Interpreting Neural Networks

A toy sentiment model reads "the film was not bad" and says positive. Attention gives "not" only 6% of its weight. Remove "not", and the chance of positive falls from 0.88 to 0.13.

Pick a tool and see which word it blames. Then tap "not" to remove it. Then we build each tool from zero, test every one against an intervention, and end with what a model knows that we do not.

You need a little Python, what a probability is and what attention does (Lecture 5). We build the rest from zero.

Lecture 15, "Guest Lecture: Interpretability", of Stanford CS224N, Natural Language Processing with Deep Learning (Winter 2026, Diyi Yang and Yejin Choi; the guest lecturer is Been Kim). The course posts no slides for it. This page follows its readings: agentic interpretability (Kim et al., 2025), "The Pareto Frontier of Human-Centered AI" (Kim), concept discovery in AlphaZero (Schut et al., 2025), "We Can’t Understand AI Using our Existing Vocabulary" (Hewitt, Geirhos and Kim, 2025) and neologism learning (Hewitt et al., 2025). Chapters 1 to 5 add the standard tools those readings build on. Before: Lecture 14, Tokenization and Multilinguality. Next: Lecture 16, Social and Broader Impacts.

Ask four tools which word decided

Tap to remove:

Illustrative toy, built so we know the truth. An attention head reads the sentiment words; a separate negation unit flips the sign when it sees "not" (Chapter 0). Removing a word sets its input to zero. Bars for gradient, integrated gradients and removal are changes in the model’s score z, the number that P(positive) squashes. A tick means the tool’s top word is the word whose removal moves z most.

Chapter 0

The Box Is Open, and Still Dark

Print every number inside a small model, and see why the numbers do not say why it answered

A sentiment model reads "the film was not bad" and says positive, with probability 0.88. Why? In a neural network nothing is hidden. We can print every weight and every activation. The trouble is that the numbers carry no labels.

Open the box

Pick a review. The purple bars are six hidden neurons; the blue bar is the model’s chance of positive. Look for a neuron that means "positive".

Illustrative toy. Each neuron is tanh of a fixed mix of three internal values: the sentiment the head reads, the negation unit and the score. The mixing weights are ours.

This page uses one toy model the whole way, so we can check every tool against the truth. It has two parts. An attention head reads the words and returns a sentiment value v: negative for "bad", positive for "good". A negation unit fires when it sees "not"; its output g runs from 0 to 1. A weight w = 2 scales the result into the model’s score z:

Say it aloud

z equals w times v times one minus two g.

z
z the score. The chance of positive is P = 1/(1 + e−z), so z = 0 means 0.5.
w
w a fixed weight, 2 in this toy.
v
v the sentiment the attention head reads: each word’s sentiment (−2 for "bad"), weighted by its attention.
1 − 2g
one minus two g the sign switch. g is the negation unit, 0 to 1; when g is near 1 this is near −1.
In plain words

The head says how negative or positive the words are, as v. If the negation unit fires, g is near 1 and one minus two g is near minus one, so the sign of v flips. Multiply by w to get z.

With numbers

For "the film was not bad": v = −1.01 and g = 0.998. z = 2 × (−1.01) × (1 − 1.995) = 2.01, and P = 0.88. Remove "not": g = 0.002, z = −1.94, P = 0.13.

The six neurons in the device are mixtures of v, g and z. Each fires for reviews with opposite verdicts, so none of them means "positive". Real networks look like this too, as Chapter 5 shows.

The guest lecturer, Been Kim, frames the goal as communication. A model may know things we do not. Interpretability tools are how that knowledge reaches people. Each tool makes a claim about the model, and we trust a claim when it survives a test.

Symptom: an explanation that sounds right but predicts nothing.

Measure: change the thing it points at, and check that the output moves as claimed.

Fix: test every reading with an intervention (Chapter 4).

