What does it take to find a feature manifold?

Abstract

There is a growing interest in identifying “feature manifolds” in neural network activations, where computational variables are represented with some organized geometry in low-dimensional subspaces of activation space. However, the craft of discovering and characterizing these structures in practice remains nascent. In this work, we perform a deep case study of the representation of “character count” in language models, building on the work of Gurnee et al. [1]. We use this setting to address a variety of questions related to the discovery, characterization, and theoretical origin of feature manifolds. We begin by exhaustively describing how sparse autoencoders (SAEs) “tile” the character count manifold, and find, in line with other recent work, that individual SAE latents can sometimes be poor units for decomposing representations. We then test whether methods that cluster SAE latents are sufficient to re-discover this manifold, and find that they can struggle to surface clean structure when used in an entirely unsupervised way. We next apply these lessons to discover a novel representation of character count that appears on a different data distribution from Gurnee et al. [1], finding that models represent character count modulo 8, 4, and 2 on strings of hexadecimal characters. We investigate the functional role of these representations and their universality across models. We also consider whether representations of character count are in fact part of higher-dimensional joint representations of other computational variables, which leads to some satisfying visualizations of model computation in addition to some methodological lessons about the characterization of feature manifolds in general. Lastly, we explore whether we can theoretically explain the geometry of these representations—particularly the way that representations change across model layer—via an analysis of the structure of the prediction problem these representations enable the network to solve. Our predictions qualitatively match the geometry we observe in both toy networks and LLMs. Overall, we hope our work provides useful lessons on finding feature manifolds and a calibrated picture of the difficulty of this task, while also broadening our understanding, and appreciation of the beauty of, character count representations specifically.

Introduction

How do neural networks organize their internal representations? This question, broadly construed, underlies many parallel efforts to understand both artificial neural networks and biological brains. Neural representations can be characterized at different levels of granularity. At a macroscopic level, the activity of entire populations of neurons, across a broad distribution of inputs, can be described with summary statistics [2, 3] and compared between networks [4, 5, 6, 7, 8]. At a microscopic level, individual neurons can be understood in detail in terms of how they respond to specific network inputs [9, 10, 11, 12].

There are many reasons why it is desirable to decompose neural network representations into microscopic units, like the activations of individual neurons, and to build our understanding from the bottom up [13, 14]. For one, this kind of reduction can enable a mechanistic [15] explanation of network computation: to understand how a representation is computed, we can study how its constituent units are computed from those in earlier layers, forming circuits across the network [9, 16, 17, 18, 19]. We can also hope to explain macroscopic properties of representations with reference to facts about their constituent parts. For instance, different networks might induce similar representations of inputs because they possess a set of neurons that respond to those inputs in similar ways [20].1

What units should be the basis of such low-level, mechanistic analysis? [23, 24, 14, 25] While the activations of individual neurons are obvious units and have been studied extensively, for reasons we review in Section 2, they may sometimes not be a satisfying choice. One alternative is to consider general directions, possibly distributed across many neurons, as units of analysis [26, 27, 28]. However, a growing body of work suggests that networks represent some quantities via the geometry of their activations within subspaces of dimension greater than one.2 For instance, Engels et al. [32] found subspaces where language models organize their activations on inputs referring to “days of the week” or “months of the year” along a circle, so that representations of “Sunday” are next to “Monday”. We reproduce their data for illustration below:

A large number of works have likewise documented nontrivial geometry within subspaces of activation space in both toy [33, 34, 35, 36, 37] and large-scale artificial neural networks [32, 38, 39, 40, 1, 25, 41, 42]. These structures have been variously referred to as “multi-dimensional features” [32, 43], “feature manifolds” [44, 45, 46, 1], “representation manifolds” [40] and “concept manifolds” [25]. The minimum necessary content of a discovery of one of these structures is the identification of a subspace of activation space and a distribution of network inputs such that network activations on that distribution, when projected onto that subspace, organize with some interesting geometry.3 This geometry need not be smooth in order to be interesting, and so the term “manifold” may sometimes be a misnomer [25]. In this work, we use the terms “multidimensional feature” and “feature manifold” somewhat interchangeably, but prefer “multidimensional feature” when activation geometry is not necessarily smooth.4

These structures are attractive objects of study. They are richer than individual neurons or directions, but, as units of analysis, are simpler and narrower than the entire representation space of which they are a part. They are often aesthetically beautiful, and their geometry calls out for theoretical explanation [47]. While they can be difficult to first discover, they can usually be communicated and reproduced with relatively simple recipes. The research community therefore seems poised to identify an increasing number of such structures over the coming years. Special attention was recently placed on this agenda by Bhalla et al. [25, 48], who reported several new instances of such geometry in language models, proposed an improved method for automatically discovering such structures, and emphasized the opportunity for further developing such methods.

However, the craft of discovering and characterizing multidimensional features remains nascent. As we will show, a variety of choices can change the quality of results. It is also not yet clear what standard of evidence should be met by new reports of these structures. Altogether, this ambiguity is a barrier to those attempting to discover new multidimensional features and grow this literature. Motivated by these concerns, in this work we perform a case study on identifying feature manifolds that we hope will provide useful lessons and a calibrated picture of the difficulty of this task. We begin by studying the “character count” manifold, which was discovered by Gurnee et al. [1] in Claude 3.5 Haiku, arguably the cleanest feature manifold reported thus far. Because this structure is so clean, it provides an excellent setting to test methods for discovering feature manifolds and to understand the choices that influence the clarity of results. Pulling on these threads leads us to a variety of discoveries, including the discovery of a novel multidimensional representation of character count with different geometry from Gurnee et al. [1]. We additionally attempt to give a theoretical account of the origin and geometry of these representations. Our contributions include:

  • We support recent findings that sparse autoencoders “tile” feature manifolds in unintuitive ways. We first report how sparse autoencoders (SAEs), a common technique for decomposing neural network representations into features, reconstruct the character count manifold from Gurnee et al. [1]. Our results add detail and further support to a growing literature on how sparse autoencoders “tile” [46, 1, 25] feature manifolds. We broadly find results consistent with Bhalla et al. [25], who observe similar tilings on other manifolds. We additionally observe that these tilings depend on the SAE sparsity but not on the SAE dictionary size.
  • We test methods for discovering feature manifolds with sparse autoencoders. We next investigate the difficulty of re-discovering the character count manifold using techniques that cluster sparse autoencoder latents [32, 49, 25]. We find that clustering methods can correctly group together the latents that tile the manifold, but that visualizing raw activations with these methods does not yield clean structure, emphasizing the difficulty of applying these methods in an entirely unsupervised way.
  • We discover a novel multidimensional feature that tracks character count, with different representational geometry from Gurnee et al. [1]. Applying the lessons above, we next report the discovery of a novel character count representation that appears on strings of digits and hexadecimal characters, and that represents character count modulo 8, 4, and 2. We describe this structure in detail, investigate its causal role, and also document its universality across models, with nuanced results.
  • We investigate whether the character count manifold is in fact part of an intrinsically higher-dimensional object. We then return to the original manifold from Gurnee et al. [1], but now study whether model representations jointly depend on other computational variables beyond character count. Our findings highlight some of the challenges with using centroids to characterize model representations, illustrate some further limitations of SAEs, and also give us satisfying ways to visualize model computation.
  • We explore whether we can account for the geometry of these representations from theory and with analysis of toy models. Lastly, we study a synthetic task that captures a core functional purpose of the character count manifold, and derive the predictive states that an optimal predictor must track in order to predict future tokens on that task. We show that a small toy transformer represents these predictive states, and that even when activations are averaged by these exact ground-truth predictive states, the resulting centroids still carry information about other variables correlated with those states. Finally, we propose that early layers place these states in a generically useful arrangement (which we call a coordinate embedding), while later layers arrange them by what they predict about future newlines in the specific task at hand (which we call a forecast embedding). We find that both the toy model and Gemma-2-9B qualitatively match this pattern.

This work is organized as follows. In Section 2, we review background on neural network activation geometry and sparse autoencoders. In Section 3 we replicate the character count representation from Gurnee et al. [1] in Gemma-2-9B, document how sparse autoencoders interact with the geometry of that feature manifold, and investigate the difficulty of re-discovering this manifold automatically with clustering. In Section 4, we discover and describe our novel representation of character count, its universality across models, and its causal role. In Section 5, we investigate higher-dimensional structure in models and give our theoretical analysis of these structures. We discuss additional related work in Section 6 and close in Section 7. Project code can be found at this GitHub repository.

This work is a sprawling case study and makes a very wide variety of points, both methodological and object-level. Most centrally though, we hope it serves as a useful reference for those hunting for and seeking to understand feature manifolds, and inspires similar deep-dives on other manifolds that, for now, remain waiting to be discovered.

Background: superposition, sparse autoencoders, feature manifolds

In this section, we review models of neural network activation geometry that currently underlie efforts to decompose representations into features, and give background on sparse autoencoders, the most prominent method for discovering such features automatically. We also discuss recent work on how sparse autoencoders interact with feature manifolds and how they may be used to automatically discover such manifolds.

LRH and superposition. Much work on the interpretability of neural network activations follows from two hypotheses. The first is the Linear Representation Hypothesis [50, 51, 52], which states that networks linearly encode the value of their internal computational variables fi,fj,…f_i, f_j, \ldots, called features, so that the value of these features can be “read off” via a linear map fi≈a⋅e^if_i \approx \bm{a} \cdot \bm{\hat{e}}_i from activations a\bm{a}. The second is the Superposition Hypothesis [50], which states that networks seek to represent a greater number of such features than there are dimensions in representation space, requiring features to be represented nonorthogonally (“in superposition”). Together, they suggest a model of activations as:

a(x)=∑ifi(x) e^i\bm{a}(\bm{x}) = \sum_i f_i(\bm{x}) \, \bm{\hat{e}}_i

where a(x)∈Rd\bm{a}(\bm{x}) \in \R^d is the vector of network activations, at a given layer, when the network input is x\bm{x}, fi(x)f_i(\bm{x}) is the feature value of feature ii on input x\bm{x}, and e^i\bm{\hat{e}}_i is its feature direction. Features are assumed to be sparse, meaning fi(x)=0f_i(\bm{x}) = 0 for most inputs x\bm{x}. When feature directions are approximately orthogonal and features are sparse, then interference between features is low, and a feature’s value can be approximately read off, linearly, by projecting activations onto that feature’s direction: fi(x)≈e^i⋅a(x)f_i(\bm{x}) \approx \bm{\hat{e}}_i \cdot \bm{a}(\bm{x}).

Polysemanticity. As noted in Section 1, individual neurons may not be sensible units for decomposing representations. This point is sometimes trivial: some representation spaces in artificial neural networks, such as the residual stream of transformer models, have no neurons and no “privileged” basis at all [53]. But even where neuron activations do form a basis, such neurons are often observed to be polysemantic [9]5, activating on seemingly unrelated inputs. The superposition hypothesis was motivated, in part, to explain this polysemanticity: if a network represents more features than there are neurons at a given layer, then these feature directions e^1,e^2,…\hat{e}_1, \hat{e}_2, \ldots cannot all be assigned to unique neurons, and so some features must be distributed across neurons. Consequently, individual neurons will participate in representing multiple features, leading to polysemanticity.

Sparse autoencoders. If the superposition hypothesis describes neural network representations, then we may automatically recover the underlying feature directions and feature values with sparse dictionary learning [55, 56, 57, 58]. A simple and popular method is the sparse autoencoder (SAE) [59, 60, 44, 61]. An SAE consists of an encoder z=Enc(a)=σ(Wea+be)\bm{z} = {\rm Enc}(\bm{a}) = \sigma(\bm{W}_e \bm{a} + \bm{b}_e) and a decoder a′=Dec(z)=Wdz+bd\bm{a'} = {\rm Dec}(\bm{z}) = \bm{W}_d \bm{z} + \bm{b}_d, where We,be,Wd,bd\bm{W}_e, \bm{b}_e, \bm{W}_d, \bm{b}_d are learned and σ\sigma is a nonlinearity. SAEs are trained with gradient descent to minimize a loss like ∥a−a′∥22+λ∥z∥0\| \bm{a} - \bm{a'} \|_2^2 + \lambda \| \bm{z} \|_0, which induces the SAE to reconstruct activations as a sparse linear combination of the columns of Wd\bm{W}_d, the SAE’s latent directions (also called decoder directions). The hope is that these latent directions recover the network’s underlying feature directions e^i\bm{\hat{e}}_i and the latent activations ziz_i track the feature values fif_i. In practice, the activations of these latents, zj(a)z_j(\bm{a}), within trained SAEs, have been found to activate more monosemantically than individual neurons do in large language models [61], suggesting that they are better units of analysis than neurons and may correspond with the underlying model features.

Multidimensional features. Following early speculation about “feature manifolds” by Bricken et al. [44], Engels et al. [32] argue that some features may indeed be irreducibly multidimensional, taking values fi(x)∈Rdi\bm{f}_i(\bm{x}) \in \mathbb{R}^{d_i} within did_i-dimensional subspaces of activation space, and suggest a multidimensional superposition hypothesis6, where neural network activations are modeled as:

a(x)=∑ifi(x) Vi\bm{a}(\bm{x}) = \sum_i \bm{f}_i(\bm{x}) \, \bm{V}_i

where Vi∈Rdi×d\bm{V}_i \in \mathbb{R}^{d_i \times d} are matrices whose rows provide a basis for the subspace in which feature ii is represented.7

SAEs and multidimensional features. Sparse autoencoders were motivated to recover the individual feature directions e^i\hat{e}_i underlying the one-dimensional superposition hypothesis. How do they behave when some features are multi-dimensional? Can they be used to recover the subspaces Vi\bm{V}_i instead?

When there exist multidimensional features, multiple SAE latents must participate together in reconstructing the value of one of these features fi\bm{f}_i. The particular manner in which multiple SAE latents perform this reconstruction has been referred to as “tiling” [46, 1, 25]. When SAEs use multiple latents to reconstruct a multidimensional feature, we can then hope to discover these multidimensional features by identifying (e.g. by clustering together) the particular subset of SAE latents that tile that feature, whose decoder directions lie in the subspace Vi\bm{V}_i. This is an attractive method for discovering multidimensional features because it simultaneously gives us a subspace of activation space—the subspace spanned by the decoder directions of the latents in the cluster—and a distribution of network inputs where a multidimensional feature is represented by the network—usually defined as those inputs, within some corpus, that activate any of the SAE latents in the cluster.

Motivated in part by experiments on toy data8, Engels et al. [32] introduced and applied this approach to discover their multidimensional features (e.g. “days of the week”) by clustering SAE latents by the cosine similarity of their decoder directions. For each cluster, Engels et al. [32] use their SAE to reconstruct activation vectors using only the latents in the cluster, and then visualize the resulting point clouds with PCA. In the visualization below, we reproduce their data and show the decoder directions of the SAE latents that were clustered together to yield the “days of the week” and “months of the year” features in their pipeline:

Recently, Bhalla et al. [25] perform a much more exhaustive set of toy data experiments to characterize how sparse autoencoders tile feature manifolds, and propose to instead cluster SAE latents by their co-activation statistics, in particular by a measure of co-activation inspired by the Ising model.9 One of our contributions here is to evaluate these methods. Overall, we find that the method proposed by Bhalla et al. [25] performs better than related methods in the setting we study, though we also caution against the use of this class of methods (such as both Engels et al. [32] and Bhalla et al. [25]) in an entirely unsupervised way.

A case study on the character count manifold

Perhaps the most beautiful feature manifold reported thus far in the literature is the “character count” representation from Gurnee et al. [1]. In this section, we replicate this manifold in an open-weight model and use it to investigate a variety of methodological questions about sparse autoencoders and their use for discovering feature manifolds. Many of our experiments are motivated by the question of how difficult it would be to discover the character count manifold as if “from scratch” with automated methods.

We report several findings. First, we find that the manifold changes substantially across layers, emphasizing the importance of looking for structure across all model layers. We next study how SAEs tile the manifold, and find that they tile it in unintuitive ways, depending on the SAE sparsity. We lastly test whether we can find the latents that tile the character count manifold automatically via clustering, and indeed we find we can, but we also find that using these latents to then directly visualize model activations does not yield clean structure. We think these lessons will be of interest to those searching for other similar structures, and we successfully apply them in Section 4 to discover a new multidimensional feature.

We note that some of our observations in the first half of this section overlap with earlier work by Sinii and Balagansky [67], who reproduced the character count manifold in several open-weight models and also identified latents, in some SAEs, that responded to character count in these models. Our analysis builds on this work to more systematically understand how sparse autoencoders interact with the geometry of the character count manifold and additionally to understand whether automated methods can re-discover this manifold. We acknowledge points of overlap where relevant below.

Locating the manifold

Implicit in the next-token prediction objective of language model pretraining are a huge variety of computational tasks [21]. In natural text corpora, many documents contain text that is broken, where newlines are inserted periodically so that each line of text doesn’t exceed a given number of characters. When these documents are tokenized, newline tokens occur at the end of each line, spaced apart by roughly ww characters, which we refer to as the “document width” or just “width” [1]. The pretraining objective therefore encourages language models to learn to recognize this pattern and to develop mechanisms to predict these newline tokens in the correct position. Gurnee et al. [1] found that, to do this task, Claude 3.5 Haiku computes a count of the number of characters seen on each line of text—the “character count”—and compares this count to the width of the previous lines so as to predict the newline token with high probability as the character count approaches that width. In particular, they find that character count is represented as a point along a spiral in the residual stream at an early layer of the model.

The simplest recipe given by Gurnee et al. [1] to visualize this character count representation is to compute centroids:10 across a corpus of line-broken documents, compute the mean residual stream activation at all token positions which are the same number of characters into their line of text, where the current token’s characters contribute towards that count. For our replication, we take paragraphs from Project Gutenberg books [68, 69] and insert newlines so that the text is wrapped with a fixed width. We use widths w∈{20,21,…,160}w \in \{20, 21, \ldots, 160\}, and create 20 documents per width.11 Documents each contain between 10 and 50 lines. We refer to this as our “synthetic prose corpus” and compute centroids by character count on these documents. We exclude tokens within the first three lines from the centroid computation. Below, we exhibit a few of the documents from this corpus, and illustrate what these equivalence classes of tokens (by character count) that we compute centroids across, look like:

In the widget above, selecting “show Gemma-2-9B newline probs” highlights the tokens in these documents according to the probability that Gemma-2-9B predicts that those tokens will be a newline token. We see that by the second or third line within these documents, the model begins to predict newlines in roughly the correct place at the end of the lines. Doing this requires the model to infer the document width from the first couple lines.

When activation centroids are computed across these equivalence classes of tokens, the resulting set of points exhibits beautiful geometry. We compute centroids for character counts 10-150 and perform PCA, visualizing these centroids along PCs 1-3 and 4-6 as in Gurnee et al. [1] and Sinii and Balagansky [67], below:

Representations of character count in the residual stream of Gemma-2-9B, across layers. Across a corpus of documents with fixed maximum line width, we compute mean residual stream vectors across all tokens that are the same number of characters into their line, for character counts 10-150, and perform PCA on these centroids. We show projections onto PCs 1-3 on the left and PCs 4-6 on the right. Scanning across layers, we find that although centroids are organized continuously by character count across all layers, it is only in layers 11-14 where character counts have particularly distinct and interesting geometry, forming a spiral shape. From layer 15 onward, most of the variance of these centroids lies in the first PC (see Figure 26).

