Introduction
Claude 3.5 Haiku learns to count characters from tokenized text, infer a document’s line width, estimate remaining space, and compare that space with its likely next word. This study combines sparse-feature attribution graphs with geometric analysis and causal interventions. The same counting representations can be described as discrete features or curved, low-dimensional manifolds; the geometric view simplifies mechanisms first located with dictionaries [6]. Biological comparisons are functional analogies, not claims of identical implementation.



Preliminaries
The authors remove and reinsert newlines in diverse prose at word boundaries for widths from 15 to 150 characters. Haiku usually adapts by the third line. Main-text features come from a ten-million-feature weakly causal crosscoder, with activations normalized to each feature’s maximum.
Four score and seven years ago our⏎ fathers brought forth on this continent,⏎ a new nation, conceived in Liberty, and⏎ dedicated to the proposition that all⏎ men are created equal.
Representing Character Count
Character count means characters since the last newline, including the current token. A linear probe after layer 1 achieves R² = 0.985, but the representation is not a single straight direction. Sparse features, a low-dimensional subspace, a curved manifold, and multiclass probes provide complementary descriptions.
Character Count Features
Ten early-layer features have smooth, overlapping responses to character-count ranges. Their receptive fields widen at larger counts, resembling a population code rather than one neuron for each number.

The Model Represents Character Count on a Continuous Manifold
Six principal components explain 95% of the variance in mean layer-2 activations across 150 counts. The resulting curved representation is closely reconstructed by interpolating between a few neighboring dictionary features; the discrete approximation has mild kinks.

Validation: The Character Count Subspace is Causal
Ablating the count subspace preferentially disrupts newline prediction. Replacing the estimated count with a different count’s mean activation shifts the linebreak decision. The controlled intervention changes adjacent token positions consistently; subspace specificity remains an assumption that is better supported here by dense count activity.


The Probe Perspective
Multiclass count probes have root mean squared error near five characters after layer 1. Six components capture 82% of their weight variance. Their similarity profiles exhibit secondary oscillatory bands, termed ringing.

Rippled Representations are Optimal
Compressing nearby-similar but distant-distinct values into few dimensions naturally produces rippled curves and ringing. Low-rank similarity approximations and a particle simulation reproduce the effect. The toy construction explains a capacity–resolution tradeoff, not a proof that every model representation is globally optimal [7].




Sensing the Line Boundary
Boundary detection compares the current character count with an inferred line-width representation, producing an estimate of remaining characters.
Twisting with QK
A boundary head’s QK transformation aligns the current-count manifold with slightly larger line-width values. Their dot product therefore detects proximity to the boundary. Other heads produce different offsets, and softmax limits the impact of secondary ringing peaks.

Left: Joint PCA of character count and line width probes.
Right: Same after multiplying them through the corresponding QK weights of the boundary head. Range is from 40 (dark) to 150 (light). View original figure

Leveraging Multiple Boundary Heads
Several boundary heads have overlapping response ranges. Their outputs combine into a two-dimensional remaining-space representation that resolves ambiguities left by any single head. Ablations and mean-vector substitutions support this representation’s causal role.




The Role of the Extra Dimensions
Multiple dimensions permit rotations, preserve distinguishability across many counts without enormous magnitude differences, and provide enough curvature for fine resolution. Multiple heads cooperate because each head’s linear mixing alone cannot produce the required output geometry.
A Discovery Story
Attribution graphs first revealed interactions between current-position features and previous-line-width features. Systematic characterization then exposed the manifolds and the attention transformations. The comparison with biological boundary cells is suggestive rather than mechanistic equivalence.

Predicting the Newline
Late break-predictor features combine remaining space with representations of the likely next word; break-suppressor features act when that word should fit. The circuit links an early perceptual calculation to a later semantic prediction.


Joint Geometry Enables Easy Computation
Remaining space and predicted-token length occupy nearly orthogonal subspaces, making the break decision approximately linearly separable. A classifier from three-dimensional mean geometry reaches AUC 0.91. The analysis labels examples with the true next token, approximating the model’s prediction, and does not explain every multitoken or uncertain-output case.

(Left) The PCA of their union. (Right) The PCA of all their pairwise combinations.
The orthogonal representations make the correct newline decision linearly separable. View original figure
A Distributed Character Counting Algorithm
Many attention heads jointly construct and sharpen the count estimate. Five key layer-0 heads yield probe R² around 0.93; eleven heads across the first two layers raise it to about 0.97. Layer-0 contributions are approximately rays, while layer-1 contributions have richer curvature.

In Layer 0, each head output is almost 1-dimensional, while in Layer 1 heads display more curvature (which they got from Layer 0!). View original figure
Embedding Geometry
Token-length information is already organized in the embedding matrix. Three principal components capture about 70% of the examined variance, revealing circular and oscillatory structure for lengths one through fourteen.