The road

  1. Probes: what a layer holds, checked with a control task.
  2. Attention: why a weight is not a reason.
  3. Gradients: slopes go flat; integrated gradients add them up.
  4. Patching: copy one part across two runs and measure what returns.
  5. Features: superposition, and sparse autoencoders that undo it.
  6. Showcase: put every tool on trial; the hero, opened up.
  7. Explain: score explanations, and let a model help.
  8. AlphaZero: concepts people did not have, taught to grandmasters.
  9. New words: neologisms for machine concepts.
  10. Field guide: the tools, the numbers and the code.
We can print every activation of a network. Why is that not an explanation of its answer?

Chapter 1

Probes: What Can Be Read Out

Train a small classifier on frozen activations, and check it against a control task before you believe it

What information sits in a layer? A probe answers that. Freeze the model and take each word’s activation vector h at one layer. Train a small classifier on h to predict a label, such as part of speech. If it scores well, the label can be read out of h.

But a big enough classifier can memorize labels by itself. Hewitt and Liang (2019) built a test for this. A control task gives each word type a random label, the same label every time that word appears. Only the probe’s own memory can learn random labels. So call a probe’s task accuracy acctask, its control accuracy acccontrol, and their gap its selectivity:

Say it aloud

Selectivity equals acc-task minus acc-control.

selectivity
selectivity how much of the probe’s score comes from the representation, not from the probe’s memory. Percentage points.
acctask
acc-task the probe’s accuracy on the real labels.
acccontrol
acc-control the same probe’s accuracy on random labels fixed per word type.
In plain words

Train the probe twice on the same activations: once on real labels, once on the control labels. Subtract the control accuracy from the task accuracy. A large gap means the information is in h.

With numbers

Hewitt and Liang, ELMo layer 1, part of speech: a linear probe scores acc-task 97.2% and acc-control 71.2%, so selectivity is 26.0 points. An MLP probe scores 97.3% and 92.8%: only 4.5 points.

Grow the probe and watch it memorize

The dots are word types; yellow fill is a random control label. Pick a probe size and see its boundary, then compare the two pink bars.

The bars are Table 1 of Hewitt and Liang (2019): ELMo layer 1, part-of-speech tagging, default settings. The dots and boundaries are an illustration of memorizing random labels, not their data.

The MLP gains 0.1 points on the real task and 21.6 on the control: memory, not information in h. Prefer the simplest probe that works, and report selectivity next to accuracy.

A probe can also read structure. Hewitt and Manning (2019) trained a structural probe: a matrix B that maps word vectors. After the map, the squared distance between two words should equal their distance in the parse tree. For words i and j with vectors hi and hj:

Say it aloud

d-B of h-i and h-j equals the squared length of B times h-i minus h-j.

dB(hi, hj)
d-B of h-i and h-j the probe’s guess of how many tree edges separate word i and word j.
B
B the probe’s matrix, the only thing trained. The model stays frozen.
hi − hj
h-i minus h-j the difference between the two words’ vectors at one layer.
‖ · ‖2
the squared length add up the squares of the entries.
In plain words

Subtract the two word vectors, map the difference through B, and add up the squares. Train B so this number matches the tree distance for every pair of words.

With numbers

With made-up numbers: h-i minus h-j = (1, 2) and B = [[1, 0], [0, 0.5]]. B times the difference is (1, 1), and its squared length is 2. The probe says the two words are two edges apart.

In the lab you build that probe: raw vectors hide the tree, and the right B shows it.

Symptom: a probe scores 97% and a story follows about what the layer "knows".

Measure: the same probe’s accuracy on a control task.

Fix: use the simplest probe that works, and report selectivity.

A probe scores 97% on a task and 93% on its control task. What does that tell you?

Chapter 2

Attention Is a Weight, Not a Reason

Shuffle a head’s weights, watch its output, and see that the values decide how much a weight matters

Attention maps are tempting. In "the cat sat because it was tired", a head on "it" may put most of its weight on "cat". It looks as if the model resolved the pronoun. But look at what a head computes. Each word j has an attention weight aj and a value vector vj, and the head returns their weighted sum o:

Say it aloud

o equals the sum over j of a-j times v-j.

o
o what the head sends on, for the word "it".
Σj
the sum over j add one term for every word in the sentence.
aj
a-j the attention weight on word j: a softmax of query times key, divided by the square root of the size. The weights add up to 1.
vj
v-j the value vector of word j: what that word sends if attended to.
In plain words

