Explain what is known about LLM internals
Describe how information is represented and processed inside a model: the residual stream, linear features in superposition, MLPs as fact stores, and attention circuits. Describe the tools used to probe these: logit lens and sparse autoencoders.
Builds on: Sparse autoencoders for interpretable features, Logit lens: reading intermediate predictions, MLPs as key-value memories for facts, QK and OV circuits of a head
What the animation says
Where does 'Paris' come from?
Give a model the prompt: The Eiffel Tower is in the city of. It answers: Paris. Each token has its own position, and each position carries a running vector up through the layers. The prediction is made at the last position, on the word 'of'. But 'of' says nothing about Paris. The fact must be retrieved somewhere, then moved here. So where is Eiffel Tower to Paris first looked up?
Stream, features, lookups, routing
The lookup happens in a middle-layer MLP, at the Tower position. MLPs work one position at a time. Keys detect a pattern, Eiffel Tower. Values write related features: Paris, France. A feature is a direction. Superposition packs more features than dimensions, as nearly perpendicular directions, with few active at once. Then a later head: its query-key part picks Tower to read from, its output-value part copies Paris to the last position. Each sublayer adds its output to the stream. Nothing is overwritten.
Everything is a sum of writes
Every write is added, so the final vector at the last position is a sum: embedding, plus every head and MLP output. Treat the final norm as a fixed scale, here one. Then a token's logit is that sum dotted with its unembedding column. For Paris versus London, use the difference of their columns. Call it u. Each write's push is its own dot product with u. The last-position MLP wrote zero, one, zero. How much does it push Paris over London?
Crediting each write
Zero. That write lies along a direction u ignores. Size alone tells you nothing. Embedding: one-point-five times zero-point-two is zero-point-three, minus zero-point-two from the last entry. Total: zero-point-one. The head: one-point-five times two is three, plus zero-point-five. Three-point-five. Add the shares: three-point-six. Paris is about thirty-seven times likelier than London. Signs matter. A positive share favors Paris; a negative share favors London. Another head writes minus one, two, zero. Which way does it push?
Who delivered vs who computed
Back to Paris. The head wrote three-point-five, almost the whole margin. But it didn't invent Paris. It copied Paris from the Tower position, where the mid-layer MLP had written it. Credit at the last position shows who delivered the answer, not who computed it. To find the source, ablate: switch a component off and watch the margin. Tap the component to switch off so the head has nothing to copy.
What the tools see, and don't
Two tools read this stream. The logit lens unembeds the partial sums, layer by layer, to watch the answer form. It's noisy in early layers. The tuned lens learns a small map per layer and reads them better. A sparse autoencoder learns feature directions, and how strongly each fires for an input. But it leaves reconstruction error: part of the vector it can't explain. So: a sum of additive writes, MLPs looking up facts, heads routing them. Much of the computation is still unexplained.
One picture: stream, features, lookups, routing
Everything is a sum of writes
Crediting each component for 'Paris'
What to remember
On Bytewise this lesson comes in small steps with a check at the end, and the app brings it back right before you would forget it.
Bytewise
All courses