Layers at Similar Depths Generate Similar Activations Across LLM Architectures

Christopher Wolfram, Aaron Schein

TL;DR

This paper reveals a surprising universality in how Large Language Models (LLMs) process information: layers at similar depths across different LLM architectures tend to learn similar internal representations, even when trained independently. This suggests that LLMs, despite architectural differences, follow a common developmental path in how they transform input data.

What Problem Does This Paper Address?

Understanding the internal workings of complex neural networks like LLMs is a major challenge. While we know they learn representations of data, it's unclear how these representations evolve within a model and whether different models learn similar things. Specifically, this paper investigates:

  • How do the "latent spaces" (the internal representations) of independently trained LLMs relate to each other?
  • Are there universal properties in how these representations change from layer to layer within a single LLM?
  • Are these properties shared across different LLM architectures?

Methods

The core of the paper's methodology revolves around analyzing nearest neighbor relationships within the activation spaces of LLMs. Here's a breakdown:

  1. Activation Extraction: For a given prompt and a specific layer in an LLM, the authors extract the model's internal activation vector.
  2. Nearest Neighbor Identification: For a dataset of prompts, they identify the k other prompts that yield the most similar activation vectors to a given prompt at a specific layer. This reveals the "local geometry" of the latent space at that layer.
  3. Representational Similarity Measure: They use mutual k-nearest neighbors (mutual k-NN) to quantify how similar the nearest neighbor relationships are between two different layers (or two different models). A high mutual k-NN score means the layers agree on which prompts are closest to each other.
  4. Affinity Matrices: To visualize these similarities across all layers of two models, they construct affinity matrices. Each cell $(i, j)$ in the matrix represents the mutual k-NN similarity between layer $i$ of model 1 and layer $j$ of model 2.
  5. Statistical Testing: To confirm their observations, they employ a block bootstrap test to statistically validate the presence of "diagonal structure" in the affinity matrices, which indicates consistent similarity between corresponding layers.

Datasets

The primary dataset used for experiments is OpenWebText, a large corpus of internet text. The paper also mentions using other datasets for sensitivity analysis, including:

  • IMDB movie reviews
  • Text from books in English and German (from Tiedemann, 2012)
  • Various LLM evaluations (IFEval, MMLU)

Key Insights and Ideas

  • Layer-wise Progression: LLMs don't just produce static representations; they evolve them layer by layer. The nearest neighbor relationships change significantly as you move deeper into a model (Claim 1). This suggests a structured progression of learned features.
  • Cross-Model Universality: Despite being trained independently and having different architectures, LLMs exhibit remarkable agreement in their nearest neighbor relationships at corresponding layers (Claim 2). This implies that different LLMs are learning similar underlying structures or concepts at similar stages of processing.
  • "Stretched and Squeezed" Architectures: The authors propose that LLMs generate a common "progression of activation geometries," but this progression can be "stretched and squeezed" to fit into architectures with varying numbers of layers. This explains why layers at proportionally similar depths (e.g., 30% of the way through) are more similar than layers at the same absolute depth.
  • Not Arbitrary, Not Obvious: The shared nearest neighbor relationships are not arbitrary (they are consistent across models) but also not "obvious" in a superficial sense (they vary within a model and aren't universally the same across all layers). This points to a deeper, emergent property of transformer architectures.

Key Results

  • Diagonal Structure: Affinity matrices consistently show a strong diagonal structure. This means layers at similar depths in different models have high similarity scores, while layers at very different depths have low scores. This pattern holds across a wide range of 24 open-weight LLMs.
  • Statistical Significance: A rigorous statistical test (block bootstrap) confirms that the observed diagonal structure is highly significant, meaning it's extremely unlikely to occur by chance. The p-values are astronomically small.
  • Proportional Depth Correspondence: The most similar layers between models often align at proportional depths (e.g., layer 10 in an 8B model and layer 20 in a 9B model, representing roughly the same percentage of layers) rather than absolute depths.
  • Layer Compression: When comparing models of vastly different sizes, the correspondence between layers can be compressed, particularly in the middle layers, suggesting that some functions are more critical and consistently learned than others.
  • Input Distribution Sensitivity: While the diagonal structure is robust across various web text datasets, it can be affected by the input distribution. For instance, instruction tuning can alter activation structures in later layers, and random alphanumeric strings show similarity but lack the strong diagonal structure.

Limitations and Future Work

  • "Why" is Still Unclear: The paper demonstrates that this similarity exists but doesn't fully explain why LLMs converge on these specific representations or what functional role these shared geometries play.
  • Superficial Features: While the paper argues against purely superficial features driving the similarity (e.g., the "Twitter" example), it acknowledges that some superficial agreement might exist, especially with specific input types like random strings.
  • Future Work: The authors suggest further investigation into the functional implications of these shared geometries, exploring how they relate to specific linguistic capabilities, and understanding the impact of different training regimes and architectures on this emergent property. They also hint at the potential for this understanding to inform model design and interpretability.

Summary updated

BibTeX
@inproceedings{wolfram2025layers,
  author = {Christopher Wolfram and Aaron Schein},
  title = {{Layers at Similar Depths Generate Similar Activations Across LLM Architectures}},
  booktitle = {COLM},
  year = {2025},
  url = {https://openreview.net/forum?id=8wKec6faAT},
}
Figure