Tensor directory and alignment

Defines the 64-byte tensor entry, supported ranks and dtypes, payload ranges, quantization scale locations, and alignment assumptions.

Experimental
Last verified
2026-06-25 00:00 UTC
Updated
Reading time
2 minutes

Defines the 64-byte tensor entry, supported ranks and dtypes, payload ranges, quantization scale locations, and alignment assumptions.

Implementation evidence: this topic is grounded in the reviewed GGUF.MiRust.com source snapshot. It documents observed code and artifacts without claiming broad deployment, model quality, or production readiness.

Tensor entry fields
Entry offset Field Type
0 name_hash u64 FNV-1a of canonical UTF-8 name
8 dtype u32
12 rank u32, 1–4
16 dim0 u32
20 dim1 u32
24 dim2 u32
28 dim3 u32
32 byte_offset u64 absolute file offset
40 byte_length u64
48 scale_offset u64 absolute offset for quantized scales
56 block_size u32
60 reserved 4 bytes

Range validation

Every tensor payload must fit within file length. A nonzero quantized scale offset must be less than file length. Model loading then validates exact encoded lengths for each dtype and shape.

Alignment

The header requires the tensor-data section to start on a 64-byte boundary. Individual writer behavior also aligns sections. The runtime copies values into Rust-owned vectors rather than relying on aligned borrowed tensor pointers.

Name representation

Directory entries store only 64-bit hashes, not names. Collision handling is therefore a format-level concern. The current loader resolves known names by recomputing hashes and assumes no collision among required tensors.

Scope

This starter page defines the questions, boundaries, evidence, and failure modes that should be recorded before a capability is presented as supported.

Engineering considerations

  • Identify the source, version, target environment, and owner.
  • Separate observed values from estimates and externally reported values.
  • Record trade-offs, unsupported cases, and fallback behavior.
  • Link performance statements to a compatible benchmark methodology.

Verification questions

  • What exact artifact, revision, backend, and environment were reviewed?
  • Which assumptions could change the result?
  • Which data should be retained so another engineer can reproduce the conclusion?