Scale each word’s value v-j by its weight a-j and add them up. The result o depends on the weights and on the values together.

With numbers

In the device, "cat" gets a-j = 0.55. If every value is (1.0, 0.5), then o = (1.0, 0.5) for any weights at all. The 0.55 on "cat" then explains nothing.

Shuffle the weights

Blue bars are the weights from "it". Purple arrows are the values; the blue arrow is the output. Spread the values, then shuffle.

0.1

Illustrative toy: seven made-up 2-D values around (1.0, 0.5), and fixed weights. The average shift is over all 5,040 orderings of the weights, divided by the output’s length.

When the values are alike, the weights hardly matter. At value spread 0.1, shuffling the weights moves the output by 5% on average. At spread 1.0 it moves it by 40%. So a heatmap alone cannot tell you how much a weight counts.

Jain and Wallace (2019) tested this on text classifiers with an attention layer. Attention often disagreed with gradient-based importance, and different attention weights could give the same prediction. Wiegreffe and Pinter (2019) answered that the result depends on the task and model, and that an explanation need not be the only one possible. Both sides agree on the practice: a heatmap is a hypothesis.

A better reading weighs each word by what it sends. Kobayashi et al. (2020) used the size of a-j times v-j instead of a-j alone; press the toggle to see it. Better still is to intervene on the head, as in Chapter 4.

In the lab you compute a real attention matrix, then shuffle one row and measure the shift yourself.

Symptom: a heatmap shown as the reason for an answer.

Measure: shuffle or replace the weights, and check whether the output moves.

Fix: patch the head (Chapter 4) before you claim it does the job.

A head puts 0.55 of its weight on "cat". Shuffling its weights moves its output by only 5%. What follows?

Chapter 3

Gradients and Integrated Gradients

Take the slope at the input, watch it go flat, then add up slopes along a path from a blank input

A gradient asks: if I nudge this input a little, how much does the score move? One backward pass gives a value for every word, a saliency map.

In the hero model the gradient for "not" is 0.18, and for "bad" it is 3.61. Yet removing "not" moves the score by 3.95, and removing "bad" by 2.01. The negation unit is saturated: its output g is already 0.998, so a small nudge changes almost nothing. The slope is flat exactly where the effect is large.

Sundararajan, Taly and Yan (2017) proposed integrated gradients (IG). Choose a baseline input x′ with no signal; here, every word switched off. Walk in a straight line from x′ to the real input x, and add up the gradient along the way. Call the position on the path γ, from 0 to 1. The credit for word i is:

Say it aloud

IG-i equals x-i minus x-prime-i, times the integral from zero to one of the slope of z with respect to x-i, taken at x-prime plus gamma times x minus x-prime, d-gamma.

IGi
IG-i the credit for word i, in units of the score z.
xi − x′i
x-i minus x-prime-i how far word i moves from the baseline to the input: 1 here (off to on).
∫01 … dγ
the integral from zero to one, d-gamma the average over every point on the path, from the baseline (γ = 0) to the input (γ = 1).
∂z(…)/∂xi
the slope of z with respect to x-i the gradient for word i, taken at that point of the path.
In plain words

Turn every word up together from off to on in small steps. At each step, take the gradient for word i. Average those gradients and multiply by how far word i moved. That is IG-i.

With numbers

For "the film was not bad": IG is 1.44 for "not", 0.66 for "bad" and −0.09 for "film". They add up to 2.01, which is z(x) − z(x′) = 2.01 − 0. "Not" now gets the most credit.

That sum is completeness: the credits always add up to the score’s change from baseline to input. It also checks the numerical sum. With 20 steps our credits add up to 2.12, 5.3% too high; with 300 steps, 2.02. The paper suggests 20 to 300 steps.

Walk the path from blank to input

The blue curve is the score z as every word turns on together. Drag along the path and watch the pink credits grow. Then choose fewer steps and check the sum.

1.00

The hero’s toy model. The path credits are exact; the step counts use the paper’s right-hand sum, (1/m) times the gradients at k/m for k = 1 to m.

