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 , called features, so that the value of these features can be “read off” via a linear map from activations . 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:
where is the vector of network activations, at a given layer, when the network input is , is the feature value of feature on input , and is its feature direction. Features are assumed to be sparse, meaning for most inputs . 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: .
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 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 and a decoder , where are learned and is a nonlinearity. SAEs are trained with gradient descent to minimize a loss like , which induces the SAE to reconstruct activations as a sparse linear combination of the columns of , the SAE’s latent directions (also called decoder directions). The hope is that these latent directions recover the network’s underlying feature directions and the latent activations track the feature values . In practice, the activations of these latents, , 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 within -dimensional subspaces of activation space, and suggest a multidimensional superposition hypothesis6, where neural network activations are modeled as:
where are matrices whose rows provide a basis for the subspace in which feature is represented.7
SAEs and multidimensional features. Sparse autoencoders were motivated to recover the individual feature directions underlying the one-dimensional superposition hypothesis. How do they behave when some features are multi-dimensional? Can they be used to recover the subspaces instead?
When there exist multidimensional features, multiple SAE latents must participate together in reconstructing the value of one of these features . 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 . 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 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 , 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:
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 () as a function of the character count of the network’s input token14, across our synthetic prose corpus:
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:
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:
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 , 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 B 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:
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 . 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:
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:
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:
- There is a relatively narrow range of layers where this manifold appears.
- 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].
- 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.
- 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.
- 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.
- 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 , 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 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:
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 characters (). 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:
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 , we again center our centroids, then fit these centroids by least squares to and , where 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:
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.
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:
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:
- 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.
- 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 . 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- plane with the method from Section 4.2: we fit the hex centroids by least squares to and , 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.
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 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:
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 and according to line number separately, and find that adding these centroids gives a collection of points with similar geometry to the joint centroids . In the figure below, we visualize the character count centroids , line number centroids , their sum , and the joint centroids :
Broadly, we see similar geometry between the sum , and the joint centroids . 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 . 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 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:
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: . We show joint centroids across a few model layers in the figure below:
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 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 .
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:
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).
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.
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 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 , 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, , and your current belief of what value is. When you get to the end of the first line, you notice that the newline occurs at . This means that . You then notice that the first word of the next line has 5 characters, which means that . As you see more lines, your knowledge of what is will be further confined to an interval between a lower and upper bound, . Your prediction of where the new line will occur will depend on the triple of numbers, . After a few lines, these lower and upper bounds meet, and the triple reduces to the pair .
To formally capture this, we consider the following generative model of fixed-width text sequences, visualized in Figure 21:
- At the start of each sequence, a line width is drawn uniformly from a range of widths, and the current line’s character count, , is set to 0.
- At each position, one of content (non-newline) tokens is drawn independently from a fixed distribution . Each token stands for a word with characters; for instance, the token for the word
cathas . - If , the token is emitted and is incremented to .
- If , a newline token is emitted, then token , and is reset to .
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 or the width . It must learn each token’s length to count characters, and infer in-context from where newlines occur. As discussed above, at any content token, the triple captures all information about the past needed for predicting all future tokens. All possible triples 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 plane, and the predictive state can be described simply by . In other words, the distinction between and is relevant only at early context positions. We will return to this later. In Section A.6.2, we give the exact state along with its update rules.25
Recovering the predictive states (and confounds) with centroids
In the previous section, we described how 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 and act as bounds for . We thus consider taking centroids according to and versus according to , 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 , and to test how centroid binning behaves when the true task variables are known, we train a small 4-layer transformer () from scratch on our synthetic process with line widths and content tokens of lengths (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 . Figure 22 compares the predictive state coordinates on the left against the toy model’s layer 1 activations on the right across three views: raw activations, centroids, and centroids.
The figure opens on the raw activations in their own top-3 principal components.
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 of the most recent token. Once has been added into , 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 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 centroids do not form a single sheet. A set of thinner parallel sheets remain, especially at narrower widths, ordered by . 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 is tightly coupled to a different variable, the number of newlines seen so far, since bins with 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 centroids (step 5) averages over (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 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, 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 are visible in the raw activations’ top principal components. Regardless, the same centroids still average the unrelated variation away and bring out a structured representation.
For Gemma-2-9B, we use centroids and skip the first three lines of each document (and the first 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 , , and is relevant only at early context positions where the width is uncertain. In Gemma, because token lengths in our natural-text dataset peak around to characters, roughly of the positions after the third line satisfy , so width uncertainty should be very low for any reasonable prior over the task. Section 5.1 and Section 5.2 also binned by 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 when the first few lines are skipped.
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 of raw variance and leave the centroids bunched in a knot near the center, whereas the top three principal components of the centroids capture 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 does not protect against variables correlated with or . For example, a document of width passes through many more newlines than one of width 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 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 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 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 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 future context positions we assign a vector of length to each state whose -th entry is the probability that the current line ends exactly steps ahead:
Each element is the probability that the first newline occurs exactly steps in the future, so this vector has nonzero entries only within the current line. This length 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 -th entry is the probability that the symbol steps ahead is a newline, whether it is the next newline or a later one:
This is also a length 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 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 quickly collapses to and so each state has only one forecast vector associated with it.
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, . How do we understand this geometry? If we are characters into a line of width , whether any string of tokens fits on the current line is decided by
Thus, a state’s forecast of everything up to the next newline can be expressed as a function of alone, and the embedding shows this geometrically. If we ask only how soon the current line ends, variation across widths at fixed does not matter at all. All states with the same 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 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 , 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 characters. This means that states with equal but different 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 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.
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 . 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 and 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 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 differ mainly in how the stretch along is distributed— and we find no consistent best value for 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 is a linear function of and the fully observable quantity , and make equally valid coordinates as and . We could just as well write all of our coordinates in terms of as in terms of . This means many of our interpretations of -dependent structure can often be equally considered - or - dependent structure. Take, for example, the conclusion above: “states with equal but different widths pull apart and an apparent width structure emerges in the embedding”. This “width structure” happens at fixed , so a different is the same thing as a different 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: . In this, we find that the model carries very little width-specific information beyond what is carried by and . This points towards these representations being best thought of as , rather than . 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 . 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 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 representation is from correlations with the line number.
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 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.
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.
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 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:
- Firing frequency. We record the total number of times each latent activates across our synthetic corpus, and keep the top 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.
- 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 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.
- Mutual information. We lastly compute the mutual information between latent activations and the character count of the tokens these latents activate on. In particular, we binarize SAE latent activations () and compute across our synthetic corpus, where ranges from 10–150. We keep the top 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 used, and that the set of latents that meet all three of these criteria is much smaller (20 latents) than each of . 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:
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).
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 at token we define the binary firing indicator . We accumulate the firing count and the same-token co-firing count for all pairs (the SAE we consider has 16k latents). The harvest covers tokens. All co-activation metrics we describe below use the empirical probabilities and .
We then compute five notions of edge weight:
- Decoder cosine similarity [32]: , where is the decoder direction of latent . This is the only weight that does not use the corpus.
- Pointwise mutual information (PMI) [92]: , 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]: . NPMI lies in , equaling 1 when the two latents only ever fire together and 0 when they fire independently. Dividing by removes most of PMI’s bias toward rare pairs.
- Jaccard similarity [94, 49]: , the number of tokens where both latents fire divided by the number of tokens where either fires.
- Mean-field Ising couplings , 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 (), since estimates from so few events are unreliable.
Ising couplings. Bhalla et al. [25] convert each latent’s firing into a spin and model the joint distribution of spins over tokens with a pairwise Ising model,
The fields absorb each latent’s firing rate, and the couplings describe the interaction between latents and after conditioning on all other latents. Latents that fire on most tokens get large but can have small , and two latents that are correlated only through a third latent can have . They then run community detection on the graph with edge weights , so that strong excitatory and strong inhibitory couplings both count as strong edges.
Bhalla et al. [25] fit by maximizing the pseudolikelihood [95, 96]. This requires every token’s full firing pattern. Our co-activation harvest stores only first and second moments ( and ), 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:
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 before inverting, and use as the edge weight. Up to the scaling of each row and column, 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 enforced during optimization, and regularization strength chosen by the extended Bayesian information criterion with , 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 ) 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 sparse, and their code additionally drops edges with by default. The mean-field is dense, so we keep only the top 3M pairs by 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 , the peak IoU at 3M edges was 0.52, compared with 0.70 for mean-field couplings. At , 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 raised the peak IoU to 0.68 (at this penalty has fewer than 3M nonzero pairs, so the graph uses all of them). We chose 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 [103]. Larger gives smaller communities. We run Leiden to convergence at 121 values of spaced logarithmically between 1 and , with three random seeds each. For each partition, we compute the max IoU, , where ranges over the communities of the partition and 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 ), 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 () was the only weight that scored well at both budgets. The mean-field couplings need a dense graph: the top 100k pairs by 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 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 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.
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).
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 of the centroids over character counts. For a period , we fit the centered centroids by least squares to and , which gives two directions in the residual stream; orthonormalizing them gives the period- 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 (one row per direction), we replace the residual stream at the output of layer by
which sets the component of 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.
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 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 probability to newline tokens within the line, and then assigns 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.
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 corresponds to period , so periods 8 and 4 are and , 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 (– and –), 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
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, ) as being composed of three parts:
A map from histories of tokens to predictive vectors. Given the history , there exists a map
where stays fixed as increases.
This vector contains enough information to give the same next-token probabilities as the full history through a function :
The predictive vector can be updated iteratively through a function , using only its current value and an observed token:
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:
Starting from the vector for a given history, this generates continuations according to the process probabilities. These conditions make 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 reproduces this distribution, predicting from 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 and .
A familiar example is a finite-state HMM, which has restricted to be a probability distribution. For an HMM, and are defined by the same set of nonnegative linear maps, which sum to a row-stochastic matrix. Using row vectors, let be the probability of emitting and moving to state , given current state . Then
where 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 and 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 , each token has a fixed emission probability and an affine update. Using row-vector notation,
with
The update is piecewise affine, and the readout 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 is known, the only thing about the past that matters for future predictions is the current line position , the characters since the last newline. is not hidden, it is a count over observed tokens. Assume token has length and is drawn with a position-independent probability ; the whole next-token distribution is that draw put through a threshold, token fits iff :
Tokens that fit in the line keep their 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 and that token, the observer knows a newline happened at but not which token caused it (any token with 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 on the restricted domain of tokens that would have overflowed:
Here, the conditioning on indicates this is the probability distribution after having just observed a newline token from position . 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 characters.
While we just described this generator in terms of a single count register , the automaton that implements this process actually requires two character-counting registers. Let count the characters on the current line, and let temporarily hold the position of the last newline. These registers update from observing content tokens or newlines in the following way:
- a content token increments : , and erases :
- a newline token swaps the registers:
These dynamics mean the state is always except for right after a newline, where it is . 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 against and the one that compares and 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 from a prior over candidate widths at the start of each sequence. The observer must infer this from the token stream, since it is not directly observable the way that is. A Bayesian observer should refine their estimate of 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 itself. Our data draws 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 and upper bound :
Every content token that moves us to position proves , which raises ; the beginning of each line shows us a token that overflowed, proving and lowering .
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 as the probability mass that the prior assigns to the interval , we simply implement the following transformations:
Substituting the above into our probability expressions yields
The register updates carry over completely unchanged, but we also need to include rules for updating the registers. These updates are as follows:
- a normal content token can raise the width floor: .
- the first token after a newline can lower the width ceiling: .
The entire probability distribution over the future can be represented with four registers and the prior over widths. While the position pair still updates with affine maps, and update through and .
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 , and that evidence is width-dependent:
The smaller 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 register — which is only nonzero right after seeing a newline. This means that, when looking at content tokens, we effectively only have three registers . When looking for content token geometry, we refer to this as 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 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 . With distinct token lengths we need:
- position states: . From , a token that fits on the line () moves with certainty; if the token doesn’t fit, a newline is emitted and we move to one of the buffer states , defined below.
- buffer states: — one per distinct , holding the deferred token so it can open the next line.
In total, this means a state HMM. As an example, let’s write out the matrices for an HMM for data with and . The HMM has states: , and a vocab of 3 tokens: . The token-conditioned transition operators are:
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 and columns by futures . Then
the joint probability the process emits followed by . Any linear model factors every entry through its -dimensional latent state: . This implies a factorization with inner dimension . Thus, for any linear model of the process, no matter how clever the entries. (The bound is tight: a linear model of dimension 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 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 | |
| 20 | 1, 2, 3 | 24 | 23 | |
| 150 | 2–8 | 158 | 155 | |
| 20–150 | 2–8 | 12,183 | 11,790 | |
| 20–240 | 2–8 | 30,498 | 29,835 | |
| 20–150 | 1–15 | 13,231 | 13,100 |
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 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, and have identical future distributions of tokens if no 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 over widths the exact mixture HMM carries 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 state assigns to a particular continuation 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 that the non-newline token generator made, and a list of newline placement positions . These draws are made with the same distribution from every state. The likelihood each state assigns to factors into a independent factor (the probability of the content tokens neglecting the newlines) times a factor that depends on the newline placement.
Here, is just an indicator function that is either 0 or 1, depending on whether the newline placement is consistent with 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 states’ forecasts lies entirely in the difference between newline placement. The token content itself does not separate different states. Thus, we should expect that 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 for every , so states with the same number of characters remaining coincide.
This reorganization in terms of characters remaining can be quantified with a variance decomposition of the centroids. We cluster the centroids by characters remaining, with one cluster per value of , and compute the fraction of the variance that lies between the groups rather than within them. A value of 0 means is not correlated with where a centroid sits, 1 means that its position can be determined by 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 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 , because successive newlines sit characters apart. This means that, as the horizon grows, 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 , , and
In Section 5, we described the joint sheet as a geometric object: a two-dimensional surface in the residual stream, parameterized by the current character count and the line width . However, we close that section by discussing the close relationship between the characters remaining 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 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 sheet, using either the width-conditioned or the width-agnostic mean activation, and read out the change in the model’s newline prediction.
Probes
We wrap English prose at line widths to 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 and with the width of its document. For each variable (, , , and a control variable ) 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 as a function of layer.
Any linear function of and 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 , we group centroids by one variable’s values and compute the variance between the group means as a share of total variance among all 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 , 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 or . These nulls show what a grouping would score by inherited structure even if only the preserved variable was represented. The variable , 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 . In general, the width never explains more variance than the amount implied by the structure of the character count.
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 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 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
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 at content tokens in the middle of lines, where the correct prediction is to continue the line.
At these tokens, we shift the component of the residual stream vector from the model’s own state to a chosen counterfactual point:
where spans a rank-8 subspace fit on the full set of width-conditioned character count centroids, is the centroid for the token’s actual and , and is the centroid for the injected count on a line of injected width . 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 characters on a line of width ; 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 , the intervention from Gurnee et al. [1]. We sweep the injected count for different counterfactual widths 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 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 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 , 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 . 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.
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 denote a width centroid: the mean residual stream vector at the newline tokens of documents wrapped at width . These centroids span a low-dimensional manifold, and we take 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 :
either at a single layer or at each of layers 10–14. The content tokens are left untouched. We then read after every word and plot it against the character count . A narrow injection () should make it break early, at and a wide injection () should suppress the break at the true boundary, . Figure 40 shows both behaviors, though only when the intervention is done across multiple layers.
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 that must be inferred from context. Its vocabulary is content tokens, with token representing a word of characters, plus a newline token. Widths are drawn uniformly from .
Two token-length distributions were used. The uniform 2–8 process has tokens of lengths with . We calculate the forecast embeddings for Gemma using a slightly different process with tokens of lengths and set to the token-length distribution of Gemma-2-9B’s tokenizer on tokens from the Gutenberg corpus, and then clipped to 15 characters:
Every document begins with a beginning-of-sequence token followed by 511 emitted symbols, filling the model’s 512-token context.
Five widths, , 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 and 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 , and a 512-token context. It has , two attention heads of dimension , and MLP width . It was trained with AdamW (, no weight decay) at a constant learning rate of 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 (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 , the line index, the document’s true width , and the observer’s bounds and from Section A.6.2.
Centroids are weighted means over positions sharing either the predictive state or the pair . Unless stated otherwise we skip the first three lines of every document and exclude positions with . 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 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 over the target’s coordinates. For (c, L, U) centroids the target is their 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 forecast is a weighted average of newline forecasts to horizon , either the per-step all-newline forecast or the next-newline forecast, and the embedding is the weighted PCA of those vectors.