Skip to content

AI model formats

See also: AI model scan limits for why a model can be missing metadata, and Metadata provenance for the annotations named below, and SBOM from a Git URL for a model file in a Git repository.

Use this when you want to know which AI model file formats loom model reads, what each format can hold, what Pitloom takes from it, and where each value ends up in the SBOM.

Quick guide

pip install "pitloom[ai]"
loom model path/to/model.safetensors -o model.spdx3.json

pip install "pitloom[ai]" installs every optional reader library below; install a single extra (pitloom[gguf], ...) if you need one format only. Every reader is read-only: Pitloom never runs model code and never calls pickle.load(). See Command line for loom model and the other targets that scan for models.

How a file is recognised

A file is a model when its header confirms a format. The header check comes first, so a file named on the command line (loom model, loom generate, generate()), or by a Git URL, is read whatever its suffix when its header has a magic (a x.dat with GGUF magic is GGUF); ONNX, Keras v3, PyTorch, PT2 and NumPy .npz files have none Pitloom can tell from other files (a protobuf, a ZIP, a pickle), so a copy of one named x.dat is not recognised: it keeps its suffix. A project or wheel scan, and a folder given for its one model file, only look at the suffixes below. A header that contradicts the suffix (text named .gguf) is not a model, and a Git LFS pointer is never one (it is listed as a file only); see What is a model.