The score dips below zero first: the head reads "bad" before the negation unit wakes. Near γ = 0.5 the unit fires and the score climbs. IG credits "not" for that climb; the gradient at the end never sees it.

The paper derives IG from two rules. Sensitivity: if input and baseline differ in one feature and the outputs differ, that feature gets non-zero credit. Plain gradients break it, as "not" shows. Implementation invariance: two networks that compute the same function get the same credit.

Symptom: a saliency map gives almost no credit to the word that flips the answer.

Measure: compare the gradient with a removal test on a few inputs.

Fix: integrated gradients with the completeness check; choose the baseline and report it.

Why does the gradient give "not" only 0.18 when removing "not" moves the score by 3.95?

Chapter 4

Intervene: Activation Patching

Run a clean and a corrupted input, copy one part across, and measure how much of the answer comes back

Every tool so far reads the model. An intervention changes the model and watches what follows. The cleanest form is activation patching. Run the model twice: on a clean input, "the film was not bad", and on a corrupted one, "the film was so bad". They differ in one word, and the verdict flips.

Now rerun the corrupted input, but copy one internal value from the clean run into it. If the answer comes back, that value carries the difference. Call the clean score zclean, the corrupted score zcorrupt, and the score after the patch zpatch. The fraction of the gap restored is R:

Say it aloud

R equals z-patch minus z-corrupt, over z-clean minus z-corrupt.

R
R the restored fraction: 1 means the patch brings back the whole clean answer, 0 means nothing.
zpatch
z-patch the score of the corrupted run with one value copied in from the clean run.
zcorrupt
z-corrupt the score on the corrupted input, "so bad".
zclean
z-clean the score on the clean input, "not bad".
In plain words

Measure how far the patch moves the corrupted score toward the clean score. Divide by the whole distance between them.

With numbers

z-clean = 2.01 and z-corrupt = −1.94. Patch the negation unit: z-patch = 1.94. R = (1.94 + 1.94) / (2.01 + 1.94) = 0.98.

Patch one part across

Top row: the clean run. Bottom row: the corrupted run. Toggle a part to copy its value from the clean run into the corrupted one.

The hero’s toy model. "so" is a neutral word with no attention key of its own.

Patch the negation unit and 98% of the gap returns. Patch the attention head’s output and −2% returns: nothing. The head read "bad" in both runs; the difference lives in the negation unit. That is a causal claim, found by doing, not by looking.

Researchers find real circuits this way. Meng et al. (2022) added noise to the subject of a fact in GPT models. Then they restored hidden states one at a time. Middle-layer MLPs at the subject’s last token brought back most of the answer. Wang et al. (2022) used patching to map the heads GPT-2 small uses to finish "When Mary and John went to the store, John gave a drink to" with "Mary".

Symptom: a patch restores most of the answer, but the two inputs differ in many ways.

Measure: build clean and corrupted inputs that differ in one thing, and check R on several pairs.

Fix: minimal pairs, and patch one part at a time.

Patching the attention head restores −2% of the gap; patching the negation unit restores 98%. What is the conclusion?

Chapter 5

Superposition and Sparse Autoencoders

Pack more features than dimensions, see the cross-talk, and pull the features apart with a sparse code

Chapter 0’s neurons were mixtures, and real neurons often fire for unrelated things. One reason is superposition: a layer stores more features than it has dimensions, each as a direction instead of a neuron. Elhage et al. (2022) showed small networks do this when features are rare.

Why can it work? In high dimensions, random directions are nearly at right angles: at 768 dimensions, the typical |cosine| between two is 0.029. The number of nearly orthogonal directions grows exponentially with the dimension.

Pack five features into two dimensions

Purple arrows are features; the teal arrow is an input made of the active ones. Blue bars are the reads. Raise the threshold to cut cross-talk, then turn on two features at once.

0.40
5

Illustrative toy after the pentagon of Elhage et al. (2022). Features are evenly spaced unit arrows, and each input adds its active features. A feature fires when its read passes the threshold.

