Latent Fovea Open the visualizer

Is this really a model's latent space?

Yes. But only some of what you see is the raw data. The rest is either derived from it by a standard technique, or drawn to make it readable. This page separates the three.

New to all this, or looking for how to use a view? Read the handbook ↓: twenty short chapters, from what a language model computes to every view in the tool, and a glossary of terms.

Summary of this tool

Every number on screen comes from the published weights of the model you picked, running for real in your browser: the built-in GPT-2, DistilGPT2 or MDLM, or an open model loaded from Hugging Face. The point cloud is that model's own vocabulary, its first latent space: every token is a vector of hundreds or thousands of numbers (50,257 tokens of 768 numbers for GPT-2, 151,936 tokens of 1,536 for Qwen2.5-1.5B). You can't see that many dimensions, so the cloud is a 3-D map of them, and like any map it distorts. The model has more latent spaces than this one, hidden inside it: after every layer, each token is carried as a new vector, its internal state, and these hidden states are where the model does its work. They are shown too: as a space of their own, each token a path from its embedding through every layer (press S); through the logit lens, which reads what each state would say (the River); and through attention, which shows how information moves between them (the Flow). When you type a query the model genuinely runs; every intermediate result is recorded and replayed slowly. The playback is slowed down, not the model.

Where the numbers come from

Nothing is simulated

The model runs once per token at full speed. The visualizer records everything it computed, then plays it back layer by layer at whatever speed you choose.

01 · Weights
The published modelOfficial releases from each model's authors, kept at 16-bit precision. Models too big for memory are read from storage one layer at a time: the same numbers, just slower.
02 · Compute
A real forward passThe model's own maths, rebuilt from scratch and running in your browser: on the CPU, or on your graphics card where the browser supports WebGPU. Same weights, same steps.
03 · Replay
Recorded, then slowedAttention, neurons and predictions at every layer, replayed in the order they happened.

Checked against the standard reference implementations on the same weights. The built-in GPT-2 matches to 4 decimal places, and MDLM to about 0.00001. The Hugging Face models marked Verified in the model browser pick the same next word, share at least 9 of the top 10 guesses, and give probabilities within 0.0013 at worst. Models marked Should load use a supported design but have not been checked one by one. On the GPU, every recording (the internal state at every layer, attention, neurons, attribution, interventions) is checked against the CPU version (with full-precision weights; the optional 8-bit weights are a close copy, and the status line says when they are used): they agree to about one part in 100,000 for most models (one in 10,000 for Pythia, whose large activations magnify rounding), and probabilities to within 0.001.

Three kinds of thing on screen

Real, derived, illustrated

Real

The model's own numbers

Read straight out of the computation. No interpretation added.

  • The text it writes
  • Attention of every head, every layer
  • Every MLP neuron activation (36,864 in GPT-2)
  • How hard each head writes
  • A token's full vector (the barcode)
  • Nearest neighbours, measured in the full space
  • What changes when a part is knocked out
  • Each token's internal state after every layer (the hidden states)
  • How much attention and the MLP change that state, layer by layer
  • A neuron's input, its examples, other side and shape in a public corpus, and your own test sentences
  • The exact split of a neuron's input into earlier parts
  • What the model does with a neuron held at its max, trough or minimum
Derived

Real data through a standard lens

