Files
rea/docs/model-artifacts.md
T
morluto 6911a609f1 fix(model): preserve uncertainty across released GGUF layouts
Separate common row constraints from established storage sizes. Preserve Q8_1 and K-layout uncertainty, plus numeric IDs and ambiguous textual identities for historically shifted IDs16–25. Keep zero-byte facts and identity limitations independently, and propagate producer facts through totals, cancellation and retained views. Pin released source evidence and document the compatibility cost.

Fixes #6848
2026-10-24 02:00:10 +08:00

18 KiB
Raw Blame History

Model file declarations

Use inspect_model_artifact (CLI: inspect-model-artifact) to inspect a local GGUF v2/v3 or safetensors file. Detection uses content, including GGUF byte order, rather than its extension. REA does not load a model, interpret weights, run inference, import Python, open external-data references or use the network.

Unsupported GGUF versions remain refused. Their diagnostic preserves the four version bytes and both UINT32 interpretations with byte order unknown, rather than inferring big-endian from an unrecognized little-endian value. Little-endian v2/v3 and big-endian v3 remain supported; big-endian v2 remains refused.

rea inspect-model-artifact /absolute/path/model.gguf --json
rea inspect-model-artifact /absolute/path/model.safetensors --hash full --json

The CLI defaults to complete Evidence. For compact delivery with portable access to every retained observation:

rea inspect-model-artifact /absolute/path/model.gguf \
  --detail summary --evidence_output /absolute/path/model-evidence.json --json

Identity and reads

The default hash: "header" reads only the metadata and tensor directory. The result records the exact selected path, file size, header length, header SHA-256, bytes read and read scope. GGUF alignment padding is outside this prefix. artifact.sha256 and the Evidence subject are null: a header digest is not a commitment to the weights. Different files can have identical headers and sizes. The reported GGUF tensor-data offset follows the aligned tensor directory when padding is present. For zero-tensor metadata-only files that end at the directory, it is the directory end; no tensor payload is implied. A partial alignment gap is rejected. header_length still ends at the directory, before any padding.

hash: "full" additionally streams the remaining file bytes through SHA-256. It returns a full-file digest and Evidence subject, while retaining the same header digest. It uses bounded buffers and does not interpret tensor data, but it does read the whole file. Cost therefore grows with file size. Both modes check descriptor and selected-path identity and metadata before completion; this detects observed replacement or modification, not adversarial modification that defeats filesystem metadata checks.

If full-file hashing fails or is cancelled after either format's header has been validated, partial Evidence retains the parsed metadata and tensor directory. Header coverage is complete; digests and final file identity remain unknown. Safetensors header parsing is atomic, so interruption before validation does not expose unvalidated JSON rows.

Facts and selected queries

GGUF reports version, byte order, alignment, typed metadata, and each tensor's name, original type ID, dimensions, relative data offset, file offset and derived byte length. Alignment accepts every positive UINT32 multiple of eight, including non-powers of two. Partial Evidence retains explicit alignment once validated; the default alignment becomes known after metadata completes. Cancellation retains completed declarations with unknown digests and unverified final file identity. Metadata keys preserve their spelling and use lowercase ASCII alphanumeric components separated by dots, underscores or hyphens; standard numeric components such as