Skip to main content

Module bind

Module bind 

Source
Expand description

Which checkpoint tensor fills each weight an authored program declares, and how.

The author names a layer’s weights the same way for every model (an3, Wq3, Qn3, Wo3, fn3, Wg3 …), in the layout the language reads them: a projection Y = X matmul W holds W as in × out, row-major. A GGUF checkpoint holds the same projection as out rows of in weights. The binding names the tensor and the view that turns one into the other:

• a projection is transposed; • a stacked expert tensor (ffn_gate_exps [d, dff, E]) is already the (E·dff) × d stack the moe sugar reads, and the embedding table already vocab × d; • a checkpoint whose rotation pairs neighbouring dimensions (2i, 2i+1 — Llama) has each head’s query and key rows (and their norm weights) permuted so the pairs fall dims/2 apart, the pairing the rope sugar turns. Attention scores are unchanged: the same orthogonal permutation multiplies every query and every key.

• a projection that holds several outputs per head (Qwen3.5’s gated attention: each head’s queries, then its gate) is read a part of every head at a time, and one that stacks several projections (Gated DeltaNet’s attn_qkv, its convolution kernel) a range of rows at a time.

The rotary tables (RC/RS, Rcos/Rsin) are not weights: rope_tables computes them from the spec. The carried state — a KV cache, a convolution ring, a delta-rule memory — is not read from the checkpoint at all: it starts at zero (Source::State).

A weight a spatial program reads as it is stored Q8_0 is two tensors, its int8 values and its block scales (q8_planes), repacked from the checkpoint’s blocks through the same view. A rotary table’s values are rotary_values.

Structs§

Binding
One declared weight’s source.
Q8Planes
A Q8_0 weight as a spatial program reads it (spatial::passes::from_q8): the int8 values in the layout the program declares the weight, K × N row-major, and one scale per 32 rows of each column, K/32 × N.
RotaryTable
A rotary table’s role: which rotation, a decode step’s caches (cached) or a forward’s one row, cosines or sines.
Unbound
Why a declared name has no source.

Enums§

HostTable
A table the host computes from the spec rather than reads from the checkpoint.
Source
Where a declared name’s values come from.
View
How a declared weight is read out of its tensor.

Functions§

bind
Where var is read from, for a model of spec.
computed_tables
The host tables beyond the rotary ones that a decode step of spec reads, each once: a row of ones as wide as each head that a layer norms without a weight, a row of ones as wide as the model that spreads a shared expert’s gate across its row, and the cosines and sines of the attention temperature for each head width that takes one.
computed_values
The values of a host table the spec alone gives (every one but a rotary table, whose frequency factors a checkpoint may hold): a decode step’s caches of positions rows, or a forward’s one row. None for a rotary table, or for a temperature table of a model that has none.
host_values
The values of the host table var names (HostTable::named) for a model of spec: a decode step’s caches of positions rows, or a forward’s one row (position 0). None when var names no table.
neox_order
v (whole heads of head_dim) with each head’s rotated dims reordered from interleaved pairs to halves — the basis a View::NeoxPairs-bound program’s queries and keys live in.
q8_planes
The planes of the Q8_0 weight b binds, repacked from the checkpoint’s blocks: what a bundle manifest names q8_0.values and q8_0.scales. The view moves each block’s int8 values as values moves the weights they scale, and a plane block’s scale is the scale of the one checkpoint block its 32 rows come from, so values[k][n] · scales[k/32][n] is the weight values reads. Refused: a tensor stored in another format, declared rows that are not whole blocks of 32, and a view that lays a checkpoint block along the declared columns.
rope_tables
The rotary tables for positions 0..rows: row p holds the (cos, sin) of each of the dims/2 frequencies (Rope::rotation — the checkpoint’s per-frequency factors, its sections, linear and YaRN scaling, the magnitude folded into both).
rotary_values
The values of the rotary table var names (RotaryTable::named) for a model of spec: a decode step’s caches of positions rows, or a forward’s one row (position 0), of the rotation the name gives, the frequency factors read from source when the rotation reads the checkpoint’s (rope_freqs.weight). None when var names no table.
rotation_of
The rotation layer l turns by, as its index in rotations — None for a layer that does not rotate.
rotations
The distinct rotations spec’s attention layers turn by, in the order of the first layer to turn by each: a program declares one pair of rotary tables per rotation (Gemma’s local and global layers turn by two bases).
stored_as_q8_planes
Whether the weight b binds is stored as the two planes q8_planes repacks — Q8_0, its blocks down its declared rows — read from the checkpoint’s description of the tensor alone, never its bytes.
temperature
The attention temperature spec’s layers take — one for the model, as every family that has one sets it.
values
A declared weight’s values, in the layout the program declares it (rows × cols row-major, View::declared).