Getting Started with Neural Geometry

A worked tutorial: find a structured concept hiding in a model's activations, prove it is real, and steer the model along it — on the seven days of the week in Llama-3.1-8B.

TopicsLanguage models · Neural geometry · Steering · Circuits & causal tracing
ModelsLlama-3.1-8B
ReferencesEngels et al., circular features · Goodfire, geometric calculator
Try it yourself. Open the finished run in your own workspace and pick up where it leaves off.

Some ideas a language model handles have built-in structure: the days of the week cycle, the numbers order, the compass directions turn. When a concept has a shape like that, does the model store it as a shape, and can that shape be read and used? This recipe shows the basic workflow for discovering and verifying these structures inside LLMs: find a candidate geometry in the activations, verify it with tests a scatter plot cannot fake, then steer the model along it to show the model actually computes with it.

The running example is the seven days of the week inside Llama-3.1-8B. The days turn out to sit on a ring in the model's internal activations, in calendar order, and the model does day arithmetic by moving along that ring. The scatter below is that ring: every mention of a weekday, projected to its three strongest directions and colored by the day. Drag it to see the loop from any angle.

The ring does not appear in the raw activations. It emerges only after one corrective step, and when it does the day-to-ring agreement jumps 0.03 → 0.99 — from no better than noise to a clean calendar ring, produced not by retraining but by subtracting each sentence template's own average before looking. A direction read straight off that ring then shifts the model's predicted next day by exactly the intended amount 98% of the time, where a random nudge of the same size does essentially nothing.

Key takeaways

Neural geometry in a nutshell

A common picture of how models store concepts is that each feature is a direction in activation space, and unrelated features point in unrelated directions. That picture is incomplete for concepts that carry their own internal structure. If an idea has an order or a cycle, the model can lay it out as a matching shape — a curve, a ring, a grid — where nearby positions mean related values. When that happens the geometry itself is informative: it tells you which direction means "next" and which means "previous", and that is exactly the handle needed to read the concept out or to steer it.

This is not a hypothetical. Engels and colleagues showed that language models represent cyclic concepts like days and months as circular features rather than as bags of unrelated directions. Related work from Goodfire framed number representations as a "geometric calculator", where the model does arithmetic by moving along a learned curve. The shared lesson is that some concepts are stored as legible low-dimensional geometry.

The catch is that a shape which can be seen can also mislead. Collapsing a high-dimensional representation down to two axes can conjure a circle that was never really there. So a careful recipe has three parts:

Step 1 — Find the geometry

The search starts with controlled stimuli. The run wrote 80 carrier sentences and filled each one in for all seven days, then read the activation at the day word itself partway up the network — layer 30 of Llama-3.1-8B. Each reading is a point in a space of 4,096 numbers, giving 560 points in all. To see that many dimensions at once the run flattens to two with PCA, which keeps the directions of greatest variation.

The first look is a let-down: no ring. The points clump by which sentence they came from, not by which day they name, and the day-to-ring agreement is essentially zero. The day signal is buried under the wording.

The fix is to subtract, for every carrier sentence, that sentence's own average across its seven days. What remains is only what changes when the day is swapped and the wording held fixed, controlling for phrasing so that the day is all that is left. Do it, and the circle snaps into view in Monday-to-Sunday order.

Two PCA scatter panels of day activations. Left, raw readings scatter with no ring and day-to-ring agreement 0.03. Right, after within-template centering the same readings settle onto a clean ring in calendar order with agreement 0.99.
The ring is there, but the wording hides it. Each dot is one mention of a day, colored by the day; large rings mark the seven day averages. Raw readings (left) scatter by sentence and show no ring. After removing each template's own average (right), the same readings settle onto a ring in Monday-to-Sunday order — the agreement jumps from 0.03 to 0.99.

The lesson generalizes past this example. The structure was present in the raw activations the whole time. It was hidden by a nuisance factor — the sentence wording — that dominated the projection. Centering removed the nuisance so the concept could show itself. When a geometry fails to appear, the readout is worth suspecting before the model is.

Step 2 — Verify it is real

A ring in a scatter plot is a claim, not a result, so the recipe leans on three independent checks. Two are correlational and one is causal, and they have to point the same way.