Format Suffixes scanned Header check Reads Library (extra)
CRFsuite .crfsuite, .model magic lCRF header and label strings none
fastText .ftz, .bin magic BA 16 4F 2F whole model, in memory fasttext-community (fasttext)
GGUF .gguf magic GGUF key-value header and tensor infos, by Pitloom's own reader (memory-mapped; arrays as length and type) gguf (gguf), for quantisation names and tensor sizes
HDF5, Keras v1-v2 .h5, .hdf5 HDF5 magic, or any non-empty file (a userblock moves the signature) root attributes h5py (hdf5)
Keras v3 .keras ZIP metadata.json, config.json (architecture, compile settings) and the member list none
NumPy .npy, .npz .npy: magic \x93NUMPY; .npz: ZIP array headers numpy (numpy)
ONNX .onnx none: any non-empty file whole protobuf, in memory; external data files not loaded onnx (onnx)
PyTorch classic .pt, .pth ZIP, or pickle protocol 2-5 (a text .pth path file is not a model) archive listing, top of data.pkl fickling (pytorch), optional: without it, no type of model
PT2 (torch.export) .pt2 ZIP archive listing, small text and JSON members none
Safetensors .safetensors 8-byte little-endian header size, then { JSON header safetensors (safetensors)
Hugging Face Hub model ID or URL, not a file -- Hub API, model card, config files huggingface_hub (huggingface_hub)

An HDF5 file with a keras_version attribute is reported as format keras, otherwise as hdf5 (and then only its format is recorded). .bin and .model are shared with other tools: such a file is a model only when it carries a supported format's magic (usually fastText or CRFsuite), and no warning is given otherwise.

What each format holds

One row per format. Yes: read into an SBOM field. Kept: read, and kept only in the verbatim artifact-metadata annotation (see Where each field goes). Part: partly; see the note. Fixed: a constant Pitloom sets for the format. No: the format can hold it, Pitloom does not read it. --: the format has no such field.

Format Name Description Version Licence Type, architecture Hyperparameters Inputs, outputs Labels Training, evaluation Other keys
CRFsuite -- Part [1] -- -- Fixed -- Part [2] Kept -- Kept
fastText -- -- -- -- Yes [3] Part [4] Part [2] Kept Kept (loss) --
GGUF Yes Yes Yes Yes [5] Yes Part [6] -- Kept [7] Part [29] Kept
HDF5, Keras v1-v2 Yes -- -- -- Yes [8] Part [9] Part [10] -- Kept [11] Kept
Keras v3 Yes -- -- -- Yes [8] Part [9] Part [10] -- Part [12] Kept [27]
NumPy -- -- -- -- Fixed -- No [13] -- -- Kept [13]
ONNX Part [14] Yes Yes [15] Yes [16] Part [17] -- Yes [17] -- -- Kept [18]
PyTorch classic -- -- -- -- Part [19] No No -- No Kept [20]
PT2 (torch.export) Yes Yes Yes Yes -- -- Part [21] -- -- Kept [20]
Safetensors Part [22] Part [22] Part [22] Part [22] Part [22] -- No [23] -- -- Kept
Hugging Face Hub Yes Yes Yes [28] Yes [24] Yes Part [25] -- No Kept [26] Kept
  1. Generated by Pitloom from the labels (Method: generated_from_labels), not written by the model's producer.
  2. One output. CRFsuite: label_sequence, shape ["sequence_length"], a symbolic length as an ONNX dim_param (a tagger emits one label per input item); the label count is num_labels. fastText, supervised models only: label_probabilities, shape the label count. The file states neither output: Pitloom names it from the format (Method: derived_from_format). Feature weights and CRFsuite attribute strings (training-text features) are never read. A model over a label cap keeps its counts but no label (see scan limits).
  3. args.model (supervised, cbow, skipgram). The domain is fixed: natural language processing, plus text classification for a supervised model (Method: derived_from_format). Labels and outputs are read from a supervised model only: for cbow and skipgram, fastText's label list is the word vocabulary (training text).
  4. 9 of the training args: bucket, dim, epoch, maxn, minCount, minn, neg, wordNgrams, ws. lr and minCountLabel are not in the file (a loaded model reports their defaults), so they are not read. maxn is skipped for a supervised model of file version 11, which the loader resets.
  5. general.license (an SPDX expression by the GGUF spec), trimmed and classified like any model licence; only a non-blank string counts (general.version may also be a number, read as its text). With no general.license, or one that is a placeholder (other, custom, proprietary, unknown, unlicensed, N/A, NOASSERTION; llama.cpp writes a card's license: other that way), general.license.name (the licence's name) stands in, trimmed. general.license.link is not read. With no name, a placeholder that points elsewhere (other, custom, proprietary, unlicensed, N/A) gives no licence, as on the Hub; unknown and NOASSERTION stay (NOASSERTION).
  6. Keys ending .context_length, .embedding_length, .feed_forward_length, .block_count, .attention.head_count, .attention.head_count_kv, .attention.layer_norm_epsilon, .attention.layer_norm_rms_epsilon, .expert_count, .expert_used_count, .rope.freq_base, .rope.dimension_count, .rope.scaling.type, .rope.scaling.factor, .rope.scaling.original_context_length; plus quantization, the name of general.file_type when it is an integer other than GUESSED (1024, not stated). Every other key is kept. A blank GGUF, Safetensors or ONNX text field (name, description, version, architecture, quantisation, doc_string) reads as absent, and where several keys are tried the next stands in.
  7. An array (a tokenizer vocabulary, scores, per-layer values) is recorded by length only: {"length": "N", "type": "<element type>"} in the annotation (type left out for an element code the format does not define); its elements are never read.
  8. The Keras class name (Sequential, Functional, ...).
  9. The scalar entries of the model config (Keras v3: all but name, layers and dtype, a dtype policy). The number of layers is kept as properties layer_count; an InputLayer counts as a layer.
  10. The input shape only (Keras v3: an InputLayer's batch_shape, else a layer's build_config.input_shape, else the model's; v1-v2 the first layer's batch_input_shape). No outputs.
  11. From training_config: the optimiser's class name, as properties optimizer; the loss and the metrics as given, as loss and metrics (a string as is, an object or a list as its canonical JSON text). A null or "" value is left out, and so are empty metrics. A training_config that is absent, null or {} is quiet; one that is not a JSON object ([] included) is one WARNING:.
  12. compile_config: the optimiser (its class name, or the string a model was compiled with), the loss and the metrics, recorded as for training_config (note 11). Not read: the optimiser's settings (learning rate, ...), loss_weights, weighted_metrics, run_eagerly, steps_per_execution, jit_compile. A compile_config that is absent, null or {} is a model not compiled: no warning. Any other value that is not an object ([] included) is one WARNING:, as for an HDF5 training_config.
  13. An array is data, not a model input, so there are no inputs. An .npy file's shape and dtype are kept as properties array_shape (2x2, scalar for none) and array_dtype; an .npz archive's array count as array_count.
  14. graph.name, unless blank, a tool's default (torch_jit, main_graph, tf2onnx, merged, spox_graph, mxnet_converted_model, ...) or the writing tool's own name (producer_name), alone or followed by _ or - and more.
  15. model_version; a bit-packed SemVer value (any of its upper 32 bits set) as MAJOR.MINOR.PATCH (ONNX versioning).
  16. The standard model_license metadata property (ONNX IR optional metadata).
  17. Type of model neural network, unset when a node uses an ONNX-ML operator (ai.onnx.ml: trees, linear models, SVMs); the opset import alone does not count (tf2onnx adds it to plain networks). Each input and output has its name, shape (dim_param names kept as text) and dtype by its NumPy name (float32, int64), or ONNX's own, lowercased, for a type NumPy lacks (bfloat16, string); no shape for an unknown rank or a non-tensor value (a sequence). An initializer (weight) that an IR version 3 graph also lists in graph.input is not an input; from IR version 4 on, a name in both is an input with a default, and kept.
  18. producer_name, producer_version (the tool that wrote the file, also a line of the package comment; see Where each field goes), domain, opset.<domain> and every metadata_props entry as metadata_props.<key>; a repeated key keeps its last value, with one WARNING: ... ONNX metadata_props: <N> key(s) appear more than once; kept the last value of each: <keys> [model-field-conflict] per file.
  19. The class of the object at the top of data.pkl, found by fickling without running the pickle: the module's class for a full-model save (Linear), OrderedDict for a state dict, none for a plain dict checkpoint.
  20. The archive member list and count; for PT2 also extra/author (also the producer; see Producer and parameter count) and extra/tags. PT2 name, description, version and licence come from extra/ (the name also from METADATA.json). A root version file is the export schema version, never the model version: it is the format version (its provenance names the version file) when there is no archive_version.
  21. Tensor names from models/model.json, no shapes: only the user_input entries of its signature.input_specs and the user_output entries of output_specs. Parameters, buffers and constants are placeholders of the graph, not inputs; a file without a signature gives none. Its torch_version is the framework version (framework is pytorch). A PT2 Archive is what torch.export.save writes, not an ExecuTorch .pte program, which Pitloom does not read.
  22. Only from conventional __metadata__ keys: name modelspec.title, or name (kohya-ss ss_base_model_version names the base model, so it is kept as a property only); description modelspec.description or description; version modelspec.version, version or model_version (LTX-2); architecture modelspec.architecture or architecture; quantisation modelspec.precision or precision; producer modelspec.author; licence modelspec.license (SDXL, Stable Cascade, FLUX.1), else license (Lightricks LTX-Video and LTX-2), as written, trimmed: a name, an expression or a whole licence text (LTX-2 writes its 21 KB licence agreement there). The format itself defines no such key; the provenance names the key read.
  23. Tensor names are weights, not a model's inputs: not recorded.
  24. Model card license, or a licence file detected when the card has none or a vague one (other, custom, proprietary, unlicensed, N/A, unknown). Also from the Hub: DOI, arXiv IDs, page URL, base model, datasets, domains (pipeline tag).
  25. Selected values of config.json and generation_config.json.
  26. The model card's model-index evaluation results, as read.
  27. Properties, as text: date_saved (metadata.json, as written; it has no time zone, so it is not a release time), layer_count, and the member list and count of the ZIP (archive_contents, archive_member_count). A config.json metadata object (a description, author, version or licence that some exporters add) is not a Keras field and is not read. No parameter count: it would need the weights member (model.weights.h5), which is not opened.
  28. The revision read: its 40-digit commit hash (model_info sha), not a release version.
  29. Training datasets, trainedOn: the spec's general.datasets (a string array of names or links; a link is also the download location) and llama.cpp's numbered general.dataset.<id>.* entries (general.dataset.count). A Hub dataset page, https://huggingface.co/datasets/<id>, as a numbered entry's repo_url or an array element, names the dataset by its Hub id (Method: hub_dataset_id), as a Hub model card's datasets are named. llama.cpp writes a card's Hub id owner/name as name = a title of the name part (OpenHermes 2.5), organization = a title of the owner, a version guessed from the name, and the model page URL https://huggingface.co/owner/name (no dataset is there) as repo_url; a card's link http(s)://huggingface.co/<a>/<b> it splits the same way. For an entry whose repo_url has that form and whose name is that title of its name part, the made-up organisation and version are not read, and it is named by the Hub id and located at its dataset page (unless <a> is a site area such as papers). A card's id with no owner gets no repo_url; its titled name and guessed version are read as stated. Otherwise name, else repo_url, names the dataset; repo_url is its download location as written, version and description are read, author, else organization, is its creator. The numbered entries come first; a dataset named in both is one dataset, a Hub id in any case (an array element is the first numbered entry of its name). Two numbered entries of one name and version are one dataset, the first's values kept, with a WARNING: per field they state differently; one name at two versions is two datasets, which the SBOM still shows as one package, the first version kept, with a WARNING:. At most 1000, with one WARNING: past them. quantize.imatrix.dataset (written by llama-quantize) is the calibration text of an importance matrix, not training data: it stays a property. general.base_model.* and general.source.* stay properties.

A .keras archive member that cannot be read (not valid JSON, its top level no object, nested too deeply) is one WARNING: (model-field-unreadable); the other member is still read. A value of the wrong type is dropped with one WARNING: per part (the metadata, the model config, the compile config).

Producer and parameter count

Two values the G7 SBOM-for-AI minimum elements ask for are read from structured fields only. A value that sits in free text (a model card's prose) is left to the sbom-enrich Skill.

Format Producer (originators) Supplier (supplier) Parameter count (parameter_count)
GGUF general.author, then general.organization: one name each -- Sum over the shapes in tensor_infos; none when split.count is above 1
ONNX model_author metadata property: a comma-separated list -- Sum over graph.initializer and graph.sparse_initializer, subgraphs included
PT2 (torch.export) extra/author: one name -- Sum over the sizes of every stored weight (parameters and buffers) in data/weights/model_weights_config.json
CRFsuite -- -- The feature count of the FEAT chunk: each feature stores one weight
Safetensors modelspec.author in __metadata__ (ModelSpec): one name -- Sum over every tensor shape in the header (header only)
Hugging Face Hub The repository owner (author): one name The same name safetensors.total, else gguf.total, as the Hub states it

In the provenance the values are keyed by their field names, originators, supplier and parameter_count.

Every other format gives neither: PyTorch classic (no shapes without unpickling), Keras and HDF5 (the weights are not read), NumPy (a bare array is not a model) and fastText (its matrix size follows the dictionary stream).

Producer and supplier. Each name becomes a generic SPDX Agent (name only, no email) in the ai_AIPackage's originatedBy, one Agent per distinct producer name, shared when two models name the same one, and with a dataset creator of that name (an SBOM creator of type agent, a main-package author and a dependency's author are other elements and are not merged with it). No model file format sets suppliedBy: an author written in a file originated the model, and the file does not say who ships it. A model read from the Hugging Face Hub is the exception: the Hub repository is where the model is shipped from, so its owner is also the suppliedBy, and the same one Agent is referenced by both properties. suppliedBy holds one agent, so one owner. A model never inherits the main package's suppliedBy (the SBOM's first creator, which says nothing about the model). Whether a name is a person or an organisation is not decided here; a fragment can add a Person or Organization to originatedBy when the model card says which (lists merge by union, so the generic Agent stays beside it). Things to know:

  • ONNX defines model_author as a comma-separated list, so the text is split on commas, and Method: comma_list is recorded when it has one. A name that itself holds a comma (Doe, Jane, Foo, Inc.) is split wrongly.
  • The Hub's author is the account that owns the repository, recorded with Method: repository_owner for both originators and supplier. A re-upload, quantisation or fine-tune names the uploader, not the original maker; the base model a card names is recorded separately as descendantOf, which records lineage only.
  • GGUF, PT2 and Safetensors names are not split: general.author, extra/author and modelspec.author hold one name. The raw keys also stay in properties.
  • The llama.cpp converter often fills GGUF general.organization by guessing from the base model's _name_or_path, so a fine-tune's file can name the base model's organisation. Pitloom reads it as stated and cannot tell a stated organisation from a guessed one. The Hub route names the repository owner instead, so the same model can show two producers by route.
  • A name over the length cap is cut; several over-long names in one model give one warning, not one per name (see scan limits).

