Model Flow · October 2026 · version 0.3

Model Flow

What does a language model look like if you study it the way you would study a fluid: not molecule by molecule, but by how the whole body of it moves? Here, the molecules are the model's weights and circuits, and the fluid is thousands of texts flowing through the model's layers.

This project does not try to explain individual weights. It follows a population of texts through a model and measures where the population holds its shape and where it reorganizes. Three findings:

How this was made. This is a human–AI collaboration. The author set the question and the ideas behind it, chose the directions, and reviewed each step. Claude (Anthropic), working in Claude Code, wrote the code, ran the experiments, searched the literature and drafted this page, including proposing the checks that narrowed several claims. Results and wording were reviewed together.

One running total

A language model reads text as tokens (words or pieces of words) and turns each token into a vector, a list of a few thousand numbers. The vectors then pass through a stack of layers. Each layer reads the current vector, computes something nonlinear from it, and adds its result, its write, back on. The running total is called the residual stream (Elhage et al. 2021).

Each layer writes in two steps. Attention lets each token read from the tokens before it, through several parallel readers called heads. The MLP, a small two-stage network, then transforms each token's vector on its own. Both steps add their results to the residual stream.

Because every layer adds to the same running total, the vector after layer 9 and the vector after layer 18 live in the same space, with the same axes. That is what makes the fluid picture possible: one space, and a flow through it, layer by layer.

A cloud of texts

One text gives one point per layer. We send thousands of short encyclopedia articles (DBpedia summaries, at most 64 tokens) through an already-trained model, without changing its weights (a frozen model), and represent each article at each layer by the average of its token vectors. That gives a cloud of points at every layer. The question is how the cloud changes from one layer to the next. Where something is fitted to articles (a grouping, a map between layers), it is tested on held-out articles that the fit never saw.

We compare two layers in two ways:

Models: Gemma 4 E2B and E4B, Qwen3-1.7B, Qwen3.5-2B, SmolLM2-1.7B, Pythia-410M (untrained and trained), and one encoder, ModernBERT-large. All public, all frozen.

What we see

Comparing every pair of layers gives a map of the whole model. In Gemma 4 E2B the map has two features. Dark square blocks are stretches of layers that share coordinates. And at layer 14 there is a sharp break: across that one layer, articles' coordinates become unrelated. We call a layer like that a turn.

Every pair of layers, compared. Left: same place, as a share: of 3,000 held-out articles, how many have their own vector as the nearest point at the other layer (after centering). Right: share of 10 neighbours kept (same company). Darker is more similar. Switch models to compare; hover a cell for its value.

Other models show breaks too, if measured plainly: Qwen3 seems to turn at layer 2 and SmolLM2 at layer 7. Before reading anything into these, each needs a reference.

Is it real? Three controls

An untrained model: staying put is the default

In an untrained Pythia (choose "pythia_0" above), every article still finds itself at any layer up to six layers away, and keeps most of its neighbours at that distance. Each layer adds a small random write to a large running total, so nothing moves far quickly. So blocks of shared coordinates are not, by themselves, something the model learned (Veit et al. 2016). Training shows up as departures from this.

Robust scaling: a change in a few huge coordinates can look like a turn of the whole cloud

Language models carry a handful of coordinates with values hundreds of times larger than the rest (Kovaleva et al. 2021; Sun et al. 2024). When one switches on, it dominates every cosine. Rescale each coordinate by its typical spread, and the Qwen3 and SmolLM2 breaks become ordinary layers. Qwen3, Qwen3.5 and SmolLM2 then keep their coordinates all the way through. Gemma's turn stays.

The huge coordinates are not noise. In Qwen3, three coordinates switch on at layer 2, almost entirely on the first token of each text, which becomes the token every other token can attend to by default (an attention sink, Sun et al. 2024). Blocking that switch breaks the model. But the other 2,045 coordinates keep their arrangement across layer 2. So the event is real and needed, and it is a change in a few coordinates of one token, not a turn of the whole cloud like Gemma's.

A second model as reference: rotations link layers, and they link models

To ask whether information survives a layer, fit a rotation from one layer's cloud to another's on some articles, then check whether it carries new articles to themselves. It does, very well. The same procedure works almost as well between two different models.

