Apertus never generates an answer. In one forward pass it produces hidden states, and a small bilinear pointer head turns exactly two kinds of hidden state — plus two gated side-inputs — into a score for every class. This page shows exactly what enters that head: the token layout it reads from, the wiring, the attention mask that makes it fair, and the formulas with a worked example.
The image and a one-line product context form a causal prefix. Then six question blocks follow in the same user turn. Every block lists its options as - class (hint) lines and ends with Answer:. Two token positions per block matter to the head: the last token of each option line (the dots) and the colon of Answer:. Pick a block to inspect it.
Nothing else. Not the image, not the option text as strings, not any generated token — just hs, the last-layer hidden states of the backbone at a handful of token indices, plus two cheap side-vectors computed outside the model. The head casts everything to fp32 before touching them.
The block layout is enforced by an additive attention mask (layout(), train.py:107). The prefix is ordinary causal. Inside a block the question sees the prefix and itself; each option sees the prefix, the question and only its own tokens; the readout tail sees its whole block. Blocks never see each other. Hover the cells — rows attend, columns are attended.
Each block starts at the prefix end with fresh position ids, so it computes exactly what it would in a sequence of its own — six cheap questions in one padded pass.
selftest: rel. err 4.5 % maxOptions are mutually blind and share position ids; no token of an option encodes its rank. Shuffling the option order cannot change scores beyond numerics.
selftest: reversed order 2.3 % · unmasked control 79 %Blocks cannot attend to each other, and the prefix cannot see any block. Predictions are independent of block order and of the other questions.
asserts in layout(): readout must see prefix + own blockAll of it is Pointer.forward (train.py:156-164), verbatim. D is the backbone text hidden size, H = 512, K_j the number of options of dimension j (max 13).
One forward pass of the LoRA-adapted backbone over the masked sequence x = [x_img, x_ctx, B_1 … B_6]; h_t is the last-layer state at token t.
The decision state is adjusted by a learned per-dimension embedding and by two gated lanes, all before the LayerNorm. The gates are scalars, initialised to zero.
Each option is represented by the state at the end of its own line — after it has read the image, the context, the question and itself, and nothing else.
A scaled dot product per option — the whole “decoding” is this bilinear form, in fp32, plus a learned per-(dimension, option) bias initialised to zero.
Cross-entropy only on cells with a human label marked relevant; every other token position is unsupervised. The pod runs the fixed norm: the gradient is always divided by 6 (the dimension count), while the logged loss is the per-image mean over its n scored cells.
AdamW, weight decay 0, two groups; warmup over total/25 steps then linear decay to a 5 % floor; grad-norm clip 1.0.
σ = 0 at initialisation, so step 0 is exactly the feature-free pointer; the lanes survive only if they earn gradient. This is why the Orient lane can be trusted not to hurt the other five dimensions.
| symbol | shape | note |
|---|---|---|
| h_t, d_j, c_jk | D | backbone text hidden size, bf16 → cast to fp32 in the head |
| W_Q, W_K | 512 × D | linear, no bias — the only bilinear parameters |
| e = dim_emb | 6 × D | one embedding per dimension, zero-init |
| b = bias | 6 × 13 | 13 = max options (subject); sliced to K_j per block |
| G_j (feat lane) | D × 20 each | one linear per dimension; gate σ_j ∈ R⁶ zero-init |
| G_o (orient lane) | D × 58 | single linear; gate σ_o ∈ R¹ zero-init |
The earlier arm read the LM-head logits of the option letters at the same colon: one number per class, but constrained to live in the vocabulary space of single letter tokens. The pointer frees the comparison from the vocabulary entirely (README: 0.649 → 0.710 mean macro F1 from this swap plus the mask).
The richest dimension: ten options and the only block with an active Orient lane. Vector strips are illustrative 32-of-512 slices; scores are invented but arithmetically consistent (the softmax is computed in the page). The side facts in green are measured, from the pmb4→pmb6 training runs.
Ten c_k dots and one d dot — these eleven token positions are all the head receives from the backbone. Every option starts at the same position id; the tail starts after the longest option.
Zero-shot geometry model: where the product’s front points, how high the camera sits, image tilt — as distributions, plus confidence. Standardised by the train file’s mean/std. It enters only here, multiplied by the trained gate.
| option k | s_k = ⟨q,κ_k⟩/√512 + b | softmax | p(class) |
|---|
Scores illustrative; softmax computed from them in this page. One number per class is the entire output — no tokens were generated.