Established techniques applied to the real numbers. Useful, but they add assumptions.

  • The 3-D positions (Clusters or PCA)
  • The logit lens: "what it would say at layer N"
  • Attribution: which parts pushed toward a word
  • A neuron's effect on a word, and the words it writes
  • The local re-layout inside the fovea (PCA), with the share of the local variation it shows
  • The hidden-state space (S): a 3-D PCA of those states
  • The lens river: the logit lens at every depth at once
  • Attention flow (attention × what each token offers) and rollout
  • What reads a neuron (weights scaled by each reader's norm)
  • The neuron graph: exact shares through each neuron's slope, at one token
Illustrated

A picture of real data

Drawings that make the numbers readable. They are not objects inside the model.

  • The purple "thought path" and the fly-through along it
  • Attention arcs (averaged over heads)
  • Masked MDLM slots floating in space
  • Token colours (word, number…)

The most important caveat

The cloud is a map. The neighbour lines are the territory.

The real space has hundreds to thousands of dimensions: 768 for GPT-2, 1,536 for Qwen2.5-1.5B. The cloud squeezes it into 3 so you can see it, in one of two layouts (switch with C). Clusters (UMAP) groups tokens with some of their neighbours, so points close together tend to be related, but most true neighbours end up elsewhere: the line under the Clusters / PCA switch measures how much survives, live, for the model you are looking at: how often a token's true nearest neighbours land in the same visible region of the cloud, and how well the cloud's near/far ordering agrees with the real space. (Strictly, only about 6% of a GPT-2 token's 15 nearest neighbours are also among its 15 nearest in the cloud, about 2% for Qwen2.5-0.5B; that is a 15-of-150,000 exact-rank test, far stricter than what the eye reads, and the ⓘ there gives it as the caveat.) Distances between clusters, directions and the overall shape mean very little; the layout is one of many equally valid arrangements, and UMAP started from a different random seed would place the clusters differently. PCA shows the three directions along which the vectors vary most. Those directions are real, but for GPT-2 they hold only 3.4% of the variation, so most tokens pile into one blob and fewer than 1% of true neighbours stay together. To see the real geometry, open the Embeddings view and look at a token: the cyan neighbour lines are measured in the full space, which is why they often jump across the cloud. That jump is the map's distortion made visible.

token A token B
The map (3-D), schematic: two tokens that are neighbours can land far apart. The dashed line is the real neighbour link reaching across.
token A token B
The territory (full space): the same two tokens, measured in the model's real space, sit next to each other. In the Embeddings view, look at a point and the fovea shows you this geometry.

The forward pass, four ways

One pass, four views

When you type a query, everything the model computes for every token is kept. The panel at the bottom shows it three ways (switch with the Field · River · Flow tabs, or the keys 1, 2, 3), and the scene above can swap the word cloud for the model's internal states (Hidden states, or S). Each view answers a different question about the same numbers. Click a token chip to put that token on screen in all of them.

HEADSMLPLENS
Field · 1

Which parts are working, and how hard?

Read it: one row per layer, the embedding at the bottom. Each square is an attention head, brighter when it writes more into the model's state, with a small comb showing which recent tokens it looks at. The strip beside it is every MLP neuron of that layer. On the right, the logit lens: what the model would say if it stopped at that layer.

Watch for: the lens changing its mind as you go up. Point at a head for exactly what it reads; press A to see which parts pushed toward the next word.

Paristhe EMBEDDINGLAST LAYER
River · 2

When does it make up its mind?

Read it: left to right is depth through the model, from the embedding to the last layer. At each depth the coloured bands are the words it would say if it stopped there, each as tall as its probability, and a word keeps its colour all the way along. The empty space at the top is every other word in the vocabulary. The white line is how unsure it is: "as unsure as choosing among N words".

Watch for: a band appearing, swelling and taking over; the readout names the layer where the final answer takes the lead for good. A guess that leads early and then vanishes is the model changing its mind.

Flow · 3

Where did this word's information come from?

Read it: tokens run left to right, layers bottom to top, and every dot is one token's state after one layer. A line from an earlier token up to a later one means attention carried information across at that layer; thicker means more. With Rollout on, the cyan cone traces everything that fed the token on screen, and the bars under the tokens say how much each one contributed.

Watch for: long late lines back to one earlier word: that is the model copying or recalling it. In "…a country of immigrants. We are a country of", the second " of" takes half of what it reads at layer 9 from the earlier " immigrants". Point at any dot to see what it took in.

embeddinglast layer
Hidden states · S

How does each word's meaning move through the model?

Read it: this replaces the word cloud with the model's own internal states. Every token is a line: it starts at its embedding and takes one step per layer to its final state. Each step is drawn in two parts, cyan for what attention changed (information gathered from other tokens) and violet for what the MLP changed (processing on the token itself), and it is thicker the bigger the change. The white dots are every token at the layer being replayed.

Watch for: tokens that start far apart and end up close: the model has come to treat them alike, as with the countries and capitals of a list. Point at a dot to read its token, layer and guess; click it to put that token on screen. The layout is a projection, and the readout says how much of the states' variation it shows.

How sure each view is: the Field's heads, neurons and write strengths, and the hidden states themselves, are the model's own numbers. The River uses the logit lens, a standard but rough readout of the middle layers. The Flow's links multiply real attention by the size of what each token offers, and rollout is an estimate built on them. The hidden-state space is a 3-D projection of real states. Details for each are below.

Piece by piece

What each part of the screen is

Real

Attention heads (layers × heads grid)

The actual attention weights each head assigns to each earlier token, for the token you are looking at. One row per layer, one column per head: 12 × 12 for GPT-2 and MDLM, 6 × 12 for DistilGPT2, 28 × 12 for Qwen2.5-1.5B. In Llama, SmolLM and Qwen models, several heads share one set of keys and values (grouped-query attention), but each head still has its own attention pattern, and that is what is shown. For MDLM, attention runs both ways, so a slot can attend to words on its right.

Real

Head write strength

How much each head adds to the model's running state (the residual stream) at this token: the length of what it writes. A head can attend strongly and still write very little.

Real

MLP neurons

The actual activation of every neuron in every layer: the number that feeds the layer's output projection. In GPT-2, DistilGPT2 and Pythia it is one projection passed through GELU. In Llama, SmolLM and Qwen it is a gated product (SwiGLU): one projection passed through SiLU, times another. Either way it is the model's own number. MDLM's replay stores attention and neurons at 8-bit precision to save memory, which is enough for colour.

Real

Barcode and neighbour lines

In the Embeddings view: the token's actual coordinates (768 for GPT-2, 576 for SmolLM2-135M, 1,536 for Qwen2.5-1.5B), and the tokens closest to it in the full space by cosine similarity. For the built-in models the neighbours were worked out exactly in advance. For models built in your browser they are worked out when you look: a quick 8-bit pass shortlists 64 candidates, which are then rescored from the stored vectors, so they are exact unless a true neighbour missed the shortlist. The most faithful geometry on the page.

Derived

Logit lens column

The model's working state partway through, pushed through its final normalisation and output layer to ask "what would you say if you stopped here?". A standard interpretability technique, not something the model does itself. Trustworthy near the top, rough near the bottom. For models with very large vocabularies it is worked out at a spread of depths as the model writes (6 of 29 for Qwen2.5-1.5B), and at any other layer as soon as you point at it or replay it: detail where you look, like the rest of the viewer. Either way it is the same exact readout.

Derived

Attribution (A)

How much each head, each MLP and the embedding pushed one word's score (its logit compared with the average word's). The model's running state is a sum of what every part wrote, so with the final normalisation's scale held at this token the score splits exactly into one share per part. It is a standard technique (direct logit attribution) and it counts direct effects only: a head that matters by feeding later layers shows up in those layers, not in its own cell.

Real

Neuron inspector: activations

Click an MLP row: each neuron's activation at this token, and across every token of the text so far, and its input before the activation function (for SwiGLU, its gate and value). These are the model's own numbers, measured on the same terms as the neuron's book: for GPT-2 and DistilGPT2 the run starts after <|endoftext|>, as the book's documents do.

Real

The ⟨doc⟩ chip

For GPT-2 and DistilGPT2 the first chip, dashed, is <|endoftext|>, the token GPT-2 saw before every document in training. It is put in front of your text so the model reads it as the start of a document, and so a neuron's value here matches the book and Test it; without it, the values change at every later token too: on GPT-2, a typical neuron's largest change over a sentence is about 2% of its range in the corpus, and for one neuron in ten it is more than 6 to 11%, depending on the sentence (for one in a hundred, more than 20%). The model parks most attention on it, so its own values say little; token numbers count your text from 1 after it.

Derived

Neuron inspector: effects and words

A neuron's effect on a word is its activation times how much its output weights point at that word, through the final normalisation. The words it "writes" are read from its output weights alone. Both ignore what later layers do with its output.

Real

Interventions (Rerun)

Knock out a head, an MLP or a neuron and run the same text again: what comes out is what the model really does without that part, through every route, direct or via later layers. The one assumption is how a part is removed: its output is set to zero, a blunt change, since in normal use no part ever falls completely silent.

Derived

Comparing runs (Δ A)

With a run pinned as A, the Δ A column shows how far this run's internal state is from A's at each layer of the token on screen: the cosine distance between the two 768-or-more-number vectors (0 = pointing the same way). "Parts ways" marks the first layer to reach a quarter of the largest difference, a rule of thumb. Positions are matched by index, which is exact only when both texts have the same number of tokens.

Derived

Features (SAE)

Click a layer's label to see its features (GPT-2 small). A sparse autoencoder is a second network, trained by others to rewrite the model's state at one layer as a sum of a few learned directions; it is a model of the model, not part of it. The drawer says how much of this token's state it rebuilds, and what it misses is not shown anywhere. The one-line descriptions come from Neuronpedia and were written by an AI model from each feature's strongest examples: useful guesses, not ground truth. Asking for them contacts neuronpedia.org with only the layer and feature number, never your text.

Real

A neuron's examples, other side and shape

Its own activations on three million tokens of a public corpus (FineWeb-Edu), read straight from the model, each document from its start: the passages that drive it hardest, those where its input is most negative, and how its values spread over its range, with up to eight tokens drawn at random from its top band (above half its maximum) and from each of five bands below it. ↑ runs a passage again in your browser and shades every token; across a long document the browser's 256-token window can move the value a little, and the drawer says when. A sample, not the whole of language (§11.4).

Real

What feeds a neuron

Its input at this token, split exactly into one share per earlier part: the arithmetic of the network itself, with nothing estimated (§11.5). If you steer the neuron, the split is the input it would have had, and the drawer says what your steer adds.

Derived

What reads a neuron

The later neurons whose input weights line up most with its output, from the weights alone, each scaled by its layer's normalisation at the token on screen so readers in different layers compare. A list of where its output can go, not of what happened: what feeds a reader at a token says whether it did (§11.5).

Real

Steering a neuron

Hold at its max, Hold at its trough (GELU) and Hold at its minimum (SwiGLU) fix its activation at every token and run the model again: the result is what the model really does with that value. The values come from the neuron itself, its strongest and most negative in the book or in this text, so the network has produced each one; holding it there at every token at once has not, which is why the drawer asks for the same change to a random neuron of the layer before reading much into it (§11.6).

Real

Test it and Read blind

Your own sentence through the unchanged model, after <|endoftext|> like the book, whatever is steered: its activation at every token, beside its strongest in the corpus. Read blind only hides things; it changes no number. It is a discipline for you, the essay's blind maximum: a reading written before the test, then a sentence meant to fire it (§11.6).

Yours

Names, notes and links

The names and notes you give neurons, the trail of neurons read and the page's address are yours, not the model's: kept in this browser, shown wherever the neuron appears, exported as one JSON file. A link carries the model, prompt, token, neuron, graph and the changes in force at the last Rerun; with Greedy decoding it reopens the same numbers, with Sample the generated words can differ.

Derived

Neuron graph

The model's own neurons behind a word, with exact input shares passed through each neuron's slope at this token: a first-order account, traced at one token only, so a neuron that acts at an earlier token is missed. Knocking a group out is the exact test, beside two controls (as many random neurons, and the most active ones, of the same layers); Restore undoes the graph's own knockout and puts back your changes (§11.7).

Real

Distances from one token (D)

Pin a token and press D: every token moves to a radius equal to its exact cosine distance from the pinned one, on a disc facing you, with rings at cosine 0.9, 0.7, 0.5, 0.3 and 0.1. The radius is the real geometry, measured in the full space, so this view answers what a map cannot: what is near this token, and how near. The direction around the disc is kept from the cloud so tokens don't jump, and it means little.

Derived

Axes you choose

Type two word pairs and the cloud is redrawn with x = a's vector minus b's and y = c's minus d's (made at right angles to x); depth is the direction of greatest remaining spread. Positions along x and y are exact projections of the real vectors: "further right" means exactly "more a-like than b-like". What is lost is everything else, and the line under the layout switch says how little of the variation those three directions hold. Derived, but with axes that mean something.

Derived

Semantic zoom (Z)

Re-arranges the tokens under the parafovea with their own clustering, in place. It is still a 3-D layout, so still a map, but one that only has to honour a few thousand tokens, and the line under the layout switch says how much more of their true neighbourhoods it keeps than the global cloud did. The rest of the cloud is unchanged, so positions across the boundary of the region mean nothing.

Derived

3-D positions

Clusters (UMAP) or PCA of the vocabulary; switch with C. For the built-in models and popular Hugging Face models the cluster map is computed in advance. For other models your browser shows PCA first and computes the clusters in the background, with the same recipe. Local neighbourhoods are roughly right; global layout is arbitrary.

Derived

Hidden-state space (S)

The model's own internal states as a space of their own. The states are real: the residual stream of every token after every layer, the same vectors the logit lens and attribution read. Each is centred and scaled the way the model's normalisation does, then all of this run's states are laid out by one PCA, refitted as the text grows (the first token is drawn but left out of the fit: most models give it outsized values as a resting place for attention, and it would stretch the axes toward itself); the panel's readout says how much of their variation its three axes show (around a third to a half). Each token is a line from its embedding to its last layer. Each step's split between attention (cyan) and the MLP (violet), and its thickness, are exact: the MLP's own output, and the rest of the layer's change, compared with the layer that changed this token most. Positions are a projection: close in 3-D usually means close in the full space, and far always holds less exactly than near.

Derived

Lens river

The logit lens for one token at every depth at once, as stacked bands as wide as each word's probability: the same exact readouts as the logit lens column, so the same caveat (rough near the bottom). The eight words that ever do best get a colour, the rest of each depth's top ten is grey, and the empty space above is every other word. The white line is the entropy, shown as "as unsure as choosing among N equally likely words" (e to the entropy). "Settles on" is the first depth from which the top guess stays the same.

Derived

Attention flow and rollout

Tokens left to right, layers bottom to top. A link runs from an earlier token's state to a later one's where attention moves information between them: each head's real attention weight times the length of the value vector it reads (what that token actually offers, after Kobayashi et al., 2020), averaged over the layer's heads, with the links under 3% and beyond each state's top four left out. Weights alone overstate the first token, which most models use as a resting place and which offers almost nothing. Rollout (Abnar and Zuidema, 2020) chains these through the layers, counting each layer's residual connection as half, to estimate what feeds the token on screen. It is an approximation: it ignores the MLPs and how heads combine. The first token only attends to itself, so rollout piles up there; its share is given apart and the shares shown are among the other tokens.

Illustrated

The purple thought path

At each layer, the average map position of the model's top 10 guesses, weighted by how likely each is. A picture of what the model is leaning toward. It is not the model's internal state moving through space. That state is a vector as wide as the token vectors (768 numbers for GPT-2) at every layer, and it doesn't live on the vocabulary map: press S to see the states themselves, in a space of their own. The fly-through (T) moves the camera along this path, so you travel through the picture of what the model is leaning toward; in the hidden-state space (S) it follows the token's real state instead. The guesses labelled along the way are the real logit-lens readouts for that layer.

Illustrated

Attention arcs

Real weights, but averaged over all the heads of the current layer unless you pin one, and anything under 2% is hidden.

Illustrated

MDLM masked slots

A masked slot has no real position; it is drawn at the average of its guesses until it locks onto a word.

Illustrated

Colours

Word, subword, number, punctuation: a rule based on how the token is spelled. The model knows nothing about these categories.

Which model you are looking at

Different designs, same view

Every model here is a transformer. Token vectors go in, pass through a stack of layers that each gather information from other tokens (attention) and transform it (the MLP), and come out as guesses for the next word. The view is the same for all of them; these are the differences worth knowing.

GPT-2

GPT-2 and DistilGPT2

Position is a learned vector added to each token at the start. LayerNorm and GELU neurons. The same table reads tokens in and picks the output word. Every run starts after <|endoftext|> (the ⟨doc⟩ chip), as GPT-2 read documents in training.

Llama · Qwen

Llama 3.2, SmolLM2, Qwen2.5, Qwen3

Position is not added as a vector: it rotates each head's queries and keys (rotary embeddings), so attention depends on how far apart two tokens are. RMSNorm, gated SwiGLU neurons and grouped-query attention. Qwen3 also normalises each head's queries and keys. These small models share one table for input and output.

Pythia

Pythia (GPT-NeoX)

Rotary positions on part of each head, and attention and the MLP read the same input side by side instead of one after the other. It has a separate output table.

MDLM

MDLM, a diffusion model

Not a next-word model. The whole answer starts as [MASK] and every slot is filled in over denoising steps, in any order, with attention running both ways. It has a separate output table.

Chat

Instruct and chat models

Your text goes in exactly as typed, without the chat template these models were fine-tuned on. So they continue your text rather than reply like a chatbot, and what you see is the model's raw response to that text.

Where people get confused

Two notes for the reader

01 · "FOVEATED" MEANS YOUR EYES

Foveation is how the viewer saves bandwidth, not the model's attention

Like a VR headset, the visualizer loads full detail only where you are looking. The model's attention is a separate, real thing, shown in the heads grid, the arcs and the Flow view. They share a metaphor; keep them apart.

02 · "LATENT SPACE" IS PLURAL

The cloud is one latent space. The model has more.

The cloud is the token embedding space: a fixed table and the model's entry point. In GPT-2 and most models here the same table also picks the output word, which is why plotting predictions on it makes sense. MDLM and Pythia use separate input and output tables, so placing their guesses on the input map is an approximation. The hidden states inside the model are latent spaces too, arguably the more interesting ones. Press S in the forward pass to see them as a space of their own: every token's state at every layer, joined into the path each token takes. The field, the lens river and the attention flow show what reads and writes them.

If someone asks "so is it real?"

Observability matters a lot - but isn't perfect

The model and every number it produces are real. The cloud is an honest but distorted map of the model's vocabulary space. The purple path is a picture of what it is leaning toward, not a literal trajectory; press S for the real one, each token's internal state layer by layer.

The handbook

A course in reading a language model

The sections above say what is real. This handbook says how to use it. It is written as a short course: Part I introduces the ideas the rest depends on, Parts II and III take each view in turn, and Part IV covers the models and the machinery behind them. Each chapter states what the view is for, what is on the screen, how to operate it, how to read it, a worked example, and its limits.

No prior knowledge of machine learning is assumed, but the treatment is exact: where a quantity is shown, the chapter gives the formula that produces it. Readers who know transformers may skip Part I.

Part I · Foundations

Chapter 1

How a language model computes

A language model is a function that reads a sequence of tokens and returns, for the next position, a probability for every token in its vocabulary. Everything this tool shows is an intermediate quantity of that function.

1.1 Tokens and the vocabulary

Text is first cut into tokens: whole words, pieces of words, punctuation and spaces, according to a fixed table learned before training. GPT-2's table has 50,257 entries; Qwen2.5's has 151,936. A token is therefore an integer between 0 and V − 1, where V is the size of the vocabulary. Note that the leading space belongs to the token: " Paris" (with a space) and "Paris" are different tokens, which is why the tool sometimes writes a space as ␣.

1.2 The embedding

Each token is turned into a vector by looking up a row of the embedding matrix WE, which has V rows and d columns. The number d is the model's width: 768 for GPT-2, 896 for Qwen2.5-0.5B, 2,048 for Qwen2.5-3B. The row is the token's starting representation; GPT-2 also adds a second learned vector that encodes where in the text the token sits; Llama, Qwen and Pythia instead encode position inside attention, by rotating queries and keys (rotary embeddings).

1.3 The residual stream

For every position the model keeps one vector of width d, the residual stream, and passes it through L identical-looking layers (12 in GPT-2, 36 in Qwen2.5-3B). Each layer reads the stream and adds its result to it, never overwriting it:

xℓ+1 = xℓ + Attnℓ(norm(xℓ)) + MLPℓ(norm(xℓ + Attnℓ(…)))

Sequential form (GPT-2, Llama, Qwen). Pythia evaluates attention and MLP side by side on the same input and adds both.

The sequence x0, x1, …, xL for one position is that token's sequence of hidden states. Because every part only adds to the stream, the final state is literally the sum of the embedding and of everything every part ever wrote. Chapters 10 and 15 depend on this fact.

1.4 Attention

Attention is the only place where positions exchange information. A layer has several heads (12 per layer in GPT-2). For the position being computed, i, a head forms a query qi, and for every earlier position j a key kj and a value vj, each a linear function of the normalised stream. The head's attention weights are

aij = softmaxj( qi · kj / √dh ),   j ≤ i

a probability distribution over the earlier positions, and the head writes WO Σj aij vj into the stream. A weight says where the head looks; the value says what it finds there. Both matter, and Chapter 14 shows why confusing them misleads. In grouped-query models (Llama, Qwen) several heads share one set of keys and values but keep their own weights. Models in this tool are causal: position i can only attend to j ≤ i. The diffusion model of Chapter 17 is the exception.

1.5 The MLP

The second part of each layer, the MLP (multi-layer perceptron, or feed-forward block), works on each position separately. It projects the stream up to a wider space (3,072 dimensions in GPT-2), applies a nonlinearity, and projects back down:

h = φ(Win x),   MLP(x) = Wout h

φ is GELU in GPT-2 and Pythia. Llama and Qwen use SwiGLU: h = SiLU(Wgate x) ⊙ (Wup x).

Each component hk is a neuron, and its value is the neuron's activation. Neuron k always writes along the same direction, column k of Wout, scaled by its activation. Much of what a model "knows" about words is thought to be stored in these layers.

1.6 Normalisation

Before each part reads the stream, the stream is normalised: LayerNorm subtracts the vector's mean and divides by its standard deviation; RMSNorm (Llama, Qwen) only divides by the root mean square. Both then multiply by learned weights. Normalisation matters for interpretation because it means a part reacts to the direction of the stream far more than to its size.

1.7 From the last state to a prediction

After the last layer, the final state is normalised once more and multiplied by the unembedding matrix WU (V rows), giving one score, a logit, per token. The softmax turns logits into probabilities:

p(w) = exp(zw) / Σv exp(zv),   z = WU · norm(xL)

Only differences between logits matter: adding the same constant to all of them changes nothing. Many small models reuse WE as WU (tied embeddings), which is why predictions can be drawn on the embedding cloud. To write text, the model picks the most probable token (greedy decoding) or draws one at random in proportion to the probabilities (sampling), appends it, and repeats. Keys and values of earlier positions are kept (the KV cache), so each new token costs one pass through the layers.

1.8 Uncertainty

How spread out a distribution is can be measured by its entropy, H = −Σ p(w) log p(w). The tool usually reports eH instead, the effective number of choices: a distribution with eH = 3 is as uncertain as a fair choice among three equally likely words.

In this tool

The embedding (1.2) is the cloud of Part II. The residual stream at every depth (1.3) is recorded for every token and drawn directly in Chapter 15. Attention weights (1.4) appear in the field's head grid, the arcs, and the flow. MLP activations (1.5) fill the field's neuron strips. The prediction (1.7) and its uncertainty (1.8) appear at every depth through the logit lens.

Chapter 2

Latent spaces, and how they can be drawn

A latent space is a vector space in which a model represents things. It has hundreds or thousands of dimensions, and a screen has two. Every picture of one is therefore a choice about what to keep and what to give up.

2.1 Two kinds of latent space

The embedding space
The V rows of WE: one fixed point per token, the same for every text. This is the cloud of Part II.
The hidden-state spaces
The residual stream after each layer: one point per position per depth, different for every text, because each state depends on everything before it. These are drawn in Chapter 15 and read indirectly by most of Part III.

2.2 Measuring closeness

Two vectors are compared by the angle between them, through cosine similarity

cos(a, b) = a · b / (‖a‖ ‖b‖)

which is 1 for vectors pointing the same way, 0 for perpendicular ones and −1 for opposite ones. Cosine distance is 1 − cos. Angles are the natural measure here because the normalisations of §1.6 make the model attend to direction rather than length. A token's nearest neighbours are the tokens with the highest cosine to it, computed over all d coordinates.

2.3 Why every picture distorts

A 768-dimensional cloud cannot be placed in three dimensions without changing some distances. In high dimensions almost all pairs of points are nearly perpendicular, and a point can have many neighbours that are not neighbours of one another; no 3-D arrangement can honour all such relations at once. The tool offers several drawings, each with a different promise:

PCA (principal component analysis)
Projects onto the three directions along which the points vary most. Linear and faithful in what it shows, but it shows little: for GPT-2's vocabulary those three directions hold 3.4% of the variation.
UMAP ("Clusters")
A nonlinear method that tries to keep each point's nearest neighbours nearby. Local groups are roughly right; distances between groups, directions and the overall shape carry little meaning.
Chosen axes
Two directions you define from word pairs (§6.3). Exact along those directions and silent about everything else.
Radial distances
Every token at its exact cosine distance from one chosen token (§6.2). Exact in one respect, distance from that token, and arbitrary in angle.

2.4 Map and territory

The tool keeps the drawing (the map) separate from measurements made in the full space (the territory). Neighbour lists, neighbour lines, cosine values and every number in Part III are territory. Positions in a 3-D view are map. When the two disagree, for example a neighbour line that crosses the whole cloud, the line is right and the position is the distortion.

2.5 Reading the fidelity line

Under the layout switch, a line reports how much of the territory the current map keeps, measured live for the model on screen:

  • Same region: how often a token's 15 true nearest neighbours fall within its nearest 1% of the cloud as drawn. This asks the question the eye asks of a map: are related tokens drawn in the same area?
  • Near/far agreement: for sample tokens, partners at true ranks 1, 2, 3, 5, 8 … up to half the vocabulary, and the rank correlation (Spearman) between true rank and drawn distance. 1 would mean the map orders near and far perfectly; 0, not at all.
  • For PCA, the share of the variation its three directions hold. The ⓘ beside the line gives the strict figure, the share of exact 15-nearest neighbours preserved, as a caveat.
Limits

No drawing is the space. Use the drawing to navigate and the measurements to conclude.

Part II · The embedding space

Chapter 3

The cloud

The Embeddings view draws every token of the vocabulary as one point: the rows of WE (§1.2), placed in three dimensions by one of the methods of §2.3. It is the model's first latent space, the same for every text.

3.1 What is on the screen

  • Points. One per token: 50,257 for GPT-2, 151,936 for the Qwen models. Brightness is reduced where many points overlap, so dense regions read as texture rather than as a solid blot.
  • Colour. A rule based on spelling: whole word, word piece, number, punctuation, whitespace, other scripts and bytes. The legend at the lower left names them. The model knows nothing of these categories; they are there to help the eye.
  • Header. The model's name and size, the Embeddings / Forward pass switch, the layout switch (Clusters · PCA · Axes), a brightness slider, and the fidelity line of §2.5.
  • Inspector (right). The token under your gaze, described in Chapter 5.
  • Dock (lower left). The legend, the Find a token box, Settings, and a key reminder.

3.2 Moving around

Drag to orbit, use the wheel (or pinch) to zoom, and drag with the right button or with Shift held to pan. H returns to the starting view. When nothing is touched for a while the gaze wanders on its own (Wander when idle in Settings), which is a quick way to sample the vocabulary.

3.3 Layouts

Clusters (UMAP) is the default; PCA is the linear alternative; C switches between them and the points glide from one to the other, so you can follow a group across the change. For the built-in models and popular Hugging Face models the cluster layout was computed in advance; for others the tool shows PCA first and computes the clusters in the background, about a minute for GPT-2's vocabulary, then morphs. Axes is treated in §6.3.

The ◐ slider sets the brightness of the dots, from faint (useful when labels matter) to bright (useful for seeing structure). It is remembered between visits.

3.4 How to read it

Read the cloud as a map of neighbourhoods. Groups of related tokens, such as numbers, years, names, code fragments, or a language's word pieces, sit together in the clusters layout, and the fidelity line tells you how often that holds for this model. Do not read meaning into distances between groups or into the cloud's overall shape (§2.3).

Try this

On GPT-2, switch between Clusters and PCA with C and compare the fidelity lines. In PCA most tokens collapse into one blob, because three directions hold only a few per cent of the variation; the clusters layout separates them, at the price of arbitrary global placement.

Chapter 4

Foveated viewing

A human eye sees sharply only at the centre of gaze, the fovea, and coarsely around it. The tool works the same way: full detail where you look, a summary elsewhere. This is how a large vocabulary can be explored in a browser without loading all of it.

4.1 Three regions

Fovea
A small circle around the pointer (by default 120 pixels in radius, about 3° of visual angle at a normal viewing distance). Here the tool loads the tokens' actual coordinates, labels them, draws their true nearest neighbours as lines, and can re-lay them out (§4.3).
Parafovea
A wider ring (by default 330 pixels). Points are brighter, thinned by a fixed per-token sample that falls off with distance, so the area stays legible.
Periphery
Everything else: positions only, as faint points.

Press R to show or hide the two rings; the fovea's ring is labelled with its size in degrees. Both radii can be changed under Settings. F turns foveation off altogether, which is useful as a baseline: the whole cloud is then drawn uniformly and no coordinates load.

4.2 What loads, and when

A token's coordinates (d numbers each) are stored in tiles, groups of nearby tokens that occupy one contiguous range of the data file. While you look somewhere, the tiles under the fovea are fetched, nearest the gaze first, within a bandwidth budget, and kept in a cache of fixed size; tiles nobody has looked at recently are evicted. The statistics at the top right (In fovea, Streaming, Cache, Tiles) show this happening. In practice you only need to know one thing: pause on a region and its detail arrives.

4.3 The lens

Inside the fovea the tool can re-arrange the loaded tokens by a local PCA: a principal component analysis of just those rows, which is far more faithful to their mutual arrangement than any global layout. L turns this lens on and off. The fovea's label then reports the share of the local variation its two directions show. Points under the fovea are dimmed so the re-arranged ones stand out.

Try this

Move the gaze slowly across a cluster with L on, then off. With the lens, tokens inside the fovea spread out according to their own geometry; without it, they keep their global positions, which may stack unrelated tokens on top of one another.

Limits

Foveation is how the viewer saves bandwidth and attention. It has nothing to do with the model's attention mechanism (§1.4), despite the shared metaphor.

Chapter 5

Inspecting a token

The inspector reports one token exactly: its identity, its full vector, and its true nearest neighbours.

5.1 Reading the inspector

  • The token in quotation marks, with a leading space shown as ␣ and a line break as ↵, and its spelling category.
  • Token id, the integer of §1.1, and ‖v‖, the length of its embedding vector. Rare and unusual tokens often have atypical lengths.
  • The barcode: all d coordinates side by side, one column each, cyan for positive and violet for negative, brighter for larger magnitude (scaled to the token's largest coordinate, which is named underneath). The barcode appears once the token's tile has loaded; keep looking and it arrives.
  • Nearest in the full space: the closest tokens by cosine similarity (§2.2), measured over all d coordinates, with the similarity as a number and a bar.

5.2 Pinning and finding

The inspector follows your gaze until you click a point, which pins it (the pill changes from Following gaze to Pinned); Esc unpins. Clicking a neighbour in the list pins that neighbour and flies to it, so you can walk the neighbourhood graph token by token. To jump to a word, type it in Find a token (or press /): the tool tries it with and without a leading space and in lower case, and flies to the first match.

Worked example

On GPT-2, find "king" and read its neighbour list: the closest tokens in the full space, with their cosine similarities. Now watch the neighbour lines in the scene: several reach far across the cloud. Those tokens are near in the full space and far on the map, which is the distortion of §2.3 made visible. Click one to fly there and continue the walk.

Limits

For the built-in models the neighbours were computed exactly in advance. For models built in your browser they are computed on demand: a fast 8-bit pass shortlists 64 candidates, which are then scored exactly, so a true neighbour is missed only if it failed the shortlist.

Chapter 6

Three ways to redraw the cloud

A single global layout cannot be faithful everywhere. These three tools trade the whole picture for an exact or more faithful one about something specific.

6.1 Semantic zoom: re-arranging one region

Zoom in until the parafovea holds a few hundred to a few thousand tokens, then press Z or Re-arrange this region. The tool runs the clustering again on just those tokens, places the result where the region was, rotated to match the old arrangement, and morphs to it; the rest of the cloud stays as context. The fidelity line then compares how much of the region's true neighbourhoods the old and the new arrangement keep. Press Z again, or switch layouts, to return.

Worked example

On GPT-2, a region re-arranged this way kept 26% of its tokens' true 15 nearest neighbours, against 8.9% in the global layout: three times as faithful, because the layout only has to honour a few thousand tokens.

Limits

It is still a map. Positions across the boundary of the region, between re-arranged tokens and the rest of the cloud, mean nothing.

6.2 Distances from one token

Pin a token, then press D or Distances from here. Every token moves onto a disc facing you, at a radius equal to its exact cosine distance from the pinned token, with rings at cosine 0.9, 0.7, 0.5, 0.3 and 0.1. The radius is measured in the full space, so this view answers exactly a question no map can: what is near this token, and how near? Each token keeps the bearing it had on screen, so you can follow it; that angle carries no meaning. D or Esc returns.

6.3 Axes you choose

Choose Axes and type two word pairs, for example "king − queen" and "Paris − France", then Lay out. The horizontal axis is the difference of the first pair's vectors, the vertical axis the difference of the second pair's, made perpendicular to the first; depth is the direction of greatest remaining spread:

x(t) = e(t) · (e(a) − e(b)),   y(t) = e(t) · (e(c) − e(d))⊥x

Positions along x and y are exact projections, so "further right" means precisely "more like a than like b". The axes are labelled at their ends, and the fidelity line reports how much of the variation each holds, typically very little, which is the honest price of an interpretable picture. Only words that are a single token can be used.

Try this

Lay out "king − queen" against "man − woman". If the vocabulary encodes a gender direction, gendered words line up along a diagonal; words without gender sit near the origin of both axes.

Part III · The forward pass

Chapter 7

Running a query

The Forward pass view runs the model on your text, records every intermediate quantity of Chapter 1 for every token, and replays the computation layer by layer at a speed you choose.

7.1 Starting a run

Switch views with the tab or M. Type into the query box and press Enter (or pick one of the examples). The first time, the model's weights load into your browser; the status line under the controls says how far it has got and, once ready, where the model runs and how closely it was checked (Chapter 20). The model then reads your text token by token and writes a continuation.

Tokens
How many tokens to write after your text (16 by default).
Greedy / Sample
Greedy always writes the most probable token, so a run can be repeated exactly. Sample draws from the ten most probable at temperature 0.8, so runs differ.
Speed
How long each layer is shown during the replay: Live (no replay), 160 ms, 0.5 s or 1.5 s per layer. The model itself always runs at full speed; only the replay is slowed.
Play / Pause, Step layer
Pause the replay, or advance it one layer at a time. When a run has finished, Play and Step continue it by another Tokens' worth.

7.2 The panel and the chips

The panel at the bottom holds the controls (left) and the main display (right). Above the display is a row of chips, one per token, your text in white and the model's in violet; for GPT-2 and DistilGPT2 a dashed ⟨doc⟩ chip comes first, the <|endoftext|> token the model saw before every document in training, put in front so a neuron's values match its book. The outlined chip is the token on screen; click any chip to inspect that position (every token's recordings are kept), and click it again to return to the latest. Next to the chips, the tabs Field · River · Flow (keys 1 2 3) choose the display, and a one-line readout summarises what it shows. P hides the panel to watch the scene alone; drag its top edge to resize it.

The answer appears under the query box as it forms: your text dim, the model's bright, and, while a token is being replayed, its current guess at the layer on screen.

Chapter 8

The field

The field shows the whole network for one token at once: every head, every neuron and the model's guess at every depth. It is the most complete view, and the place most investigations start.

8.1 Layout

Each row is one depth. The bottom row, EMB, is the embedding; above it L0, L1, … up to the last layer. During a replay the current depth is highlighted and rows not yet reached are faint. Each row has three parts, from left to right.

8.2 Heads

One square per attention head. Its fill is the head's write strength, the length of the vector it adds to the stream, relative to the strongest head in that layer. Inside it, a small comb shows how much attention the head pays to each of the eight most recent tokens, newest on the right. Point at a head to open a loupe listing the six tokens it attends to most, with their weights and positions; click to pin the loupe.

Reading: strength and attention are different things. A head can attend sharply and write almost nothing, or spread its attention and write a great deal. Many heads put most of their attention on the very first token, a resting place known as an attention sink; that is normal and usually means the head has nothing to do at this position.

8.3 MLP

A strip of every neuron in the layer's MLP (3,072 per layer in GPT-2), as eight rows of pixels: cyan for positive activation, violet for negative, brighter for larger. Click a strip to open the neuron inspector (Chapter 11).

8.4 Logit lens

The right-hand column shows, at each depth, the token the model would predict if it stopped there, and its probability. This is the logit lens: the stream at depth ℓ is passed through the final normalisation and unembedding of §1.7 as if it were the last layer,

pℓ = softmax( WU · norm(xℓ) )

For models with very large vocabularies running on the CPU, the lens is computed at a spread of depths as the model writes and at any other depth as soon as you point at its row (three faint dots mark a row not yet read); on the GPU every depth is read for every token. Click a row of the lens to explain that depth's guess (Chapter 10). Clicking a layer's label opens its features (Chapter 11) where those are available.

8.5 How to read the field

Read it bottom to top, as the computation runs. A common pattern: near the bottom the lens echoes the input token or produces fragments; in the middle layers plausible continuations appear; in the top layers one of them wins and its probability rises. Heads that light up as the answer forms, and MLP strips that change sharply, are where to look next.

Worked example

On GPT-2, run "The capital of France is Paris. The capital of Germany is" and look at the last token, " is". The lens column shows fragments and function words through the lower half (" not", " now", " also"), then " Paris" briefly after layer 7, then " Berlin" at 84% after layer 8 and 85% after layer 9, easing to 32% at the output as other continuations compete. Point at the strongest head of layers 8 and 9: their loupes show 86% and 94% of their attention on " Germany". The answer appears exactly where heads fetch the country.

Limits

The heads, the neurons and the write strengths are the model's own numbers. The logit lens is a standard technique, not something the model does: middle layers were not trained to be read through the final layers, so the lens is trustworthy near the top and rough near the bottom.

Chapter 9

The scene during a pass

While the panel shows the network, the 3-D scene above it places the run on the embedding cloud: where the tokens are, what the model is leaning toward, and whom it attends to.

9.1 What is drawn

  • The sequence. The text's tokens as labelled markers joined by a faint line, the token on screen in cyan, and the token about to be written ringed and marked "predicted".
  • The thought path (violet). At each depth reached so far, the probability-weighted average position of the logit lens's top ten guesses. It travels from the input token toward the word the model settles on.
  • Attention arcs (cyan). From the current depth back to every earlier token, as thick as the attention paid to it, averaged over the layer's heads, or for one head if you have pinned its loupe. Arcs under 2% are omitted.

9.2 Fly-through

Press T or Fly-through and the camera follows the thought path instead of orbiting: behind it, layer by layer, naming the guesses it passes with their probabilities. Drag or zoom at any time; the flight resumes after a moment. With the hidden-state space on (Chapter 15), the camera follows the token's actual state instead.

Limits

The thought path is an illustration: an average of positions on a map, not the model's state. The state is a d-dimensional vector that does not live on the vocabulary map; Chapter 15 draws it directly.

Chapter 10

Attribution

Attribution asks which parts of the network pushed the model toward a word. Because the final state is a sum (§1.3), the word's score splits exactly into one share per part.

10.1 The decomposition

The score of a word w is its logit minus the average word's logit, which is what actually sets its odds (§1.7). Write the final state as the sum of what each part wrote, xL = e + Σheads oh + Σlayers mℓ + biases. Holding the final normalisation's scale at its value for this token, the score is linear in xL, so

score(w) = Σparts (1/s) · ( uw − ū ) ⊙ γ · cpart

uw: the word's unembedding row; ū: the average row; γ: the final norm's weights; s: its scale at this token; cpart: what the part wrote (for LayerNorm, centred). This is direct logit attribution.

10.2 Using it

Press A or Attribution. The field recolours: each head cyan where it pushed toward the word and amber where it pushed against it, stronger for larger shares; each MLP strip gets a frame of the same colours; a PUSH column adds up each layer, with the total score at its head. The word explained is the one written next. To explain another, click a row of the logit lens (that depth's guess), or type any word into Explain: "why not Paris?" becomes an exact answer about " Paris".

10.3 Reading it

Large pushes usually come from a handful of late heads and MLPs. Negative pushes matter as much as positive ones: they are often the parts that suppress the word the model would otherwise repeat. The share of the embedding itself, and of biases (rest), are reported too, so the shares add up to the score.

Limits

Only direct effects are counted. A head that matters because it feeds later layers shows up in those layers, not in its own cell. Interventions (Chapter 12) measure total effects.

Chapter 11

Neurons: reading the network the way it reads itself

Every MLP neuron is one of the model's own parts, built to be read by the layers after it. Read it the way they do: what drives it, what pushes it the other way, what feeds it, what it feeds, and what changes when you turn it up or down.

11.1 The neuron inspector

Click a layer's MLP strip. The drawer lists the neurons firing hardest at this token, and, when a word is being explained, the neurons pushing toward it and against it: a neuron's direct effect is its activation times how much its output direction points at the word through the final normalisation. Pick a neuron to read it:

  • Here: its activation at this token, and its input before the activation function. In a SwiGLU model (Llama, Qwen) the activation is SiLU(gate) × value, and both are shown (§11.3).
  • Where it fires: its activation, or its input, at every token of the text so far, as background colour.
  • Strongest examples and its other side: the passages that drive it hardest, and those that push it hardest the other way, from a public corpus (§11.4).
  • Its shape: how its activations spread over its own range (§11.4).
  • What feeds it here and what reads it: the earlier parts its input is made of at this token, and the later neurons that read what it writes (§11.5).
  • What it writes: the words its output weights push up and down.
  • Your name and note for it, kept in this browser and shown wherever it appears; ‹ › (or [ ]) walk back through the neurons you have read.
  • Steering and Test it: change it and rerun, or write a sentence meant to fire it (§11.6).
Worked example

In GPT-2, layer 9's neuron 1806 writes toward " an", " a" and " another". Its strongest examples are the word just before an article ("An example of a negative…", "the difference between a dialect and a language"); further down its range some of its samples still sit before an article, more weakly ("Signed into law by President Obama is another…", "people who need to follow a diet"); it is pushed hardest away on " a" itself in phrases like "there are a number of". It doesn't detect articles: it predicts one is next, and goes quiet once one has been written.

11.2 Features

A sparse autoencoder (SAE) is a second, small network trained to rewrite the stream at one depth as a sum of a few features from a large dictionary (24,576 for GPT-2 small). Click a layer's label (EMB, L0, …) to open its features at the token on screen. The first time, that layer's dictionary (about 150 MB) streams from Hugging Face and is kept in your browser.

The drawer reports how faithfully the active features rebuild this token's state (the cosine between the rebuilt and the real vector, and the share of its size they miss), then lists the most active features with a one-line description each, written by an AI model from each feature's strongest examples (Neuronpedia). Pick a feature to see where it fires across the text and which words it writes.

Features are a model of the model: useful for asking what is in one token's state, but a second step, not a first. These SAEs read the residual stream, which has no neurons of its own. In Cammarata's essay (below), an SAE trained on a vision model's last layer turned out to be mostly near-copies of single neurons (88% of its activity), and what it added were loose groupings of existing neurons; he also argues that keeping each neuron whole keeps the tools' errors visible, where a decomposition optimised to look cleaner can lose those hints. Start with the neurons.

Limits

An SAE is trained by others; what it misses is not shown anywhere, and the descriptions are informed guesses. Available for GPT-2 small, the one supported model with open SAEs. Fetching descriptions sends only the layer and feature number to neuronpedia.org, never your text.

11.3 How to read a neuron

Nick Cammarata's essay Neural Networks Are Already Clean (Goodfire, 2026) argues, as a working hypothesis from his experiments on vision and language models, that a neuron which seems to respond to "several unrelated things" is usually one thing we haven't named yet, a branch grown from it, or a tool showing it badly. This section follows that essay. Some ways in:

  • A verb, not a list of nouns. Describe the neuron without naming objects. A famous image neuron that fired on "cats and cars" turned out to detect a V shape (pointed snouts, car fronts, flames). A neuron's job is usually to draw a distinction later neurons can use.
  • Read both sides. A neuron is built from votes for and against. What pushes it negative shows the distinction it draws, and is often a close cousin of its positive side, not its opposite: the V neuron's other side is an O. A neuron with one thing on its positive side and a related thing on its negative side can act as a gate (the essay's example: cars let through, dogs kept out, before the car detectors). In GPT-2, GELU flattens everything below zero to between −0.17 and 0, so the drawer reads its other side from its input before GELU, the votes against it at their strongest; show input colours the text by that input too.
  • Two regimes in SwiGLU. A SwiGLU neuron is SiLU(gate) × value. The essay found a "double-negative regime": when gate and value are both negative, the product is positive. In our reading this is a small, sign-flipped echo of the neuron's negative side, which can crowd a list of strongest firings; the drawer names each sign regime at the token on screen and flags the double negative when it carries a real share of the neuron's range.
  • It fires next to the meaning. Neurons often fire not on the word that carries a meaning but on the word before what they predict, or on punctuation, where the model sums up what came before. Read the whole line of an example, not just the outlined token.
  • Its shape, in pages. Where its tokens sit in its own range; open a band to see what the middle of its range responds to. A page is about 400 tokens (the essay counts one token in 100 as a quarter of a page): "once every 25 pages" says more than "the 99.99th percentile".
  • Weak activations. In the essay's experiments almost all of them could be removed at little cost, except in places like a language model's last layer (which suppresses single tokens) and a vision model's early layers (dials, where slightly versus medium bright matters); elsewhere what weak activations carry is fine distinctions between things the model already confuses, and the strange-looking cases he traced came through ordinary routes. Follow what feeds a weak firing before calling it noise, and open the bands of its shape (§11.4) to see what sits in the middle of its range.
  • Groupings are clues. A neuron that grows from "iy" to "diy" to "do it yourself" has branched, not been packed with unrelated things. If two meanings share a neuron, ask what the network sees in common.
  • Try to break your reading. A good explanation predicts things that could fail: what steering will make the model write, what knocking it out will change, a sentence that should fire it hard.

11.4 Strongest examples and shape

For the built-in GPT-2 and DistilGPT2, every neuron has a book, built once offline (tools/build_neuron_examples.py) by running the model over about three million tokens of FineWeb-Edu (ODC-By): every fourth document of 20 row groups spread across one file of it. Each document is read from its own start, after the <|endoftext|> token GPT-2 saw between documents, for up to 1,023 tokens (1,024 with that token), so a neuron that needs long context gets it and no example's context runs into another document. The first position, where the model parks attention and values are outsized, is left out. Per neuron the book keeps the twelve tokens that drive it hardest and the six where its input is most negative, no two closer than 29 tokens in one document, so no two windows overlap, each with the 24 tokens before it and 4 after, and the neuron's value along the line; ↑ runs an example's whole passage, from the start of its document, through the model. It also counts, in halving bands of the neuron's own maximum, how many tokens land in each band: its shape, drawn on a log scale, with the share of tokens where it is positive at all and how often it reaches half its maximum; and it keeps up to eight random tokens from its top band and from each of the five bands below it, no two within 29 tokens in one document. Click a band to read them: the top band is what it mostly does when it fires hard (its twelve strongest are a sliver of it, and for some early-layer neurons all sit in a document's first few tokens, which the drawer flags); the lower ones are the middle of its range, where a reading should still hold; ↑ shades a sample's whole passage, to see why it fires there. The drawer reads one neuron's records with a few small requests.

Limits

Three million tokens of educational web text, from one file of the corpus, is a sample: a neuron for something rare in it, or for code, fiction or dialogue, may show weak or mixed examples, and its true maximum may be higher than any shown. Documents longer than 1,023 tokens are cut there, and the browser kernel holds 256 tokens, so a long passage is re-run on the tokens nearest its example and its value can differ from the book's. Models loaded from Hugging Face have no book yet; their drawer shows the text on screen and your own tests.

11.5 What feeds it, what reads it

A neuron's input is the normalised residual stream dotted with its input weights, plus a bias. The stream is a sum of parts (the token's embedding, every earlier head's output, every earlier neuron's activation times its output weights), and the norm, at this token's scale, is linear in each part once that part is centred. So the input splits exactly into one share per part:

inputj = Σparts c r · (c − mean c) · (γ ⊙ wj) + biases

r: the norm's 1/scale at this token; γ: its weights; wj: the neuron's input weights (for SwiGLU, its gate's and its value's in turn). RMSNorm has no mean to subtract. In float32 the shares and the biases add up to the input to within about 2×10−5.

What feeds it here lists the largest shares at the token on screen; heads stand for what attention brought in from other tokens. What reads it is from the weights alone: the later neurons whose input weights line up most with this neuron's output, either way. Click any neuron to read it in turn.

11.6 Steering and testing

Below a neuron's name: Knock out sets its activation to zero; Hold at its max sets it to its strongest activation in the book (or in this text) at every token, so a silent neuron speaks; Hold at its trough (GELU) sets it to the most negative value it reaches in the book: −0.17, GELU's own trough, for a neuron whose input reaches −0.75 (where GELU bottoms out), else what its lowest input gives; its readers never get less from it, and it is close to a knockout; Hold at its minimum (SwiGLU) sets it to its most negative value in this text. Then Rerun (under Playback) sends the same text through the changed model, beside the unchanged run (Chapter 12). What the model writes when a neuron is held high is a strong test of what it means, but every token at once is far from anything the neuron does naturally: make the same change to a random neuron of the same layer before reading much into it.

Test it runs any sentence of yours through the unchanged model (whatever is steered), after <|endoftext|> as the corpus does (for GPT-2 and DistilGPT2), and shows the neuron's activation on every token and how close your strongest token comes to the strongest in the book. This is the essay's blind maximum, and it only counts if your reading came first: turn on Read blind, which hides the neuron's examples, shape, neighbours, words, its activations across your text and its maximum until you have written your reading in the note and then tested a sentence (after that it stays revealed; the layer's lists still show its value at the token on screen, among the others), and write one meant to fire the neuron as hard as possible. If your reading is right, the sentence lands near the centre of what the neuron looks for, and can beat every example in the corpus. Copying an example proves nothing; a sentence that should not fire it, a near miss, is as good a test.

Your names and notes are kept in this browser, per model, and listed under yours at the top of the drawer; export notes saves them as one JSON file (with a Markdown summary inside) and import merges a file back, keeping the newer note. The page's address follows what you read (#model?ask=…&p=…&n=layer.neuron&g=1), with the changes in force at the last Rerun, so a link reopens the same model, prompt, token, neuron, graph and changes (generated words match only with Greedy decoding); prompts over 400 characters leave the address unchanged.

11.7 Neuron graphs

Trace the neurons behind a word draws the model's own neurons that carry it at this token. It starts from the eight neurons with the largest direct effect, then walks back layer by layer: each neuron's input is split exactly (§11.5), each share is passed through the slope of the neuron's activation function at this token, and weighted by how much that neuron moves the word. Up to 36 neurons, with the four strongest routes into each; attention heads and the embedding end the walk. A circle's size is the neuron's total: its direct push plus everything it sends through the neurons drawn.

Click a neuron to read it (the graph docks to a bar; Show graph brings it back); shift-click to group neurons, then Knock out the group and rerun, and run the two controls beside it: as many random neurons, and as many of the most active neurons, from the same layers. Random neurons almost never move anything, so they are a weak control; the most active ones at this token are a stronger one, though a neuron that matters at an earlier token escapes both. Then look at what else the model now says: a knockout can break a prediction rather than remove one meaning.

Worked example

GPT-2, "The Eiffel Tower is in the city of" (after ⟨doc⟩): the model gives " Paris" 6.9%. Knocking out the graph's four largest neurons takes it to 0.12%; four random neurons from the same layers leave it between 6.8% and 7.3%. But almost all of that is one layer-0 neuron (#2733, 0.16% on its own), which is also the most active neuron of its layer, and its knockout breaks the prediction rather than removing Paris (" the" rises from 0.2% to 12%); the four most active neurons of the same layers other than the graph's leave " Paris" at 6.9%. The same layer-0 neuron dominates other "in the city of" prompts. On "The capital of … is" prompts the model is less sure (" Berlin" 0.54%, " Tokyo" 0.64%), and the graph's top four cut the word about 1.6 to 5 times, with no rise in " the" (" Berlin" to 0.26%, " Tokyo" to 0.13%). Yet the same layer-0 neuron, knocked out alone, cuts them about as far or further (" Berlin" to 0.06%, " Tokyo" to 0.14% against the four's 0.13%); knocked out only at " of", it does all of that. It is nearly silent at the last token (−0.10), so neither the graph nor the most-active control finds it: it fires on " of" (5.3), two tokens back, which the graph doesn't follow. The graph is a map of where to look, not a verdict.

Limits

The slope linearises each neuron at this token, so edges are a first-order account that can miss a neuron pushed far into its flat side; the knockout is exact for the changed model, but it acts at every token, while the graph is traced at one, and it tests whether a group is needed, not whether it is specific to this word. The graph doesn't follow attention back to other tokens. Needs the CPU kernel (choose CPU under Run on for a model on the GPU), is unavailable while weights are streamed, and isn't available for MDLM.

Chapter 12

Experiments: interventions and comparisons

Observation says what happened; an experiment says what would happen otherwise. Interventions change the model; comparisons put two runs side by side.

12.1 Knocking parts out

Shift-click a head, or press K while pointing at it, to mark it for removal (an amber ✕). In the neuron inspector you can mark a whole MLP or a single neuron. Nothing changes until you press Rerun: the same text then runs through the changed model, in which those parts write nothing, at every position, so every later layer and token sees the change. The unchanged run is kept and shown beneath the new answer, with the first difference underlined, and the readout gives the probability the changed model now assigns to the word the unchanged model wrote. Clear restores the model.

Worked example

GPT-2 on "The country of Canada is a country of immigrants. We are a country of": the four heads attribution ranks highest for " immigrants" take its probability from 44.9% to 9.1% when knocked out together, while four other early heads leave it at 56.4%. Attribution suggested where to look; the intervention confirmed it.

12.2 Comparing two runs

Press Pin as A to keep the run on screen, then run something else: change one word, switch to Sample, or knock parts out. The answer shows A's beneath it; chips whose token differs from A's are outlined in amber. In the field, a Δ A column gives at each depth the cosine distance between this run's state and A's at the token on screen (0 means the same direction), and marks the depth where they part ways, the first to reach a quarter of the largest difference. Heads whose attention differs from A's get an amber outline. Rerunning with interventions pins the unchanged run as A automatically.

Worked example

Pin "The capital of France is" and run "The capital of Germany is". At " Germany" the runs part ways at the embedding, as they must. At the final " is" the state barely moves (cosine distance about 0.001) until layer 9, where it jumps tenfold: the country reaches the last token's state late in the network.

Limits

Knocking out sets a part's output to zero, a blunt change: in normal use no part ever falls completely silent. Runs are compared position by position, which is exact only when both texts have the same number of tokens.

Chapter 13

The lens river

The field shows one guess per depth. The river shows the whole contest: every serious candidate at every depth, so you can see when and how the model makes up its mind.

13.1 Construction

Open the River tab (2). For the token on screen, the horizontal axis is depth, from the embedding on the left to the output on the right. At each depth the logit lens (§8.4) gives the ten most probable tokens; they are stacked bottom to top as bands, each as tall as its probability, joined smoothly from depth to depth. The eight tokens that ever do best get a colour, kept across the whole river; the rest of each depth's top ten is grey; the empty space above the bands is the probability of every other token in the vocabulary. A strip above the river traces the uncertainty, eH of §1.8, on a logarithmic scale from one word to the whole vocabulary.

13.2 Using it

Point at a depth to read its top five and its uncertainty. During a replay, a cyan line marks the depth being computed and the river grows to it. Choose another chip to see another token's river. The readout states the conclusion in words: the token it settles on, the first depth from which the top guess no longer changes, and the depth where that token first entered the top ten.

13.3 How to read it

  • A band that appears late and grows quickly is a decision made late in the network.
  • A guess that leads for several layers and then vanishes is the model changing its mind; the depth where it falls is worth inspecting in the field.
  • A large empty region means the model is spread over many tokens; the uncertainty line says how many, in effect.
Worked example

On GPT-2, generate after "The capital of France is Paris. The capital of Germany is Berlin. The capital of" and look at the token " the" that the model writes: the river settles on " United" from layer 11, having entered the top ten at layer 6, as the model heads for "the United Kingdom". On Qwen2.5-0.5B, the " is" before " Berlin" leans toward " capitals" around layer 20 and settles on " Berlin" (92%) only at layer 23.

Limits

The river is the logit lens at every depth, with the lens's caveat: rough near the bottom. For large vocabularies on the CPU, depths not yet read out appear as dots and fill in when you pause.

Chapter 14

Attention flow

Attention moves information between positions (§1.4). The flow draws where it moved, for the whole text and every layer at once, and estimates what fed the token on screen.

14.1 Construction

Open the Flow tab (3). Tokens run left to right and depths bottom to top; each dot is one token's state after one layer. A line from token j at depth ℓ to token i at depth ℓ+1 means layer ℓ's attention carried information from j into i. Its weight is not the raw attention but attention times the length of the value vector being read, averaged over the layer's heads and scaled so that each state's incoming weights sum to one:

fℓ(i ← j) ∝ Σheads h ahij · ‖vhj‖

After Kobayashi et al. (2020). Links under 3%, and beyond each state's four strongest, are omitted.

Why weight by the value? Most models park a large share of their attention on the first token, whose value vector is tiny: looking there moves almost nothing. Raw weights would draw thick lines from the first token everywhere; weighted ones show where information actually came from.

14.2 Rollout

With Rollout on, the tool chains the flow through the layers to estimate how much each input token contributes to the token on screen by the last layer (Abnar and Zuidema, 2020). Counting each layer's residual connection as half:

rL = ei,   rℓ = ( ½ Fℓ + ½ I )T rℓ+1

The result is drawn as a cyan cone of dots and links reaching back from the token, and as bars under the input tokens. Because the first token only ever attends to itself, whatever reaches it stays there, and rollout accumulates on it; the readout therefore reports the first token's share separately, and the shares of the other tokens among themselves.

14.3 Using and reading it

Point at any dot to see what that state took in at that layer: its sources, each with the weighted share and the raw attention side by side. Click a column to put that token on screen. Look for long, strong lines in the upper layers: they are the model fetching a specific earlier word.

Worked example

On GPT-2, "The country of Canada is a country of immigrants. We are a country of": point at the second " of" at layer 9. It took in 50% of what it read from the earlier " immigrants", although only 12% of its raw attention went there. This is the copying step behind the model's answer, " immigrants". On Qwen2.5-0.5B with the capitals prompt, the second " is" at layer 18 gives "The" 57% of its raw attention but takes only 13% from it; its real sources are " capital" (29%), " Paris" (18%) and " Germany" (14%).

Limits

Attention weights and value sizes are real; their product is a derived measure, and rollout is an estimate that ignores what the MLPs do and how the heads' outputs combine. In the example above, rollout for " of" does not rank " immigrants" in its top three even though the per-layer link shows it plainly: read the layer-by-layer links first and the cone second.

Chapter 15

The hidden-state space

The hidden states (§1.3) are the model's working representations: one vector per token per depth. This view draws them directly, as a space of their own, so you can watch each token's meaning move through the network.

15.1 Construction

Press S or Hidden states. The word cloud dims, and every recorded state of the current run appears: n tokens × (L + 1) depths. Each state is first normalised as the model's own normalisation would (centred and divided by its root mean square, §1.6), so the growth of the stream from layer to layer, and the few huge dimensions some models carry, do not dominate. Then one PCA is fitted on all of the run's states except the first token's (an attention sink with outsized values, which would stretch the axes toward itself; it is still drawn) and every state is projected onto its three directions. The readout reports how much of the variation those three directions show. The fit is refreshed as the text grows.

15.2 Reading the drawing

  • Paths. Each token is a line from its embedding through every layer. The token on screen is drawn boldly; the others faintly.
  • Steps. Each segment is one layer. Its cyan part is how much attention changed the state, its violet part how much the MLP did, and its thickness how large the change was compared with that token's largest. These amounts are exact: the MLP's output is recorded, and the rest of the layer's change is attention's.
  • The slice. White dots mark every token at the depth being replayed, so during playback you watch the whole text advance one layer at a time. Short texts are labelled at the slice.

Point at any dot to read its token, depth and what the logit lens says there; click it to put that token on screen. With T, the camera follows the token's actual state.

15.3 How to read it

Tokens whose paths converge have come to be represented alike by the model; paths that separate are being distinguished. A long, violet-heavy step is a layer whose MLP rewrote the token substantially; a cyan-heavy step is one where information arrived from elsewhere. In most models the first layer makes a large jump, from the embedding into the network's working region.

Worked example

On GPT-2 with "The capital of France is Paris. The capital of Germany is", by layer 6 the countries and capitals (" France", " Paris", " Germany") have gathered in one region, apart from the function words. On Qwen2.5-0.5B, the final " is" wanders through the middle layers and makes one large final step to the state that reads "Berlin 92%".

Limits

The states are real; the 3-D picture is a projection, typically showing a third to a half of their variation. Near in the picture usually means near in the full space; far holds less exactly than near.

Part IV · Models and machinery

Chapter 16

Choosing a model, and where it runs

Every view works on every supported model. Choosing a model is a choice of subject; choosing where it runs is a choice of speed and size.

16.1 The model menu

Click the model's name at the top left. The menu lists, under Ready to use, the built-in models (GPT-2, DistilGPT2, MDLM) and any you have downloaded, with the one open marked. Below, a search of Hugging Face lists open models this tool can run, by family and sorted by downloads, trends or likes, each with a badge:

Verified
Checked end to end against the reference implementation (Chapter 20).
Should load
A supported design that fits; not checked one by one.
Runs on your GPU
Too big for the CPU path, but your browser can run it on the graphics card (§16.3).
GPU, 8-bit
Too big for the CPU path and, at full precision, for a typical graphics card; it runs on the GPU with its weights stored as 8-bit integers (§16.4).
Streams
Too big to hold in memory on the CPU; its weights are read from storage one layer at a time, exactly but slowly.
Needs HF token
A gated model: accept its licence on Hugging Face and add a read token under Token.
Too big · Unsupported
Shown with the reason, when "Also show models it can't run yet" is ticked.

Choosing a model shows a check before anything downloads: its family, format, tokenizer, the memory it needs, the space it will take in your browser, expected speed and licence. The weights then come straight from Hugging Face into your browser's storage, are converted there, and load from storage on later visits. The Storage tab (also reached from Manage storage at the top of the menu) shows how much of your browser's storage the tool uses and on what: downloaded models, the feature dictionaries of §11.2, and any download that did not finish. Each can be deleted on its own, and Free up space deletes everything except the model open now. Everything deleted can be downloaded again; when experimenting with large models, clearing the ones you are done with keeps the browser within its storage allowance.

A browser keeps each site's storage separate, and each browser and profile has its own, so a model downloaded in one place is invisible in another. Export, beside each model (Chrome and Edge), copies it to a folder you choose on your disk, with a list of its files and their sizes. Import model from a folder… (any browser) copies one or several exported models back in and checks every file against that list, so a model never needs downloading twice: a copy on disk takes seconds to a minute, where the download of a 15 GB model takes many minutes. The list itself is cached in your browser and refreshed at most hourly, so opening the menu costs nothing most of the time.

16.2 Families

GPT-2 and DistilGPT2 use learned positions, LayerNorm and GELU. Llama 3.2, SmolLM2, Qwen2.5 and Qwen3 rotate queries and keys for position, use RMSNorm, gated SwiGLU neurons and grouped-query attention; Qwen3 also normalises each head's queries and keys. Pythia applies rotation to part of each head and runs attention and the MLP side by side. Instruction-tuned and chat models receive your text exactly as typed, without the chat template they were trained with, so they continue it rather than reply.

16.3 CPU or GPU

Models from Hugging Face run on the graphics card when your browser supports WebGPU (Chrome and Edge, Safari 26, Firefox on Windows), and on the CPU otherwise; the status line says which, and why if the GPU could not take the model. Both compute the same function on the same weights. The GPU is many times faster and, because its memory lies outside the 4 GB a page gets for everything else, holds models of up to about 7 GB of weights whole, where the CPU must stream them. Run on under Playback switches to the CPU for comparison; the model loads again.

Measured

On an Apple M-series machine: Qwen2.5-0.5B, about 11 ms per token for the forward pass on the GPU against 93 ms on the CPU; Qwen2.5-3B, about 0.17 s per token on the GPU with the logit lens at all 37 depths and full attribution, against 1.6 s per token streamed on the CPU with the lens at a sample of depths.

16.4 Eight-bit weights

A model's weights are published as 16-bit numbers, two bytes each. When those do not fit in the graphics card's memory, the tool can store each weight matrix as 8-bit integers instead, one byte each plus one scale for every 64 weights: about half the memory, and, because decoding one token is limited by how fast the weights can be read, roughly twice the speed. The conversion happens on the GPU as the model loads; the download and the files kept in your browser are unchanged. Formally, each group of 64 weights w1 … w64 is replaced by

ŵk = s · round(wk / s),   s = maxk |wk| / 127

so each weight moves by at most half a step. The tool measures the result as it converts: the status line gives the relative size of the change, √(Σ(w − ŵ)² / Σw²), typically about 0.6%. Normalisation weights and biases are kept at full precision.

Run on offers GPU when available (full precision, then 8-bit if that does not fit, then the CPU), GPU, 8-bit weights, and CPU only.

Measured

Qwen2.5-3B at 8 bits: 3.4 GB of GPU memory instead of 6.2 GB, 19.8 ms per step instead of 52.5, the probability of " Berlin" 0.883 instead of 0.887, and the same 20-token continuation. Qwen2.5-0.5B keeps the same top guess at 23 to 25 of its 25 depths. Qwen2.5-7B at 8 bits: 8.2 GB instead of 15.3 GB, 52 ms per step instead of 110, the same top guess at all 29 depths, and the same continuation.

Limits

An 8-bit model is a close copy of the published one, not the same model: every number the tool shows moves slightly, and greedy text can take a different turn where two words were nearly tied. The tool says when it is in use. For exact work, choose a model that fits at full precision, or run on the CPU.

Chapter 17

A different kind of model: diffusion

MDLM is not a next-word model. It writes the whole answer at once, starting from blanks and filling them in over several steps, and every position can attend to every other.

With MDLM chosen, your text is followed by a number of [MASK] slots (the Tokens setting). At each denoising step the model reads the whole sequence, and each still-masked slot is filled with probability proportional to the step size, taking a token from the model's belief for it; a final pass fills any slot left. The answer shows every slot: locked words bright, the word that just locked highlighted, and masked slots as their current best guess, faded by confidence. The field replays each pass for one slot, by default the one that unmasks at this step; its heads show attention to words on both sides. In the scene, masked slots hang at the weighted centre of their guesses and snap onto a token when they lock. Attribution, interventions and the newer views apply to next-word models and are hidden here.

Chapter 18

Attention without a decoder: a KnowDrive store

A retrieval store does what one attention head does: it scores a query against a fixed set of keys, masks some of them out, and reads from the best. It has no weights and writes nothing, but its key space can be explored exactly like a vocabulary.

A KnowDrive store built into a data set (with tools/build_kdstore.py, which needs a KnowDrive account) appears in the model menu. Its points are atoms. An atom is a passage of a file (a heading and its paragraph, a table, a speech), stored as one 1,024-number vector made by the Jina-CLIP-v2 embedding model. A model's vocabulary is a fixed set of vectors with labels, and so is a store, so most of Part II applies unchanged.

18.1 What carries over, and what changes

In a transformerIn the storeWhere you see it
KeysAtoms: one vector per passage, fixed when the file is storedThe cloud (Chapter 3)
Query · key scoreCosine between the question and an atomDistances from the question (§18.3)
A second headFull-text (BM25) over the wordsThe Full-text switch
Combining headsReciprocal Rank Fusion of the two listsThe Hybrid switch
Attention maskTags, store, version and access: which atoms may be readClicking the legend (§18.4)
How peaked the attention isThe recall shape: how the score falls along the pageThe bars in the panel
What the head writes (OV)The facet read-out: the tags the matched atoms carry"What the page is about"

What does not exist in a store: learned weights, neurons, a next word to predict. The Forward pass view, the lens, attribution and features are therefore absent for it.

18.2 The cloud of atoms

Each point is an atom, coloured by the domain of its file. Labels are not the atom's text, which would bury the cloud in sentences, but a short name: the three words most particular to that passage (frequent in it, rare in the rest of the store), in reading order. The inspector shows the passage itself, with any web-page markup removed for reading, the file it comes from, its position in that file, and the file's tags. Nearest neighbours are exact over all 391,922 atoms, as for a vocabulary; the fovea streams the vectors tile by tile (about 800 MB in all, of which only what you look at is loaded).

18.3 Asking a question

Pick a question in Ask the store. Arcs run from the question to the page of atoms the chosen head returns, thickest for the best; the top five are numbered. In a cloud layout the question is placed among its five best atoms, since a layout has no position for a vector it was not built from. Distances from the question is exact: every atom moves to a radius equal to its true cosine distance from the question, with rings of equal cosine and a dashed ring at the page's edge, the last atom the page took. Everything inside that ring was attended to; everything outside was not.

A browser cannot run the embedding model, and KnowDrive's search does not return the question's vector. It does return the score of every atom it ranks, and each score is a fixed function of one dot product with an atom whose vector the data set holds. The vector head's score is exactly the cosine between the question and the atom (checked by searching with an atom's own vector: KnowDB's scores for the 100 nearest atoms equal the cosines computed here). So 1,500 scored atoms pin down all 1,024 numbers of the question's vector by least squares, and the result must reproduce every score. For each of the ten example questions it does: the recovered vector has length 1.0000, every one of the 1,500 scores is reproduced to within 2×10−7 (the rounding of 32-bit numbers), and the browser's top 50 matches KnowDB's vector list, in order, for all ten. With that vector, the Vector head is recomputed here, over every atom.

Full-text needs the store's word index, which stays on the server, so that list is KnowDB's own, recorded when the data set was built and replayed. Hybrid is KnowDB's fusion of the two, also replayed.

18.4 The mask

Click a domain in the legend to mask it out, and again to bring it back. Masked atoms fade where they are: the keys never move, because masking changes what may be read, not what is stored. The vector page is re-ranked over the atoms still lit, exactly; the replayed lists are filtered, and say so, since the server would have refilled the page from further down.

18.5 Recall shape and read-out

The bars are the page's scores, best first, the top five bright. A steep fall means the question has a clear answer in a few passages; a flat run means many passages are about equally relevant, the retrieval analogue of a spread-out attention pattern. The line beneath gives the share of the page's score held by the top five. What the page is about counts the tags of the files on the page: domain, document type, source. It is how a store reports what it read, and in KnowDrive it is also how a next question can be narrowed, by turning a tag found here into a mask.

Real: the atoms, their vectors, tags and text; the vector head's distances and ranking; KnowDB's replayed lists. Derived: the recovered question vector (checked as above), labels, layouts. Illustrated: arcs, the question's placement in a cloud layout.

Chapter 19

A 744-billion-parameter model, streamed from a drive

GLM-5.2 is far too large for any browser's memory, but each token uses only a small, changing part of it. Keep the part every token needs on the GPU, leave the rest on a fast drive, and read each piece at the moment it is needed.

GLM-5.2 (Z.ai, MIT licence) has 744 billion parameters in 78 layers. Three layers are ordinary; in the other 75, the feed-forward part is a mixture of experts: 256 small networks per layer, of which a router picks 8 for each token, plus one shared expert every token uses. So about 40 billion parameters work on any one token, and only the routed experts, about 12.7 GB of them, change from token to token. The technique, and the int4 container the page reads, come from colibrì by Vincenzo Fornaro (Apache-2.0): parameters are not something to hold in memory but data to be staged, the way a just-in-time compiler compiles only the code that runs. Open it from the model menu: GLM-5.2 under "Streamed from your drive".

19.1 What lives where

  • On the GPU, always: attention, the shared experts, the three dense layers and the output layer, about 10 GB in the container's own 4-bit and 8-bit form, decoded inside the GPU kernels.
  • On the GPU, as a cache: as many routed experts as the cache you choose holds (21.2 MB each), split equally between the 75 layers, the least recently used of a layer giving way. (One shared pool would fail: a token needs 600 experts, so each layer would evict the experts the next layer is about to use.)
  • In RAM, optionally: on a computer with a separate graphics card, experts evicted from the GPU drop into system memory instead of going back to the drive, so a later need for them costs a memory copy rather than a drive read. On Apple Silicon the GPU and the processor share one memory, so this tier would only take room from the GPU cache, and it is off.
  • On the drive: all 19,200 routed experts, about 407 GB. When the router picks an expert the cache does not hold, its bytes are read straight from the file on the drive, in place; nothing is copied into the browser's storage.

19.2 One token, layer by layer

Attention in GLM-5.2 is multi-head latent attention: instead of a key and a value per head, each position stores one compressed 512-number latent plus a 64-number positional part, and every head reads through that latent. Then the router scores all 256 experts; its scores come back from the GPU, the eight best (by score plus a learned balance term) are chosen exactly as the reference does, any missing ones are read from the drive, and the experts run, weighted, added into the residual stream. The page waits on the drive whenever the cache misses, which is why speed depends on the drive far more than on the GPU: a token that misses every expert reads 12.7 GB.

19.3 What the page shows

  • Experts: 75 rows (the MoE layers) by 256 columns (the experts). For the current token, the eight chosen in each layer: cyan if they were already on the GPU, amber if they had to be read from the drive. Purple shows how often each was routed this session, so the structure of routing (the same experts recur for the same kind of text) builds up as you use it. Hover for an expert's layer, weight and history.
  • This token / Session: seconds per token, experts served from the cache, gigabytes and speed read from the drive, the hit rate.
  • Logit lens: the next word read off the residual stream at a few depths (Chapter 8), the same idea as for the smaller models.
  • Attention: for the newest token, each layer's attention over the earlier tokens, averaged over the 64 heads.
  • Warm the cache: colibrì's container ships a routing history; this fills the cache with the most-routed experts before you start, raising the hit rate.

19.4 Reading ahead

The router of layer l+1 is tiny and always on the GPU, so it can be run early on the state layer l already has, to guess which experts the next layer will want and start reading them before it asks (Read ahead). The guesses are good: measured on GLM-5.2, 79% of the next layer's eight experts are guessed right (colibrì reports 71.6%). But reading ahead only pays when the drive has idle time to fill. On a USB SSD it does not: every token already keeps it busy, so the 38% of early reads that turn out unneeded, and the cached experts they push out, cost more than the overlap saves (about 31 s per token, against 22.5 s without). It stays off by default; on a faster drive, or with a cache large enough to keep spare slots, it may win. The Experts view marks experts that arrived by reading ahead in green.

19.5 The experts as a space

A router scores expert e as sigmoid(we · h), where h is the token's normalised hidden state and we is the expert's row of the router: one 6,144-number vector per expert, the direction in the hidden state that wakes it. So the 19,200 experts are 19,200 vectors in one space, exactly the kind of thing the Embeddings view draws, and the model menu lists them as GLM-5.2 experts. Experts close together answer to the same kind of state; their nearest neighbours often sit in other layers. Each is labelled by layer and number, and with the vocabulary words whose embeddings align best with its row: a rough guide only, since the router reads hidden states, not raw words.

With GLM-5.2 running in another tab, each token's choice lights up in the cloud, coloured by where the expert came from. Distances from the token places every expert at its exact rank in its own layer's choice for the last token (sigmoid score plus balance bias, as the router decides), following the run token by token: the eight chosen per layer sit inside the first ring (checked: 600 of 600 for a token). The balance biases are large (about 4 to 20, rising with depth) beside scores between 0 and 1, so they weigh heavily in every choice; ranks show the decision itself.

19.6 Previews: the periphery at lower fidelity

An exact token waits on the drive; a preview does not. For the next few words, the page runs the token on the GPU alone: each chosen expert that is not already on the GPU is stood in for by the resident expert of the same layer whose router row is closest to it (the expert cloud's geometry, used as a lower-fidelity periphery), with no drive reads, in about half a second per word. The preview is shown faintly after the exact text, then confirmed or replaced as the exact words arrive about 20 seconds later; the exact answer never depends on it. Measured on GLM-5.2, with about 72% of each token's chosen experts missing from the GPU: the preview's first word was exactly right 69% of the time over 13 tokens (71% live, 10 of 14), and the exact word was in its top three 92% of the time. Simply leaving the missing experts out does worse (54%). A preview that runs several words ahead can drift (each word builds on the last approximate one), which shows as an occasional repeated word. Preview ahead sets how many words; previews never make the exact answer faster, since every chosen expert must still be read.

19.7 Limits

The context stops at 2,048 tokens: GLM-5.2's sparse attention indexer is not in the container, and without it attention is exact only up to that length. The draft head for speculative decoding is not used. Speed: a fraction of a second to a few seconds per token of GPU work, plus whatever the drive takes; on a USB SSD reading about half a gigabyte a second, a cold token takes tens of seconds, and it improves as the cache warms.

Checked: on two test models in the same container format (colibrì's own tiny oracle, converted by its converter, and a random model at GLM-5.2's full dimensions), the engine matches transformers run on the same dequantized weights: identical predictions and experts at every position, residual streams within 2×10−5, identical greedy text (tools/glm_ref.py).

Chapter 20

How the numbers are checked

A visualiser is only as trustworthy as its arithmetic. Every model in the tool is a from-scratch implementation, and each is compared with a reference.

  • Built-in models. GPT-2 matches a reference implementation to four decimal places; MDLM to about 0.00001.
  • Hugging Face models marked Verified are checked against the reference library (transformers): the same next word, at least nine of the same top ten guesses, and probabilities within 0.0013 at worst. Others use a supported design but are not checked one by one; the status line says which applies.
  • The GPU path is checked against the CPU path recording by recording on the same prompt: the internal state at every depth, attention, neurons, the lens at every depth, attribution and interventions. They agree to about one part in 100,000 for most models (one in 10,000 for Pythia, whose large activations magnify rounding), with probabilities within 0.001.
  • Attribution is exact by construction (its shares add up to the score), and was checked against independent computations to about 1e-5.
  • A KnowDrive store's vector head (Chapter 18) is checked against KnowDB itself: recovered question vectors reproduce KnowDB's scores to 2×10−7, and the browser's top 50 matches KnowDB's list in order for all ten example questions.
  • GLM-5.2 (Chapter 19) is checked on test models in its container format against transformers on the same dequantized weights: identical predictions, experts and greedy text, residuals within 2×10−5.
  • Eight-bit weights (§16.4) are a deliberate approximation, checked against the full-precision model on the GPU; the status line reports how far the weights moved, and the figures in §16.4 show how far the predictions move.

The sections at the top of this page classify every element of the screen as real (the model's own numbers), derived (a standard technique applied to them) or illustrated (a drawing to make them readable); what you write yourself, the names and notes you give neurons, is tagged yours. When in doubt about a view, its row there says which it is.

Appendices

Appendix A

Keyboard reference

MSwitch between Embeddings and Forward pass
/Find a token (Embeddings) or type a query (Forward pass)
HCamera home
EscUnpin; leave the distances view
CClusters ↔ PCA layout
F L RFoveation on/off; the fovea's local layout; the fovea rings
ZRe-arrange the region under the parafovea (semantic zoom)
DDistances from the pinned token
1 2 3Field, River, Flow
SHidden-state space
AAttribution
TFly-through
K, Shift-clickMark the head under the pointer to knock out
PHide or show the panel
drag · wheel · Shift-dragOrbit · zoom · pan

Appendix B

Glossary of terms

Every term used on this page and in the tool, with the section that explains it.

ActivationThe value a neuron takes at one position: how strongly it fires (§1.5).
AtomIn a KnowDrive store, one passage of a file stored as one vector: what a key is to an attention head (§18.1).
AttentionThe mechanism by which a position reads from earlier positions: a weighted average of their value vectors, with weights from query–key similarity (§1.4).
Attention flowThe view of where attention moved information, weighted by the size of what each token offers (Chapter 14).
Attention sinkA token, usually the first, that many heads attend to when they have nothing to do; it carries little information (§8.2, §14.1).
Attention weightThe probability a head gives to one earlier position; a head's weights over the positions sum to one (§1.4).
Attribution (direct logit)The exact split of a word's score into one share per part of the network, counting direct effects only (Chapter 10).
AutoregressiveWriting one token at a time, each conditioned on everything before it (§1.7). Contrast diffusion.
BM25A full-text score: how often a passage uses the question's words, weighted by how rare they are. A store's second head beside the vector score (§18.3).
BarcodeThe inspector's picture of all of a token's coordinates, one column each (§5.1).
CausalAble to attend only to earlier positions, as next-word models are (§1.4).
ChipOne token of the run in the forward-pass panel; click to inspect that position (§7.2).
Cosine similarity, distanceThe cosine of the angle between two vectors (1 is the same direction); distance is one minus it (§2.2).
DepthA point in the network: the embedding (depth 0) or the output of a layer. A model with L layers has L + 1 depths.
DerivedComputed from the model's numbers by a standard technique that adds assumptions, such as the logit lens or PCA (top of this page).
Diffusion modelA model that fills in a whole masked answer over several steps, attending in both directions; here MDLM (Chapter 17).
EmbeddingA token's starting vector, one row of the embedding matrix (§1.2).
Embedding spaceThe fixed cloud of all token embeddings; the model's first latent space (§2.1, Part II).
Entropy, eHHow spread out a probability distribution is; eH is the equivalent number of equally likely choices (§1.8).
Facet read-outThe tags carried by the atoms a store returned, counted: what the matched set is about, and a way to narrow the next question (§18.5).
FeatureA direction in a sparse autoencoder's dictionary, a learned model of the model; mostly a neuron, or a group of neurons seen in context (§11.2).
Fidelity lineThe live measure of how much true neighbourhood structure the current layout keeps (§2.5).
Fly-throughThe camera following the thought path, or the token's real state in the hidden-state space (§9.2).
Fovea, parafovea, peripheryThe regions of full, intermediate and minimal detail around the gaze (Chapter 4).
GELU, SwiGLUThe nonlinearities used in MLPs: GELU in GPT-2 and Pythia; SwiGLU, a gated product, in Llama and Qwen (§1.5).
8-bit weightsWeights stored as one-byte integers with a scale per 64, about half the memory of the published 16-bit weights; a close copy of the model (§16.4).
GPU, WebGPUThe graphics card, and the browser interface that lets a page compute on it (§16.3).
Greedy, samplingAlways writing the most probable token, or drawing one at random by probability (§1.7, §7.1).
Grouped-query attentionSeveral heads sharing one set of keys and values while keeping their own attention weights (§1.4).
HeadOne of the parallel attention mechanisms in a layer (§1.4).
Hidden stateThe residual stream of one token at one depth; the model's working representation (§1.3, Chapter 15).
IllustratedA drawing that makes real numbers readable but is not itself an object in the model, such as the thought path (top of this page).
Intervention, knockoutChanging the model, here by silencing a head, an MLP or a neuron, and running it again (Chapter 12).
KV cacheThe stored keys and values of earlier positions, so each new token needs only one pass (§1.7).
KnowDrive storeA retrieval store whose atoms are keys scored against a question, with no weights and no decoder: attention without the rest of a transformer (Chapter 18).
Latent spaceA vector space in which a model represents things (Chapter 2).
LayerOne block of the network: attention, then the MLP, each adding to the residual stream (§1.3).
LayerNorm, RMSNormThe normalisations applied before each part reads the stream; LayerNorm also removes the mean (§1.6).
Lens riverThe logit lens at every depth for one token, drawn as stacked probability bands (Chapter 13).
LogitA token's raw score before the softmax; only differences between logits matter (§1.7).
Logit lensReading the stream at any depth through the final normalisation and unembedding, as if it were the last layer (§8.4).
Mixture of expertsA feed-forward layer made of many small networks, of which a router picks a few per token; GLM-5.2 has 256 per layer and uses 8 (Chapter 19).
MLPThe position-wise part of each layer: up-projection, nonlinearity, down-projection (§1.5).
Mask (store)A rule, such as a tag, that decides which atoms a question may read; changing it changes what is attended to without moving any key (§18.4).
Nearest neighboursThe tokens most similar to a given one by cosine, measured in the full space (§2.2, §5.1).
Negative sideWhat pushes a neuron the other way; it shows the distinction the neuron draws, and can act as a gate for the neurons that read it (§11.3).
NeuronOne component of an MLP's hidden layer, with its own input and output directions (§1.5, §11.1).
Neuron graphThe model's own neurons that carry one word at one token, and how they feed each other; tested by knocking groups out (§11.7).
Parts waysIn a comparison, the first depth at which two runs' states differ substantially (§12.2).
PCAPrincipal component analysis: projecting onto the directions of greatest variation (§2.3).
Multi-head latent attentionAttention that stores one compressed latent per position instead of a key and value per head; GLM-5.2's is 576 numbers per position per layer (§19.2).
Query, key, valueThe three vectors a head computes: what a position looks for, what it advertises, and what it hands over (§1.4).
Reciprocal Rank FusionA way to merge ranked lists: each item scores 1/(k + its rank) in each list, summed. How a store combines its vector and full-text heads (§18.3).
Recall shapeHow a store's scores fall along the page it returns: steep for a clear answer in a few passages, flat when many are about equally relevant (§18.5).
RealThe model's own numbers, read straight from the computation (top of this page).
Residual streamThe vector per position that every layer reads from and adds to (§1.3).
RouterThe small layer that scores every expert for a token and picks the few that run (§19.2).
RolloutAn estimate of input tokens' contributions to a later token, chaining attention flow through the layers (§14.2).
Rotary embeddingEncoding position by rotating queries and keys, used by Llama, Qwen and Pythia (§1.2).
Semantic zoomRe-running the clustering on just the region under the gaze, so that region is drawn faithfully (§6.1).
SoftmaxThe function that turns scores into probabilities: exponentiate and normalise (§1.7).
Sparse autoencoder (SAE)A second network that rewrites a hidden state as a sum of a few dictionary features (§11.2).
StreamingReading a model's weights from browser storage one layer at a time, when they do not fit in memory (§16.1).
Thought pathThe probability-weighted average position of the logit lens's guesses at each depth; an illustration (§9.1).
Tied embeddingsUsing the same matrix to read tokens in and to score them out (§1.7).
Token, vocabularyA unit of text, and the fixed table of all of them (§1.1).
UMAPA nonlinear method that keeps each point's nearest neighbours nearby; the "Clusters" layout (§2.3).
UnembeddingThe matrix that turns the final state into one logit per token (§1.7).
Value vectorWhat a token hands to a head that attends to it; its length sets how much the attention actually moves (§1.4, §14.1).
Width (d)The number of coordinates in each embedding and hidden state: 768 for GPT-2 (§1.2).
Write strengthThe length of the vector a head adds to the stream (§8.2).

↑ Back to the contents