Parameter count. SPDX 3.0.1 has no property for a model's size, so the count is an ai_hyperparameter entry, key parameters, value a decimal integer as text ("7241732096"). The G7 SBOM for AI mapping to SPDX (bact.github.io/bom) names this key for the parameter count. It is not a hyperparameter, and the package comment says so, in this line, whenever the entry is there:

Parameter count: ai_hyperparameter "parameters" holds the number of elements in the model's stored tensors, as its parameter count, because SPDX 3.0.1 has no model-size property (it is not a hyperparameter).

A fragment merge keeps the line in step with the entry for each package it merges into: afterwards the package has the line first in its comment if it has a parameters entry that is a positive decimal integer (ASCII digits, up to 10^15) and none otherwise, whatever a fragment's comment says (a base parameters entry wins over a fragment's). A value such as 7B gets no line. A package that no fragment merges into keeps its comment as written. A merge cannot tell a model's own parameters entry from a count, so it labels that too.

  • A count read from the file is the sum of the element counts of its tensors, not bytes: a [32, 2] tensor adds 64 whatever its type. It is recorded with Method: tensor_element_sum, as is the Hub's: its safetensors.total (or gguf.total when there is no safetensors field; safetensors wins when both exist) is the same sum, computed by the Hub. The provenance reads Source: Hugging Face Hub | Field: model_info safetensors.total | Method: tensor_element_sum.
  • ONNX counts every tensor in graph.initializer and graph.sparse_initializer and in subgraphs, a tensor stored in an external data file by its declared dimensions (the file is not read). Constant nodes and model.functions are not counted.
  • PT2 counts every weight its weights config lists, parameters and buffers alike, by the sizes the config states (no tensor is read). Names sharing one stored weight (tied weights: one blob, one view) count once; views of one blob count each; lifted constants, in their own config, are not counted. A symbolic size gives none, with the malformed-dimension WARNING: below.
  • CRFsuite counts its features (Method: one_weight_per_feature): each stores one weight, and CRFsuite keeps only the features whose weight is not zero.
  • A Safetensors file that is one shard of a model gives that file's count, and the format has no sign that it is a shard. A GGUF file with split.count above 1 gives none, since its sum would understate the model.
  • A sum of 0, or a file with no tensor, gives no count (never "0"), with no message. A malformed dimension (negative, not an integer) or a count over 10**15 gives none and one WARNING: ending parameter count not recorded; see scan limits.
  • A hyperparameter the model itself declares under the key parameters is replaced by the count, with a WARNING:.