With five features 72° apart, reading feature 1 while feature 2 is on gives cos 72° = 0.31; the far features read −0.81. A threshold of 0.4 cuts that cross-talk. With two non-adjacent features on, each reads only 0.19, and the feature between them reads 0.62: a false fire. Superposition works while features rarely occur together.

A sparse autoencoder (SAE) pulls the features back out. It maps an activation x to many more features f than dimensions, keeps few of them on, and rebuilds x. The encoder is one layer with a ReLU:

Say it aloud

f equals ReLU of W-enc times x, plus b-enc.

f
f the feature activations: a long vector, mostly zeros.
ReLU
ReLU keep positive numbers, set negative ones to zero.
Wenc
W-enc the encoder matrix: one row per feature, the direction that feature reads.
x
x one activation vector from the model, for one token.
benc
b-enc the encoder bias. A negative bias acts as the threshold in the device.
In plain words

Read x along every feature direction in W-enc, add the bias b-enc, and zero every negative result. What is left is f.

With numbers

The device’s pentagon with one feature on: the reads are 1, 0.31, −0.81, −0.81, 0.31. With b-enc = −0.4, f = ReLU(0.6, −0.09, −1.21, −1.21, −0.09) = (0.6, 0, 0, 0, 0). One feature is left on.

The decoder rebuilds the activation as x̂ = Wdec f + bdec. Training trades the rebuild against feature activity, with a weight λ:

Say it aloud

L equals the squared length of x minus x-hat, plus lambda times the sum over i of the absolute value of f-i.

L
L the training loss of the SAE. The model stays frozen.
‖x − x̂‖2
the squared length of x minus x-hat the rebuild error.
λ
lambda how much we pay for each unit of feature activity.
Σi |fi|
the sum over i of the absolute value of f-i the L1 norm: total feature activity. It pushes most features to zero.
In plain words

Add the rebuild error to lambda times the total feature activity. A lower lambda buys better rebuilds with more features on.

With numbers

With made-up numbers: features f = (0.8, 0, 0.3) on directions (1, 0), (0, 1), (0.6, 0.8) rebuild x = (1, 0.3) as x-hat = (0.98, 0.24). With lambda 0.1, L = 0.004 + 0.1 × 1.1 = 0.114.

Templeton et al. (2024) trained SAEs with up to 34 million features on the middle layer of Claude 3 Sonnet. When they clamped a Golden Gate Bridge feature to a high value, the model brought the bridge into unrelated answers. Gao et al. (2024) trained a 16-million-feature SAE on GPT-4 activations.

Symptom: the features look clean, but the model behaves differently with the SAE spliced in.

Measure: the rebuild error, and the model’s loss when x-hat replaces x.

Fix: a bigger dictionary or a lower lambda; check features by steering, not only by their top examples.

Why does superposition break when two features are on at once?

Chapter 6

Showcase: Put Every Tool on Trial

Run three reading tools on four reviews, score each against the removal test, then change the model and score again

This is the hero, opened up. There are four reviews and three reading tools, with the removal test as the judge. Two knobs change the model itself. Gate sharpness c sets how hard the negation unit saturates. Attention to "not" sets how much the head looks at "not", without giving "not" any sentiment to send.

Score the tools, then change the model

The top shows the chosen review and tool. The grid scores every tool on every review: a tick when its top word matches the removal test.

12
−0.5

The hero’s toy model. "Attention to not" is the attention key of "not"; "very" has a small key and no sentiment. Pink bars are the tool, the grey outline is the removal effect, both in units of the score z.

What to find. As c grows from 4 to 12, the gradient’s credit for "not" falls from 1.75 to 0.18. Over the same range, its removal effect grows from 3.02 to 3.95. Integrated gradients keeps "not" on top at every c.

Now raise attention to "not" to 2.5. Attention gives "not" 0.57 of its weight and scores 4 of 4: right for the wrong reason. The head still sends nothing from "not"; it only steals weight from "bad", so P(positive) falls to 0.72. A tool that matches the truth on these cases has passed a test. It has not shown a mechanism.

With attention to "not" at 2.5, attention scores 4 of 4. Why is that not evidence that the head handles negation?

Chapter 7