In the figure above, we show centroids across all layers of the residual stream.12 Scanning across layers, we observe that (1) across all layers, centroids are organized geometrically along a line, roughly in order of character count, but (2) there is a narrow band of layers—layers 11 to 14—where centroids have a distinctly ordered and beautiful spiral geometry. This dependence on layer can also be seen in the interactive figures of Sinii and Balagansky [67], who additionally fit linear probes at each layer and find that character count is most linearly decodable around these same layers.

From these observations, we note a couple of simple takeaways for practitioners interested in discovering and characterizing feature manifolds. First, representations change substantially across layers. There is a very particular set of layers where model representations are richest, and so when searching for a clean representation of some structure, one should make sure to visualize representations across all model layers, whenever possible. It would be easy to miss this structure if one only looked at a single layer. Second, even at layers where model representations are not particularly rich, the centroids are still arranged continuously by character count in the top PCs. One therefore has to be cautious: just because activations (especially centroids) appear somewhat organized, that observation alone may not correctly characterize the model’s true or richest representation of some feature. We will return to some of the challenges with centroids again in Section 5.

A close look at SAE tiling

As mentioned earlier, the way that sparse autoencoders reconstruct or “tile” feature manifolds is a subject of contemporary interest. Having located the character count manifold, we next study how sparse autoencoders tile it. We focus on layer 11 of Gemma-2-9B, the first layer in the band from layers 11-14 where representations appeared richest, and use the Gemma Scope SAEs [70]. Our results here set up our study of automated methods later in this work (Section 3.4). Gurnee et al. [1] documented how crosscoders “tile” the character count manifold in Claude 3.5 Haiku, and found that their crosscoder latents respond to a specific and contiguous range of character counts, giving a sensible “featurization”. We find a somewhat more nuanced story for SAEs.

We select an SAE from layer 11 of Gemma-2-9B with 16k latents and average L0 of 118 (the mean number of latents active per token), and apply a method we describe in Section A.4.2 to identify a subset of these latents that together reconstruct the character count manifold.13 Our basic approach to finding these latents involves ranking latents along a few metrics (such as the mutual information between their activations and the character count of the network input token, across our synthetic prose corpus), and keeping latents that are top-ranked along all metrics.

We identify a set of 20 latents that tile the character count manifold. We visualize some properties of these latents below. In Figure 2, we plot (1) their geometry, i.e. the arrangement of their decoder directions relative to the character count centroids and (2) their tuning curves, or rather the probability that a latent activates (zj(x)>0z_j(\bm{x}) > 0) as a function of the character count of the network’s input token14, across our synthetic prose corpus:

A close look at how an SAE tiles the character count manifold. We find that sparse autoencoder latents exhibit tuning curves that reflect the geometry of model activations more than semantic meaning. Left: the character count representation manifold, shown via centroids as in Figure 1. We also plot the decoder directions of SAE latents that reconstruct this manifold, emanating from the SAE decoder bias. We also plot the activation centroids for residual stream vectors after reconstructing such vectors using only this subset of SAE latents. Right: tuning curves for SAE latents as a function of character count. We find that some latents have bimodal or even slightly trimodal tuning curves, activating strongly at multiple distinct ranges of character counts. Selecting one of these latents (e.g. 8998) highlights in the left subfigure the centroids according to the probability that that latent tends to fire on tokens at that character count. We see that the disjoint intervals of character counts that activate these latents are on geometrically the same “side” of the helix relative to the SAE decoder bias vector, explaining why these tuning curves have multiple humps.

Selecting individual latents in this interactive figure highlights that latent’s tuning curve, and also colors the points on the manifold according to the latent’s probability of activating at the corresponding character count. Observing these tuning curves, we find results broadly consistent with what Bhalla et al. [25] describe as “dilution”, where multiple SAE latents co-activate to reconstruct activations along different parts of the manifold. We also observe that some of these latents have bimodal or even slight trimodal tuning curves, activating on multiple separated intervals of character counts. Looking carefully at the left subplot, we can see that the latents that exhibit bimodal tuning curves have decoder directions that point in directions where the helix doubles back on itself. The tuning curves therefore reflect the geometry of the underlying model representations more than semantic meaning.15

The existence of these bimodal tuning curves likely implies these SAE latents are poor units for reasoning about model computation [25]. It also further complicates the problem of interpreting what an SAE latent is doing. To make this point clear, we show how our group of 20 SAE latents respond to tokens within a specific document from our synthetic prose corpus:

We exhibit how SAE latents that respond to character count activate on tokens in a specific document. In this document, we see concretely how some latents respond at multiple disconnected sections along each line. These patterns of activation would make the task of “interpreting” such latents challenging without understanding the geometry of the underlying model representations these latents are reconstructing.

The most common way of coming up with an “explanation” for an SAE feature is to look at the contexts where it activates. Needless to say, it would be very difficult to come up with such an explanation for some of these features. The contexts in which they activate only make sense in light of the underlying geometry of the model representations that they reconstruct. We also note the importance of looking at the tokens that activate these latents within an entire document, as opposed to looking at individual max-activating tokens within a short context.

These results are also somewhat of a counterpoint to Gurnee et al. [1], who found that their crosscoders gave a “featurization” of the character count manifold that was better-behaved: each latent responded to a specific contiguous range of character counts. We find that this need not be the case, at least for the SAEs we study, though it is sensitive to the sparsity of the SAE, which we explore next.

Tilings are canonical across dictionary size but not across sparsity

We now report how these tilings vary with SAE dictionary size and sparsity. Across several SAEs in the Gemma Scope suite, we apply the same criteria as above to identify SAE latents that tile the character count manifold. The SAE sparsity is described using the L0, the average number of SAE latents with nonzero activation as reported in the Gemma Scope release [70].

In the figure below, we show tuning curves for these latents in six SAEs of varying dictionary size and sparsity:

SAE sparsity determines tiling, not dictionary size. For a variety of Gemma Scope SAEs for Gemma-2-9B at layer 11, we identify latents that respond to character count and plot their tuning curves. Comparing subplots within columns, we find that SAEs of different dictionary size, but similar sparsity, allocate a similar number of latents to reconstructing the character count manifold, with similar tuning curves. However, comparing subplots within rows, we see that SAEs of different sparsity tile the manifold with a qualitatively different number of latents having different tuning curves. This picture somewhat complicates the claim from Gurnee et al. [1] that “featurizations” of the character count manifold are canonical. We find that they are canonical across dictionary size, but not sparsity. Note that SAE sparsities are less well-matched in the right column, and, accordingly, we find that the subplots in that column are less alike than other columns.

Overall, we observe that for SAEs with similar sparsity, a similar number of latents tile the character count manifold, and that these latents have qualitatively similar tuning curves. However, we find that SAEs with different sparsity have quite different tilings.

We find these observations noteworthy for a couple of reasons. For one, Michaud et al. [46] expressed concern that as SAEs are scaled to larger dictionary size, they may pathologically allocate a large number of latents to tile common feature manifolds, since doing so can improve the sparsity at which an SAE reconstructs a given manifold (at least in some of the toy settings they studied). Our observation that SAE tilings are consistent across SAE dictionary size is evidence against this being a practical concern, though the range of SAE dictionary sizes we study here is still relatively narrow, and we cannot rule out that much larger SAEs might exhibit different behavior. Gurnee et al. [1] similarly found that in crosscoders of different scale (1M, 3M, and 10M latents), an identical number of latents appeared to tile the character count manifold and that these latents had almost identical tuning curves. They suggest that the “featurization” (tiling) their crosscoders provide is “canonical”. We refine this picture, and find that these tilings are canonical across dictionary size, but vary quite substantially with SAE sparsity.

Our results here may also have some relevance to the question of how to choose the SAE sparsity in practice. While it might be tempting to use very sparse SAEs because their latents are simpler to understand (in our SAEs above with L0 ≈10\approx10, each latent activates in a contiguous range of character counts), these SAEs can poorly reconstruct the underlying feature manifold. In Figure 4 above, we can see that the very sparse SAEs we analyze (left column) often don’t fire any of the latents that tile the character count manifold at low character count, necessarily leading to poor reconstruction of this feature. We show this directly in Section A.4.4, where we find that character count centroids, after reconstructing activations with the latents that tile the character count manifold, have different geometry from the centroids of the full activations.

Re-discovering the character count manifold

Having located the manifold and characterized how SAE latents tile it, we now turn to the question of whether automated methods can re-discover this manifold. As noted in Section 2, a popular method for discovering multidimensional features is to cluster SAE latents to attempt to identify the subset of latents that together tile some particular feature. Having manually identified the subset of latents that tile the character count manifold earlier in this section, we now ask whether unsupervised clustering methods could have automatically surfaced this precise set of latents. We find that this provides a nice benchmark for methods that purport to discover feature manifolds via clustering in this manner.

Engels et al. [32] cluster SAE latents according to the cosine similarity of latent decoder directions. They used spectral clustering or simply found connected components of a graph whose nodes are SAE latents and where an edge connects two nodes if the cosine similarity between the corresponding decoder directions for those latents is above some threshold. Bhalla et al. [25] instead suggest clustering SAE latents by co-activation statistics, and propose a measure of co-activation based on the Ising model, which we review in Section A.4.5. Bhalla et al. [25] also use network community detection algorithms for the clustering step. To evaluate these methods, we construct a graph with nodes corresponding to each of the 16k latents in the layer-11 SAE with average L0 118 from Section 3.2. We then assign edge weights between latents according to either their decoder direction cosine similarities, or one of four co-activation statistics computed over ∼1{\sim}1B tokens of The Pile [71, 72] (PMI, NPMI, Jaccard similarity, and Ising couplings, which we estimate with a mean-field approximation, see Section A.4.5 for details). We keep the 3 million edges in this graph with highest weight and apply the Leiden community detection algorithm16 across a range of “resolution” parameters, which control the typical community size. For each resulting partition of the graph (and thus of the SAE latents), we identify the community of latents with the maximum intersection over union (IoU) with the set of latents we had manually found in Section 3.2. We give full details in Section A.4.5. We report these IoU scores across resolutions below:

Comparison of methods for re-discovering the set of latents that tile the character count manifold. We run the Leiden communities algorithm across “resolution” parameters for different notions of edge weight between latents, then report the maximum intersection over union (IoU) of the resulting communities with our set of latents we had manually identified as tiling the character count manifold and showed in Figure 2. We find that a method similar to Bhalla et al. [25] (gold line) performs best.

For these experiments, we chose an SAE with high L0 (118) instead of one with low L0 (e.g. 10) because from Figure 4 we saw that the tuning curves for latents in high-L0 SAEs overlap much more, implying they co-activate more commonly, and so perhaps are more likely to be clustered together with co-occurrence-based clustering methods. In Figure 5, we find that our replication of the Ising couplings approach of Bhalla et al. [25] recovers our manually identified reference set of latents best across almost all choices of Leiden resolution values we considered.

Our highest-IoU community has IoU of 0.71 with a Leiden resolution of ≈200{\approx}200. This community has 21 latents, 17 of which are in the reference set. While an IoU of 0.71 relative to the set of manually identified latents may seem somewhat discouraging, looking carefully at the latents in this community gives us an optimistic picture: all of the latents that respond most strongly to character count are in the community, with only a few extra latents included in the community and a few less-important manually identified latents excluded from the community. We emphasize that the only information that the community detection algorithm uses is the co-occurrence statistics of the SAE latent activations on a broad text corpus. Below, we show the tuning curves for these latents and color them according to whether they are shared between the community and the manually identified set or are specific to each:

Community detection identifies the most important latents that tile the character count manifold. We show tuning curves for latents that tile the character count manifold, colored by whether they are clustered together in the same “community” by the Leiden community detection algorithm versus are in our manually identified reference set of latents that we believe tile the character count manifold. We find most of the latents that we had manually identified as responding strongly to character count are included in the cluster.

While it is encouraging that clustering can group together the latents that tile the character count manifold, clusters like these are then meant to be used to visualize activations directly. To recall, the basic approach from Engels et al. [32] and Bhalla et al. [25] is to (1) across a natural text corpus, identify the activation vectors that activate any of the SAE latents in a given cluster and then (2) project these activations onto the subspace spanned by the SAE decoder directions in the cluster, then visualize these activations with PCA [32, 25]. We test whether methods like this recover the helical character count manifold. To do so, we project activations across two different input distributions: random documents from The Pile versus our synthetic prose corpus, and also using two different projection methods: reconstructing activations using only the latents in the cluster and then performing PCA on the resulting point cloud, like Engels et al. [32] versus projecting activation vectors directly onto the subspace spanned by the cluster’s decoder directions, like Bhalla et al. [25]. In the figure below, we find that neither combination of these methods recovers a particularly clean helix:

Visualizing activations using the SAE latents that tile the character count manifold does not recover clean structure on a realistic distribution of documents. We run Gemma-2-9B on documents from The Pile (top) or on our synthetic prose corpus (bottom) and identify activation vectors that cause latents in our community of latents to fire, project those activations onto the subspace spanned by the decoder directions of the latents in the community, and then visualize with PCA. We find that on The Pile, the resulting visualizations of activations do not show clean structure. This result highlights the difficulty of applying some feature manifold discovery pipelines in an entirely unsupervised way.

In this figure, by default we do not color points by the character count of the input token, but provide the option to turn this on. We think the non-colored versions give a more realistic picture of what unsupervised methods like this would produce “in the wild”, where there isn’t an obvious unsupervised scheme for coloring activations. Overall, we observe that the distribution of documents that produced the activations matters much more than the particular projection method used. Our synthetic documents produce structure that is closer to the geometry of the spiral, where activations appear to be arranged along a messy cone. However, this distribution of documents was created manually. The point clouds we get from The Pile (top row) are accordingly a more realistic picture of what one would get applying these methods in practice.

We are uncertain as to why these point clouds, especially on The Pile, obscure the structure of the character count representation. In Appendix Section A.4.6, we instead project these activations onto the subspace given by PCA on the character count centroids, and find that the resulting point cloud, even for activations on The Pile, is indeed closer to the point cloud from our synthetic prose corpus. This suggests that at least part of the problem is that automated methods that perform PCA on raw activations, even after projecting onto the subspace spanned by a cluster of SAE latents, identify the wrong subspace. We note though that even projecting onto the right subspace, we find that activations on The Pile are still messier than on our synthetic corpus. We leave a full analysis of this problem to future work.

The geometry of some language model features clearly can be elicited by methods that cluster SAE latents and then project raw activations, as was shown in Engels et al. [32] for their “days of the week” and other examples, and Bhalla et al. [25] for their examples. Yet for some structures, like character count here, where there is indeed an underlying order to network activations, this structure appears harder to automatically visualize. We think this points to an intriguing possibility, that there may be many beautiful structures underlying neural network activations, but that our current techniques just fail to reveal this structure.

In this section, we were motivated to understand the difficulty of re-discovering the character count manifold from Gurnee et al. [1]. We found:

  1. There is a relatively narrow range of layers where this manifold appears.
  2. Looking at one of these layers, we found that there is a particular set of SAE latents that together reconstruct the character count manifold, as in Gurnee et al. [1] and Sinii and Balagansky [67].
  3. These latents respond to character count in somewhat unintuitive ways, reflecting the geometry of the underlying model representations more than semantic meaning or computational role.
  4. Looking at max-activating individual tokens for these latents likely does not easily lend itself to their interpretation, though looking at their activations across whole documents gives a better picture.
  5. We found that we could automatically cluster SAE latents by methods similar to Bhalla et al. [25] with one of the resulting communities recovering the particular set of latents that tile the character count manifold reasonably well.
  6. Lastly, we find that visualizing raw activations using this community of latents does not recover a clean character count representation.

These combined observations suggest that clustering SAE latents may be a useful exploratory step in the discovery of feature manifolds, but that additional work is required to cleanly visualize and characterize these structures. Such work might include constructing a synthetic distribution of inputs and computing centroids. We next apply these lessons to discover a novel multidimensional representation in language models, which also appears to track character count.

A novel periodic character count representation

In this section, we discover a new multidimensional feature that also appears to track character count on a different distribution of text documents from the manifold from Gurnee et al. [1], and has distinct representational geometry. We first describe how this structure can be found, further contributing to the methodological points from the previous section. We then answer a variety of object-level questions about its structure, universality across models, and causal role, which we hope will be of independent interest.

A cluster of SAE latents with periodic tuning curves

In the previous section, we found we could re-discover the set of latents that tile the character count manifold from Gurnee et al. [1] using a method similar to Bhalla et al. [25]: one of the communities produced by the Leiden community detection algorithm consisted of the latents that tile the character count manifold. Looking across other communities from that same SAE, we find a different community containing 14 latents that have a curious pattern of activation. Across a variety of documents from The Pile, we find that the latents in this community activate periodically, roughly every 8 characters, on strings of decimal or hexadecimal digits.17 We note that this community has 14 latents at a Leiden resolution of 116, which is different from the Leiden resolution of 200 which produced the best cluster for the character count manifold in the previous section. At a resolution of 200, this new community splits into 4 separate communities, illustrating the difficulty of choosing a single “correct” resolution value. For some of the latents in this new community, we highlight tokens that they activate on, across some of their max-activating documents from The Pile, below:

We see that these latents activate on strings of decimal and hexadecimal digits within documents that have an exact fixed width.18 These patterns of activation reminded us of our earlier study of the latents that tile the character count manifold in Figure 3, where some latents activated on tokens in multiple vertical bands within line-broken documents. We found that this pattern of activation ultimately reflected the helical structure of the model’s underlying representation of character count. For this new cluster of latents, we see a similar pattern, which led us to conjecture that there is some separate representation of character count within these documents that winds around with higher frequency.19

Character count representations on hexadecimal strings exhibit periodic structure

To investigate these representations, we use a recipe similar to what we used earlier in Section 3.1. Instead of using a corpus of prose documents though, we create a new corpus of fixed-width documents containing lines of random hexadecimal characters separated by newlines, where each line has exactly the same number of characters. Widths range from {20,21,…,80}\{20, 21, \ldots, 80\}, and we create 20 documents per width. We refer to this as our “synthetic hex corpus”. As we saw above, documents with this structure occur within natural text corpora. We show some of these synthetic documents below:

In the widget above, we again provide the option of showing the probability that Gemma-2-9B assigns to the newline token at each token position within these documents. Unlike in our prose documents, where the model sometimes predicts the newline token early, we find that on these documents the model assigns ≈0{\approx}0 probability to the newline token up until the newline token actually occurs, where the model predicts the newline token with close to 100% confidence. This confidence is possible because each line within these documents has exactly the same width.

Across these documents, we collect residual stream activations and compute centroids according to each token’s character count into its current line, excluding the first three lines, for character counts 10-80. We perform PCA on these centroids and show their geometry across all model layers in the figure below:

Representations of character count on hexadecimal strings, in the residual stream of Gemma-2-9B, across layers. Across a corpus of documents containing strings of hexadecimal characters of fixed line width, we compute mean residual stream vectors across all tokens that are the same number of characters into their line, for character counts 10-80, and perform PCA on these centroids. In contrast to the representations of character count on prose documents, where centroids for adjacent character counts are arranged closely together, we find that centroids on these hex documents are much more spread apart. They also are periodic: in the plane defined by principal components 2-3 in layer 12, we see that centroids have similar placement every 8 characters.

We find that, unlike in the smooth “prose” character count representation from the previous section, the character count centroids on our hex documents are much more spread apart. Looking closely at these centroids in PCs 1-3 (left subplot above) at layer 12, we find that indeed these centroids form a helix that winds around roughly every 8 characters. We were therefore able to correctly infer something about the geometry of model representations by looking at the patterns of activation within a cluster of SAE latents. The periodic pattern of the SAE latent activations reflects an underlying periodicity to model representations.