What the count counts

It is the number of elements of all stored tensors, not the "trainable parameters" of a size such as bom:ai-model-size. Do not filter by type: int8 weights are parameters.

  • It includes buffers stored as tensors (attention masks, shape constants) and tied weights stored twice (a PT2 archive stores a tied weight once: it counts once). The ONNX test model gpt2-tiny-decoder counts 404256, which includes a 262144-element uint8 causal mask (transformer.h.0.attn.bias, [1, 1, 512, 512]) and a 32000-element transposed copy of wte.weight; about 110112 are weights of their own. A tiny Marian Safetensors model's 174535 includes the 58101-element final_logits_bias buffer, and squeezenet1.1-7's 1235498 is 1235496 weights plus a 2-element int64 reshape constant. The Hub API gave 137022720 for openai-community/gpt2 (2026-10-15), against about 124.4 million weights: attention-mask buffers make up the rest.
  • Packed or quantised weights count differently by format. GGUF shapes are logical (a Q4_0 tensor of shape [64] counts 64). GPTQ, AWQ and bitsandbytes Safetensors files store packed integer tensors: a GPTQ-style 64 x 64 layer with qweight (I32 [8, 64]), scales, qzeros and g_idx counts 648 against 4096 real weights. Block-quantised ONNX (MatMulNBits) under-counts likewise.
  • The Hub's safetensors.total and gguf.total have the same property. For a repository of several components, such as the diffusion pipeline stabilityai/stable-diffusion-xl-base-1.0, whose safetensors.total is the UNet only, the Hub's total may cover only part of the repository.

