Trace residual paths, calculate LayerNorm, and compare pre-norm with post-norm.
Preparation: Averages and variance; chain rule 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. Trace residual paths, calculate LayerNorm, and compare pre-norm with post-norm.
Preparation: Averages and variance; chain rule for college. Work through one section at a time. Predict the experiment result before changing its controls, then explain what the example leaves out.
A residual operation y=x+F(x) has Jacobian I+J_F. The identity term is a direct derivative path, but it does not guarantee stable gradients under every parameterization or normalization placement. Residual addition requires compatible shapes. A branch may expand and contract feature width internally, then return to d_model. Separate this architecture-level statement from an empirical claim that every deeper model will train better.
Worked step 1. Let x=[1,3] and the branch correction be [0.2,−0.4].
Worked step 2. Add componentwise to get [1.2,2.6].
Worked step 3. The branch changed the representation without replacing its direct input route.
y=x+F(x); J_y=I+J_F
The output is the input plus its branch. Its derivative contains an identity path plus the branch derivative.
Try it yourself. If the branch outputs zero, what does a bare residual addition return?
Pause the recording and write your reasoning before continuing. The worked solution follows.
Reveal worked solution
Worked solution. It returns x exactly. A later normalization can still transform that result.
Section 02 / 07
Normalize features within one position
LayerNorm computes per-example, per-position feature mean μ and population variance v, then x_hat=(x−μ)/sqrt(v+ε). A learned elementwise gain γ and bias β produce γ x_hat+β. Epsilon stabilizes the denominator, so the normalized variance is not exactly one when epsilon is nonzero. Statistics are over the normalized feature axes, unlike batch normalization's dependence on batch-level statistics.
Worked step 1. For [1,3], mean=2 and population variance=1.
Worked step 2. Ignoring epsilon only for hand arithmetic, normalized features are [−1,1].
Worked step 3. With gain two and bias one, the output becomes [−1,3].
LN(x)=γ⊙(x−μ)/√(v+ε)+β
Subtract the feature mean, divide by the square root of variance plus epsilon, then apply learned gain and bias.
Try it yourself. Must the final LayerNorm output always have mean zero?
Pause the recording and write your reasoning before continuing. The worked solution follows.
Reveal worked solution
Worked solution. No. Learned gain and bias change the normalized features; the zero-mean statement applies before the affine transformation.
Section 03 / 07
Placement changes the route
Pre-norm uses y=x+F(LN(x)); post-norm uses y=LN(x+F(x)). Their Jacobians differ because LayerNorm sits on different paths. In pre-norm the sublayer retains an unnormalized identity route, though a network may apply final normalization elsewhere. In post-norm the normalization Jacobian acts on the combined result. Do not transfer derivative claims or stability conclusions between these layouts without tracing their actual composition.
Worked step 1. Set the branch to zero.
Worked step 2. Pre-norm sublayer returns x.
Worked step 3. Post-norm sublayer returns LN(x), which generally differs from x.
pre: y=x+F(LN(x)); post: y=LN(x+F(x))
Pre-norm normalizes before the branch. Post-norm normalizes after adding the branch.
Try it yourself. Which layout preserves an exact identity route at this sublayer when the branch is zero?
Pause the recording and write your reasoning before continuing. The worked solution follows.
Reveal worked solution
Worked solution. Pre-norm. This statement concerns the sublayer; a complete network may include additional normalization later.
Section 04 / 07
Differentiate the shared mean and variance
Let g be upstream sensitivity after the affine output and u=g⊙γ. For d normalized features, G_x=(u−mean(u)−x_hat mean(u⊙x_hat))/sqrt(v+ε). The mean terms account for shared centering and variance. Gain and bias gradients are sums of g⊙x_hat and g over shared examples. This formula includes epsilon through the denominator and x_hat. Finite differences should test nonconstant inputs and nonuniform upstream gradients.
Worked step 1. Take input [1,2,4] and add five to every feature.
Worked step 2. Both inputs have identical centered deviations.
Worked step 3. With identical gain, bias and epsilon, their LayerNorm outputs match.
G_x=[u−mean(u)−x̂ mean(u⊙x̂)]/√(v+ε)
Subtract the upstream mean and the normalized-input weighted mean term, then divide by the normalization scale.
Try it yourself. Why is dividing each upstream gradient by standard deviation incomplete?
Pause the recording and write your reasoning before continuing. The worked solution follows.
Reveal worked solution
Worked solution. It ignores the input dependence of the mean and variance. All features participate in those statistics.
Section 05 / 07
Expand features, gate them, return to width
A common gated branch is [SiLU(xW_gate)⊙(xW_up)]W_down. Both first projections map d_model to d_ff; elementwise multiplication requires matching hidden widths, and W_down returns to d_model. SiLU(z)=z sigmoid(z). This is a positionwise feature transformation, not attention across tokens. Architecture variants differ in biases and activation choices; the two-branch shape constraint remains essential.
Worked step 1. Start with a 24-feature position.
Worked step 2. Two projections each produce 64 hidden features.
Worked step 3. Multiply their matching coordinates, then project 64 features back to 24.
FFN(x)=[SiLU(xW_gate)⊙xW_up]W_down
A nonlinear gate multiplies a separate up-projection, then a down-projection restores model width.
Try it yourself. Why can a 64-feature branch not be directly added to a 24-feature residual?
Pause the recording and write your reasoning before continuing. The worked solution follows.
Reveal worked solution
Worked solution. The feature shapes differ. The branch needs a projection back to the residual width.
Section 06 / 07
Compare complete block paths
Our scalar-gain branch is a controlled stand-in for a learned sublayer. Compare x+g LN(x) with LN(x+gx), using fixed nonconstant x and unit affine parameters. These are genuine computations of the two placements but not a training benchmark. Check common-offset behavior, gain-zero behavior and finite-difference derivatives. A real transformer has attention and feed-forward residual sublayers plus architecture-specific final normalization.
Worked step 1. At gain zero, pre-norm gives the original input.
Worked step 2. At gain zero, post-norm gives normalized input.
Worked step 3. Changing gain exposes how normalization placement changes the computation.
Try it yourself. Does a cleaner-looking bar chart establish that one layout trains better?
Pause the recording and write your reasoning before continuing. The worked solution follows.
Reveal worked solution
Worked solution. No. The fixture explains algebra. Training quality requires controlled experiments with a complete model, data and optimization settings.
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.
Which expression is pre-norm? Option 1: LN(x+F(x)). Option 2: x+F(LN(x)). Option 3: F(x)+LN(F(x)).
Pause here and choose an answer before continuing. The checkpoint explanation follows.
Reveal worked solution
The correct choice is option 2: x+F(LN(x)). Normalization is inside the branch before its transformation.
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.