Let a Model Help Explain

Score an explanation by how well it predicts a feature, then let the model talk with you about itself

An SAE gives millions of features, far too many for people to label. Bills et al. (2023) at OpenAI automated the work. GPT-4 read a neuron’s top examples in GPT-2 XL and wrote an explanation. A model then simulated the neuron: from the explanation alone, it predicted the activation on each token of new text. Call the simulated activations ŝ and the real ones s. The explanation score is their correlation:

Say it aloud

The score equals the correlation of s-hat and s.

score
score how well an explanation predicts the feature, from −1 to 1.
corr
the correlation of Pearson’s r: 1 when the two lists rise and fall together.
ŝ
s-hat the activations the simulator predicts from the explanation, one per token.
s
s the feature’s real activations on the same tokens.
In plain words

Write down what the explanation predicts for every token, as s-hat. Put it next to the real activations s, and compute their correlation.

With numbers

In the device, "negation words: not, never, no" scores 0.975. "The word not" scores 0.587, because it misses "never" and "no". "Contrast words" scores 0.047.

Score three explanations

Blue bars are the feature’s real activations; yellow outlines are what the chosen explanation predicts. Pick an explanation, then add a test text.

Illustrative toy: a made-up feature and texts. Our simulator is a written rule, where Bills et al. used a language model.

A chosen test text separates explanations that the top examples cannot. "I never said no to it" has no "not". The explanation "the word not" predicts nothing there, while "negation words" predicts both words. Add it, and the first score drops to 0.457 while the second rises to 0.982. Choosing that text is the step a scientist, or an agent, adds.

Kim, Hewitt, Nanda, Fiedel and Tafjord (2025) go further. In agentic interpretability, you hold a multi-turn conversation in which the model helps you understand it. It builds a model of what you know and teaches to it. The authors name the trade-off: it gives up completeness for interactivity, so it suits learning more than high-stakes safety checks of a model that might deceive. The human is part of the method, which makes it hard to evaluate.

Symptom: a fluent explanation that scores well on its top examples only.

Measure: the score on held-out text, and on texts chosen to split rival explanations.

Fix: hold out text, and report the score with the explanation.

Why add a text like "I never said no to it" when scoring explanations of a feature?

Chapter 8

Concepts People Did Not Have

Find a sparse direction that prefers AlphaZero’s chosen plan to a worse one, filter it, and teach it to grandmasters

Sometimes a model knows something people do not. AlphaZero learned chess by playing itself, with no human games. Schut, Tomasev, McGrath, Hassabis, Paquet and Kim (2025) asked whether people could pull out its new ideas and teach them to top players.

They look for a concept vector v in one layer’s activations. Take the line AlphaZero chose in its search, with activations z+t at step t, and a worse line it rejected, with activations z−t. Find the vector with the smallest L1 norm that scores the chosen line at least as high at every step:

Say it aloud

Minimize the L1 norm of v, such that v dot z-plus-t is at least v dot z-minus-t for every step t.

‖v‖1
the L1 norm of v the sum of the absolute values of v’s entries. Small means few neurons used.
v
v the concept vector we search for.
z+t
z-plus-t the layer’s activations at step t of the line AlphaZero chose.
z−t
z-minus-t the activations at step t of a worse line from the same search.
t
t the step along the line, up to a set depth.
In plain words

Look for the cheapest vector v whose score is at least as high on the chosen line as on the rejected one, at every step. Cheap means a small sum of absolute values.

With numbers

In the device’s toy, we ask for a margin of 1. Then v = (1.11, 0) meets all four steps at an L1 norm of 1.11. v = (1, 1) costs 2.0 and fails step 2, where it scores 0.70.

Find the cheapest concept vector

Each line is one step’s rule; the vector must sit on its far side. The pink diamond is every vector with the same L1 cost. Move v, then press Solve.

1.00
1.00

Illustrative 2-D toy with made-up activation differences. We ask for a margin of 1 so that v = 0 cannot win; the paper writes the plain inequality.

The L1 norm favours vectors with many zeros, so a concept uses few neurons. You can see it in the device: the cheapest point that meets every rule sits on an axis.

