mej7.comHow AI Works

Value Mixing

Lesson 2 of 4 · Mechanistic Interpretability level · interactive visualization (simplified teaching model)

VALUES

How attention mixes value vectors

Sentence: THE CAT SAT. Pick a query token, drag raw Q·Kᵀ scores, and watch softmax weights scale each value arrow then add them tip-to-tail into one output.

VALUE MIXING · TOY HEAD
Row (query token):
Attention pattern after softmax
THE
CAT
SAT
THE
CAT
SAT
Raw scores from Q @ Kᵀ (drag; negatives allowed)
THE
CAT
SAT
Value vectors scaled by attention weights and added tip to tail value of THE value of CAT value of SAT output

Causal mask: token i only sees positions ≤ i. Softmax turns scores into weights that always sum to 1; the output is the weighted sum of value vectors.

Toy model for intuition, not real model weights.

What you are seeing

The sentence is fixed: THE CAT SAT. You pick which token is the query, then you drag three raw scores. Those scores stand in for the numbers a QK circuit would have produced. Softmax turns them into three weights that sum to one, and the bars show those weights. On the right, three arrows are the value vectors. Each arrow is scaled by its weight, the scaled arrows are placed tip to tail, and the orange arrow is their sum. That sum is the output of this one head at the chosen position.

This is the OV half of the story, drawn so you can see the mix. In a real head the value vectors are not three arrows chosen for a diagram. They are the residual stream at each position, multiplied by a learned value matrix and then by a learned output matrix. The geometry is the same idea: the output is a weighted sum, and the weights came from the pattern.

What is simplified here

There is no trained W_V or W_O. The arrows have fixed directions so the picture stays readable. The causal mask is real as a rule on this page: a token only receives weight from itself and from earlier tokens, which is why a query at THE does not use CAT or SAT. The numbers you drag are yours. They are not evidence about how any model treats the words "the", "cat", and "sat".

A real head writes its output back into a high-dimensional residual stream, added to whatever was already there. This drawing replaces that stream with a flat plane. Overlap, cancellation, and the fact that other heads write at the same time are all missing. Softmax is the real function, and the caption on the page states the two facts worth keeping: weights sum to one, and the output is the weighted sum of values.

How this relates to real models

When researchers say a head "copies" a token, they mean the OV circuit writes a direction that the unembedding will later read as that token, and the QK circuit aims that write at the right position. The tip-to-tail sum is the picture from the Mathematical Framework, reduced to two dimensions. To see it in a model you cache values and attention weights, then you check causality: patch or ablate the head and see whether the copied token disappears.

Continue with QK/OV circuits and circuits, and with A Mathematical Framework for Transformer Circuits and the indirect object identification paper. The attention-map lab on MEJ7 is the other half of this same toy. Neither half is a measured head.