no mapwithin one modelacross different modelsshuffled pairs (null)
Share of 3,000 held-out articles whose nearest neighbour, after the fitted map, is the same article (chance 1 in 3,000; maps fit on 10,000 other articles). Fitting on shuffled pairs falls to chance.

Both results point the same way: the arrangement of articles is shared, between layers of one model and between different models (Huh et al. 2024), and a rotation carries one onto the other.

The second model also sets a limit on what a good fit means. Two different models were never rotations of each other, yet one fits onto the other almost as well as one layer onto the next. So a good fit between two layers does not show that one layer rotated the other. It shows only that both arrange the articles in a similar way (Ding et al. 2021). And the rotation carries the arrangement, not everything: about half of each vector's length is left unexplained.

Gemma 4's turn

One break survives every control. This section describes it, explains how it happens, tests the explanation on a second model, and asks why the model's predictions tolerate it.

What it looks like

Across layers 13 to 15 of Gemma 4 E2B, articles' coordinates become unrelated, yet each article keeps about half of its 10 neighbours, where neighbouring layers elsewhere keep about four in five. The turn holds on a second sample, at 1,000 to 6,000 articles, with the huge coordinates removed, in 32-bit and 16-bit arithmetic, and for single tokens as well as whole articles. Here is one article, chosen by a fixed rule (the first in the sample with the median number of neighbours kept):

One article across the turn. Its 10 nearest neighbours at layer 13 and at layer 15; shared ones in bold. Its own centered cosine across the turn is : its coordinates are unrelated. Yet half its company is the same, and the rest is the same kind of thing.

To see the turn as a flow, we need one more idea. At each layer we sort the articles into a few groups with k-means, a standard method that splits points into a chosen number of groups by distance, using no labels. k-means starts from random points, so we run it twice and score how well the two runs agree: the repeatability (1 = identical, 0 = chance). Then we follow the same articles from one layer's groups to the next.

topic agreement of the groupsgrouping carried to the next layerrepeatability
Gemma 4 E2B, 1,500 held-out articles. Bands follow the same articles between layers. Colours show the topic most over-represented in each group, added after the grouping. Repeatability under each layer (median with four groups, with eight); layers below 0.8 are faded. Lower panel: topic agreement (adjusted mutual information with the nine DBpedia topics) and carry-over (adjusted Rand index between consecutive layers). Try "layers 10–20". Hover a band for its size.

Most of the depth is steady flow: groups carry over from layer to layer. Around the turn the carry-over drops and topic agreement roughly halves (lower panel), then the groups re-form a few layers later. The map shows who moves with whom, not why. Its groups are our choice of resolution, not the model's concepts.

How it happens

After each layer, Gemma 4 multiplies the whole residual stream by a fixed number stored in the checkpoint, the layer scalar (layer_scalar). Gemma's technical report says it is there to keep values within 16-bit range (Gemma Team 2026). Unlike similar tricks that scale only a layer's write (Touvron et al. 2021), it scales the running total too.

Gemma 4 E2B, one column per layer. Blocks: stretches of layers that share coordinates. Coordinate turn: 1 − centered cosine between a layer's input and output. Layer write: the layer's own write relative to the residual, scalar divided out (log scale). Layer scalar: the stored multiplier. Attention: full-attention layers (circles; size = strongest induction head) and mean attention to the first token. Shaded: layers that reuse earlier layers' attention keys and values.

Size sets the turn; content sets the company. A cosine only sees whether the axes changed, not what was written. So for single tokens we also track company: which 10 other tokens are closest after layer 14, and whether they are the same ones as in the unchanged model. We then changed the writes of layers 13 and 14 in six ways, from setting 1,024 random MLP units to their average value up to replacing the whole write with noise of the same size.