On these strings (unbroken strings of hex, digits, etc.), we understand the model’s representation of character count to have the following structure: the model computes the character count representation from Gurnee et al. [1], which we now refer to as the “prose character count manifold”, as before in a similar subspace. However, the model additionally represents character count modulo 8, 4 and/or 2 in subspaces nearly orthogonal to the prose character count manifold.20 Principal components of our character count centroids can mix these subspaces, but we can isolate them with Fourier analysis.

We first measure periodic structure by computing a Fourier transform on our collection of centroids. Using the centroids for character counts 12-75 (giving us 64 vectors), we take a discrete Fourier transform across character count for each residual-stream dimension, after centering each layer’s centroids and normalizing them by their Frobenius norm. Summing the squared magnitudes across dimensions gives a “Fourier power” at each period P=64/kP = 64/k characters (k=1,…,32k = 1, \dots, 32). This gives us a measure of the degree to which representations have periodic structure with a given period. For layer 12 of Gemma-2-9B, we plot this metric below for character count centroids on both our synthetic hex corpus and our synthetic prose corpus:

Fourier spectrum of character count centroids in Gemma-2-9B at layer 12, on hex and prose documents. For character counts 12-75, we take a discrete Fourier transform along character count for each residual stream dimension and sum the squared magnitudes across dimensions. We plot this Fourier power at each frequency, labeled by its period in characters. Both corpora here use line widths 20-99. On hex documents, the spectrum has a large peak at period 8 and a smaller peak at period 4. On prose documents, the spectrum decays smoothly with no peaks. The y-axis is on a log scale by default, which makes the period-4 peak easier to see; a button switches it to linear.

We find that on our hex strings, representations have periodic structure with period 8 and (less obviously) period 4 that is not present in the prose character count centroids. In Figure 33 we show similar results across layers and also across open-weight models, and find consistently that periodic structure with these periods is absent in prose documents but present in hex.

We next identify the planes in the residual stream where this periodic structure is represented. To do this for a given period PP, we again center our centroids, then fit these centroids by least squares to cos⁡(2πc/P)\cos(2\pi c/P) and sin⁡(2πc/P)\sin(2\pi c/P), where cc is the character count, giving us two directions in the residual stream. We orthonormalize these two vectors and then project centroids onto the resulting plane. The centroids form octagons for period 8 and squares for period 4. We show these projections for layer 12 of Gemma-2-9B below:

Character count centroids on hex documents in Gemma-2-9B at layer 12, projected onto the period-8 and period-4 planes. For each period PP, we take our collection of centroids by character count (at character counts 12-75), center them, and fit them by least squares to cos⁡(2πc/P)\cos(2\pi c/P) and sin⁡(2πc/P)\sin(2\pi c/P), giving us two directions in the residual stream. We then orthonormalize these directions and project centroids onto the resulting planes. By default, we color centroids by character count modulo PP.

We find that these planes are nearly orthogonal to the prose character count manifold. At layer 12 of Gemma-2-9B, each of the period-8 and period-4 planes contains less than 1% of the variance of the prose centroids (Section A.5.1).

We note that on our synthetic hex corpus, there is a much closer relationship between character count and token position than on prose, since most tokens have only a single character. However, we do not believe that the periodic structure we observe in this section is a naive consequence of language model positional embeddings (Gemma-2-9B uses RoPE). In Figure 35, we report that this periodic structure is represented on strings of hexadecimal and base-10 digits, but is largely absent on strings of alphabetical characters that we manually tokenize to have a single character per token.

Periodic structure is only weakly universal across models

We next investigate the degree to which these periodic representations of character count are universal across language models. Broadly, we find that different models represent character count mod 2, 4, and 8 to varying degrees, and so the universality of these representations is somewhat subtle. In Figure 11 below, we show heatmaps of the Fourier power as in the previous section, but now across both model layer and period for Gemma-2-9B, Gemma-4-31B, and Qwen3-8B. We find that Gemma-2-9B has representations with period-8 more strongly than period-4, that Gemma-4-31B represents periods 8, 4 and 2 clearly, and Qwen3-8B represents period-4 and period-2 but does not cleanly represent period-8. We also show projections of character count centroids for these models onto the corresponding planes for a given period, as in the previous section.

Models represent character count within strings of hexadecimal characters via a periodic multidimensional feature, with different periods represented more strongly by some models than others. For three models, we show the Fourier power of the character count centroids on our synthetic hex corpus and the centroids projected onto the plane of one period at one layer (top), colored by character count modulo that period. In Gemma-2-9B (layer 12) and Gemma-4-31B (layer 32), the centroids form octagons in the period-8 plane. In Qwen3-8B (layer 17), they form a square in the period-4 plane. Hovering over a cell in the heatmap in the period-8 or period-4 lines shows the centroids projected onto that period’s plane at that layer.

Overall, we see that different models represent character count mod-P to varying degrees for different P. We show similar heatmaps for a wider range of models in Figure 34, and find that models within families are more similar than models between families.

To see the difference between these models in another way, we show PCA of the hex character count centroids for Qwen3-8B, and see the period-4 structure directly in the top PCs, similarly to how we first observed the period-8 structure in Gemma-2-9B. The first principal component aligns with a linear representation of character count, and so character count centroids in Qwen3-8B are arranged in a “box” shape in PCs 1-3:

Representations of character count on hexadecimal strings, in the residual stream of Qwen3-8B, across layers. We use the same synthetic hex corpus and method as in Figure 8: we compute mean residual stream vectors across all tokens that are the same number of characters into their line, for character counts 10-80, and perform PCA on these centroids at each layer. We find that the period-4 structure of Qwen3-8B shows up in the PCA, in contrast to the period-8 structure we saw earlier in Gemma-2-9B, reflecting the fact that Qwen3-8B represents character count mod 4 much more strongly than character count mod 8, whereas Gemma-2-9B represents character count mod 8 more strongly than mod 4.

Overall, our results in this section contribute to an ongoing line of work studying the degree to which different models learn similar representations. While representations can be compared between networks at a very coarse level, for instance with measures of kernel similarity [8, 4, 5], another line of work in the interpretability literature studies whether models share individual low-level features [9]. For instance, networks might possess individual neurons [73, 20] or, more generally, feature directions [44] that activate similarly across inputs. Multidimensional features provide a new level to study universality, where we can ask whether the particular geometry of these features is shared across networks. Here, we find a subtle story, where models represent character count periodically but where some periods are represented more cleanly than others, exemplifying a kind of “weak” universality that has also been observed in some toy settings [74].

We encourage future work aimed at explaining the origin of these representations and accounting for the differences we observe between models.

Causal role of periodic representations

We now investigate the functional role of these periodic representations. We consider two main hypotheses:

  1. Unlike in prose, where each line width varies slightly depending on the length of the words that occur near the line breaks, on our synthetic hex corpus all lines have the exact same width, and indeed we saw that some pretraining documents have this same structure. In these documents, the fact that all line widths are exactly equal allows for models to predict the position of the newline tokens extremely confidently. Accordingly, we conjectured that the addition of the periodic representations helps the model “spread out” its representations of character count in activation space, helping the model represent character count with lower chance of error and thereby predict the newline position with higher confidence.
  2. In some natural documents, there may be strings of hexadecimal characters that have variable length, but where strings are always multiples of some number of characters (multiples of 8 characters, for instance). When a model encounters each such string in these documents, it will be optimal to place some probability of the string ending periodically (e.g. every 8 characters). The discrete, periodic representations we observe could be used to track position within such strings for this purpose.

Overall, we find stronger evidence for hypothesis #2 above, that periodic representations are used to predict the ending of strings of hex characters periodically, when the model knows string lengths will be a multiple of some number of characters, but is uncertain exactly how long each string will be.

To test this, we create documents containing lines of random hexadecimal characters separated by newlines, but where the width of each line is randomly and independently chosen from {16,24,32,…,64}\{16, 24, 32, \ldots, 64\}. We create documents each with 30 lines. After the first few lines, we find in Figure 13 that Gemma-2-9B indeed begins to predict the newline token with low confidence every 8 characters in these documents.

To test whether the model uses the periodic representations to make these predictions, we ablate them during the forward pass. At each layer, we find the period-PP plane with the method from Section 4.2: we fit the hex centroids by least squares to cos⁡(2πc/P)\cos(2\pi c/P) and sin⁡(2πc/P)\sin(2\pi c/P), which gives two directions in the residual stream, and orthonormalize them. We ablate the period-8 plane, the period-4 plane, or both planes together (the 4-dimensional span of the two). Since we are specifically interested in the causal effect of the periodic representations, we take care to avoid ablating the smooth prose character count manifold. Before ablating any of these subspaces, we remove its overlap with the prose character count representation by taking the top 10 principal components of the prose character count centroids at that layer, subtracting their span from the subspace, and re-orthonormalizing, so that the ablation leaves the prose representation unchanged. At every layer from 6 to 36 and at every token position, we set the residual stream’s component in the subspace to its value at the mean of the hex centroids, and leave all orthogonal directions unchanged (see Section A.5.2 for more detail).

In Figure 13 below, we see that without any ablation, the model assigns some probability of the newline token every 8 characters: the probability assigned to the newline token oscillates, “spiking” every 8 characters. When we ablate the period-8 and period-4 planes, these oscillations mostly disappear, and we instead are left with a much flatter line that increases gradually with character count. This effect also happens when we ablate each of the period-8 or period-4 planes individually, but less strongly. We take this as evidence that the periodic representations are implicated in periodically predicting the newline token in these strings.

Ablating the periodic planes removes the newline spikes at multiples of 8 on documents with varying line widths. We plot Gemma-2-9B’s probability of predicting a newline as a function of character count, on hex documents whose line widths are drawn independently from 16, 24, …, 64 for each line. Subspaces are fit and ablated at layers 6–36 as described in the text (details in Section A.5.2). Without ablation, the model puts sharp peaks at every possible line end. With the period-8 and period-4 planes ablated, the peaks disappear and the probability rises smoothly along the line. Ablating a random 4-dimensional subspace of the top 50 principal components of the activations (though ensuring that these 4-dimensional subspaces are orthogonal to the prose subspace and both period-8 and period-4 planes), lowers the peaks but does not remove the period 8 pattern. The dotted line represents the average over 10 random subspaces. The y-axis is on a log scale by default; the single-plane ablations can be shown with the buttons below the plot.

In Section A.5.2 we investigate hypothesis #1 above, and consider the effect of ablating these same period-8 and period-4 planes on the model’s newline prediction in documents from our synthetic hex corpus, where all lines have equal width. Overall, we find that the effect of this ablation on the model’s newline prediction is much weaker than what we observed in this section, where lines had mixed widths.

Higher-dimensional structure

So far in this work, we have studied the representations of one-dimensional structures, like character count, which is parameterized by a single scalar. In this section, we now study higher-dimensional structure. We begin by computing centroids on our synthetic prose corpus jointly for variables like line number and document width in addition to character count. The resulting point clouds are strikingly beautiful. We then describe a few salient observations that arise from the study of these structures. These include that (1) visualizing centroids jointly in multiple variables, across model layers, can provide a satisfying visualization of model computation, (2) that centroids can subtly mix together multiple features, and (3) that SAEs may treat co-occurring manifolds as one higher-dimensional manifold. We lastly train small transformers on a synthetic version of the line-breaking task and perform some theoretical analysis that attempts to account for why these computational variables (like character count) are represented, and have the geometry they have, based on the structure of the prediction task that networks solve here.

Centroids in multiple variables

In Section 3 and Section 4, we computed activation centroids according to the character count of the network’s input token within its line of text, across documents of line-broken text. We now compute centroids jointly in other computational variables beyond character count.

We return to our synthetic prose corpus and first compute activation centroids in the residual stream of Gemma-2-9B according to both the character count of the input token in its line and also according to its line number within its document. This gives us centroids that correspond to something like a token’s 2d position within a block of text (its position on the “page”, so to speak) since character count gives its horizontal position and line number gives a vertical position.21

We compute centroids for line numbers 1-30 and character counts 10-150, giving us 30×141=423030 \times 141 = 4230 centroids at each layer of the residual stream, and perform PCA on each such collection of centroids. We plot these centroids below, across model layer:

Joint character count × line number centroids in Gemma-2-9B, across layers. We take documents consisting of paragraphs of prose that are wrapped to fixed widths ranging from 20-160 across documents, pass them through Gemma-2-9B, and average residual stream activations across all tokens that have simultaneously the same character count (10-150) into their line and have the same line number (1-30). We fit a PCA to these centroids at each layer and show projections onto top PCs. Hue indicates character count and lightness indicates line number, where line 1 is palest. Centroids from line 1, which directly follows the beginning-of-sequence token and precedes any newline token, lie far from those of all other lines. Use the slider to move across layers, and drag to rotate.

While the plots above are striking, we think that the geometry we see here is mostly explained by the character count and line number being represented independently. By this, we mean that the model represents line number and character count as points on curves in approximately orthogonal subspaces, and the geometry of the joint centroids is approximately the Cartesian product of the two curves. The PCA axes mix these subspaces, producing the self-intersecting surfaces we see above.

To test whether character count and line number are indeed independent in this way, we compute centroids according to character count μc\mu_c and according to line number μl\mu_l separately, and find that adding these centroids μc+μl\mu_c + \mu_l gives a collection of points with similar geometry to the joint centroids μc,l\mu_{c,l}. In the figure below, we visualize the character count centroids μc\mu_c, line number centroids μl\mu_l, their sum μc+μl\mu_c + \mu_l, and the joint centroids μc,l\mu_{c,l}:

Joint character count × line number centroids compared with the sum of separate character count and line number centroids, in Gemma-2-9B across layers. Using the same documents as in Figure 14, we compute centroids by character count alone, μc\mu_c (top left), and by line number alone, μl\mu_l (top right), each averaging over all tokens with that count or on that line. Adding them (and subtracting the overall mean, which shifts all points equally) gives a point μc+μl\mu_c + \mu_l for each pair of character count and line number (bottom left), which we compare with the joint centroids μc,l\mu_{c,l} (bottom right). Each panel shows its own top three principal components at each layer, and the sum is rotated within its three-dimensional space to best match the joint centroids, which changes only the viewing angle. Colors follow Figure 14; the count and line panels use the middle row and middle column of the color square. Below the panels we report the fraction of the joint centroids’ variance that the sum reproduces. Use the slider to move across layers, and drag to rotate.

Broadly, we see similar geometry between the sum μc+μl\mu_c + \mu_l, and the joint centroids μc,l\mu_{c,l}. However, we find that this is not the case when line number is low—the character count centroids on the first few lines of our documents have clearly distinct geometry than on other lines. This is especially the case for the first line. In Figure 14, we saw that the centroids in the first line correspond to the “tail” of points that drifts away from the other centroids, which is especially prominent in principal components 4-6. This dependence on line number likely reflects the fact that on the first line the model does not yet know it is in a document which contains line breaks, and so it does not compute the character count yet. As the model sees more lines, it becomes more confident in the kind of prediction problem it is solving, and its representations become more consistent deeper in the document. By plotting the joint centroids, we can see this updating happen across the model’s context.

We next plot a different set of joint centroids. We again take our synthetic prose corpus, containing documents with widths {20,21,…,160}\{20, 21, \ldots, 160\}. We now compute centroids on these documents jointly according to both character count and to the document width.22 This lets us investigate whether representations of character count depend in some manner on the width of the document. We compute centroids for document widths 20-160 and character counts 10-150, giving us 1136611366 centroids at each layer of the residual stream23, and perform PCA on each such collection of centroids. We plot these centroids across model layer below:

Joint character count × document width centroids in Gemma-2-9B, across layers. On our synthetic prose corpus (here 300 documents of 25 lines for each width 20–160, excluding the first three lines), we average residual stream activations separately for each pair of character count c (10–150) and document width W, and project these centroids onto their top three principal components, fit separately at each layer. Hue indicates c/W, the fraction of the line completed so far, and lightness indicates W (wider documents are darker). Use the slider to move across layers, and drag to rotate.

We find that this geometry is quite striking, especially when viewed across model layer. We discuss this structure, and how it changes across model layer, in the next section.

Visualizing model computation across layer

In Figure 16, we visualized activation centroids jointly by character count and document width. Here, we describe this structure in more detail and discuss what it tells us about model computation.

We first describe how representations are structured at a few model layers. In early layers, we find that our joint character-count × document-width centroids are arranged in a sheet, with character count along one axis and document width along the other. Then in layers 11-14 centroids are arranged in a spiral or cone. Then from layers 15 onward they are mostly arranged along a curve primarily according to their characters remaining: r=w−cr = w - c. We show joint centroids across a few model layers in the figure below:

Joint character count × document width centroids at a few model layers. Each pane shows the top three principal components of the centroids at a given layer, for Gemma-2-9B on our synthetic prose corpus. At layer 8 the centroids lie on a sheet, at layer 11 on a cone-like shell, and at layer 15 mostly along a single curve ordered by characters remaining. Drag to rotate each pane.

We think that the representations we see here are the result of the model computing a character count representation, then shortly afterwards computing a representation of the number of characters remaining on the current line of text. This is consistent with Gurnee et al. [1], who report that Claude 3.5 Haiku first computes a character count representation then compares this with the previous line widths to compute a characters remaining representation. When we compute centroids according to both character count and width, the geometry of our centroids is influenced by underlying model features for both character count and characters remaining. In looking at how these centroids change across layer, we get a visualization of the model’s computation of the characters remaining representation from the character count representation.

In the previous subsection, we computed centroids separately for two variables (character count and line number) and found that joint centroids are well-approximated as a sum of model representations for each variable. For character count and document width, naively applying this analysis is difficult because character count and document width depend on each other (a centroid for a given document width ww averages over character count representations only up to that width). Instead, in Section A.6.5, we report results from training linear probes for character count, document width, and characters remaining at every layer. Looking at the accuracy of these probes, we find that character count and document width are most linearly decodable around layers 10–11 and become less so in later layers, while characters remaining near the end of the line becomes decodable around layer 12 and remains decodable through the rest of the network. Section A.6.5 also includes steering experiments. Overall, we think the geometry of the joint character count × document width centroids, especially in layers 11 and onward, is best explained as a sum of the model’s character count and characters remaining representations, with the characters remaining accounting for a much higher fraction of the variance deeper in the model layers. We note that computing centroids by character count and document width is the same as computing centroids based on character count and characters remaining, since c+r=wc + r = w.

Centroids can subtly mix together features

Throughout this work, we have found the use of centroids to be an essential tool for visualizing feature manifolds. However, we now note one challenge to using centroids, broadly resulting from the fact that they are a supervised technique. Centroids are computed over a distribution of inputs and a partition of those inputs that are both manually specified. They can therefore mix the geometry of multiple computational variables if one is not careful.

This problem can be illustrated nicely in the context of the discussion in the previous subsection, in particular how the character count and characters remaining representations co-occur in some layers of the residual stream. At token positions that occur at the end of their line of text, the character count will be represented, and also the characters remaining will be represented, simultaneously in some layers. This means that, for some distributions of document widths, the characters remaining representation will influence the character count centroids. For instance, both the prior work of Gurnee et al. [1] and Sinii and Balagansky [67], in their study of the character count manifold, used a maximum document width of 150 when computing character count centroids up to character count 150. With this choice, all tokens that contribute to the character count 150 centroids occur at the very end of their lines. However, on such tokens the model also computes a characters remaining representation. The centroids for character count 150 would then combine both the character count representation and the characters remaining one.

To illustrate this point, we compute character count centroids for character counts 10-150 separately on documents of width 150 and width 200. In the figure below, we compute PCA on the union of these two sets of centroids and visualize the resulting projections for each character count spiral:

Character count centroids depend on the document widths they are computed over. We compute character count centroids for counts 10–150 in Gemma-2-9B on the same prose paragraphs wrapped at width 150 (blue) and at width 200 (orange), and project both sets onto the top three principal components of the two sets combined, fit separately at each layer. From around layer 12 onward, the width-150 centroids for counts near 150, which all come from tokens at the end of their line, move away from the width-200 centroids for the same counts.

We find that these two curves, which are both nominally “character count” representations, have substantially different geometry. They are similar before layer 12, but at layer 12 and later the curves diverge substantially, especially as the character count approaches 150. This divergence increases throughout layers 11-15, which is consistent with those being the layers where the characters remaining representation is computed by the model. So for some distributions of inputs, centroids can mix in other model features which happen to vary with the quantity of interest on the distribution where centroids are computed. We note that this likely affected some of our earlier analysis of character count in Section 3, though we chose a range of documents with maximum width 160 instead of 150 to make this effect less severe.

We think this general problem is worth keeping in mind for future practitioners using centroids to visualize feature manifolds.

SAEs don’t separate co-occurring manifolds

If centroids can mix together different features, we might hope to instead turn to unsupervised methods. However, methods like SAEs face a similar challenge: when feature manifolds co-occur in activations, SAEs may treat those features as a single higher-dimensional manifold to tile. Indeed, we find evidence of this in Gemma-2-9B.

In the figure below, we take some SAE latents that we earlier found to tile the character count manifold at layer 11, and plot their tuning curves separately on documents of different width.24 We find that these tuning curves do indeed depend on document width, which we think likely reflects the fact that the SAE is reconstructing a joint character count × characters remaining representation, since both representations co-occur, as we saw in the previous two sections (Section 5.2 and Section 5.3).

Some latents that tile the character count manifold also respond to characters remaining. For three of the latents from Figure 2 (Gemma Scope SAE at layer 11 of Gemma-2-9B, 16k latents, average L0 118), we show the probability that each latent fires as a function of character count, with one line per document width, on our synthetic prose corpus extended to widths 20–400 (each line pools widths within 5 of the value shown). Each latent fires at a fixed character count, and on wider documents also fires a fixed number of characters before the end of the line.

We note that Gurnee et al. [1] saw hints of a similar phenomenon in their appendix, and presented some latents that responded to character count differently at different widths, though they attribute this phenomenon to feature splitting.

In the figure below, we show similar data to Figure 19 but plotted as a 2d heatmap, and again we see that these latents activate in response to both character count and characters remaining.

Firing probability of the same latents across all character counts and document widths. For the latents in Figure 19, we show the probability that each latent fires as a function of character count and document width (top) and of character count and characters remaining (bottom), for widths 20–400. If these latents only responded to character count, we would see only vertical bands in all these subplots. If latents only responded to characters remaining, we would see horizontal bands in the bottom row of subplots. For all latents, we see both vertical and horizontal bands, suggesting that this SAE may be treating co-occurring representations of character count and characters remaining as a single higher-dimensional manifold to reconstruct.

A theoretical account of the count × width sheet

In Section 5.1 and Section 5.2, we saw that the joint count × width centroids arranged into a 2D sheet, organized by character count in earlier layers, and then by characters remaining in later layers. Intuitively, it seems plausible that this structure is a consequence of what predicting the next token in line-wrapped text requires. Here, we study a toy synthetic line-breaking task that captures the part of the prediction task that has only to do with predicting newlines.

We take an approach that is typical of our work at Simplex. We first consider the states an optimal predictor must have in order to perform the prediction task, and how such a predictor might geometrically embed these states in service of that task. We then ask if that kind of predictive structure is reflected in the geometric structure of the activations of a transformer trained on the task. Here, we also use this as an opportunity to ask a methodological question about using centroids to characterize multidimensional manifolds. What are the consequences of taking centroids according to different choices of latent task variables? What information is lost or gained? In what ways can this analysis method find structure or be misleading? We then study line breaking in Gemma-2-9B, and find that raw activations are quite unstructured, but that we can recover the 2D sheet using centroids. Finally, we offer an explanation for what Gemma’s joint c×wc \times w activation centroids might be representing as they reorganize between layer 10 and layer 15. We propose that the converged centroid organization reflects an embedding that respects the prediction task, predicting (from theory) a particular arrangement of the centroids. We find that both the toy models and Gemma match this arrangement qualitatively.

A toy synthetic task for line breaking

Imagine that you are reading text that has an unknown but fixed width ww, and you are trying to predict when the next newline will occur. In order to do this well, you have to keep track of the current character count, cc, and your current belief of what value ww is. When you get to the end of the first line, you notice that the newline occurs at c=40c=40. This means that w≥40w \ge 40. You then notice that the first word of the next line has 5 characters, which means that w≤45w \le 45. As you see more lines, your knowledge of what ww is will be further confined to an interval between a lower and upper bound, L≤w≤UL \le w \le U. Your prediction of where the new line will occur will depend on the triple of numbers, (c,L,U)(c, L, U). After a few lines, these lower and upper bounds meet, and the triple reduces to the pair (c,w)(c, w).

To formally capture this, we consider the following generative model of fixed-width text sequences, visualized in Figure 21:

  1. At the start of each sequence, a line width ww is drawn uniformly from a range of widths, and the current line’s character count, cc, is set to 0.
  2. At each position, one of nn content (non-newline) tokens is drawn independently from a fixed distribution pp. Each token kk stands for a word with ckc_k characters; for instance, the token for the word cat has ck=3c_k = 3.
  3. If c+ck≤wc + c_k \leq w, the token is emitted and cc is incremented to c+ckc + c_k.
  4. If c+ck>wc + c_k > w, a newline token is emitted, then token kk, and cc is reset to ckc_k.
The synthetic line-wrapping process fills each line with tokens until the next drawn token would exceed the document width ww, then emits a newline and starts the next line with that overflowing token. Top: each content token is ckc_k characters wide; the dashed outline marks the drawn token that did not fit on the current line. Bottom: the emitted token stream seen by the model, in which tokens carry no explicit length label and ww never appears. Widths here are drawn from 2020–4040 for legibility (2020–150150 in our toy-model experiments). Play steps through generation one token at a time; New samples a fresh width and sequence.

As with a real language model trained on tokenized text, a network trained on data from this process observes only tokens IDs, and never (explicitly) the character lengths ckc_k or the width ww. It must learn each token’s length to count characters, and infer ww in-context from where newlines occur. As discussed above, at any content token, the triple (c,L,U)(c, L, U) captures all information about the past needed for predicting all future tokens. All possible triples (c,L,U)(c, L, U) form a state space for the sequential prediction task over our toy line-breaking task that we refer to as a predictive state space; we call points in that space predictive states. We note here that once enough lines have been observed such that the lower/upper bounds meet, the predictive states are restricted to lie along the L=U=wL = U = w plane, and the predictive state can be described simply by (c,w)(c, w). In other words, the distinction between U,L,U, L, and ww is relevant only at early context positions. We will return to this later. In Section A.6.2, we give the exact (c,L,U)(c, L, U) state along with its update rules.25

Recovering the predictive states (and confounds) with centroids

In the previous section, we described how (c,L,U)(c, L, U) acts as a predictive state space. We now ask if this kind of predictive structure can be found in the activations of a transformer trained on the synthetic line breaking task. We also ask a methodological question. When taking centroids of activations, the person doing analysis makes a choice as to the latent variables that supervise the averaging. But what implications do these choices have? In our case, the latent variables LL and UU act as bounds for ww. We thus consider taking centroids according to LL and UU versus according to ww, and see what information is lost or gained. We will see that because of correlations between these latent variables, geometric structure found in centroids can be misleading.

To see whether transformers actually learn a low-dimensional representation of the predictive states (c,L,U)(c, L, U), and to test how centroid binning behaves when the true task variables are known, we train a small 4-layer transformer (dmodel=8d_{\text{model}} = 8) from scratch on our synthetic process with line widths w∈{20,…,150}w \in \{20, \ldots, 150\} and 77 content tokens of lengths ck∈{2,…,8}c_k \in \{2, \ldots, 8\} (see Section A.6.6 for training details; see also Chaudhari [75] which studies how character count manifolds emerge during training on a related but different toy line-wrapped data). We collect layer 1 residual-stream activations at content tokens, skipping the first line of each document so that there is some information regarding ww. Figure 22 compares the predictive state coordinates (c,L,U)(c, L, U) on the left against the toy model’s layer 1 activations on the right across three views: raw activations, (c,L,U)(c, L, U) centroids, and (c,w)(c, w) centroids.

The figure opens on the raw activations in their own top-3 principal components.

Predictive states and layer 1 activations in the toy model. Left (”Theory”): the predictive state space, the (c,L,U)(c, L, U) states an optimal predictor tracks. Right (”Activations”): the toy model’s layer 1 residual-stream activations at content tokens from line 2 onward, past each line’s first 10 characters. The five buttons show the same activations through different lenses. (1) Raw activations in their own top three PCs, colored by line progress (c/wc/w) and width, already resemble the state space. (2) Colored by latest token length, we see them split into seven parallel sheets (one per length). (3) Plotting(c,L,U)(c, L, U) activation centroids, makes those sheets vanish. (4) Coloring these averages by mean lines seen (1–9+) reveals the new set of sheets are correlated with the number of newline tokens seen. (5) Moving to (c,w)(c, w) centroids folds them into one. Click Free explore to swap between several averaging and coloring options on your own.

In this view, we see that the activations qualitatively mirror the predictive states. However, when coloring by the last token’s length (step 2), we see that the raw point cloud is split into seven parallel sheets, one for each of the seven possible lengths ck∈{2,…,8}c_k \in \{2, \ldots, 8\} of the most recent token. Once ckc_k has been added into cc, the length of the most recent token is irrelevant to predicting future tokens, yet it is still a prominent feature of the raw activations in the residual stream. It is intuitive that taking centroids with respect to the predictively relevant variables will average this variation out. Indeed, going from raw activations to (c,L,U)(c, L, U) centroids does remove the seven sheets (step 3), and the resulting centroids align closely with the predictive states’ coordinates. However, even then, there is still extra unexplained structure in these centroids!

Notice that the (c,L,U)(c, L, U) centroids do not form a single sheet. A set of thinner parallel sheets remain, especially at narrower widths, ordered by U−LU - L. Two things could be behind these sheets. Part of the separation may be the model genuinely representing its remaining uncertainty about the width. Another possibility is that U−LU - L is tightly coupled to a different variable, the number of newlines seen so far, since bins with U−L>0U - L > 0 occur disproportionately on the earliest lines of a document. Because the model’s activations also vary with the number of newlines seen, coloring by lines seen (step 4) shows that this variation is mixed into the sheets. We have not measured how much of the separation comes from width uncertainty versus newline count.

Switching to (c,w)(c, w) centroids (step 5) averages over U−LU - L (and, since they are correlated, its coupling to the newline count), leaving a single two-dimensional sheet. However, this sheet still contains hidden information about the number of lines seen in the document: low values of ww move through newlines more quickly— and so their centroids average over activations at a larger newline count, on average. This is another example of the lesson we saw in Section 5.3, but here with known ground truth. Even in this case, where we bin activations by an explicit ground-truth predictive state, the centroids let through a variable that is correlated with them.

Line breaking predictive structure in Gemma-2-9B

Can we find evidence of the predictive geometric structure studied in the previous section in a real LLM? Here we find that in Gemma-2-9B, (c,w)(c, w) centroids recover the count × width sheet from Section 5.1 and Section 5.2, even though the top principal components of the raw activations on line-broken text show no sheet at all (left panel of Figure 23). In the toy model, the raw activations already showed the sheet plus some extra structure which separated the activations into seven sheets according to the most recent token. When taking centroids, we could remove the variance associated with that extra structure.

Gemma-2-9B is trained on far more than line breaking, so its raw activations are dominated by many different structural aspects of natural language. Because of this, it is perhaps unsurprising that no clear signature of the activations organization by (c,w)(c,w) are visible in the raw activations’ top principal components. Regardless, the same (c,w)(c, w) centroids still average the unrelated variation away and bring out a structured representation.

For Gemma-2-9B, we use (c,w)(c, w) centroids and skip the first three lines of each document (and the first 1010 characters of each line). While the toy model knows the task immediately, and that each line will have a fixed maximum width, we cannot expect Gemma to carry this same prior over widths or tasks. Gemma’s pretraining data, and post-training schedule will have imparted some unknown prior so we should not expect it to carry its uncertainty over the task the same way as the toy. However, recall that the distinction between UU, LL, and ww is relevant only at early context positions where the width is uncertain. In Gemma, because token lengths in our natural-text dataset peak around 44 to 55 characters, roughly 99%99\% of the positions after the third line satisfy U−L≤1U - L \le 1, so width uncertainty should be very low for any reasonable prior over the task. Section 5.1 and Section 5.2 also binned by (c,w)(c, w) and skipped the first three lines. We see now that this provided the richest predictive structure because the binning effectively captured the full predictive state (c,L,U)(c, L, U) when the first few lines are skipped.

Gemma-2-9B layer 10: the same (c, w) centroids and a sample of raw activations, in the top-3 PCs of the raw activations (left; these axes hold 7.6% of the raw variance) and in the top-3 PCs of the centroids (right; 85.4% of the centroids’ variance). In the raw frame the centroids collapse to a knot at the center of the cloud; in their own frame they form a curved sheet that is organized by their (c,w)(c, w) coordinates. Hover a centroid to find it in both panels.

Figure 23 shows the geometric arrangement of Gemma’s raw activations and centroids at L10. The top three principal components of the raw activations capture only 7.6%7.6\% of raw variance and leave the (c,w)(c, w) centroids bunched in a knot near the center, whereas the top three principal components of the (c,w)(c, w) centroids capture 85.4%85.4\% of centroid variance and recover a curved count x width sheet organized in the same way as the toy model. In Section A.6.5, we test this manifold causally by comparing width-conditioned and width-agnostic control of newline placement and find that conditioning on width provides more nuanced control of the newline placement.

The warning from the toy model still applies here: binning by (c,w)(c, w) does not protect against variables correlated with cc or ww. For example, a document of width w=20w = 20 passes through many more newlines than one of width w=150w = 150 in the same number of tokens, so the width axis of the centroids also carries hidden newline-count information.

What determines the centroids’ arrangement in activation space?

At layer 10, Gemma-2-9B’s (c,w)(c, w) centroids form a triangular sheet similar to the toy model’s layer 1 centroids, only much more curved. In later layers, both models stretch and deform this sheet away from the flat (c,w)(c, w) coordinate embedding. In this section, we propose this deformation can be explained as the model re-arranging activations: they shift from a coordinate embedding, which places the predictive states directly by their (c,w)(c, w) coordinates, to what we will call a forecast embedding, which places those same states by what they predict. This distinction might sound incredibly nuanced and maybe even pedantic, but it is a very natural distinction in the realm of optimal prediction, we will see how this greatly changes the geometry of the activations 26.

We then test this with two ways of describing each state by “forecasts” of newline placements. If we use only the forecast for the current line, the variable of width drops out entirely and all that matters is characters remaining. If we use the forecast of all newlines (i.e. at every future position), width structure comes back, giving a curved shape that qualitatively matches both models.

The pictures above place each (c,w)(c, w) centroid by its coordinates: its position on the current line, and the width of the document it came from. We will call this the coordinate embedding. It comes with a sense of distance — two states are close when their coordinates are close. All our plots have used that distance implicitly but, importantly it is not the only choice. These coordinates are worth tracking because they determine future token probabilities but, while the predictive states are sufficient for optimal prediction of future token sequences, the predictive coordinate embedding does not place the centroids by what they predict. This contrast introduces a second sense of distance, in which two states are close (or far) when they assign similar (or different) probabilities to future tokens.

Take, for example, a one or two character difference towards the end of a line. These characters barely change the coordinates of the predictive state but can raise the probability of a newline from zero to one. So, while the points are close in the coordinate embedding, they should be placed far apart according to this new sense of distance. This is where the deformation noted above might come from. Said another way: the token probabilities are a nonlinear function of the coordinates, so a linear readout would need to act on a curved embedding of the coordinates in order to function properly. Early in the model we see evidence of a more generic coordinate embedding, where the centroids are not placed primarily by what future token predictions they produce. As the model turns representations into predictions through depth, we will see the centroids reorganize to respect the geometry of the prediction task.

First, we investigate what such a geometry might look like, when compared to the flat sheet of the coordinate embedding27. Given a fixed horizon of DD future context positions we assign a vector of length DD to each (c,w)(c,w) state whose hh-th entry is the probability that the current line ends exactly hh steps ahead:

vDnext(c,w)=(P(xh=newline, x1,…,xh−1≠newline∣c,w))h=1Dv^{\text{next}}_D(c,w) = \Big(P(x_h = \text{newline},\ x_1, \ldots, x_{h-1} \ne \text{newline} \mid c, w)\Big)_{h=1}^D

Each element is the probability that the first newline occurs exactly hh steps in the future, so this vector has nonzero entries only within the current line. This length DD vector can be the basis for what we will call a forecast embedding. To see a manifold where distances are related to Euclidean distances between future newline token probabilities, we project these vectors onto their directions of largest variance (the principal components). Note that this embedding only cares about newlines, not the full token distribution. This is the appropriate consideration for the centroids in question, which also only care about the newline task since we have averaged out other considerations. (Section A.6.4 shows that future distributions of content tokens drop out of all forecast embeddings except at the newline position itself, which we do not include in our activation centroids).

The figure below compares two forecast choices: the next-newline forecast above (steps 1–3), and the all-newline forecast (steps 4 and 5), whose hh-th entry is the probability that the symbol hh steps ahead is a newline, whether it is the next newline or a later one:

vDall(c,w)  =  (P(xh=newline∣c,w) )h=1Dv^{\text{all}}_D(c, w) \;=\; \Big(P(x_h=\text{newline} \mid c, w) \,\Big)_{h = 1}^{D}

This is also a length DD vector, but its entries can be nonzero past the current line.28 The figure shows the coordinate embedding (left) beside the forecast embedding (right) for the (c,w)(c, w) states, for the mixture our toy models are trained on (token lengths 2–8, widths 20–150). Recall that the width is largely known after the third line: the full predictive state (c,L,U)(c,L,U) quickly collapses to (c,w,w)(c,w, w) and so each (c,w)(c,w) state has only one forecast vector associated with it.

Coordinate embedding (left) and forecast embedding (right) of the (c, w) states for the mixture that our toy model was trained on. The buttons below step through the comparison, at D = 32: (1) the next-newline forecast embedding, colored by characters remaining r = w − c; (2) the lines r = 48, 16 and 4, each of which collapses to a single point; (3) one line of text (w = 96), whose positions bunch together while many characters remain and spread apart near its end; (4) the all-newline forecast embedding, in which the same lines of constant r pull apart by width; (5) the same embedding colored by line progress and width. Free explore allows unguided exploration of the same views. The motion between embeddings is for guiding the eye, intermediate frames are not intermediate embeddings.

Step 1 shows the next-newline forecast embedding: compared with the flat coordinate embedding, the sheet folds up on itself, and the organizing variable becomes characters remaining before the next newline, r=w−cr = w - c. How do we understand this geometry? If we are cc characters into a line of width ww, whether any string of tokens x1,…,xmx_1, \ldots, x_m fits on the current line is decided by

cx1+⋯+cxm  ≤  w−c\qquad c_{x_1} + \cdots + c_{x_m} \;\le\; w - c

Thus, a state’s forecast of everything up to the next newline can be expressed as a function of rr alone, and the embedding shows this geometrically. If we ask only how soon the current line ends, variation across widths at fixed rr does not matter at all. All states with the same rr collapse onto one point, folding the sheet into a single curve ordered by characters remaining. Step 2 highlights three such lines (r = 48, 16 and 4), and each collapses to a single point.

