LLM Layers Immediately Correct Each Other

Arjun Patrawala, Jiahai Feng, Erik Jones, Jacob Steinhardt

TL;DR

Mechanistic interpretability usually assumes that transformer layers progressively and additively build up information. This paper reveals the Transformer Layer Correction Mechanism (TLCM), showing that adjacent layers actually systematically counteract and correct each other's contributions. This finding fundamentally challenges how we understand and steer Large Language Model (LLM) representations.

What Problem Does This Paper Address?

A major goal in AI safety and mechanistic interpretability is reverse-engineering the "brains" of LLMs. A standard approach uses tools like Sparse Autoencoders (SAEs) to extract readable, linear features from the model's "residual stream"—the central pathway where layers read and write information.

These methods rely on a foundational assumption: that layers operate additively, progressively enriching the residual stream with new information. But what if layers also actively delete or reverse information? If a feature written by Layer 5 is immediately erased by Layer 6, analyzing Layer 5 in isolation gives a highly misleading picture of what the model is actually doing. This paper investigates whether such systematic corrections occur, how they work, and what they mean for our ability to interpret and control LLMs.

Methods

To uncover how layers interact, the authors employed a mix of observational and causal techniques:

  • Cosine Similarity Analysis: They measured the cosine similarity between the output contributions of different layers across thousands of tokens. Negative similarity indicates reversal or correction.
  • Developmental Tracking: They analyzed model checkpoints during pretraining (specifically OLMo) to see if this correction behavior is innate to the architecture or learned over time.
  • Causal Interventions: To prove Layer $i+1$ is reacting to Layer $i$, they artificially scaled the output of Layer $i$ (by a factor $\alpha$) and observed if Layer $i+1$ adaptively scaled its correction in response.
  • Jacobian Analysis: They computed the Jacobian matrix of the transformer layer to linearize its behavior. By looking at the eigenvectors with negative eigenvalues, they could isolate exactly which mathematical subspaces were being aggressively corrected versus left alone.

Datasets

  • WikiText: Used for general token analysis and computing baseline cosine similarity matrices.
  • Custom Long-form Queries: A dataset of 100 realistic prompts (covering science, history, etc.) and their responses generated by Llama 3.1 8B, yielding ~79k tokens to study token-specific correction rates.
  • PyTorch Instructional Content: A small corpus used to track the emergence of TLCM across training checkpoints.

Key Insights and Ideas

  • The "Propose-and-Reject" Hypothesis: The authors suggest LLMs might build features via trial and error. Layer $i$ might "guess" (propose) several possible features. Layer $i+1$, using its attention mechanism to gather more context, then "rejects" (corrects) the incorrect guesses.
  • Context is King: Corrections happen far more frequently on tokens that depend heavily on surrounding context—like parts of numbers (e.g., "202" in "1,808,202"), dates, and punctuation. Furthermore, TLCM activates more frequently later in the context window, where there is more information to process.
  • Explaining SAE "Misfires": Extracted SAE features often seem vague or irrelevant to the text. TLCM explains why: these features might be "misfires" proposed by one layer that the very next layer immediately deleted.
  • Why Model Steering is Hard: To force an LLM to act a certain way (e.g., making it refuse to answer a dangerous prompt), researchers often have to artificially amplify a feature by 10x. Why so high? Because TLCM actively fights back against the intervention, treating the injected feature as a "mistake" to be corrected.

Key Results

  • Ubiquity and Strong Anti-correlation: TLCM is present in 5 out of 7 major open-weight model families tested, including Llama 3, OLMo, Mistral, Gemma, and Qwen2. On average, adjacent layers (Layer $i$ and $i+1$) have a cosine similarity of $\approx -0.2$. Non-adjacent layers do not show this opposing behavior.
Cosine similarity matrices across different models showing the presence and absence of TLCM.
  • Targeted Erasure: The Jacobian analysis revealed a bimodal eigenvalue distribution with a strong mode at $\lambda = -1$. This means TLCM doesn't just uniformly dampen the previous layer's output; it perfectly and selectively reverses specific feature directions.
  • It is Learned: TLCM does not exist at initialization. In OLMo 7B, it emerged around 21% of the way through pretraining (after ~0.5 trillion tokens) and strengthened over time.
  • MLPs do the Heavy Lifting: While both attention and MLP sublayers are involved, MLPs are primarily responsible for executing the corrections against both prior attention and MLP outputs.
Comparison of attention and MLP sublayer contributions to layer correction.

Limitations and Future Work

  • Architectural Exceptions: TLCM is notably absent in GPT-2 and Microsoft's Phi models. The authors suspect this might be due to specific architectural choices (like dropout blocks after sublayers), but the exact root cause remains unconfirmed.
  • Hypothesis Verification: The "propose-and-reject" framework is a compelling hypothesis that fits the data, but it was not explicitly proven end-to-end in this paper.
  • Future Directions: The authors suggest using the Jacobian analysis to find "safe" feature directions—subspaces that TLCM ignores. Intervening on these specific directions could allow for highly effective model steering without requiring massive, brute-force amplification. They also advocate for using cross-layer transcoders (which look at multiple layers at once) instead of standard SAEs to better capture these dynamic corrections.

Summary updated

BibTeX
@inproceedings{patrawala2025llm,
  author = {Arjun Patrawala and Jiahai Feng and Erik Jones and Jacob Steinhardt},
  title = {{LLM Layers Immediately Correct Each Other}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=7DY7kB8wyZ},
}
Figure