2026-10-19T10:01:50.030141 image/svg+xml Matplotlib v3.10.3, https://matplotlib.org/ 0.0 0.2 0.4 0.6 0.8 1.0 fraction (1 = full turn / all kept) no change 1,024 random neurons to mean 1,024 largest neurons to mean every neuron to its mean every neuron from another text write replaced by noise Content changes, the turn does not coordinate turn across layers 13-14 company kept after layer 14 next-token prediction unchanged x0.5 x1 x2 x4 layer 12's scalar, multiplied by 0.0 0.2 0.4 0.6 0.8 1.0 coordinate turn across layer 13 ordinary layers as trained set to 1 The previous scalar sets part of it
Gemma 4 E2B, 2,000 tokens. Left: each row changes the writes of layers 13 and 14 in one way. Blue: coordinate turn across the two layers (1 − centered cosine, as in the track figure). Orange: company kept, the share of each token's 10 nearest neighbours after layer 14 that match the unchanged model. Green: share of tokens whose predicted next token is unchanged. Right: coordinate turn across layer 13 when layer 12's scalar is multiplied by a factor; the band is the range of ordinary layers.

Read the left panel down the rows. The blue bars do not move: every change, even noise, leaves the turn as it was. The orange and green bars fall as more of the content is replaced, down to almost no company kept when the write is another text's or noise. So the size of the write sets the turn, and its content sets the company. Even with every MLP unit held at its average, which adds the same vector to every token, the turn happens: whatever else writes at those layers is large enough against the shrunken total. The same changes on Gemma 4 E4B also leave its turn in place.

Part of the size comes from the layer before. A layer's own scalar cannot turn it, because multiplying everything by one number leaves a cosine unchanged. But it shrinks the running total that the next layer writes onto. So changing layer 12's scalar should change the turn at layer 13, and it does, smoothly (right panel). Even at four times the trained value, layer 13 turns more than ordinary layers, so the size of its own write does the rest.

The same event in a larger model

In Gemma 4 E2B, the smaller a layer's scalar, the sharper its turn. So before computing any geometry of the larger Gemma 4 E4B, we read only its stored scalars and wrote down three predictions: its two sharpest turns lie in layers 22–24; the scalar–turn rank correlation is at least 0.5; a block of shared coordinates starts at layer 23–25. All three held. pre-registered · held-out model

layer scalar (from the checkpoint)coordinate turn (1 − centered cosine across the layer)
Gemma 4 E4B, one column per layer. The green band is the predicted window, fixed before the turn was measured.

Caveats: the prediction window left out layer 1 (third-smallest scalar), a choice made after reading the scalars. Both models are Gemma 4. A scalar meant to keep values in range is expected to be small where a layer writes something huge; the test shows that this numerical device also marks the geometry.

Why the predictions tolerate it

Does the turn matter for what the model predicts? A first test changed the turn layers' scalars, which sets how sharp the turn is. We expected this to hurt the predictions more than the same change at ordinary layers. It hurt less, even when the change was matched in absolute size predicted · failed. So scalar changes do not show that the turn matters.

A cleaner test changes only the axes. At one layer's input we rotate every token's vector, keeping its length and the layer's average, and measure how far the next-token predictions move. Just after the turn, rotating back toward the pre-turn axes does as much damage as a random rotation. At ordinary layers, the axes of two layers back do far less damage than random ones. So the layers after the turn get nothing from the old axes.

Across layers, a random rotation wrecks the predictions almost everywhere, but much less in a window that starts inside the turn and fades over a few layers (figure). Gemma 4 E4B shows the same window, less deep. The few huge coordinates do not cause it: holding them fixed while rotating the rest leaves the window unchanged.

The window comes from a feature of Gemma 4's design. Attention reads earlier tokens through keys and values, summaries that each attention layer normally computes from the residual stream. In Gemma 4 the later layers skip this and reuse the keys and values of earlier layers. Layers 13 and 14, the turn layers, are the last two that compute their own, and every later layer reuses theirs. In E4B the turn layers are again the last two (dotted lines in the figure). So a rotation after the turn cannot reach anything attention reads.

To test whether that is what protects the predictions, we rotated at layers before the turn while giving every attention layer its keys and values from the unrotated model. We expected little effect, since a rotation there also scrambles the input to the turn's large writes. Instead the damage almost vanished at every layer tried (hollow points) pre-registered. The predictions can be rebuilt from keys and values that the rotation cannot reach.