Where each field goes

One row per field of AiModelMetadata (pitloom.core.ai_metadata), one column per output format. Formats are named as in the tables above; "HF" is the Hugging Face Hub, "card" a README or model card read with --enrich.

Field Filled by SPDX 3.0.1 JSON-LD
name GGUF, ONNX, Keras, HDF5, PT2, Safetensors, HF ai_AIPackage.name; without one, the file name's stem (Method: file_name_stem), else the format
description GGUF, ONNX, PT2, Safetensors, CRFsuite, HF ai_AIPackage.description
version GGUF, ONNX, PT2, Safetensors, HF (the revision's 40-digit commit hash) ai_AIPackage.software_packageVersion
release_time HF (the revision's last-modified time) ai_AIPackage.releaseTime, in UTC; a time that is not ISO 8601 is left out with a WARNING:
license GGUF, ONNX, PT2, Safetensors, HF, card licence element plus hasDeclaredLicense (the model's own statement) or hasConcludedLicense (a third-party source); see How a licence value is recorded
originators GGUF, ONNX, PT2, Safetensors, HF ai_AIPackage.originatedBy: one generic Agent per name; see Producer and parameter count
supplier HF ai_AIPackage.suppliedBy: the repository owner's generic Agent, the one in originatedBy when the name is the same; no file format fills it
type_of_model CRFsuite, fastText, HDF5, Keras, NumPy, ONNX, PyTorch, HF ai_typeOfModel, first entry
architecture GGUF, Safetensors, HF ai_typeOfModel, after type_of_model; one INFO: line per model says it has no property of its own
quantization GGUF, Safetensors ai_hyperparameter, key quantization, first
parameter_count GGUF, ONNX, PT2, Safetensors, CRFsuite, HF ai_hyperparameter, key parameters, decimal integer as text, among the entries sorted by key; with it a line in ai_AIPackage.comment saying it is not a hyperparameter (SPDX 3.0.1 has no model-size property); what it counts: What the count counts
hyperparameters GGUF, fastText, HDF5, Keras, HF ai_hyperparameter, one DictionaryEntry per key, sorted by key, value as text
domain, usage.domains fastText, HF ai_domain
inputs, outputs see the table above ai_informationAboutApplication, JSON keys inputs, outputs
usage.intended_use, usage.unintended_use none ai_informationAboutApplication, JSON keys intended_use, unintended_use
usage.limitations none ai_limitation, joined with ;
usage.safety_risk_assessment none ai_safetyRiskAssessment (high, medium, low, serious)
usage.known_biases none ai_AIPackage.comment, Known biases: ..., after the parameter-count and writing-tool lines when they are there
doi HF externalIdentifier, type other, comment DOI
arxiv_ids HF externalRef, type documentation
url HF externalRef, type altWebPage
base_model, base_model_relation HF Relationship descendantOf to an ai_AIPackage for the base model (made if absent); the relation in its comment
datasets GGUF, HF, card dataset_DatasetPackage plus Relationship trainedOn or testedOn; references to one dataset (a Hub id in any letter case, or one name with different spacing) give one package with one relationship per role, a later reference only filling what the first leaves unset; a licence the dataset's metadata states becomes a licence element and hasDeclaredLicense (or hasConcludedLicense for a third-party source), as for the model. A Hub card's dataset gets the licence, description, revision and owner of its own Hub dataset repository (see Hugging Face Hub models)
properties, raw_metadata, raw_metadata_types every format Annotation of kind artifact-metadata (schema https://pitloom.dev/provenance/artifact-metadata/2): metadata, valueTypes, format; only when preserved, see below
raw_metadata_dropped any format, over the entry cap that annotation's truncatedKeyCount and maxEntries
raw_metadata_unread GGUF, the pairs a header read in part did not reach that annotation's truncatedKeyCount
extra_data, extra_lists HF that annotation, format huggingface
provenance every format ai_AIPackage.comment (Metadata provenance: ...) and/or a provenance Annotation, by [tool.pitloom.provenance] format
format_info.model_format every format the artifact-metadata annotation's format
format_info.format_version, framework, framework_version most formats not written: cited in the provenance only
format_info.writing_tool, writing_tool_version ONNX (producer_name, producer_version) a line of ai_AIPackage.comment, Model file written by: <tool> <version>, after the parameter-count line; the exporter or converter, not the model's producer
format_info.file_path_relative project and wheel scans Relationship contains from the ai_AIPackage to the model's software_File (which has the SHA-256 and SHA-512)
usage_files --scan-model-usage LifecycleScopedRelationship hasDataFile, scope runtime, comment read access / write access / read and write access / unknown access, from each .py software_File to the model's

The artifact-metadata annotation is written when preserve-source-metadata says so: by default (auto) only for a model whose file is not in the SBOM's file list, as with loom model FILE; see Preserved artefact metadata. In it a collection is a JSON array (or object) and a scalar is text, for every format.

Text a model's source wrote is untrusted: bidi and zero-width controls in the properties shown to a reader are written as \uXXXX, with one WARNING: per model, while the artifact-metadata annotation keeps the text as read. Which properties, and how to read them back: Reading values back. Long names and labels are capped: see scan limits.

No model format fills ai_metric, ai_metricDecisionThreshold, ai_energyConsumption, ai_autonomyType, ai_modelDataPreprocessing, ai_modelExplainability, ai_sensitivePersonalInformation, ai_standardCompliance or software_primaryPurpose on an ai_AIPackage; an SBOM fragment can add them. Nor does any model file format fill suppliedBy, on purpose: a producer name is an originatedBy; only the Hugging Face route sets it, to the repository owner (see Producer and parameter count).

Two properties come from the file or the repository, not from a format field:

  • verifiedUsing: the model file's SHA-256 and SHA-512, from one read, whenever Pitloom read the file. A Hugging Face model has none.
  • software_packageUrl: pkg:huggingface/<owner>/<name>@<commit> for a Hugging Face model (the commit only when the Hub gave a 40-digit hash; an ID with no owner, such as gpt2, gets none); otherwise pkg:generic/<file name>?checksum=sha256:<digest> for a hashed model file. A dataset with an http:// or https:// download URL gets pkg:generic/<name>[@<version>]?download_url=<url>.

Hugging Face Hub models

Pass a Hugging Face Hub URL or a bare model ID instead of a local file -- no download required for the SBOM itself (needs pip install pitloom[huggingface_hub]):

loom model https://huggingface.co/mistralai/Mistral-7B-v0.1
loom model Qwen/Qwen3-235B-A22B

The www.huggingface.co and hf.co forms, http:// and any case of the host are read as https://huggingface.co/..., with one INFO: line saying so (target-ambiguous/hf-url): INFO: URL=<url>: read as Hugging Face model <target> [target-ambiguous/hf-url].

This reads the model card, config.json, tokenizer_config.json, generation_config.json and the Hub's model information, and produces an ai_AIPackage as in the tables above.

Those files (and a licence file, and each listed dataset's card) are downloaded at the revision the Hub's model information names, from the Hub (huggingface.co) and its CDN (cdn.hf.co or a host under it, https on the default port) only, into a temporary directory removed afterwards; none goes to the huggingface_hub cache. Each is capped at the smaller of --max-download-bytes (max-download-bytes, 512 MiB by default) and its own cap (config.json, tokenizer_config.json and generation_config.json 16 MiB; a model or dataset card 1 MiB; a licence file 256 KiB), counted on the bytes received, and read within 120 s per file; a file over the cap or the time is left out with a WARNING: naming the cap (over-cap) and the rest is read. A local card over 1 MiB still has its frontmatter read when that closes within the first MiB; a Hub card over 1 MiB is not downloaded. A Hugging Face token (HF_TOKEN, or the stored hf auth login) is sent to the Hub only, never to the CDN a file is redirected to. With huggingface_hub's HF_ENDPOINT set to another Hub (a mirror), the files are asked of that Hub instead of huggingface.co, the token sent to it only, with an INFO: (url-moved/hf-endpoint); an HF_ENDPOINT that is not https (or holds credentials, a query or a fragment) is refused, so the token never goes over plain http: nothing is asked of the Hub (no file, no model or dataset information), the SBOM holds the model's id and URL only, with one WARNING: (url-unsafe/hf-endpoint). https://HuggingFace.co/ and the port 443 count as the default Hub. A file the repository does not hold is skipped silently; any other failed download (a gated or private repository read without access, a network failure, a timeout, a redirect elsewhere) leaves that file out with a WARNING: carrying the code a Git or PyPI URL fails with (download-network-failed, download-timeout, url-unsafe). --offline refuses the model (offline-unusable), and with huggingface_hub's HF_HUB_OFFLINE set no file is downloaded (one WARNING: each). The Hub's model and dataset information (the model information also lists the repository's files) are huggingface_hub requests, each with a 30-second socket timeout (per connect or read, no total deadline), and pass through neither the cap nor the library's check_url=, which every file download does.

huggingface_hub also makes one request of its own, which Pitloom does not ask for and does not read: on the first Hub request of a process it asks the Hub (HF_ENDPOINT, if set) for /api/agent-harnesses, a list it uses to tell whether an AI coding agent runs it, for its own user agent. It sends no token with it, waits 3 seconds at most, and keeps the answer in .agent_harnesses.json under HF_HOME for 24 hours. It is not made with HF_HUB_OFFLINE set, and HF_HUB_DISABLE_TELEMETRY=1 stops it for Pitloom's requests (seen with huggingface_hub 2.2.0 and 2.4.0).

A failed model or dataset information request is one WARNING: that says what is lost, with the same codes: a request that failed or timed out (download-network-failed, download-timeout), HF_HUB_OFFLINE (offline-unusable), or an answer that could not be read (hub-response-invalid): WARNING: URL=<url>: the Hub's answer could not be read (<failure>); <outcome> [hub-response-invalid]. A model whose information failed keeps its id and URL and has no author, version, dates, tags or parameter count from the Hub, and no licence file is looked for, since only the information lists them.

A model read with no revision (the information failed, or the Hub, a mirror say, stated none) has its files read at the default branch as it is at the time of the run, which can change between runs. One WARNING: says so, once per read of a model, however many files are read (hub-revision-unpinned): WARNING: URL=<url>: the Hub stated no revision; files are read at the default branch as it is now [hub-revision-unpinned]. No file is read, and this line is not said, with the Hub refused (--offline, a refused HF_ENDPOINT) or HF_HUB_OFFLINE set. There is no option to pin the revision: for a repeatable result, download the repository at a commit and run loom model on the local copy.

It never opens a model file of the repository, so it reads no per-file metadata and no hash: a repository whose weights are a .keras file gets an SBOM from its card and configuration files, with no Keras-derived field, no format and no file entry. Reading the archive's members over HTTP range requests would be a partial download of the file from the Hub's storage hosts, which Pitloom does not do. To get a model file's fields, download it and run loom model <file>; for a model file in a Git repository, give its Git URL (see SBOM from a Git URL).

For each dataset the model card lists (datasets:, else the Hub's dataset:* tags) that is a Hub repository id, Pitloom also reads that dataset's own card and repository information, the first 20 datasets only. A dataset listed twice (a Hub id is case-insensitive, so O/D is o/d) is one dataset, and a card lists at most 1000, with one WARNING: when it lists more:

Dataset field From Provenance Field:
licence the card's license; for other, its license_name and license_link (name first, as name (link); a name that reads as an SPDX licence is used alone unless the link reads as a different one, so apache-2.0 with the Apache link gives Apache-2.0; with no name, the link; a name that does not read, such as Modified MIT License, keeps its link); unknown, N/A, NOASSERTION or an other with no real name or link give none; a list of several gives one hasDeclaredLicense each, in order, and a package comment that the card does not say whether they combine as AND or OR dataset card license
description the card's first prose paragraph; a table of contents, key lines (**Paper:** [...]), badges, HTML, tables and code blocks are passed over dataset card
keywords (not written: SPDX 3.0.1 has no dataset keyword property) the card's tags dataset card tags
version the repository's commit hash dataset_info sha
creator (publishedBy) the repository owner dataset_info author, Method: repository_owner

A field the dataset does not state is left out. A failed request (a network error, a gated, private or deleted dataset) is one WARNING: naming the dataset's page and what is not recorded, as for a model (WARNING: URL=<url>: <failure>; <outcome> [download-network-failed]; never a path in the local cache); the dataset keeps its name and download URL. A card that cannot be read or parsed is one WARNING: of its own, as a local card is. These requests run only when the model itself is looked up, so --offline stops them too.

Not yet supported

JAX (Orbax), TensorFlow SavedModel, TensorFlow Lite, and scikit-learn (pickle/joblib) are on the roadmap but not implemented yet.

Adding a format

The tables are kept one row per model format and per field, one column per output format, so that either grows by one line or one column.

  • A new SBOM output format (CycloneDX, another SPDX version): add a column to Where each field goes. The SPDX 3 mapping lives in pitloom.assemble.spdx3._ai_package and pitloom.assemble.spdx3.ai; a new format gets its own assembler that reads the same AiModelMetadata.
  • A new model format: fill every field the format can express the way the existing formats do (licence, producer, parameter count, version), and read only what the file itself stores: a value a binding returns as a default, or resets by version, is not the file's (fastText's lr is one). Then add a row to the tables in How a file is recognised and What each format holds, and its name to the "Filled by" cells it fills. In code: an AiModelFormat member (suffixes, magic) in pitloom.core.ai_metadata; a reader in pitloom.extract.ai_model (a library-free header reader goes in its formats subpackage), registered in REGISTRY in pitloom.extract.ai_model.reader (and in _EXTENSION_ADMITS there when the format has no magic); its library in pitloom.extract.ai_model.reader_requirements and a pyproject.toml extra; a decision on the wheel gate (pitloom.extract.scanner_wheel.WHEEL_GATED_FORMATS); and fixtures under tests/fixtures/aimodels/. A reader that knows the producer or the tensor shapes fills originators with originator_names() (pitloom.core.model_originators, which bounds the read; the reader records the originators provenance) and parameter_count with derived_parameter_count() (pitloom.extract.ai_model.parameter_count, which bounds the sum and records its provenance); it does not build an Agent or an entry itself.

See also

  • AI model scan limits -- caps, gated formats in wheels, and what a format cannot record.
  • Metadata provenance -- the provenance and artifact-metadata annotations.
  • Command line -- the loom model command in context with Pitloom's other generation targets.
  • Python API -- generate_model_sbom(), the equivalent entry point from Python code.