Order. The seven days come out in calendar order around the ring, Monday beside Tuesday beside Wednesday and so on. That ordering is what the 0.99 circular correlation actually measures — not merely that the points form a loop, but that the loop matches the calendar.

Topology. A test from persistent homology looks for a genuine hole in the middle of the point cloud, the signature of a true loop rather than an arc or a blob. It scores a strong 0.98, well above the roughly 0.66 that a matched random cloud, a Gaussian blob with the same overall spread, produces. (Shuffling the day labels cannot serve as the null here, since the point cloud's shape does not depend on the labels; the order test above is what the label shuffle checks.) With only seven days this is supporting evidence rather than proof, but it agrees with the order test.

Cause. The sharpest check is whether the model uses the ring. For each step size k, the run took the average difference between a day's reading and the reading of the day k ahead, then added that difference into the activations while the model read a day-completion prompt. If the day code is what the model reads, nudging it forward by k should move the predicted word forward by k days. It does, for step sizes one through six, about 98% of the time. A random nudge of the same size does essentially nothing.

Bar chart. Full day-difference nudge lands the prediction exactly k days ahead 98 percent of the time. Moving only within the two-dimensional ring plane works 14 percent. A random nudge of the same size works 0 percent.
The model computes with the direction. Share of day-completion prompts whose predicted next word lands exactly k days ahead, averaged over k from one to six across 99 prompts. The full day-difference direction almost always works; a random direction of the same size almost never does. The middle bar is the subject of Step 3.

Three tests, three agreements. Only at this point is the ring worth believing.

Step 3 — Steer along it, and read the honest limit

The causal test also sets up a twist worth dwelling on, because it is where a tidy story meets the real geometry. There are two ways to move a few days forward. The full day-difference direction is the one that works 98% of the time. But moving only within the two-dimensional ring plane — rotating around the flat circle and nothing else — lands the right day just 14% of the time. The pretty picture is not the whole mechanism.

The reason is dimensionality. The flat circle is the structure in the seven day averages. Each individual mention of a day scatters across many more dimensions, roughly 13 to 16 by two independent estimates. So a direction confined to the ring plane throws most of the signal away, while the full day-difference direction keeps it. A straight-line move in the full space beats an on-ring rotation on endpoint accuracy. The ring is a real and readable map of how the days are organized, not a complete account of how every token is stored.

Where the ring's signature does show is in the path, and the explorable below makes it visible. Steering along the around-the-ring route, the prediction's nearest weekday steps through each day in turn, passing through the days in between. The straight-line route jumps to the same final answer and skips them. Both arrive at the right day. Only the ring route visits the days along the way, because those in-between days are real, ordered stops the model steps through when moved along the ring instead of across it. (At a few strengths the model's literal top token is a filler word like "the" rather than a day; the explorable shows that token too, alongside the nearest weekday.)

The findings carry the usual caveats: one model, one concept, and a topology test that is thin with only seven points. The recipe — controlled stimuli, centering, a projection, a null test, and a causal intervention — travels more reliably than the exact numbers.

Why concept geometry is worth finding

The striking part is that nobody built this ring in. Llama-3.1-8B was trained only to predict text, yet it reconstructed the calendar as a geometric object, the same cyclic order people draw by hand. A model that organizes a concept this way is not memorizing surface correlations one fact at a time. It has compressed the concept into a reusable structure and computes over it. Finding these structures is a window into how a model represents the world, and how much of that representation lines up with the way people organize the same ideas.

The practical value is that a shape is a handle. Once a concept's geometry is known, it can be read and it can be moved. A readout turns activations into a monitor: what does the model currently represent, and how strongly, without waiting for the behavior to surface in the text. A steering direction turns the same geometry into a control, nudging behavior along a meaningful axis instead of by trial-and-error prompting. Both act on the representation itself, which is more direct and less circular than inferring the model's internal state from its outputs.

The loop is also not specific to days. Any construct with real internal structure is a candidate: sentiment, formality, time, spatial direction, number. Build controlled stimuli, read the activations, find the geometry, verify it against a null, and test it causally. Where the structure is there to find, this recipe is a template for turning a black box into an instrument that can be read and turned. Where it is not, the null tests are what tell you so, which is a useful result of its own.