Two filters follow. Teachability: a student network trained on positions that show the concept must agree more with AlphaZero on new positions. Novelty: AlphaZero’s own games must explain the concept better than human games do. Then four grandmasters solved puzzles built on the concepts, studied AlphaZero’s lines, and solved new puzzles of the same concepts. All four improved, by 6 to 42 percentage points in the preprint’s table.

Symptom: a "concept" that is only some direction separating two sets of positions.

Measure: does a student learn from it, and does it carry over to new positions?

Fix: teachability and novelty filters, then a test with people.

Why does the search minimize the L1 norm of v?

Chapter 9

New Words for Machine Concepts

Train one new word’s embedding with the model frozen, and see why a machine’s word can sit far from ours

If people and machines hold different concepts, we need words that point at them. Hewitt, Geirhos and Kim (2025) argue that our existing vocabulary is not enough. They call for neologisms: new words for precise human concepts we want to teach machines, or machine concepts we need to learn. A useful one is specific enough to say something and general enough to reuse.

Neologism learning (Hewitt, Tafjord, Geirhos and Kim, 2025) makes this concrete. Add one new token to the vocabulary. Train only its embedding e on examples of the concept, such as short answers. Every other weight stays frozen. Each step moves e against the gradient of a loss L, with a step size η:

Say it aloud

e becomes e minus eta times the slope of L with respect to e.

e
e the new word’s embedding vector: the only thing that changes.
η
eta the step size, 0.2 in the device.
∂L/∂e
the slope of L with respect to e the direction in which e raises the loss fastest.
In plain words

Run the frozen model with the new word in the prompt, and measure how far its answers are from the concept, as L. Move e a little in the direction that lowers L. Repeat.

With numbers

In the toy, the frozen model gives 200-word answers, and we want 40. Starting from e = (0.8, −1.4), one step cuts the answers from 192 words to 82. After ten steps they are 40 words long.

Teach the model a new word

Purple dots are existing words; the ring is the new word. Every point on the dashed line gives 40-word answers. Pick a start and press Train.

Illustrative toy: answer length is 200 × eu·e for a fixed direction u = (1, 0.6). The loss is the squared gap in log length. We made up the word positions.

Then ask the model what the new word means. It answers in its own words: self-verbalization. The paper checks each answer with plug-in evaluation: put the description into the prompt and see whether behaviour moves toward the concept. It also reports machine-only synonyms: words that look unrelated to people but cause similar behaviour in the model.

The device shows one way that can happen. In our toy, length depends on one direction of e only. Training stops where it first meets the 40-word line, which can be 1.72 away from "short".

Symptom: the model’s description of a new word reads well but does not change its behaviour.

Measure: plug-in evaluation: use the description in place of the word.

Fix: keep descriptions that reproduce the effect, and treat the rest as machine-only.

In neologism learning, what is trained?

Chapter 10

Field Guide

Keep the tools, the numbers and the code, and see where to go next

Reading tools say where to look. Probes say what a layer holds; attention says where a head looks; gradients and integrated gradients say what a score is sensitive to. Interventions test the reading: removal and patching change the model and measure what follows. SAEs give the units to read and patch. The lecture’s readings add the human side: let the model help explain, extract what it knows that we do not, and coin words for it.

