Skip to main content

Module gguf

Module gguf 

Source
Expand description

uor_addr::gguf — the GGUF v3 realization of UOR-ADDR.

Typed content-addressing for GGUF v3 model files (GGUF_MAGIC = 0x46554747, version = 3) under a spec-canonical structural form. The default σ-projection is prism::crypto::Sha256Hasher; address_blake3, address_sha3_256, address_keccak256, and address_sha512 select the other axes (crate::hash).

§σ-axis vs. the canonical form

The leaf commitments inside the skeleton (tensor-data, array-payload, and long-string digests) are SHA-256 by canonical-form definition (CANONICAL_FORM_VERSION) — they are a fixed part of the serialization, exactly as JCS fixes JSON number formatting independently of the κ-hash. The selected κ-axis H is applied on top of that fixed canonical form: κ = H(skeleton). So address_blake3 yields blake3(skeleton-with-sha256-leaves). Every byte still binds (a flipped tensor byte changes its SHA-256 leaf → changes the skeleton → changes κ), and the sha256 κ-labels are byte-identical to prior releases.

§Authoritative sources

§Canonical form

The GGUF spec defines no canonical form; this realization defines one (canonical form v2 — CANONICAL_FORM_VERSION). It is the full flat Merkle skeleton (ADR-060): a structural form (header, metadata KVs sorted by key bytes, tensor info sorted by name bytes with recomputed canonical offsets) in which every variable-length leaf — tensor data, metadata array payloads, long strings — is represented by its 32-byte streamed SHA-256 digest. The skeleton’s size grows only with the KV / tensor counts (never with model size) and flows through the pipeline as a Borrowed carrier that ψ₉ folds; tensor data is streamed through the hash axis at the host boundary (true incremental SHA-256) with bounded resident memory. There is no two-level commitment and no count / width ceiling. See crate::gguf::value for the full byte layout.

Two GGUF files that decode to the same logical content (modulo metadata-KV order, tensor order, and tensor-data layout) canonicalize to byte-identical skeletons and therefore to the same κ-label.

§Tensor element types

Validated against the [prism::tensor::dtype] alphabet via dtype::GgmlType — a total mapping of the 29 GGUF v3 ggml_type IDs to prism::tensor::dtype shapes.

Re-exports§

pub use dtype::GgmlType;
pub use model::AddressModel;
pub use model::AddressModelBlake3;
pub use model::AddressModelKeccak256;
pub use model::AddressModelSha3_256;
pub use model::AddressModelSha512;
pub use model::AddressRoute;
pub use pipeline::address;
pub use pipeline::address_blake3;
pub use pipeline::address_keccak256;
pub use pipeline::address_sha3_256;
pub use pipeline::address_sha512;
pub use pipeline::AddressFailure;
pub use pipeline::AddressOutcome;
pub use pipeline::AddressWitness;
pub use pipeline::VerifyError;
pub use shapes::bounds::GGUF_DEFAULT_ALIGNMENT;
pub use shapes::bounds::GGUF_HEADER_BYTES;
pub use shapes::bounds::GGUF_MAGIC;
pub use shapes::bounds::GGUF_MAX_DIMS;
pub use shapes::bounds::GGUF_METADATA_ARRAY_DEPTH_MAX;
pub use shapes::bounds::GGUF_VERSION_REQUIRED;
pub use value::GgufCarrier;
pub use value::canonicalize;
pub use value::GgufValue;
pub use verbs::address_inference;
pub use verbs::VERB_TERMS_ADDRESS_INFERENCE;
pub use crate::resolvers::AddressResolverTuple;

Modules§

dtype
GgmlType — the GGUF tensor element-type alphabet, a total mapping from the GGML ggml_type integer IDs to the [prism::tensor::dtype] shapes.
model
gguf::AddressModel* — the gguf realization’s PrismModel declarations, one per admissible σ-axis (crate::hash). Each binds the shared AddressResolverTuple ψ-tower and the axis’s capacity profile (AddrBounds for the 32-byte axes, AddrBounds64 for sha512). AddressModel (sha256) is the default.
pipeline
gguf::address — the GGUF realization’s public entry point.
shapes
GGUF realization spec constants + axis selection. The capacity profile is the shared crate::bounds::AddrBounds; only the GGUF v3 spec constants live here.
value
GGUF v3 typed input (ADR-023 amended by ADR-060).
verbs
GGUF realization’s ψ-chain content-address derivation verb. Identical at the term-arena level to crate::ring::verbs — the canonical k-invariants branch ψ_1 → ψ_7 → ψ_8 → ψ_9 — over Input = GgufValue.

Constants§

CANONICAL_FORM_VERSION
Canonical-form version (see module docs). Bumped to 2 under ADR-060: the canonical form is now the full flat Merkle skeleton (no two-level commitment), so v2 κ-labels differ from the v1 commitment’s.