Separate routing and content; calculate projection and shared-input gradients.
Preparation: Coordinates; matrix calculus for college.
Plan 20–35 minutes with the activities; this is a study estimate, not a timed requirement. Both paths have complete narration. Your notes and progress are kept separately for each level.
FULL LOCAL NARRATION
Follow the complete explanation.
Narration includes worked solutions. Pause at each practice prompt before continuing. Formula notation has a spoken explanation; all teaching text remains readable.
College path. Separate routing and content; calculate projection and shared-input gradients.
Preparation: Coordinates; matrix calculus for college. Work through one section at a time. Predict the experiment result before changing its controls, then explain what the example leaves out.
Under a row-vector convention, Q=XW_Q, K=XW_K and V=XW_V. Projection matrices are parameters; their outputs are input-dependent activations. Some architectures include biases. Keep parameters, activations and embedding tables distinct. Independent projection blocks may be packed into one implementation matrix without tying their weights. The packing operation is an efficiency choice, while sharing is an architectural constraint.
Worked step 1. Let x=[2,1].
Worked step 2. Use projection columns [1,0], [0,1] and [1,1].
Worked step 3. The scalar query, key and value become two, one and three.
Q=XW_Q; K=XW_K; V=XW_V
Multiply the input by three learned matrices to obtain queries, keys and values.
Try it yourself. Changing only the value projection directly changes which role?
Pause the recording and write your reasoning before continuing. The worked solution follows.
Reveal worked solution
Worked solution. It changes message content. Query-key scores remain fixed if queries and keys are unchanged.
Section 02 / 07
Use shapes as a contract
X has shape n×d_model and W_Q has shape d_model×d_k, giving Q of shape n×d_k. The contracted axis is model features, not positions. The same matrix is used at every position, so parameter gradients accumulate across rows and batches. Libraries may store transposed weights; derive shapes from their actual operation. A memorized transpose formula without its convention can silently produce an incorrect interpretation.
Worked step 1. Input shape: 3×2.
Worked step 2. Projection shape: 2×4.
Worked step 3. Output shape: 3×4.
Try it yourself. Can a 3×2 input directly multiply a 4×2 projection here?
Pause the recording and write your reasoning before continuing. The worked solution follows.
Reveal worked solution
Worked solution. No. Inner dimensions two and four differ. Transposing that projection gives a compatible 2×4 matrix.
Section 03 / 07
Hold messages fixed and change routing
Varying one query-projection coefficient with fixed K and V isolates routing. Scaling V with fixed Q and K isolates content and makes O linear in the value gain. In a trained network, several projections and their shared input can change together. The local intervention is therefore a controlled fixture, not a complete causal explanation of a model. Describe exactly which tensors are fixed when interpreting an experiment.
Worked step 1. At zero query scale, equal weights average [10,20,30] to twenty.
Worked step 2. Positive and negative scales prefer different keys.
Worked step 3. Doubling value gain doubles the mixture with weights fixed.
Try it yourself. If weights are unchanged and every value doubles, what happens?
Pause the recording and write your reasoning before continuing. The worked solution follows.
Reveal worked solution
Worked solution. The output doubles. A fixed weighted sum is linear in its values.
Section 04 / 07
Differentiate the learned rule
For Q=XW_Q with upstream G_Q, the weight gradient is X transpose G_Q and the input contribution is G_Q W_Q transpose. Dimensions force these products. The parameter gradient has the same shape as W_Q. Do not substitute key or value weights into the query parameter derivative. Bias gradients, when present, sum the upstream query gradients over the axes where the bias is shared.
Worked step 1. x=[2,1], upstream query sensitivity=3.
Worked step 2. The weight gradient is [6,3] transposed.
Worked step 3. At learning rate 0.1, gradient descent subtracts [0.6,0.3].
G_WQ=XᵀG_Q; G_X(query)=G_QW_Qᵀ
The query-weight gradient is input transpose times upstream query gradient. The input receives upstream gradient times query-weight transpose.
Try it yourself. A second item contributes [1,−2]. What is the combined weight gradient?
Pause the recording and write your reasoning before continuing. The worked solution follows.
Reveal worked solution
Worked solution. Add contributions to obtain [7,1]. The same parameters were used twice.
Section 05 / 07
Add shared-input paths
The chain rule gives G_X=G_QW_Q transpose+G_KW_K transpose+G_VW_V transpose. Each projection retains its own X transpose G parameter gradient. If X comes from an embedding lookup, repeated token IDs subsequently accumulate into the same embedding-table row. Parameter reuse changes accumulation, not the local derivative. A scalar test loss and finite differences can validate the whole shared path.
Worked step 1. The three input contributions are [1,2], [−1,3] and [4,−2].
Worked step 2. Add coordinate by coordinate.
Worked step 3. The total is [4,3].
G_X=G_QW_Qᵀ+G_KW_Kᵀ+G_VW_Vᵀ
Sum the query, key and value contributions at the shared input.
Try it yourself. Can you add the projection matrices themselves to obtain the input gradient?
Pause the recording and write your reasoning before continuing. The worked solution follows.
Reveal worked solution
Worked solution. No. Each transposed matrix must first be weighted by its own upstream gradient.
Section 06 / 07
Sharing heads saves different things
Grouped-query attention assigns multiple query heads to one KV head; multi-query attention uses a single KV head. Cache size follows KV-head count, while query-head count can remain larger. This is different from packing independent projections into one matrix. Specify head counts, grouping and per-head dimensions before estimating memory. Our cache lesson uses this distinction explicitly, linking projection architecture to generation resources.
Worked step 1. Thirty-two query heads share eight KV heads.
Worked step 2. An even grouping assigns four query heads to each KV head.
Worked step 3. Cache storage uses eight key-value heads, not thirty-two.
Try it yourself. Does placing all projections in one packed matrix force equal weights?
Pause the recording and write your reasoning before continuing. The worked solution follows.
Reveal worked solution
Worked solution. No. Independent parameter blocks can share a storage container without being tied.
Section 07 / 07
Mastery and transfer
Bring the pieces together. First answer the checkpoint without the worked solutions. Then explain the mechanism in your own words, using one numerical example from this lesson.
For Q=XW and upstream G, the weight gradient is… Option 1: XᵀG. Option 2: GWᵀ. Option 3: WᵀX.
Pause here and choose an answer before continuing. The checkpoint explanation follows.
Reveal worked solution
The correct choice is option 1: XᵀG. X transpose G has the same shape as W.
Transfer task. Change one assumption in the worked example. State your prediction, calculate or test it in Workbench, then explain whether the result supports your prediction.
Reveal worked solution
Self-check rubric. Name the changed assumption, keep the other inputs fixed, show at least one intermediate calculation, and distinguish what the toy example guarantees from what would require a trained model or a real measurement.
WORKBENCH / PREDICT → TEST → EXPLAIN
Inspect exact numerical data
These are computed teaching fixtures. No remote AI model or GPU is called by the experiment.
CHECK YOUR UNDERSTANDING
Commit to an explanation.
Keep your learning record.
Sources and scope
Original worked examples and teaching text, grounded in these primary references. Numerical fixtures explain mechanisms; model quality and hardware performance require separate measurements. Both levels share key examples, with different explanations and checkpoints.
What a model learns: from numbers to a useful answer
Follow a sentence through learned weights, temporary activations, and the next-token decision.
Additional reading · original lesson audio remains unchanged.
Read the full explanation · 586 words + college extension
What changes when you ask a question?
23input x
×
0.6−0.2learned weights
+
0.1bias
=
0.7output y
The weights stay fixed during ordinary inference. Activations change with your input.
Text → tokens
Tokens → vectors
Learned transformations
Next-token scores
Text → tokens
A model is a computation with learned settings
A language model does not contain a little librarian choosing a finished answer from a shelf. It contains a structured computation whose numerical settings were learned during training. Those settings are called parameters. Many are weights arranged in matrices; other parameters can include offsets or normalization scales. The architecture determines which operations happen and how information travels. The weights determine the particular transformations performed by those operations. Two models can share an architecture and behave differently because they learned different parameter values.
Consider a tiny operation: y = 0.6x₁ − 0.2x₂ + 0.1. With inputs x₁ = 2 and x₂ = 3, the output is 0.7. Changing the first weight from 0.6 to 0.5 changes the output to 0.5. This is a teaching example, not a miniature intelligent system. Its purpose is to make one idea visible: numerical settings influence the result. In a language model, many such transformations act together across large vectors, nonlinear functions, and layers.
Follow the sentence
First, a tokenizer turns text into a sequence of token identifiers. A token may represent a word, part of a word, punctuation, or another unit. An embedding table supplies a learned vector for each identifier. These vectors are starting representations, not complete dictionary definitions. As they pass through the network, surrounding tokens influence how the current sequence is represented.
In attention, learned projections produce queries, keys, and values. The model compares queries with keys to calculate input-dependent attention scores, then combines value representations. This distinction matters: the projection weights normally remain fixed during a conversation, while the attention scores change with the input. Feed-forward transformations further process the representations, and residual connections carry information around sublayers. Finally, an output transformation supplies scores for possible next tokens. A selection procedure chooses a continuation, which becomes part of the next input step.
Training changes the settings; a conversation changes the state
During training, a loss measures how the predictions compare with the training objective. Gradients estimate how parameter changes would affect that loss. An optimizer uses those gradients to update trainable parameters. A single example does not usually teach an isolated fact to one identifiable weight. Useful patterns emerge through many updates, and knowledge and behavior are distributed across the computation.
During ordinary inference, the parameters stay fixed. Your prompt changes the activations: the temporary numbers produced while the model runs. A cache can retain intermediate information so the system need not repeat earlier work. That cache is not a new permanent education for the model. A product may separately save conversation history or conduct later training, but those are additional mechanisms. Saying that a chatbot remembers your previous sentence does not establish that its weights changed.
Why more parameters is not a complete explanation
A parameter count describes scale, not a guarantee of reliability. Data quality, architecture, training, numerical precision, and the way a model is evaluated all matter. A large model can produce a convincing error; a smaller specialized model can perform a narrow task well. To compare systems, ask what task was tested and under what conditions, rather than treating one number as a universal intelligence score.
Return to the animation and identify three different objects: a stored weight, an activation that changes with the sentence, and an output score. If the diagram uses moving dots, those dots represent information flow; they are not literal particles inside a model. Using the small equation above on paper, change an input while keeping a weight fixed, then change the weight while keeping the input fixed. Explain why these are different experiments. That distinction will help you understand fine-tuning, quantization, caches, and model releases throughout the course.
College extension · make the assumptions explicit
For a linear layer, write y = Wx + b. If W has shape m × n, x has n entries and y has m entries. During backpropagation, the chain rule relates a loss gradient at y to gradients at W and x. During inference, the same forward transformation can execute without constructing those training gradients. In attention, WQ, WK and WV are parameters; QKᵀ and its normalized scores are functions of the current activations. Keeping these categories separate prevents a common mistake: interpreting an attention heat map as a direct picture of stored model weights.
Sources and further investigation
Source review: October 28, 2026. Model-release claims are attributed to their publishers.