ToolQuestionKindWatch for
Probewhat can be read from a layer?readingmemorizing probes; check selectivity
Attention mapwhere does a head look?readingalike values; weight is not effect
Gradientwhat is the score sensitive to here?readingsaturation: flat slope, large effect
Integrated gradientshow does credit build up from a baseline?readingthe baseline; check completeness
Removal and patchingwhich part carries the difference?interventioninputs that differ in many ways
Sparse autoencoderwhat features does a layer mix?decompositionrebuild error; split features
Explanation score, agentsdoes a written explanation predict the feature?reading + testtop examples only; human in the loop
Concept vectors, neologismswhat does the model know that we do not?discoveryteachability; plug-in checks
NumberValueWhere
Toy model, "not bad": attention on "not"; P(positive) with and without "not"0.06; 0.88 and 0.13Hero, Chapter 0
ELMo layer 1, part of speech: linear and MLP-1 selectivity26.0 and 4.5 pointsChapter 1
Shuffled attention: average output shift at value spread 0.1 and 1.05% and 40%Chapter 2
Gradient for "not" and "bad"; removal effect of each0.18, 3.61; 3.95, 2.01Chapter 3
IG for "not", "bad", "film"; sum with 20 and 300 steps1.44, 0.66, −0.09; 2.12, 2.02Chapter 3
Patching: negation unit and attention head, restored fraction98% and −2%Chapter 4
Typical |cosine| of random directions at d = 7680.029Chapter 5
Largest SAEs: Claude 3 Sonnet; GPT-434 million; 16 million featuresChapter 5
Explanation scores, alone and with the test text0.587 → 0.457; 0.975 → 0.982Chapter 7
Grandmasters’ gains on new puzzles of AlphaZero concepts+6 to +42 points, all fourChapter 8

The core as code: the toy model, the gradient, integrated gradients with the completeness check, removal, and patching.

python
import numpy as np
sig = lambda x: 1 / (1 + np.exp(-x))
# token: (attention key, sentiment, negation)
VOC = {'the': (0, 0, 0), 'film': (.8, 0, 0), 'was': (0, 0, 0), 'not': (-.5, 0, 1), 'bad': (1.6, -2, 0), 'so': (0, 0, 0)}

def parts(toks, on, c=12):
    k, s, n = (np.array([VOC[t][i] for t in toks]) for i in range(3))
    l = on * k; a = np.exp(l - l.max()); a /= a.sum()     # attention weights
    v = (a * on * s).sum()                                 # the head's sentiment read
    g = sig(c * ((on * n).sum() - .5))                      # the negation unit
    return a, v, g

def score(toks, on): a, v, g = parts(toks, on); return 2 * v * (1 - 2 * g)   # z = w v (1 - 2g)

def grad(toks, on, h=1e-6):
    E = np.eye(len(toks))
    return np.array([(score(toks, on + h*E[i]) - score(toks, on - h*E[i])) / (2*h) for i in range(len(toks))])

def integrated_gradients(toks, m=300):          # baseline: every word off
    one = np.ones(len(toks))
    return sum(grad(toks, (k / m) * one) for k in range(1, m + 1)) / m

toks = "the film was not bad".split(); one = np.ones(5)
ig = integrated_gradients(toks)
print(np.round(grad(toks, one), 2))                  # [ 0.  -0.37  0.  0.18  3.61]
print(np.round(ig, 2), round(ig.sum(), 2))            # [ 0.  -0.09  0.  1.44  0.67] 2.02  (completeness: z = 2.01)
for i in range(5):                                     # removal test
    off = one.copy(); off[i] = 0; print(toks[i], round(score(toks, one) - score(toks, off), 2))   # not 3.95, bad 2.01

# activation patching: copy the negation unit from the clean run into the corrupted run
clean, corrupt = toks, "the film was so bad".split()
_, vc, gc = parts(clean, one); _, vx, gx = parts(corrupt, one)
zc, zx, zp = 2*vc*(1-2*gc), 2*vx*(1-2*gx), 2*vx*(1-2*gc)
print(round((zp - zx) / (zc - zx), 2))                    # 0.98

Where it went next

The readings point two ways. Mechanistic work scales the SAE and patching tools to circuits in frontier models. Kim’s human-centred line asks what people can learn from those models, and how to talk with them about it. Lecture 16 turns to the social impact of NLP.

Keep going

Read next

The habit. A reading says where to look; an intervention says what is true. Before you believe that a word, a head or a feature does a job, change it and measure what moves.
Which tool can, by itself, show that a part of the model causes an answer?

Now teach it: press Present or Teach. Explain why attention and gradients both miss "not", why integrated gradients finds it, and what patching proves that neither can. Then go back to the hero, choose Gradient, and say why the slope is flat.

Interpreting Neural Networks · Stanford CS224N, Lecture 15
Before: Tokenization and Multilinguality · Next: Social and Broader Impacts · Course site · Back to Gleams