Attention Head Outputs Sum To Produce the Count
The analysis focuses on early attention because its effect on the count representation is roughly four times that of MLPs. Heads initially attend to the previous newline, then spread attention across different token ranges. Their outputs combine a position offset based on average token length with corrections for the actual lengths encountered.




Computing the Line Width
Line-width estimation appears to use a related distributed count between newlines. How the model aggregates evidence across lines—such as a maximum versus a moving average—is unresolved. Its heads partly differ from those tracking within-line position.
Visual Illusions
Certain delimiter-like strings, especially @@, divert counting heads and disrupt newline prediction despite unchanged line length. A scan over 180 two-character substitutions finds stronger effects for several code-like delimiters. Related errors appear in explicit length comparisons. These interventions support the proposed mechanism without establishing a direct equivalence to human visual illusions.

⏎@@-14,30 +31,24 @@ export interface ClaudeCodeIAppTheme {⏎



Discussion
Dictionary features enabled discovery, while controlled datasets and geometry made the computation easier to explain. Important gaps remain: uncertainty, aggregating line widths, variable-width documents, multiple candidate words, and special tokenization cases. The study is a detailed existence proof; automatically finding such simple geometric descriptions remains an open methodological problem.
Citation Information
The source provides the paper’s academic citation and bibliography.
Gurnee, et al., "When Models Manipulate Manifolds: The Geometry of a Counting Task", Transformer Circuits, 2025.
@article{gurnee2025when,
author={Gurnee, Wes and Ameisen, Emmanuel and Kauvar, Isaac and Tarng ,Julius and Pearce, Adam and Olah, Chris and Batson, Joshua},
title={When Models Manipulate Manifolds: The Geometry of a Counting Task},
journal={Transformer Circuits Thread},
year={2025},
url={https://transformer-circuits.pub/2025/linebreaks/index.html}
}Acknowledgments
The authors acknowledge manuscript reviewers, interpretability colleagues, and the teams that built attribution and QK-analysis infrastructure.
Haiku Task Performance
On 200 synthetically wrapped prose sequences across widths 20–140, Haiku generally predicts the correct newline position with high probability by the third line. Semantic next-word errors can still affect this measure even with an accurate spatial estimate.

Feature Splitting and Universality
Different dictionary sizes recover similarly placed counting features, suggesting a stable local decomposition in this setting. Some features split according to line width or proximity to the boundary. This observation does not establish that all continuous manifolds admit equally stable dictionaries.



Line Width Features
Additional figures show line-width features tiling ranges in a manner similar to character-count features.

Dynamical System Model
The physical simulation places 100 points on a unit sphere, attracts nearby indices, repels more distant indices, and applies damping with projection back to the sphere. Dimension and neighborhood width control the resulting curvature. The full source equations and parameters are retained below.
Equation
Analytic Construction of Ringing and Fourier Modes
A circulant target similarity matrix is approximated by its top eigenvectors, equivalently its dominant Fourier modes. Truncation produces ringing while preserving a linear action that shifts points around the embedded curve. Empirical Fourier fits explain nearly as much variance as PCA, and later-layer count representations become sharper with stronger ringing.



Geometry of Twisting
Joint probe visualizations show three boundary-head transformations: one preserves alignment, while the others shift it in opposite directions. These complementary offsets support the combined boundary estimate.



Break Predictor Features
Late break-predictor and suppressor families combine remaining space with token length. Some also suppress other overly long output tokens, suggesting partial constraints on alternatives rather than a newline-only switch.




Representing Token Lengths
Layer-0 token-length features overlap and are not exhaustive. Common tokens may absorb length information into token-specific features, a limitation of reading off the dictionary alone [79].

The Mechanics of Head Specialization
Heads specialize in different ranges after a newline. Their QK patterns determine how attention leaves the newline sink, and OV transforms add token-length corrections to a range-dependent baseline. A worked head example illustrates interpolation between short- and long-line estimates; other heads cover different offsets.




Layer 1 Head OVs
Layer-1 heads use both individual token lengths and the initial layer-0 count estimate, refining the representation through another distributed computation.



Full Layer 0 Attention Results
Additional prompts at different line widths display individual layer-0 head contributions and their sums, supporting the proposed distributed mechanism beyond the running example.


More Sensory and Counting Representations
The appendices report related positional representations found during the investigation, extending the study beyond fixed-width prose.
What Follows an Early Linebreak?
When a line ends early, the next word is constrained to be longer than the space left behind. Features sensitive to early line endings help predict that next word, a role obscured by simply labeling them as newline features.

Markdown Table Representations
On synthetic Markdown tables, feature families specialize to separators at particular rows or columns. Larger-table probes reveal row- and column-count geometries with ringing and curved low-dimensional structure.



Rejected Titles
The source closes with alternative working titles and technical footnotes. The footnotes qualify the dimensionality convention, data labels, interventions, and the analogy between geometric ringing and feature interference.