2026-10-19T10:01:49.224941 image/svg+xml Matplotlib v3.10.3, https://matplotlib.org/ 0 5 10 15 20 25 30 35 rotated at the input of layer 0 1 2 3 4 5 6 7 8 damage to predictions (KL) turn reuses keys and values → hollow: keys and values from the unrotated model Gemma 4 E2B 0 5 10 15 20 25 30 35 40 rotated at the input of layer turn reuses keys and values → points: mean of 3 random rotations (bars: their range) Gemma 4 E4B
Damage from rotating the residual stream at one layer's input (KL between the unchanged and the rotated model's next-token predictions, over 100 texts; 0 = no change). Each point is the mean of three random rotations that keep every token's length and the layer's average; bars show their range. Shaded: the turn layers. Dotted line: from here on, layers reuse earlier keys and values. Hollow points (E2B): the same rotations, with every attention layer given its keys and values from the unrotated model. Rotations without any change give exactly 0.

Two cautions. Each token's own keys and values were also left unrotated, so the test shows that the damage travels through what attention reads, not that other tokens supply the missing information. And why the damage climbs again over the next few layers, where keys and values are equally out of reach, is open.

What the turn is not

A recent essay argues that most neurons in modern language models do one main job (Cammarata 2026; its support is a small audit of one model's neurons). A neuron here is one of the MLP's inner units: its value at each token scales a fixed direction that the MLP adds to the running total. So we asked whether the turn is something a few neurons do. It is not. Half of each token's write at the turn takes about as many neurons as at any middle layer, in Gemma and in Qwen3. Blind raters find the turn's neurons as readable as other neurons of the same activation size, and no more. No single attention head drives the turn. The turn is a size event, not a circuit. The tests, including the ones that failed, are in the notes.

The mental map, provisionally

This is the picture we now work from. It summarizes these measurements on these models; it is not a law.

What did not hold

Open questions

Limits

Where this goes next

If the arrangement is shared and a rotation carries it, a natural next question is what the rotated states are good for, within one model and between models. That is the subject of ongoing work. A practical side result, on choosing an embedding layer without labels, is written up in a companion note: the second-to-last layer is a good default, and the note says when to do something else.

Prior work, and what is new

Most single measurements here have precedent. "Not found" means not found in searches of arXiv, OpenAlex, OpenReview, LessWrong / Alignment Forum, GitHub and the web (October 2026).

ClaimClosest prior workWhat we addStatus
Gemma 4's turn: large orthogonal writes, then a whole-stream rescaleOverwriting by writing with a larger norm: Heimersheim & Turner 2023; orthogonal updates: Lombardo et al. 2026; residual scaling: Touvron et al. 2021; Bachlechner et al. 2020A concrete, causally tested case with a dose-response, and its scalar used to predict geometry on a held-out modelidea known; case new
Rotations link layers and modelsRotations between layers: Bhattacharya & Kolli 2026; shared geometry across models: Huh et al. 2024; similarity needs a reference: Ding et al. 2021; Gröger et al. 2026Within- and cross-model fits side by side, with a second model as the referencefits known; this comparison not found
Untrained and robust-scaling references for layer similarityVeit et al. 2016; Sun et al. 2024; Davari et al. 2022Shown to remove apparent turns in two model familiespartly new
Flow maps of layer-wise clustersİrsoy & Alpaydın 2022; Sevastjanova et al. 2025; Kroeger & Bindschaedler 2025; von Luxburg 2010Each layer's groups drawn with their repeatability, setting fixed in advancepartly new
Blocks of layersNguyen et al. 2021; Lad et al. 2024; Gromov et al. 2024Tested against shuffles that keep the depth trendreproduced; tests added

Reproducing

Every number on this page is listed in a claims ledger with the result file it comes from and the script that produced it, and a checker re-derives each one from the results. Code, pre-registrations, results and the scripts to re-extract every feature cache are in the repository, archived with a DOI. The DOI always resolves to the latest version; each version's numbers are archived with it.

No model was trained. The project used about 110 GPU-hours on a consumer GPU and two older datacenter GPUs, and about 330 CPU job-hours. It cached about 0.6 TB of hidden states: some 205 million per-layer vectors from frozen public models.

Repository: github.com/SteveSolvesProblems/model-flow · Archived: doi.org/10.5281/zenodo.23437748

Versions

References