Another difference between coordinate and forecast embeddings also shows up as uneven spacing along a single line. In the coordinate embedding, successive cc values are evenly spaced: each character moves the state by the same amount regardless of proximity to the end of the line. In the forecast embedding the spacing varies. While many characters remain, each character changes predictions only in the far future, so successive positions sit nearly on top of one another. Closer to ww, each character changes the immediate forecast significantly, and the spacing is large. Step 3 follows one line of text (w = 96): its first positions sit nearly on top of one another, and its last ones spread apart. In Free explore, both forecasts show this behavior at every horizon (more softly as D grows).

The collapse by characters remaining only is a statement about forecasts that stay within the current line. Step 4 switches to the all-newline forecast, which is sensitive to newlines beyond the next one. At short horizons, it agrees with the next-newline embedding. At long horizons, the embedding increasingly includes information about future lines. The position of every later newline depends on the width because each subsequent line runs for about ww characters. This means that states with equal rr but different ww pull apart and an apparent width-dependent structure emerges in the embedding (step 5 colors the states by line progress and width to make this clear). This regime seems to most closely match the geometry of the (c,w)(c,w) manifolds in both our toy models and in Gemma. The figure below compares each model’s centroids with the theory at two depths: an early layer with the coordinate embedding (layer 1 of the toy, layer 10 of Gemma-2-9B), and a later layer with the all-newline forecast embedding of each task (layer 2 of the toy, and layer 15 of Gemma) 29.

Theory (left) against a model’s (c, w) centroids (right), colored by line progress and width. The buttons underneath the figure step through the comparison, at horizon D = 32 for the forecast embeddings: (1) the toy model’s layer 1 centroids against the coordinate embedding, which they follow closely; (2) its layer 2 centroids against the all-newline forecast embedding; (3) Gemma-2-9B’s layer 10 centroids against the coordinate embedding, which they follow but with a strong curve; (4) Gemma’s layer 15 centroids against the all-newline forecast embedding; (5) Gemma’s layer 15 centroids exactly as in step 4, with the toy’s layer 2 centroids fitted onto them in place of the theoretical embedding. The two models’ later layers match each other (R² 0.88) better than either matches its own forecast embedding (0.67 for the toy, 0.71 for Gemma). The quoted R² values are for a fit of each model’s top six centroid principal components by rotation and uniform scale only. Free explore shows the earlier and later layers side by side, with a toggle to go between the theoretical embeddings and the activations. Motion between steps is for guiding the eye, intermediate frames are neither intermediate layers nor embeddings.

Step 1 shows the early layer of the toy model, where it represents the coordinates of the predictive states. Step 2 shows the later layer, where its centroids are rearranged to organize mainly by characters remaining rr. Steps 3 and 4 do the same, for Gemma-2-9B. The first few PCs of both models’ later-layer centroids are arranged as the all-newline embedding predicts. Neighboring positions nearly coincide far from the newline, and spread apart as room on the current line runs out. We also show that linear probes to both cc and rr are consistent with Gemma’s activations organizing increasingly by characters remaining and decreasingly by width and character count on their own, see Section A.6.5 for additional details.

In the figure above, we have aligned each model’s centroids to the theory with a Procrustes fit, as a visual aid. Such fits do produce R2R^2 values, which are reported, but ultimately we believe our evidence about the geometry of the activations should be treated as qualitative. For example, different values of DD differ mainly in how the stretch along rr is distributed— and we find no consistent best value for DD among a set of a couple dozen toy models of various architectures. Our evidence supports the pattern of the organization, rather than identifying a particular horizon for either our toy models or Gemma-2-9B. It would be misleading, even, to claim that the proposed all-newline forecast embedding is exactly what the model represents 30. To that point, step 5 of the figure shows that the later-layer centroids of the two networks align to each other more readily than either aligns to its forecast embedding. This suggests a different or additional embedding (though largely shared between the toy model and Gemma-2-9B) is responsible for the exact arrangement we see, and the all-newline forecast is some approximation that captures the most prominent features.

We close by noting that, because rr is a linear function of ww and the fully observable quantity cc, (c,L−c,U−c)(c,L-c,U-c) and (c,r)(c,r) make equally valid coordinates as (c,L,U)(c,L,U) and (c,w)(c,w). We could just as well write all of our coordinates in terms of rr as in terms of ww. This means many of our interpretations of ww-dependent structure can often be equally considered cc- or rr- dependent structure. Take, for example, the conclusion above: “states with equal rr but different widths pull apart and an apparent width structure emerges in the embedding”. This “width structure” happens at fixed rr, so a different ww is the same thing as a different cc and nothing in our analysis privileges one interpretation over another at this point 31. Thus, more careful analysis is required to separate these two things. The investigation in Section A.6.5 undertakes this by doing a variance decomposition on the centroids to test how much of their variance can be explained by dependence on each of the counting variables: r,c,wr,c,w. In this, we find that the model carries very little width-specific information beyond what is carried by rr and cc. This points towards these representations being best thought of as (c,r)(c,r), rather than (c,w)(c,w). These conclusions about the apparent width structure are further supported by causal tests in the same appendix, which show the model’s representation of width is, at least in part, carried by previous newline tokens.

This section establishes four points. First, a toy transformer trained on a toy task represents the predictive states (c,L,U)(c, L, U). Second, reinforcing Section 5.3, centroids remove unrelated variation but keep variables correlated with the bin labels; this caution carries over to Gemma-2-9B. Third, the top principal components of Gemma-2-9B’s raw activations hide the sheet, and (c,w)(c, w) centroids recover it. Fourth, the centroid arrangement that emerges at Layer 15 in Gemma is qualitatively consistent with placing predictive states by their all-newline forecasts, with characters remaining as the main organizing variable, increasingly so in later layers. Three things are not established. We do not show that the all-newline embedding is exactly what the models’ centroids represent, only that they agree qualitatively in their top principal components. Additionally, we have not measured how much of the thin-sheet separation in the toy model centroids comes from width uncertainty versus newline count nor how much of the toy models (c,w)(c,w) representation is from correlations with the line number.

Related work

Neural network activation geometry. A variety of works have identified feature manifolds in neural network activations. These include work on vision models [10, 79] and language models [32, 39, 40, 80, 1, 25, 41]. Neural network activations have been found to organize in a wider variety of ways in response to different kinds of structure in data [81, 82, 83, 35, 84]. For instance, Park et al. [85] study how the geometry of representations is shaped by structure only present in-context.

Tiling and other sparse autoencoder failure modes. A variety of works have investigated the consequences of mismatches between the assumptions that SAEs make and the actual structure of activations. As discussed earlier, one such line of work has studied how SAEs behave when there exist feature manifolds in activations. Engels et al. [32] study how SAEs reconstruct some simple toy data (a sparse linear combination of circles) to motivate their SAE clustering approach. Michaud et al. [46] study how feature manifolds may affect SAE scaling, if SAEs allocate a large number of latents towards tiling common feature manifolds. Gurnee et al. [1] study how crosscoders tile the character count manifold in Claude 3.5 Haiku. Bhalla et al. [25] characterize different ways that SAEs may tile feature manifolds, via experiments on toy data and in language models. Other works have investigated SAE failure modes for reasons unrelated to feature manifolds, such as when features in data co-occur hierarchically [86], or when SAE dictionary size [87] or sparsity [88] is set incorrectly. The SAE activation function also imposes assumptions on activations [89]. Fel et al. [90] propose to find feature manifolds using “block sparse featurizers” instead of via post-hoc clustering of SAE latents, and argue that this is a more principled choice.

Periodic representations and computation in transformers. Periodic structure has been found in both toy networks and pretrained language models. Nanda et al. [34] established that transformers trained on modular addition use Fourier representations and trigonometric identities to perform addition. Zhou et al. [38] found that pretrained language models represent numbers with Fourier features, with periods such as 2, 5, and 10, and that models use these features to compute addition. Kantamneni and Tegmark [39] similarly found generalized helical representations of numbers in pretrained language models. Engels et al. [32] found that language models represent “days of the week” and “months of the year” in a circle, and suggested that these representations could be part of a modular addition algorithm (mod 7 or 12). Feucht et al. [41] find that language models instead convert these representations to a representation of the day or calendar month number modulo 2, 5 and 10, and use these representations to compute addition. In our work, we found language model representations that track character count modulo 2, 4, and 8 on some input distributions, a new example of periodic structure in activations.

Explanations of representation geometry. Several approaches connect representation geometry to the structure of training data and the demands of prediction. Modell et al. [40] described conditions under which representation manifolds preserve the intrinsic geometry of continuous features. Gurnee et al. [1] model the character count manifold as an optimal packing of points on a low-dimensional hypersphere to explain the “ringing” they observe in cosine similarities between character count representations. Karkada et al. [47] derived geometric structure from symmetries in language co-occurrence statistics. Shai et al. [35] instead start from a known generative process and find representations of the resulting predictive belief states in trained transformers. In Section 5.5, our toy model analysis follows this last approach for a simplified line-breaking process. It distinguishes the information sufficient for prediction from the geometry obtained by comparing future newline forecasts, and uses that distinction to interpret how the joint c×wc\times w manifold changes through the layers.

Discussion

Summary. This work was partly an exploration of methodological questions about the craft of finding feature manifolds and also partly a detailed object-level study of a particular set of feature manifolds—representations of character count. We began by studying how sparse autoencoders interact with the character count manifold from Gurnee et al. [1], and whether we could cluster SAE latents to re-discover this manifold, with partial success. We then applied clustering to find a new representation of character count with periodic structure, and investigated the universality and causal role of those representations. We then investigated whether character count representations are part of a higher-dimensional joint representation of other features, yielding some satisfying visualizations of how model representations change across both context and depth. Our discussion of higher-dimensional structure also raised some methodological points about centroids and SAEs. We lastly investigated similar character count representations in toy models trained on a synthetic version of the line-breaking task, and showed that the structure of the prediction task accounts for several aspects of the geometry of Gemma-2-9B’s activations as it solves this task.

Lessons for feature manifold hunters. From our case study, we take away the following lessons about the craft of identifying feature manifolds: (1) we find that model representations can change substantially, and abruptly, across model layers, suggesting that representations should be characterized across all model layers, when possible (Section 3.1). (2) As in Bhalla et al. [25], we find SAE latents can tile feature manifolds in somewhat unintuitive and inconsistent ways, complicating their interpretation as standalone units of model representation (Section 3.2). (3) Methods that cluster SAE latents, like Bhalla et al. [25], can identify groups of SAE latents that together reconstruct feature manifolds (Section 3.4, Section 4). (4) Raw model activations vary along many directions unrelated to the feature of interest (in our toy model, for example, the length of the latest token), and principal components of raw activations can pick the wrong subspace, obscuring beautiful structure that indeed underlies model representations (Section 3.4 and Section 5.5). Lastly, (5) activation centroids average much of this variation away, but they require choosing both the input distribution and the variables to average by, and they can mix in variables correlated with those choices (Section 5.3, Section 5.5).

Kinds of multidimensional features. Our results contribute to an emerging taxonomy of multidimensional features [91]. Of the structures identified so far in language models, many seem to either have continuous structure that may “ripple” through higher dimensions [43, 40, 1], or discrete periodic structure [39, 41]. We have now established that character count representations in language models exhibit both kinds of structure on different kinds of text—smooth on prose and periodic on strings of decimal and hexadecimal digits. We wonder whether a larger taxonomy of multidimensional features will be revealed in the future, and encourage work to identify more of these structures over the coming years.

Theory of activation geometry. For our toy line-breaking task, we described predictive states an optimal predictor must track and compare two ways of organizing them: a coordinate embedding that places states by their (c,w)(c, w) values, and a forecast embedding that places them by what they predict about future newlines (Section 5.5). In both a toy transformer and Gemma-2-9B, we found that early layers resemble the coordinate embedding while later layers move qualitatively toward the all-newline forecast embedding in their top principal components. Because the toy model and Gemma-2-9B align more closely with each other than either does with the forecast embedding, the forecast embedding appears to capture the most prominent features of the representation rather than its exact arrangement. Even so, the qualitative match suggests that the dominant part of the geometry we observe follows from the structure of the prediction task itself.

Outlook. Neural network feature manifolds are beautiful objects of study, but discovering, characterizing, and understanding their geometry are each subtle problems. We hope that our analysis here aids others in discovering new manifolds and in performing similarly deep studies of those manifolds, so that eventually, as a field, we may possess a very large zoo of these structures. And then with this diversity of structures in hand, perhaps we will learn something new, and deep, about how neural networks organize their internal representations.

Appendix

Acknowledgments

We thank Josh Engels, Wes Gurnee, Brittany Gelb, Francesco Cagnetta, Thomas Fel, David Chanin and Amil Dravid for helpful feedback on this manuscript at various stages. We thank Josh Engels in particular for help choosing the title of this manuscript. We also thank Wes Gurnee for sharing the idea (though attributed to Claude) that led to our understanding of the causal role of the periodic hex representations. We thank the whole Simplex team for valuable discussions and feedback throughout this project, including Casper L. Christensen, Loren Amdahl-Culleton, Paul Riechers, Javan Tahir, Andrew Lee, and Eric Alt. We also thank Andy Arditi, Alex Loftus, Ekdeep Singh Lubana, Atticus Geiger, and Tankut Can for conversations about early results.

Author Contributions

Adam Shai and Eric Michaud first got a working setup for replicating the character count manifold in open-weight LLMs. Eric Michaud performed the experiments on how SAEs tile the character count manifold, the experiments on clustering SAE latents, and the experiments visualizing activations in Section 3.

Eric Michaud first observed a cluster of latents that led to the discovery of the periodic hex representations, and performed the experiments visualizing those representations and the experiments on their universality across models in Section 4. Eric Michaud, Marmik Chaudhari, and Kyle Ray performed the ablation experiments on the periodic character count representations in Section 4.4. Kyle Ray first performed the experiments ablating periodic representations on documents with line widths varying as multiples of 8 characters.

Eric Michaud originally observed the joint character count-width structure in LLMs. Kyle Ray, Marmik Chaudhari, and Eric Michaud performed the analysis on that structure that led to Section 5. Kyle Ray led the theoretical / toy network analysis in Section 5.5.

Eric Michaud drafted the main text except for Section 5.5, with Adam Shai and Kyle Ray. Kyle Ray and Adam Shai drafted Section 5.5 and related appendices. Marmik Chaudhari ran initial experiments for and drafted Section A.6.5, with revisions and additional experiments from Kyle Ray.

The code for our early experiments on the character count manifold, SAE tiling, and SAE clustering was written mostly by ourselves, with occasional AI assistance, in early 2026. However, throughout the year we increasingly relied on Claude to implement experiments and create interactive figures. The vast majority of code for the experiments and figures in the final version of this manuscript was written by Claude. While most of the main text was painstakingly human-written over many months, some appendix sections with experimental details were drafted with AI. We take responsibility for all contents of the paper.

Citation

Please cite as:

Michaud, E. J., Ray, K. J., Chaudhari, M., & Shai, A. (2026). What does it take to find a feature manifold? Belief Updates (Simplex Blog).

BibTeX Citation:

@article{michaud2026charactercount,
  author  = {Michaud, Eric J. and Ray, Kyle J. and Chaudhari, Marmik and Shai, Adam},
  title   = {What does it take to find a feature manifold?},
  journal = {Belief Updates (Simplex Blog)},
  year    = {2026},
  month   = {dec},
  url     = {https://belief-updates.pub/character-counts/}
}

Additional results on the prose character count manifold

Distribution of centroid variance across principal components

In Figure 1, we observed that character count centroids have a distinct spiral geometry only in layers 11-14. In Figure 26 below, we show how the variance of these centroids is distributed across their principal components at each layer. We find that PCs 1-6 explain a greater fraction of the variance in layers 11-14 than they do in other model layers, and that PC 1 alone explains less variance in layers 11-14 than it does in most other model layers. Looking at how variance of some centroids is distributed across PCs may therefore provide some signal about where feature manifolds lie.

Distribution of centroid variance across principal components, by layer. For the character count centroids of Gemma-2-9B (character counts 10-150), we show the fraction of centroid variance captured by PC 1, PC 2, PC 3, PCs 4–6, and all remaining PCs. In layers 11-14, variance is more distributed across the top several PCs, but is concentrated within those top PCs. In later layers, PC 1 dominates.

Method for identifying latents that tile the character count manifold

We use the following method to “manually” identify the latents that tile the character count manifold. Our method ranks latents along three separate metrics, then selects latents that simultaneously are in the top KK of each ranking. We first use our synthetic prose corpus from Section 3, containing Project Gutenberg paragraphs wrapped to widths 20-160, and compute centroids for character counts 10–150 at the layer corresponding to our SAE (layer 11 of Gemma-2-9B, in this work). We also record SAE latent activations across all tokens in this synthetic corpus, and use this data to rank SAE latents along the following three metrics:

  1. Firing frequency. We record the total number of times each latent activates zi>0z_i > 0 across our synthetic corpus, and keep the top Kf=8000K_f = 8000 latents. Since character count is represented at most token positions across these documents (except perhaps in the first line or two), the latents that reconstruct the character count manifold should be relatively commonly activating.
  2. Decoder direction geometry. We perform PCA on our set of centroids and take the top 6 principal components, giving us a 6d subspace of the residual stream. We then project all SAE latent decoder directions onto this 6d subspace, and rank latents by the norm of their decoder direction after this projection. We keep the top Kg=500K_g = 500 latents under this metric. SAE latents can only participate in reconstructing a feature manifold if their decoder directions live in the subspace containing the manifold.
  3. Mutual information. We lastly compute the mutual information between latent activations ziz_i and the character count cc of the tokens these latents activate on. In particular, we binarize SAE latent activations (F=1zj>0F = \mathbf{1}_{z_j > 0}) and compute I(F;c)/H(F)I(F; c) / H(F) across our synthetic corpus, where cc ranges from 10–150. We keep the top Kh=1000K_h = 1000 latents under this metric. This metric excludes latents that fire independently of character count (their tuning curves will be flat as a function of character count).

We find that these criteria produce a set of latents that is somewhat insensitive to the particular Kf,Kg,KhK_f, K_g, K_h used, and that the set of latents that meet all three of these criteria is much smaller (20 latents) than each of Kf,Kg,KhK_f, K_g, K_h. We note one potential concern, which is that our mutual information criterion could exclude latents that always activate when character count is represented, no matter the character count (for SAEs with high L0, such latents could perhaps function as a feature-specific bias term that shift activations in a fixed direction, which may help with SAE reconstruction in some cases). We note that when we evaluated the community detection algorithm of Bhalla et al. [25] in Section 3.4, we found in Figure 6 that the auto-discovered community contains a latent that fires uniformly across character count, but nevertheless across The Pile co-activates often with the latents that more clearly tile the character count manifold.

The character count manifold is longer than previously documented

Both Gurnee et al. [1] and Sinii and Balagansky [67] study the character count manifold in the range of 20-150 characters. However, we found in the course of this project that Gemma-2-9B is able to predict newlines at the correct position at the end of lines in documents of width at least 300 characters. We also note that it was a somewhat arbitrary choice to begin the range at 20. Earlier in this section, we used range 10-150. In the figure below, we visualize centroids and find the latents that tile this longer manifold, using the same criteria as elsewhere in this work:

Centroids and SAE tuning curves for the character count manifold in Gemma-2-9B, where we consider a wider set of documents and character counts 1-300 instead of 10-150 as was used in Figure 2. We note that this extended set of centroids is less beautiful but more faithful to the model, which can predict newline tokens at the correct position even in documents of width 300, suggesting the model represents character count up to at least count 300. When we consider this longer range, we also find a wider set of SAE latents that tile the manifold.

We note a couple of observations. First, the manifold is less visually striking, as visualized by the PCA of character count centroids, than it appeared earlier. The choice of the range of centroids (and accordingly the distribution of documents) are a choice that influences the aesthetic quality of the plot. Secondly, a slightly wider set of latents appear to tile the manifold than we found in previous sections. We note that this makes the problem of clustering together a single set of “correct” latents that uniquely tile the manifold somewhat less well-defined than we assumed in Section 3.4.

A close look at SAE tilings across dictionary size and sparsity

In Section 3.3, we found that the way SAEs tile the character count manifold changes with SAE sparsity. Here we look at this more closely for three Gemma Scope SAEs at layer 11 of Gemma-2-9B, each with 16k latents and with average L0 10, 60, and 255 (the top row of Figure 4). For each SAE, we show the same quantities as in Figure 2, using the same synthetic prose corpus and the same method for identifying latents (Section A.4.2).

SAEs of different sparsity tile the character count manifold differently. Each column shows a Gemma Scope SAE with 16k latents at layer 11 of Gemma-2-9B, labeled by its average L0. Top: character count centroids of the full activations (circles) and of activations reconstructed using only the selected latents (squares), along with the decoder directions of the selected latents, drawn from the SAE decoder bias. The three panels rotate together. Bottom: tuning curves of the selected latents. Selecting a latent colors the centroids in its column by the probability that the latent fires at each character count. As L0 increases, more latents tile the manifold, their tuning curves overlap more, and more of them have multiple humps. In the sparsest SAE (L0 = 10), almost none of the selected latents fire between character counts of roughly 20 and 40, so at these counts the reconstructed centroids sit at the decoder bias instead of following the helix.

In the sparsest SAE, each latent fires on a single contiguous range of character counts, similar to the crosscoder latents described by Gurnee et al. [1]. However, these latents produce a poor reconstruction of the character count feature manifold. We find that the SAE with L0=60 reconstructs the manifold similarly to high-L0 SAEs, but with cleaner tuning curves. One can therefore choose SAE sparsity carefully and avoid both kinds of failures (poor reconstruction and bimodal tuning curves) for this particular manifold. For the practical question of setting SAE sparsity in practice though, it would be ideal to observe tilings for a variety of other feature manifolds in this same model, since one could imagine that the different manifolds would each have different optimal SAE L0s, depending on their geometry, making the choice of a single global “correct” L0 challenging.

Additional details on clustering methods

In Section 3.4, we studied whether we could recover the subset of latents that we had manually found to tile the character count manifold, but using automated methods that cluster SAE latents instead. Here we describe the clustering procedure whose results we showed in that section, in Figure 5. Our overall approach is to apply network community detection algorithms, following Bhalla et al. [25]. To apply these algorithms, we construct a graph where each SAE latent is a node, and weighted edges between latents are given by different notions of similarity. We test five notions of edge weight. Most of these are based on co-activation statistics of SAE latents, so we first describe how we compute these co-activation statistics.

Co-activation statistics on The Pile. We stream the training split of pile-uncopyrighted [71, 72] and truncate each document to 1024 tokens. We run Gemma-2-9B in bfloat16 and encode the layer-11 residual stream with the Gemma Scope SAE from Section 3.2 (16k latents, average L0 118). We exclude BOS, padding, and other special tokens, and keep all remaining token positions. For latent ii at token tt we define the binary firing indicator Fi(t)=1[zi(t)>0]F_i(t) = \mathbf{1}[z_i(t) > 0]. We accumulate the firing count ni=∑tFi(t)n_i = \sum_t F_i(t) and the same-token co-firing count nij=∑tFi(t)Fj(t)n_{ij} = \sum_t F_i(t) F_j(t) for all 16384216384^2 pairs (the SAE we consider has 16k latents). The harvest covers N≈109N \approx 10^9 tokens. All co-activation metrics we describe below use the empirical probabilities pi=ni/Np_i = n_i / N and pij=nij/Np_{ij} = n_{ij} / N.

We then compute five notions of edge weight:

  • Decoder cosine similarity [32]: max⁡ ⁣(0, di⊤dj/(∥di∥∥dj∥))\max\!\left(0, \, \bm{d}_i^\top \bm{d}_j / (\|\bm{d}_i\| \|\bm{d}_j\|)\right), where di\bm{d}_i is the decoder direction of latent ii. This is the only weight that does not use the corpus.
  • Pointwise mutual information (PMI) [92]: PMIij=log⁡pijpi pj\mathrm{PMI}_{ij} = \log \frac{p_{ij}}{p_i \, p_j}, the log of how many times more often the two latents fire together than they would if they fired independently. PMI is unbounded, and very large for pairs of rare latents that co-fire a handful of times.
  • Normalized pointwise mutual information (NPMI) [93]: NPMIij=PMIij/(−log⁡pij)\mathrm{NPMI}_{ij} = \mathrm{PMI}_{ij} / (-\log p_{ij}). NPMI lies in [−1,1][-1, 1], equaling 1 when the two latents only ever fire together and 0 when they fire independently. Dividing by −log⁡pij-\log p_{ij} removes most of PMI’s bias toward rare pairs.
  • Jaccard similarity [94, 49]: nij/(ni+nj−nij)n_{ij} / (n_i + n_j - n_{ij}), the number of tokens where both latents fire divided by the number of tokens where either fires.
  • Mean-field Ising couplings ∣Jij∣|J_{ij}|, described in the next paragraph.

For PMI and NPMI we set negative values to zero. For PMI, NPMI, and Jaccard we set the weight to zero for pairs that co-fire on fewer than 10 tokens (nij<10n_{ij} < 10), since estimates from so few events are unreliable.

Ising couplings. Bhalla et al. [25] convert each latent’s firing into a spin si=2Fi−1∈{−1,+1}s_i = 2F_i - 1 \in \{-1, +1\} and model the joint distribution of spins over tokens with a pairwise Ising model,

p(s)∝exp⁡(∑i<jJijsisj+∑ihisi).p(\bm{s}) \propto \exp\Big( \sum_{i<j} J_{ij} s_i s_j + \sum_i h_i s_i \Big).

The fields hih_i absorb each latent’s firing rate, and the couplings JijJ_{ij} describe the interaction between latents ii and jj after conditioning on all other latents. Latents that fire on most tokens get large ∣hi∣|h_i| but can have small ∣Jij∣|J_{ij}|, and two latents that are correlated only through a third latent can have Jij=0J_{ij} = 0. They then run community detection on the graph with edge weights ∣Jij∣|J_{ij}|, so that strong excitatory and strong inhibitory couplings both count as strong edges.

Bhalla et al. [25] fit JJ by maximizing the pseudolikelihood [95, 96]. This requires every token’s full firing pattern. Our co-activation harvest stores only first and second moments (nin_i and nijn_{ij}), which is enough to compute over a billion tokens but not enough for pseudolikelihood. We therefore use the naive mean-field approximation to the inverse Ising problem [97, 98, 99], which estimates the couplings from the inverse of the spin covariance matrix:

JijMF=−(C−1)ij(i≠j),whereCij=Cov(si,sj)={4 (pij−pi pj)i≠j,4 pi(1−pi)i=j.J^{\mathrm{MF}}_{ij} = -\left(\bm{C}^{-1}\right)_{ij} \quad (i \neq j), \qquad \text{where} \quad C_{ij} = \mathrm{Cov}(s_i, s_j) = \begin{cases} 4\,(p_{ij} - p_i \, p_j) & i \neq j, \\ 4\, p_i (1 - p_i) & i = j. \end{cases}

We restrict the inversion to latents that fire on at least 100 tokens (all but five), add a small ridge term to the diagonal of C\bm{C} before inverting, and use ∣JijMF∣|J^{\mathrm{MF}}_{ij}| as the edge weight. Up to the scaling of each row and column, −C−1-\bm{C}^{-1} is the matrix of partial correlations between spins. The mean-field estimate is therefore the negative precision matrix of the spins, i.e. the quantity that a Gaussian graphical model would use, which Bhalla et al. [25] (their Appendix F) describe as the Gaussian analogue of the Ising couplings. Our results suggest that this approximation is adequate for grouping latents, even though, as they note, binarized SAE codes are far from Gaussian.

Our pipeline differs from Bhalla et al. [25] in several further ways, some of which reflect differences between their manuscript and their released code:

  • Estimator and regularization. The manuscript describes pseudolikelihood maximization with L-BFGS, symmetry of JJ enforced during optimization, and regularization strength chosen by the extended Bayesian information criterion with γ=0.5\gamma = 0.5, following IsingFit [100]. The released code instead fits one L1-regularized logistic regression per latent (predicting that latent’s firing from all other latents’ firing, with a fixed penalty α=0.01\alpha = 0.01) on 500,000 tokens (by default from C4; the manuscript does not state what data the couplings were fit on), and symmetrizes the coefficients afterwards. We use mean-field inversion on 1B tokens with a small ridge penalty.
  • Community detection. The manuscript reports Louvain [101]; the released code uses Leiden [102]. We use Leiden, which recovered the reference set substantially better than Louvain in our experiments.
  • Sparsification. The L1 penalty in their estimator makes JJ sparse, and their code additionally drops edges with ∣Jij∣≤0.005|J_{ij}| \le 0.005 by default. The mean-field JJ is dense, so we keep only the top 3M pairs by ∣Jij∣|J_{ij}| as edges (about 2% of all pairs). We apply the same edge budget to every weight in Figure 5, so that all graphs have the same number of edges.
  • Model and SAE. Their language model experiments use a BatchTopK SAE on Llama-3.1-8B; we use a JumpReLU Gemma Scope SAE on Gemma-2-9B.

We also implemented the estimator from their released code (per-latent L1 logistic regression with liblinear, fit on a random sample of 500,000 Pile tokens with the same tokenization as above) and ran it through the same Leiden sweep. With their penalty α=0.01\alpha = 0.01, the peak IoU at 3M edges was 0.52, compared with 0.70 for mean-field couplings. At α=0.01\alpha = 0.01, the penalty is negligible compared to the log-likelihood summed over 500,000 tokens, and rare pairs of latents whose firing is nearly perfectly predictive of each other receive very large couplings, which crowd the reference latents’ couplings out of the top edges. Raising the penalty to α=100\alpha = 100 raised the peak IoU to 0.68 (at this penalty JJ has fewer than 3M nonzero pairs, so the graph uses all of them). We chose α=100\alpha = 100 from a handful of values using this same benchmark, so the 0.68 is an optimistic estimate.

Community detection and scoring. The graph has one node per SAE latent (16,384 nodes) and one weighted edge for each of the top 3M pairs. We partition it with the Leiden algorithm [102] as implemented in leidenalg, maximizing the modularity with a resolution parameter γ\gamma [103]. Larger γ\gamma gives smaller communities. We run Leiden to convergence at 121 values of γ\gamma spaced logarithmically between 1 and 10410^4, with three random seeds each. For each partition, we compute the max IoU, max⁡S∣S∩R∣/∣S∪R∣\max_{S} |S \cap R| / |S \cup R|, where SS ranges over the communities of the partition and RR is the reference set of 20 latents from Figure 2. Figure 5 shows the mean of max IoU over the three seeds at each resolution, with the range over seeds shaded. Mean-field Ising couplings reach a peak mean IoU of 0.70 (at γ≈200\gamma \approx 200), while the other weights peak between 0.49 and 0.54. The best community from the best single partition has 21 latents, 17 of which are in the reference set; Figure 6 compares the two sets.

Sensitivity to the edge budget. The ranking of the weights depends on how many edges we keep. With a budget of 100k edges instead of 3M, Jaccard similarity does best (peak mean IoU 0.63) and mean-field Ising couplings do poorly (0.18). The regularized pseudolikelihood estimator (α=100\alpha = 100) was the only weight that scored well at both budgets. The mean-field couplings need a dense graph: the top 100k pairs by ∣Jij∣|J_{ij}| include only 3 of the 190 pairs within the reference set, compared with 85 of the top 3M.

Projecting activations onto a community. For the top-left panel of Figure 7 (The Pile, projection onto the decoder subspace), we follow the visualization procedure of Bhalla et al. [25] as closely as their manuscript and code allow, using the best community SS described above. We stream 3M further tokens of pile-uncopyrighted with the same tokenization and record the layer-11 residual stream at tokens where any latent in SS fires, keeping a random sample of 60,000 such tokens. Following their conventions, a latent only counts if it fires on at least 30 of these tokens, and an activation only counts if it is at least the 10th percentile of that latent’s nonzero activations. We subtract the mean activation over these tokens, project onto the span of the community’s 21 decoder directions, run PCA on the projected coordinates, and plot a random subset of tokens on the top three principal components. The span of the decoder directions contains only 1.6% of the variance of these activations.

Centroids versus raw activations

In Figure 7, we visualized raw activations in subspaces derived from the decoder directions of the SAE latents in our community, and did not recover a clean helix. Here we instead use a subspace that we know contains the character count representation: the top three principal components of the layer-11 character count centroids from Figure 1. We project raw activations onto these same three PCs, on our synthetic prose corpus and on The Pile.

Centroids versus raw activations. All three panels show the same three directions in the layer-11 residual stream of Gemma-2-9B: PCs 1–3 of the character count centroids on our synthetic prose corpus (character counts 10–150), centered on the mean of the centroids. Left: the 141 centroids. Middle: 6,000 raw activations sampled uniformly from tokens in the synthetic prose corpus (from the fourth line of each document onward). Right: 6,000 raw activations from The Pile, sampled uniformly from tokens where at least one latent in the community from Figure 6 fires. Points are colored by character count since the last newline (counts above 160 share the top color; grey points come before a document’s first newline). Each panel has its own scale, and dragging in any panel rotates all three together. On synthetic prose, raw activations are loosely ordered by character count. On The Pile, they are largely mixed, even in this subspace.

Additional results on periodic character count representation

Overlap between the periodic planes and the prose representation

We measure how much the period-8 and period-4 planes from Section 4 overlap with the prose character count representation. We take the prose representation at each layer to be the span of the top 10 principal components of the character count centroids on our synthetic prose corpus (line widths 20–160, character counts 10–150). Figure 30 reports two measures: (a) the share of each plane that lies inside this prose subspace (the mean squared cosine of the principal angles between them), and (b) the share of the prose centroids’ variance across character counts that lies in each plane. From layer 11 onward, where the periodic representations are clearly present, about 4% or less of each plane lies in the prose subspace and each plane contains less than 1% of the prose centroid variance, except at the final layer (8% and 2%). At layers 0–10 the overlap is much larger (up to 22% and 16%). The periodic structure is weak at these layers, so the least-squares fit mostly picks up the smooth character count representation instead. For this reason we project the prose subspace out of the planes in our ablation experiments (Section A.5.2).

The periodic planes are nearly orthogonal to the prose character count representation at the layers where they appear. For each layer of Gemma-2-9B, (a) the share of the period-8 and period-4 planes (fit from hex centroids) lying inside the span of the top 10 principal components of the prose centroids, and (b) the share of the prose centroids’ variance lying in each plane. Dashed lines show the same quantities for random planes. In the shaded layers (0–10), the hex centroids have little periodic structure, and the fitted planes mostly capture the smooth character count representation.

Additional ablation experiments and details

Subspaces and ablation

Both ablation experiments mentioned in Section 4.4 use the subspaces and ablation described here.

Subspaces. We ablate the period-8 and period-4 planes described in Section 4 and shown in Figure 11, fit from the same hex centroids that we use for the Fourier analysis (character counts 12–75, on documents with line widths 20–99). At each layer, we subtract the mean μL\bm{\mu}_L of the centroids over character counts. For a period PP, we fit the centered centroids by least squares to cos⁡(2πc/P)\cos(2\pi c/P) and sin⁡(2πc/P)\sin(2\pi c/P), which gives two directions in the residual stream; orthonormalizing them gives the period-PP plane. For “both planes”, we orthonormalize the four directions from periods 8 and 4 together, giving a 4-dimensional subspace.

Because the planes are fit by least squares, they can partly overlap with the smooth character count representation that the model also uses on prose, especially at early layers (Section A.5.1). To make sure the ablation does not touch that representation, we compute character count centroids on our synthetic prose corpus from Section 3 (line widths 20–160, character counts 10–150), take their top 10 principal components at each layer, subtract their span from each subspace we ablate, and re-orthonormalize.

Ablation. For a subspace with orthonormal basis VL\bm{V}_L (one row per direction), we replace the residual stream h\bm{h} at the output of layer LL by

h−VL⊤VL(h−μL),\bm{h} - \bm{V}_L^\top \bm{V}_L (\bm{h} - \bm{\mu}_L),

which sets the component of h\bm{h} in the subspace to its value at the centroid mean. We apply this at every token position and at every layer from 6 to 36 in the same forward pass, each layer using its own subspace.

Measuring newline prediction. At each token, we compute the probability that the next token is a newline, summing over all tokens in the vocabulary that contain a newline character. We group positions by the character count of the line after the current token, and only use positions from the third line onward, since the model is still inferring the structure of the document during the first two lines.

Documents with variable line widths

For Figure 13, we generate 200 documents, each with 30 lines of random lowercase hexadecimal characters. The width of each line is drawn uniformly and independently from 16, 24, …, 64. Fewer lines reach the larger character counts, so the curves are noisier near the end of the line. As a control, we ablate random 4-dimensional subspaces drawn from the directions along which the activations vary most. At each layer, we ablate a random subspace inside the span of the top 50 principal components of the activations at hex tokens (we use a held-out set of 1600 documents to calculate the PCs, and the top 50 carry about three quarters of the activations’ variance), with the prose subspace and both periodic planes projected out so that the ablation leaves them untouched. We draw 10 such subspaces, each drawn separately at every layer, and Figure 13 shows the mean of their curves. These controls lower the newline peaks but leave them visible, whereas ablating the planes removes the periodic structure almost entirely.

To measure how sharp the peaks at the possible line ends are, we compare the log-odds of a newline at each line end with the log-odds one character earlier. Without ablation, the log-odds rise by about 2.5 on average at a line end. With both planes ablated, they rise by only about 0.1.

Other line width factors. We repeated the experiment with line widths that are multiples of 7, 9 or 10 instead of 8 (from 2x to 8x the factor), still ablating the period-8 and period-4 planes (Figure 31). For every factor, the ablation removes the peaks at the possible line ends. Without ablation, however, the model predicts line ends much more sharply when widths are multiples of 8: the log-odds rise by about 2.6 at a line end, compared with about 1 for the other factors. So the planes seem to help the model locate line ends in general, not only at multiples of 8, though the model is especially good at tracking multiples of 8.

Ablating the periodic planes removes the newline peaks for every line width factor, but the model predicts line ends most sharply at multiples of 8. As in Figure 13, but with line widths that are multiples of XX (from 2X2X to 8X8X) for X=7,8,9,10X = 7, 8, 9, 10. The same period-8 and period-4 planes are ablated in every case. The panels are scaled so that the possible line ends line up. The bottom panel shows, for each XX, how much the log-odds of a newline rise from one character before a line end to the line end, averaged over the line ends 2X2X to 7X7X (at 8X8X the line always ends).

Documents with a fixed line width

Here we test hypothesis 1 from Section 4.4: that the periodic representations help the model predict the newline precisely when every line has the same width. The effects we find are weaker, and less specific to the periodic planes, than on documents with variable line widths.

We note that if character count were only represented along a smooth manifold like Gurnee et al. [1], then it might be difficult for the model to distinguish between adjacent character counts to make such sharp predictions. We therefore conjectured that the addition of this periodic structure allows the model to perform a kind of error correction, where representations become more “spread out”. Representing character count modulo PP is sufficient for this, since the model already computes the “prose” character count representation, which gives the model a coarse sense of the character count that can then be refined with the periodic representations.

We generate 40 documents, each with 30 lines of exactly 48 random lowercase hexadecimal characters, and record the probability that the model assigns to a newline at each position. The position with character count 48 is the last token before the newline, where the model should predict it. Without any ablation, we find that the model assigns ≈0{\approx}0 probability to newline tokens within the line, and then assigns ≈0.99{\approx}0.99 probability at the actual newline token position. When we ablate planes where periodic structure occurs, we find that the model’s confidence in predicting the newline token degrades: when the next token is a newline, it outputs newline with probability 0.84 and at the previous token position outputs newline with probability 0.12. Also ablating the neighboring frequencies to period-8 and period-4 (12 dimensions now instead of 4) lowers the probability at the newline position further, to 0.49. However, we find that ablating 12-dimensional subspaces of other directions in which the centroids vary with character count, orthogonal to these bands, has a similar effect (0.50–0.53), so we are unsure whether we can attribute this effect specifically to the periodic structure. We show the effects of these ablations in the figure below.

Ablating periodic character count representations degrades the model’s confidence in the newline position, but so does ablating other count-dependent directions. Gemma-2-9B’s probability of predicting a newline at the last positions of 48-character hex lines, when subspaces are ablated at layers 6–36. Ablating the period-8 and period-4 planes lowers the probability at the end of the line to 0.84, and ablating the full period-8 and period-4 frequency bands (12 dimensions, including the neighboring frequencies) lowers it to 0.49. Ablating 12-dimensional subspaces of other directions in which the centroids vary with character count, orthogonal to these bands, has a similar effect (0.50–0.53). All subspaces are orthogonal to the prose character count representation (Section A.5.2).

Frequency bands and other count-dependent directions. To build the larger subspaces in Figure 32, we take the discrete Fourier transform of the 64 centered hex centroids along the character count axis. Frequency kk corresponds to period 64/k64/k, so periods 8 and 4 are k=8k = 8 and k=16k = 16, and the real and imaginary parts of the coefficients at these two frequencies span the same subspace as the two planes. The period-8 and period-4 bands add the neighboring frequencies (k=7k = 7–99 and 1515–1717), giving 12 dimensions. For the other count-dependent subspaces, we use three sets of six other frequencies (also 12 dimensions each), and project the bands out of each so that they do not ablate the periodic directions again. All of these subspaces have the prose subspace projected out, as described above.

Effect of projecting out the prose subspace. Without this step, ablating both planes has a larger effect: the probability of predicting the newline at the end of the line drops to 0.72 instead of 0.84. Part of the effect of the unprojected planes therefore comes from the prose representation. For comparison, ablating the top 10 principal components of the hex centroids, which contain the smooth character count representation as well as the periodic one, nearly removes the newline prediction (the probability drops to 0.07).

Robustness. We repeated the experiment on documents with line widths 30–80 (in steps of 5), aligning positions by the number of characters remaining in the line, and found the same ordering of effects. In particular, ablating both planes reduced the probability of predicting the newline at the end of the line from 0.96 to 0.81.

Additional heatmaps of periodic structure

The periodic structure appears on hex strings but not on prose. Fourier power of character count centroids across layers and periods, for hex documents (top) and for Project Gutenberg prose wrapped to fixed widths (bottom), in Gemma-2-9B, Gemma-4-31B, and Qwen3-8B. Both corpora use line widths 20–99 and character counts 12–75, and all six panels share one color scale. On this scale the prose panels are nearly black, so we label each with its maximum value, which is at period 16 for all three models.
Fourier power of hex character count centroids across open-weight models. This is the same analysis as Figure 11 but for a larger set of models.
Fourier power of character count centroids in Gemma-2-9B on three corpora of random characters: decimal digits, hexadecimal digits, and letters. As for our hex corpus, every document has lines of exactly W characters (W = 20–99, 20 documents of 30 lines for each width), and we compute centroids for character counts 12–75 from the third line onward, take a discrete Fourier transform across character count, and sum the squared magnitudes across residual stream dimensions (normalized as in Figure 11). Gemma-2-9B tokenizes each decimal digit separately; for letters, we force the same alignment by tokenizing each letter as its own token, which is not how the tokenizer would split these strings. All three panels share one color scale. Periods 8 and 4 appear on both digits and hex, with period 8 strongest on digits (layer 10), but not on letters, even though they have the same one token per character alignment as digits. Hover over a cell to see its value.

Technical details of the predictive-generator analysis and toy models of the count × width manifold

Predictive generators

Think of an exact finite-dimensional predictive generator of a process (here a process is simply a distribution over token sequences, P(x0:t)P(x_{0:t})) as being composed of three parts:

  1. A map from histories of tokens to predictive vectors. Given the history ht=x0:th_t = x_{0:t}, there exists a map Φ\Phi

    ηt=Φ(ht)∈Rd,\eta_t=\Phi(h_t)\in\mathbb R^d,

    where dd stays fixed as tt increases.

  2. This vector contains enough information to give the same next-token probabilities as the full history through a function EE:

    Pr⁡(Xt+1=x∣X0:t=ht)=E(ηt,x).\Pr(X_{t+1}=x\mid X_{0:t}=h_t)=E(\eta_t,x).

  3. The predictive vector can be updated iteratively through a function ff, using only its current value and an observed token:

    ηt+1=f(ηt,xt+1)=Φ(ht xt+1).\eta_{t+1}=f(\eta_t,x_{t+1})=\Phi(h_t\,x_{t+1}).

When the process is stationary, the same maps/functions must work at every time and for every history that can occur. Generation therefore consists of repeatedly sampling a token and updating the vector:

Xt+1∼E(ηt,⋅),ηt+1=f(ηt,Xt+1).X_{t+1}\sim E(\eta_t,\cdot), \qquad \eta_{t+1}=f(\eta_t,X_{t+1}).

Starting from the vector for a given history, this generates continuations according to the process probabilities. These conditions make ηt\eta_t a sufficient statistic of the history for the purposes of prediction. It preserves all information in the observed past that matters for predicting the future. Under next-token cross-entropy loss, the optimal probabilistic prediction is the true conditional distribution of the next token given the current context. Since the function EE reproduces this distribution, predicting from ηt\eta_t achieves the optimal loss. In this way, our predictive generator can be thought of as a mechanism for achieving optimal prediction.

The same process can have different presentations: different predictive models that reproduce its sequence probabilities. We can define classes of presentations by restricting the state space and the allowed forms of EE and ff.

A familiar example is a finite-state HMM, which has ηt\eta_t restricted to be a probability distribution. For an HMM, EE and ff are defined by the same set of nonnegative linear maps, which sum to a row-stochastic matrix. Using row vectors, let Tij(x)T^{(x)}_{ij} be the probability of emitting xx and moving to state jj, given current state ii. Then

E(η,x)=ηT(x)1,f(η,x)=ηT(x)ηT(x)1,E(\eta,x)=\eta T^{(x)}\mathbf1, \qquad f(\eta,x)=\frac{\eta T^{(x)}}{\eta T^{(x)}\mathbf1},

where 1\mathbf1 is the column vector of ones.

Not all processes possess a compact HMM presentation. In order to arrive at a compact set of predictive vectors, we must extend what operations EE and ff have access to. Another useful family uses a fixed number of numerical registers as its predictive state, rather than probability distributions. For our purposes, a register presentation has a finite collection of affine comparisons that divides the state space into regions. Within each region RR, each token has a fixed emission probability and an affine update. Using row-vector notation,

E(η,x)=px,R,f(η,x)=ηAx,R+bx,R,E(\eta,x)=p_{x,R}, \qquad f(\eta,x)=\eta A_{x,R}+b_{x,R},

with

px,R≥0,∑xpx,R=1.p_{x,R}\geq0, \qquad \sum_xp_{x,R}=1.

The update ff is piecewise affine, and the readout EE is piecewise constant. Unlike an HMM, they are specified separately. When each token uses the same affine update across all regions, the update is globally affine. This register-based viewpoint has its roots in the counter and register machines of Lambek [104] and Minsky [105]. This framework extends the updates to include piecewise-affine maps [106]; the resulting construction is an iterated function system with place-dependent probabilities [107].

Fully specifying a stochastic counter machine

If the width ww is known, the only thing about the past that matters for future predictions is the current line position cc, the characters since the last newline. cc is not hidden, it is a count over observed tokens. Assume token kk has length ckc_k and is drawn with a position-independent probability pkp_k; the whole next-token distribution is that draw put through a threshold, token kk fits iff c+ck≤wc + c_k \le w:

P(token k∣c)=pk 1[ c+ck≤w ],P(newline∣c)=∑kpk 1[ c+ck>w ]P(\text{token }k \mid c) = p_k\,\mathbf{1}[\,c + c_k \le w\,], \qquad P(\text{newline} \mid c) = \sum_k p_k\,\mathbf{1}[\,c + c_k > w\,]

Tokens that fit in the line keep their pkp_k selection probability and any tokens that would overflow have their probability mass collect on the newline. The overflowing token is emitted on the next line, so its characters are preserved.

Between the newline N\text{N} and that token, the observer knows a newline happened at cc but not which token caused it (any token with ck>w−cc_k > w - c could be responsible). Thus, right after a newline the next-token question becomes “which token overflowed?”. This means we are really just looking at the distribution P(newline∣c)P(\text{newline} \mid c) on the restricted domain of tokens that would have overflowed:

P(token k∣c, N)=pk 1[ c+ck>w ]P(newline∣c) .P(\text{token }k \mid c,\ \text{N}) = \frac{p_k\,\mathbf{1}[\,c + c_k > w\,]}{P(\text{newline} \mid c)}~.

Here, the conditioning on c,Nc,\text{N} indicates this is the probability distribution after having just observed a newline token from position cc. This distribution only matters at this context position, until the next token (the deferred token that caused the newline token) opens the new line with ckc_k characters.

While we just described this generator in terms of a single count register cc, the automaton that implements this process actually requires two character-counting registers. Let aa count the characters on the current line, and let bb temporarily hold the position of the last newline. These registers update from observing content tokens or newlines in the following way:

  • a content token kk increments aa: a←a+cka \leftarrow a + c_k, and erases bb: b←0b \leftarrow 0
  • a newline token swaps the registers: (a,b)←(b,a)(a, b) \leftarrow (b, a)

These dynamics mean the (a,b)(a,b) state is always (c, 0)(c,\ 0) except for right after a newline, where it is (0,c)(0,c). The extra register slot is simply a way to keep track of the fact that we have a different probability distribution of tokens right after the newline 32. At a known width, then, the sufficient statistic is this register pair. The state updates are always affine, but the probability readout functions are nonlinear, in the inequality that compares c+ckc + c_k against ww and the one that compares aa and bb to change the next token prediction right after a newline.

Our task includes documents of various fixed widths, so we can think of the real data as drawing ww from a prior τ\tau over candidate widths WW at the start of each sequence. The observer must infer this ww from the token stream, since it is not directly observable the way that cc is. A Bayesian observer should refine their estimate of ww through context, starting from some prior on the task. Let’s assume that the observer is Bayes-optimal and knows that we are selecting from a fixed set of widths. At optimality, the observer’s prior would be τ\tau itself. Our data draws ww uniformly from a range of candidates, and the optimal posterior over widths is simply this prior restricted to an interval of plausible widths with lower bound LL and upper bound UU:

P(w)  ∝  τ(w) 1[ L≤w≤U ]P(w) \;\propto\; \tau(w)\,\mathbf{1}[\,L \le w \le U\,]

Every content token that moves us to position cc proves w≥cw \ge c, which raises LL; the beginning of each line shows us a token kk that overflowed, proving w<c+ckw < c + c_k and lowering UU.

All said, the three formulas above need only a small change to accommodate inference over widths. Each of the indicator functions must be replaced with an average over the viable widths. If we define M(l,u)=∑w∈W, l≤w≤uτ(w)M(l,u) = \sum_{w \in W,\ l \le w \le u} \tau(w) as the probability mass that the prior assigns to the interval [l,u][l,u], we simply implement the following transformations:

1[ c+ck≤w ]  ⟶  M(max⁡(L, c+ck), U)M(L,U) ,1[ c+ck>w ]  ⟶  M(L, min⁡(U, c+ck−1))M(L,U) .\begin{aligned} \mathbf{1}[\,c + c_k \le w\,] \;&\longrightarrow\; \frac{M(\max(L,\ c + c_k),\ U)}{M(L,U)}~, \\ \mathbf{1}[\,c + c_k > w\,] \;&\longrightarrow\; \frac{M(L,\ \min(U,\ c + c_k - 1))}{M(L,U)}~. \end{aligned}

Substituting the above into our probability expressions yields

P(token k)=pk M(max⁡(L, c+ck), U)M(L,U),P(newline)=∑kpk M(L, min⁡(U, c+ck−1))M(L,U) , andP(token k∣N)=pk M(L, min⁡(U, c+ck−1))M(L,U)  P(newline) .\begin{aligned} P(\text{token }k) &= p_k\,\frac{M(\max(L,\ c + c_k),\ U)}{M(L,U)}, \\ P(\text{newline}) &= \sum_k p_k\,\frac{M(L,\ \min(U,\ c + c_k - 1))}{M(L,U)}~, \text{ and} \\ P(\text{token }k \mid \text{N}) &= \frac{p_k\,M(L,\ \min(U,\ c + c_k - 1))}{M(L,U)\;P(\text{newline})}~. \end{aligned}

The (a,b)(a,b) register updates carry over completely unchanged, but we also need to include rules for updating the U,LU,L registers. These updates are as follows:

  • a normal content token can raise the width floor: L←max⁡(L, a+ck)L\leftarrow \max(L,\ a + c_k).
  • the first token after a newline can lower the width ceiling: U←min⁡(U, b+ck−1)U \leftarrow \min(U,\ b + c_k - 1).

The entire probability distribution over the future can be represented with four registers (a, b, L, U)(a,\ b,\ L,\ U) and the prior over widths. While the position pair (a,b)(a,b) still updates with affine maps, LL and UU update through max⁡\max and min⁡\min.

Between the newline and its deferred token, the posterior is briefly not an interval

As long as the most recent token emitted is a content token, the posterior stays uniform over the viable widths. However, a newline token is itself evidence that some token overflowed at cc, and that evidence is width-dependent:

P(w∣h, N)  ∝  τ(w) 1[L≤w≤U] ∑kpk 1[c+ck>w]P(w \mid h,\,\text{N}) \;\propto\; \tau(w)\,\mathbf{1}[L \le w \le U]\,\sum_k p_k\,\mathbf{1}[c + c_k > w]

The smaller ww is, the more token lengths overflow, so the post-newline posterior is not a flat interval. However, seeing which token was deferred brings the posterior back to a uniform interval again. We can effectively ignore this wrinkle, since the bulk of our geometry analysis neglects the activations above the newline regardless — but it is still worth mentioning.

Because we ignore the activations above the newline tokens, we can also ignore the bb register — which is only nonzero right after seeing a newline. This means that, when looking at content tokens, we effectively only have three registers (a,L,U)(a,L,U). When looking for content token geometry, we refer to this as (c,L,U)(c,L,U) since the first register position is always equal to the character count on the current line.

Minimal linear dimension of the line-wrap process

The compact filter is four registers, but it is not linear. It is worth being precise about whether it needs nonlinearity. The position registers use affine transformations (addition and swapping, one operator per observed symbol, exactly as an HMM picks an operator per symbol). The interval endpoints L,UL,U are the issue, which require a nonlinear comparison to update. What does it cost to represent the same process linearly — all latent state updates linear per symbol, with the readout linear as well?

The straightforward way to linearize a hard threshold is to simply enumerate it. If we add latent directions that effectively enumerate the register domain, we can create an HMM that generates the exact process for a single width ww. With nn distinct token lengths we need:

  • w+1w+1 position states: S0…SwS_0 \ldots S_w. From SiS_i, a token that fits on the line (i+ck≤wi + c_k \le w) moves Si→Si+ckS_i \to S_{i+c_k} with certainty; if the token doesn’t fit, a newline is emitted and we move to one of the buffer states BiB_i, defined below.
  • nn buffer states: B0…Bn−1B_0 \ldots B_{n-1} — one per distinct ckc_k, holding the deferred token so it can open the next line.

In total, this means a w+1+nw + 1 + n state HMM. As an example, let’s write out the matrices for an HMM for data with w=3w=3 and ck∈{1,2}c_k \in \{1,2\}. The HMM has 3+1+2=63+1+2=6 states: [S0 S1 S2 S3 B0 B1][S_0\ S_1\ S_2\ S_3\ B_0\ B_1], and a vocab of 3 tokens: {tok0 (c=1), tok1 (c=2), newline}\{\text{tok0}\,(c=1),\ \text{tok1}\,(c=2),\ \text{newline}\}. The token-conditioned transition operators are:

T[tok0, c=1]=from\toS0S1S2S3B0B1S0..5....S1...5...S2....5..S3......B0.1....←B0 emits tok0→S1B1......T_{[\text{tok0},\,c=1]} = \begin{array}{c|cccccc l} \text{from}\backslash\text{to} & S_0 & S_1 & S_2 & S_3 & B_0 & B_1 & \\ \hline S_0 & . & .5 & . & . & . & . & \\ S_1 & . & . & .5 & . & . & . & \\ S_2 & . & . & . & .5 & . & . & \\ S_3 & . & . & . & . & . & . & \\ B_0 & . & 1 & . & . & . & . & \leftarrow B_0 \text{ emits tok0} \to S_1 \\ B_1 & . & . & . & . & . & . & \end{array}

T[tok1, c=2]=from\toS0S1S2S3B0B1S0...5...S1....5..S2......S3......B0......B1..1...←B1 emits tok1→S2T_{[\text{tok1},\,c=2]} = \begin{array}{c|cccccc l} \text{from}\backslash\text{to} & S_0 & S_1 & S_2 & S_3 & B_0 & B_1 & \\ \hline S_0 & . & . & .5 & . & . & . & \\ S_1 & . & . & . & .5 & . & . & \\ S_2 & . & . & . & . & . & . & \\ S_3 & . & . & . & . & . & . & \\ B_0 & . & . & . & . & . & . & \\ B_1 & . & . & 1 & . & . & . & \leftarrow B_1 \text{ emits tok1} \to S_2 \end{array}

T[newline]=from\toS0S1S2S3B0B1S0......S1......S2......5←tok1 overflows: newline→B1S3.....5.5←both overflow: newline→B0, B1B0......B1......T_{[\text{newline}]} = \begin{array}{c|cccccc l} \text{from}\backslash\text{to} & S_0 & S_1 & S_2 & S_3 & B_0 & B_1 & \\ \hline S_0 & . & . & . & . & . & . & \\ S_1 & . & . & . & . & . & . & \\ S_2 & . & . & . & . & . & .5 & \leftarrow \text{tok1 overflows: newline} \to B_1 \\ S_3 & . & . & . & . & .5 & .5 & \leftarrow \text{both overflow: newline} \to B_0,\, B_1 \\ B_0 & . & . & . & . & . & . & \\ B_1 & . & . & . & . & . & . & \end{array}

This is a fairly compact model, but if we have tokens that reach up to 15 characters, and a line width of 120 characters, the HMM is 136 states. Maybe that is just a clumsy construction? Maybe a more clever linear model collapses the counter into a few latents? This question can be answered by constructing the spectrum of the Hankel matrix [108, 109]. The matrix is defined by indexing rows by histories hh and columns by futures ff. Then

H[h,f]=P(h,f) ,H[h, f] = P(h,f)~,

the joint probability the process emits hh followed by ff. Any linear model factors every entry through its dd-dimensional latent state: P(hf)=(η∅Th)(Tf1)P(h f) = (\eta_\varnothing T_h)(T_f \mathbf{1}). This implies a factorization H=ABH = A B with inner dimension dd. Thus, rank⁡H  ≤  d\operatorname{rank} H \;\le\; d for any linear model of the process, no matter how clever the entries. (The bound is tight: a linear model of dimension rank⁡H\operatorname{rank} H always exists, so the rank is the minimal linear dimension.) We can use any generator to efficiently calculate joint probabilities, so we use the explicit HMM construction above to calculate the rank of HH for various single-width machines. The table below gives the calculated rank for some single width and multiple width cases:

width token lengths HMM states Hankel rank formula
3 1, 2 6 5 w+nw + n
20 1, 2, 3 24 23 w+nw + n
150 2–8 158 155 w+n−2w + n - 2
20–150 2–8 12,183 11,790 ∑w(w+n−2)\sum_w (w + n - 2)
20–240 2–8 30,498 29,835 ∑w(w+n−2)\sum_w (w + n - 2)
20–150 1–15 13,231 13,100 ∑w(w+n)\sum_w (w + n)

Calculating the rank of the Hankel matrix validates our naive construction as nearly optimal already.

In every case, each width with n different character lengths contributes approximately w+nw + n necessary latent states. All we can save is a handful of states in each width. Unfortunately, we essentially already had the minimal linear model! The loss of a couple of dimensions in the tasks that do not include a token of unit character length can be explained by collapsing of a small number of predictive states. For example, r=1r=1 and r=2r=2 have identical future distributions of tokens if no ck=1c_k=1 token exists. Though, this detail is very tangential to our overall point, and we don’t go any further than that.

The nonergodic mixture of differing widths makes the dimensions climb even higher. The widths cannot share counters (each thresholds at a different place), so the natural exact linear model is the direct sum over widths, whose dimension is the sum of the individual machines’ dimensions. Even for a modest mixture with token lengths 2,…,82, \ldots, 8 over widths 20,21,…,15020, 21, \ldots, 150 the exact mixture HMM carries ∼12,000{\sim}12{,}000 latent states. If a network’s residual stream is a linear state machine, it cannot afford an exact representation and must be running some compressed, approximate linear model of the counter. Such an approximation could very well achieve near-optimal predictive loss, but looking for these approximations is beyond the scope of the current investigation.

Forecast embeddings are independent of content token probabilities

Watching only the newlines, one step at a time, might feel like it throws away most of the richness of the predictions. However, we are throwing away less (newline-placement-relevant) information than it appears.

Consider the probability some starting (c,w)(c,w) state assigns to a particular continuation →\rightarrow consisting of a string of tokens with newlines in it. Let’s break down the continuation into two distinct components. We have the sequence of content token draws x⃗\vec{x} that the non-newline token generator made, and a list of newline placement positions ↩\hookleftarrow. These draws are made with the same distribution from every (c,w)(c,w) state. The likelihood each state assigns to →\rightarrow factors into a (c,w)(c,w) independent factor (the probability of the content tokens neglecting the newlines) times a factor that depends on the newline placement.

P(→∣c,w)  =  P(x⃗)×P(↩∣c,w)P(\rightarrow \mid c, w) \;=\; P(\vec{x})\times P(\hookleftarrow \mid c,w)

Here, P(↩∣c,w)P(\hookleftarrow \mid c,w) is just an indicator function that is either 0 or 1, depending on whether the newline placement is consistent with (c,w)(c,w) or not. The same general argument applies when the width is uncertain, but the form of the function is more complicated.

Thus, we see the difference between two (c,w)(c,w) states’ forecasts lies entirely in the difference between newline placement. The token content itself does not separate different (c,w)(c,w) states. Thus, we should expect that (c,w)(c,w) centroids are organized according to future distributions over newlines only, rather than the full token distribution.

While we can safely ignore the content tokens, and only look at newline probabilities, it is not true that looking only at the “next-newline” or the “all-newline” probabilities is the same as looking at the full joint distribution of newlines (something we do not do in this work).

Over a window that stays within the current line, all continuations contain no more than one newline. In this case the full distribution over newline placement is determined only by which step the newline lands on, and the marginal probability equals the joint. In other words: because there is only the one newline token, there are no correlations for the joint to keep track of. Thus, for horizons confined to the current line, the all-newline forecast yields the same embedding as the joint. Equal characters remaining means equal ↩\hookleftarrow for every x⃗\vec{x}, so states with the same number of characters remaining coincide.

This reorganization in terms of characters remaining r=w−cr=w-c can be quantified with a variance decomposition of the (c,w)(c, w) centroids. We cluster the centroids by characters remaining, with one cluster per value of rr, and compute the fraction of the variance that lies between the groups rather than within them. A value of 0 means rr is not correlated with where a centroid sits, 1 means that its position can be determined by rr alone. For a mixture of token lengths 2–8, widths 20–150, this fraction is 23 percent in the coordinate embedding and 99 percent in the next-newline embedding. The next-newline embedding really is an rr embedding.

Finally, we note that correspondence between marginal and joint only holds within a single line. Once the window holds two or more newlines, the distribution over placements also records how successive newlines move together. These correlations reveal information about ww, because successive newlines sit ≈w\approx w characters apart. This means that, as the horizon grows, ww returns to the embedding. Both the marginal and the joint distributions reveal this, but there is width information that the marginal throws away — and so the embeddings diverge from each other.

Tracing and steering cc, rr, and ww

In Section 5, we described the joint c×wc \times w sheet as a geometric object: a two-dimensional surface in the residual stream, parameterized by the current character count cc and the line width ww. However, we close that section by discussing the close relationship between the characters remaining rr and the line width, given they differ by the fully observable character count. Here we provide quantitative analysis that backs up and extends the claims and investigations of that section.

Where the variables of the line-breaking task are represented, how prominent they sit in the models representation, and whether they are actually used are all questions that have different answers and require different tests. A variable can be linearly decodable at a layer without the model reading it there or, indeed, anywhere while computing token probabilities. Prior steering work Gurnee et al. [1] intervened using count centroids averaged over documents of all line widths, which left open whether the model’s operational count state is a width-independent scalar or a genuinely joint (w,c)(w, c) coordinate on the sheet. We address these questions in three steps. First, we train linear probes for each variable at every layer of Gemma-2-9B, tracking how well each variable can be linearly decoded as a function of the layers of the model. We then do variance decomposition of the activations in terms of these variables, which provides quantitative evidence of the activation centroids’ reorganization around characters remaining that we predict in Section 5.5. We close by performing targeted steering experiments: we overwrite the model’s internal states with a chosen point on the (c,w)(c,w) sheet, using either the width-conditioned μ(c∣w)\mu(c \mid w) or the width-agnostic μˉ(c)\bar{\mu}(c) mean activation, and read out the change in the model’s newline prediction.

Probes

We wrap English prose at line widths w=20w = 20 to 150150 and collect residual-stream activations at every content token, skipping the first three lines of each document so the width has been established. Each token is labeled with its character count cc and with the width ww of its document. For each variable (cc, ww, rr, and a control variable w+cw + c) we fit a linear probe on the activations at every layer and evaluate it on held-out documents. In Figure 36 we report held-out R2R^2 as a function of layer.

Held-out probe R2R^2 by layer in Gemma-2-9B. Linear probes for the character count cc, the line width ww, and the characters remaining w−cw - c (fit on positions with r<40r < 40, and on all positions, r<150r < 150), trained on residual-stream activations at content tokens and evaluated on held-out documents. The fact that we find a stronger linear encoding of rr towards the end of the line is consistent with the theoretical predictions in Section 5.5.4 that the model should separate states by rr increasingly as the end of the line is approached.

Any linear function of cc and ww is decodable wherever both variables are present, so a successful chars-remaining probe cannot by itself be distinguished from a linear combination of a count and a width representation. We therefore perform variance decomposition on the centroids as well. Using only data for which r≤40r\leq40, we group (c,w)(c,w) centroids by one variable’s values and compute the variance between the group means as a share of total variance among all c,wc,w centroids. A high score means centroids sharing a value of the variable sit close together, whether or not the variable is encoded linearly. Each centroid is weighted by how many tokens fall into each.

We calibrate each curve against a full permutation of the labels, which gives the score expected by chance at these group sizes. We plot the 99th percentile of this null, and credit a variable with structure of its own only where the observed curve exceeds it. Because the variables are linked by r=w−cr=w-c, a raw score can simply be due to inherited structure from another. So, we also report a different set of nulls that permutes activation vectors between the centroid groupings, while still preserving either rr or cc. These nulls show what a grouping would score by inherited structure even if only the preserved variable was represented. The variable w+cw + c, which the model has no computational reason to track, serves as a check on the method. Its bump around layer 10 and the line width bump at the same location follows the count-preserving null which indicates both are due to inheritance from cc. In general, the width never explains more variance than the amount implied by the structure of the character count.

Fraction of centroid variance that lies between group means, by layer, when Gemma-2-9B’s activations are grouped by the character count cc, the line width ww, the characters remaining w−cw - c, and the sanity variable w+cw + c. Dashed: 99th percentile of a full label permutation.

The decomposition in Figure 37 gives a clear picture of the centroid organization across layers of the model. In the first third of the network the residual stream is organized by absolute count: grouping by cc explains about 90% of activation variance from layer 0 through layer 10, far above the null. Here we see a quantitative signature of the geometric reorganization from “coordinate” to “forecast”: between layers 12 and 15 the organization changes to be organized primarily by characters remaining. The count score collapses below its permutation null, while chars remaining jumps from near its null to about 0.7 and continues to about 0.85 by layer 30. After the transition, only rr does better than its null baseline: the late-network representations are primarily organized by the distance to the boundary specifically, not by count and width separately— at least for the tokens that are within 40 characters from the end of each line. The early layers represent how far into the line a token is, the late layers by characters remaining, the quantity actually relevant for predicting newlines.

Together, the probe and variance analyses suggest that the residual stream becomes increasingly organized around characters remaining in the middle of the network. This is the pattern we see in the toy models, and the one the forecast embedding predicts. These tests do not, however, establish that the model uses this geometry to predict a newline. We therefore next intervene directly on the corresponding representations.

Steering

Width-agnostic count steering fires only at the document’s true width. Here, we intervene on layers 10–14 with the additive intervention, and plot against the injected count c∗c^*. Injecting the width-conditioned mean μ(c∗∣w∗)\mu(c^* \mid w^*) drives a newline at each injected width’s own boundary (w∗=60,90,120w^* = 60, 90, 120; solid). Injecting the width-agnostic centroid μˉ(c∗)\bar{\mu}(c^*), the mean activation over tokens with count c∗c^* in documents of every width, fires only where the injected count reaches the documents’ true width; past that, the probability returns to baseline. The data averages over 63 different contexts whose most likely next token is exactly 55 characters. The gray dashed horizontal line is from a random direction with the norm of the width-agnostic patch.

We intervene on the width-conditioned character count sheet to test its causal effect on predicting newline tokens. We take English documents wrapped at width 90 and read the model’s newline probability P(newline)P(\text{newline}) at content tokens in the middle of lines, where the correct prediction is to continue the line.

At these tokens, we shift the (c,w)(c,w) component of the residual stream vector hh from the model’s own state to a chosen counterfactual point:

h′=h+UU⊤[μ(c∗∣w∗)−μ(c∣w)],h' = h + UU^\top \bigl[\mu(c^* \mid w^*) - \mu(c \mid w)\bigr],

where UU spans a rank-8 subspace fit on the full set of width-conditioned character count centroids, μ(c∣w)\mu(c \mid w) is the centroid for the token’s actual cc and ww, and μ(c∗∣w∗)\mu(c^* \mid w^*) is the centroid for the injected count c∗c^* on a line of injected width w∗w^*. The same displacement is added to the read token and to the two content tokens before it, so the local count trajectory stays consistent.

The injected state is meant to tell the model it has seen c∗c^* characters on a line of width w∗w^*; everything else in the document, including the width evidence at the newline tokens, remains visible to the model. Importantly, only the content tokens are patched: the newline tokens are left untouched.

We first compare these injections to ones that use width-agnostic centroids μˉ(c∗)\bar{\mu}(c^*), the intervention from Gurnee et al. [1]. We sweep the injected count c∗c^* for different counterfactual widths w∗w^* and report their impact on the probability of newline prediction. Figure 38 shows that the width-agnostic fires only at the document’s true width while injecting the width-conditioned mean μ(c∗∣w∗)\mu(c^* \mid w^*) drives a newline at each injected width’s own boundary. For example, injecting “five characters left on a width-60 line” makes the model behave similarly to a model that is five characters from the end of a width-60 line, even though every line it can actually see is 90 characters wide.

However, this is not the whole story. This may be because the (c∗,w∗)(c^*,w^*) injections change what the model believes about its proximity to the end of the line, but leaves the width evidence at previous newlines untouched. We see evidence of these conflicting instructions in Figure 38: when w∗=120w^*=120, P(newline)P(\text{newline}) also increases for injected counts near the document’s original boundary. This suggests the model is still receiving previous newline information as evidence, and using that in service of prediction.

To test this, we try a simple intervention that stops the queried token from reading previous newline tokens directly. The left panel of Figure 39 shows the same width-conditioned intervention as Figure 38, but scaled against r∗=w∗−c∗r^*=w^*-c^*. The right-hand panel shows the same data and intervention but also masks the queried token’s ability to attend to any of the previous newline tokens. The peak at the original boundary drops significantly under this mask. However, some portion of the bump persists and the newline probabilities for all interventions fall. This suggests that the information is spread out over many token positions in a way that allows the model to partially circumvent our simple masking intervention. We leave further investigation of this for future work.

Left: P(newline)P(\text{newline}) against the characters remaining on the injected line, r∗=w∗−c∗r^* = w^* - c^*. Right: the same injections, with the read token’s attention to every earlier newline token removed at all layers; all other tokens are processed normally.

We now explicitly test whether the activations at previous newline tokens carry the width evidence that the model uses when it predicts a newline. We therefore intervene on those tokens directly. Let g(w)g(w) denote a width centroid: the mean residual stream vector at the newline tokens of documents wrapped at width ww. These centroids span a low-dimensional manifold, and we take VV to be the rank-4 subspace fit on them. In a document wrapped at width 90, we shift every newline token’s width component to a counterfactual width w∗w^*:

h′=h+VV⊤[g(w∗)−g(90)],h' = h + VV^\top \bigl[g(w^*) - g(90)\bigr],

either at a single layer or at each of layers 10–14. The content tokens are left untouched. We then read P(newline)P(\text{newline}) after every word and plot it against the character count cc. A narrow injection (w∗<90w^* < 90) should make it break early, at c≈w∗c \approx w^* and a wide injection (w∗>90w^* > 90) should suppress the break at the true boundary, c≈90c \approx 90. Figure 40 shows both behaviors, though only when the intervention is done across multiple layers.

Newline-token width injections in 256 width-90 documents, w∗=50,60,70,80,120w^* = 50, 60, 70, 80, 120. Left: patched at layer 13 only. Right: patched at layers 10–14 together. Dotted colored lines mark c=w∗c = w^* for each narrow injection.

Toy model data and training

Data

The toy model featured in this post is trained on the synthetic version of the line-breaking task, with data generated by the process described in Section A.6.2. Each document has a fixed width ww that must be inferred from context. Its vocabulary is nn content tokens, with token kk representing a word of ckc_k characters, plus a newline token. Widths are drawn uniformly from {20,21,…,150}\{20, 21, \ldots, 150\}.

Two token-length distributions were used. The uniform 2–8 process has 77 tokens of lengths 2,…,82, \ldots, 8 with pk=1/7p_k = 1/7. We calculate the forecast embeddings for Gemma using a slightly different process with 1515 tokens of lengths 1,…,151, \ldots, 15 and pkp_k set to the token-length distribution of Gemma-2-9B’s tokenizer on 5.4×1085.4 \times 10^8 tokens from the Gutenberg corpus, and then clipped to 15 characters:

p1:15=(.136, .061, .174, .215, .155, .090, .061, .046, .027, .018, .010, .0044, .0021, .0009, .0002).p_{1:15} = (.136,\ .061,\ .174,\ .215,\ .155,\ .090,\ .061,\ .046,\ .027,\ .018,\ .010,\ .0044,\ .0021,\ .0009,\ .0002).

Every document begins with a beginning-of-sequence token followed by 511 emitted symbols, filling the model’s 512-token context.

Five widths, w∈{45,70,95,120,145}w \in \{45, 70, 95, 120, 145\}, were withheld from training so that the held-out evaluation loss measures interpolation to line widths the model has never seen. All geometry analyses in this post (the coordinate embeddings, the (c,L,U)(c, L, U) and (c,w)(c, w) centroids, and the forecast embeddings) are computed over all 131 widths.

Training

The toy model is a 4-layer decoder-only transformer (TransformerLens HookedTransformer) with rotary position embeddings, RMSNorm, gated GELU MLPs of width 4 dmodel4\,d_{\text{model}}, and a 512-token context. It has dmodel=8d_{\text{model}} = 8, two attention heads of dimension dhead=4d_{\text{head}} = 4, and MLP width dmlp=32d_{\text{mlp}} = 32. It was trained with AdamW (β=(0.9,0.999)\beta = (0.9, 0.999), no weight decay) at a constant learning rate of 10−310^{-3} on next-token cross-entropy over every position, for 50,000 steps. Each step used 256 freshly sampled documents with no document ever repeated. Evaluation used fresh documents from a fixed seed, separately over the trained and the held-out widths. The run was logged to MLflow with regular checkpoints, and the checkpoint and process definitions used in this post are exported from it. All analyses use the checkpoint from step 45,000.

Centroid methods

For the geometry analyses, the toy model is run on 65,536 fresh documents (eight seeds of 8,192 documents, split into two independent halves to verify the sampling noise). We record the residual stream after transformer block ℓ\ell (blocks.ℓ.hook_resid_post); layers are zero-indexed, so “layer 1” is the stream after the second block, the same convention used for Gemma. Because the process is known exactly, every position’s true values are known: the observable count cc, the line index, the document’s true width ww, and the observer’s bounds LL and UU from Section A.6.2.

Centroids are weighted means over positions sharing either the predictive state (c,L,U)(c, L, U) or the pair (c,w)(c, w). Unless stated otherwise we skip the first three lines of every document and exclude positions with c≤10c \le 10. This means waiting until the width bounds have tightened. Centroids with fewer than 96 positions are dropped. The PCA basis of a layer is the weighted PCA of its (c,L,U)(c, L, U) centroids, of which the top six components enter every fit. A rigid fit is a weighted similarity Procrustes map (rotation, reflection, uniform scale, translation) from those six coordinates onto the target; a linear fit is a count-weighted affine regression; both report the count-weighted R2R^2 over the target’s coordinates. For (c, L, U) centroids the target is their (c,L,U)(c,L,U) coordinates; for (c, w) centroids it is (c, w, w), the predictive state fixed at L = U. Raw-activation fits use every recorded position, but the widgets only show a subsample of 15,000 points.

Step 5 in Figure 25 does the fit slightly differently. To keep Gemma still when moving between steps 4 and 5, we fit the toy’s centroids onto Gemma’s layer 15 centroids as step 4 shows them. The rest of the fits are as described above.

Forecast embeddings (the figures in Section 5.5.4) involve no model: they are computed exactly from the process. Each (c,w)(c, w) forecast is a weighted average of newline forecasts to horizon DD, either the per-step all-newline forecast or the next-newline forecast, and the embedding is the weighted PCA of those vectors.