Turning a hidden vector into predictions
The final representation must become a prediction. Normalization controls its scale before vocabulary scoring. Weight tying shares a tensor across input and output, so training must combine both gradient routes.
#Section 3Final normalization
Imagine two final token vectors pointing in the same direction, one with larger magnitude. A linear head can turn that scale difference into a much sharper distribution even if the relative preferences are unchanged. The last residual addition also bypasses the normalization at the start of its sublayer. A pre-norm stack therefore usually has one more normalization after the final block.
Final normalization is the normalization applied to the last residual-stream tensor before the vocabulary projection. It acts on each token’s feature dimension, preserving B × T × d. It is separate from the two norms inside each Finch-24 block. “Every block has a norm” does not establish that the tensor leaving the last residual addition is normalized.
Final normalization controls the stream entering the vocabulary head. It acts over each token’s features, not across the batch. See normalization conventions.
[3, 4] keeps its direction under unit-gain RMS normalization when epsilon is omitted. Orange shows the calculated normalized radius; learned unequal gains can also change direction.What the final hidden representation means
A hidden representation is an internal numeric description learned for the prediction task. Here it has combined the current input token with all permitted earlier positions through the block stack. Coordinate meanings need not be individually named or stable across retraining. The head reads the whole vector to assign vocabulary scores.
Normalization controls a scale presented to the head and helps the chosen architecture train. It does not make logits probabilities, ensure calibrated predictions, or stop the learned head weights from growing. Learned gains may also change the normalized scale. RMSNorm’s scale invariance is approximate in the presence of epsilon and assumes positive input rescaling. It is not invariance to adding a constant, which LayerNorm has before its learned affine transformation.
Sensitive squared-value reductions can use higher precision than surrounding matrix multiplications. This protects normalization without changing its feature-wise role.
Ba, Kiros and Hinton introduced LayerNorm in 2016; Zhang and Sennrich introduced RMSNorm in 2019. Llama 3’s reference forward pass applies its final RMSNorm before its output projection. Norm placement belongs to the trained architecture: moving or deleting it in a checkpoint changes the function. LayerNorm, RMSNorm, Llama 3 implementation.
#Section 4LM head
The final vector has 512 coordinates, but Finch-24 has 32,000 possible next tokens. We need one score for every candidate, not a rule saying “coordinate seven is the word cat.” A vocabulary projection supplies that learned interpretation.
The language-model head, or LM head, is the projection from the final hidden width to vocabulary scores. The earlier LM head defines logits and stable softmax explains the score-to-probability conversion. A logit is an unnormalized score; a probability is a nonnegative share of a distribution that sums to one. Logits can be negative, larger than one, or shifted by the same constant without changing their softmax probabilities.
Read this as: multiply the normalized hidden tensor by the output matrix to obtain logits ; at batch index and position , exponentiate candidate 's logit and divide by the sum of exponentials over all vocabulary candidates . has shape in the row-vector convention. There is no output bias in Finch-24.
The output shape is B × T × V, so our example is (2, 8, 32000). Every sequence position gets its own next-token distribution. The logits at position predict the token after that input position, using the causal prefix through . During generation, only the last position's logits normally choose the next token; that does not mean training should discard the others.
A miniature vocabulary
The head compares the final representation with each candidate's learned vector. Stable softmax subtracts the largest score before exponentiating and normalizing, as illustrated below.
A stable softmax subtracts the maximum logit before exponentiation. This leaves the distribution unchanged because the common exponential factor cancels, but avoids overflow from large positive scores. If a row has no finite allowed candidate, softmax cannot create a valid distribution; check the mask and filtering policy before sampling.
The cost is visible at small scale
A large vocabulary makes the logits tensor substantial. Tying weights saves a parameter matrix, not the output activations.
Fused or chunked loss implementations can avoid retaining every logit during training. At generation prefill, projecting only the last position avoids scores that will not be used.
#Section 5Weight tying
Input lookup and output scoring both connect vocabulary items with features. One learned table can perform both jobs, avoiding a second independent matrix.
The embedding lookup and weight-tying mechanism are already established. Keep their convention: input rows come from of shape , and a tied output uses . The new concern here is how that shared parameter receives gradients and optimizer state.
Read the first expression as: candidate 's score is the dot product of the normalized hidden vector and embedding row . Read the second as: because both uses refer to the same parameter , the loss gradient on that parameter adds the contributions through input lookup and output scoring. The path subscripts label contributions to the same loss, not separate objectives.
The input lookup sends gradients only to rows that appeared as input, apart from any other regularization. The full-softmax output path generally sends gradients to every vocabulary row. A rare token can therefore receive output-side updates even if it did not occur in this particular input batch. Sharing does not force the token's final contextual vector to equal its input embedding.
(32000, 512) parameter supplies both input rows and output dot products. The backward pass adds both paths' contributions to the same gradient tensor.Tied and untied are architectural choices
| Property | Tied head | Untied head |
|---|---|---|
| Unique vocabulary matrices | One | Two |
| Input/output geometry | Shared | Independently learned |
| Finch-24 unique parameters | 40,509,952 | 56,893,952 |
| Gradient routes to embedding | Lookup and head | Lookup only |
| Head arithmetic | Dense projection | Dense projection |
| Checkpoint requirement | Restore aliasing | Restore separate weights |
Weight tying can reduce storage and influence generalization, but it constrains the model's input and output representation spaces. It is not universally better. Press and Wolf's work on output embeddings helped establish it for language models. The original Llama 3 8B has separate token embeddings and output weights, so its parameter count includes both vocabulary matrices. Weight tying, Llama 3's two parameter objects.
embedding = torch.nn.Embedding(V, d)
head = torch.nn.Linear(d, V, bias=False)
head.weight = embedding.weight # same Parameter, not a copied valueThe assignment must happen before constructing the optimizer, and the optimizer must not receive duplicate references to the same parameter. Loading equal numeric matrices is insufficient if they become independent parameters afterward. A useful identity check is head.weight is embedding.weight.
#Section 6The complete decoder forward pass
Put our eight input IDs on a whiteboard. We can now follow their tensors without any missing "and then the model predicts" step. Use the classic complete decoder and the finished modern block for the architectural derivation. Here we retain the training shape trace and parameter references, rather than repeat the attention or SwiGLU explanation.
A forward pass is one evaluation of the model's operations with fixed current parameters. Token IDs select rows from the embedding. Each block applies RMSNorm, causal grouped-query attention with RoPE, and a residual addition; then RMSNorm, SwiGLU, and another residual addition. The final RMSNorm prepares the residual stream for the tied vocabulary projection.
Read this as: the initial hidden tensor is the embedding lookup for the input IDs; block adds its attention update to make , then adds its feed-forward update to make the next residual tensor . The norms labeled and belong to the attention and FFN branches. Blocks have independent weights; sharing across positions does not mean sharing across depth.
Attention uses a head-first layout before returning to the residual stream. RoPE rotates queries and keys; ordinary training evaluates full causal sequences without a persistent generation cache.
Parameter flow is not parameter movement
Each operation reads the parameter tensors that belong to it. The embedding and head read the same stored object, and each block reads its own projection and gain tensors. Activations flow between operations; weights do not get passed down the sequence as if they were tokens. No optimizer updates happen inside this forward pass. The graph records the dependencies needed to differentiate the eventual loss in Section 10.
Evaluation mode and disabled gradient recording are separate controls. The first changes training-only behavior; the second prevents a derivative graph.