Small Transformers Don’t Need LayerNorm at Inference Time: Scaling LayerNorm Removal to GPT-2 XL and Implications for Mechanistic Interpretability

Luca Baroni, Galvin Khara, Joachim Schaeffer, Marat Subkhankulov, Stefan HeimersheimICLR 2026

Abstract

While LayerNorm (LN) is essential for training stable Transformers, its non-linearity is a major "black box" hurdle for researchers trying to understand a model's inner workings. This paper demonstrates that you can "wean" a pre-trained model off LayerNorm through a specialized fine-tuning process, producing LN-free versions of the GPT-2 family (up to the 1.5B parameter XL) that perform nearly as well as the originals while being significantly easier to interpret.

Introduction

Mechanistic interpretability aims to reverse-engineer neural networks into human-understandable algorithms. However, LayerNorm is a "thorny non-linearity" that stands in the way. Because LN divides the residual stream by its own standard deviation, the effect of any single model component depends on the activations of all other components. This creates two main issues: common techniques like Direct Logit Attribution (DLA) become mere approximations, and LN forces a global coupling between components, making it difficult to isolate individual "circuits" within the model. This research investigates whether LayerNorm is a necessary component for inference or merely a training scaffold.

Methodology: The LN-Removal Protocol

The authors propose a protocol to replace the dynamic, non-linear LN with a static, linear transformation through three key techniques:

  1. FakeLN: The standard deviation term in the LN formula is replaced with a fixed scalar ($\sigma_{avg}$) calculated during fine-tuning, turning the operation into a simple linear scaling.
  2. Sequential Removal: Removing all LN layers at once destabilizes the model. Instead, the authors "wean" the model by removing one layer at a time—starting with MLP layers, then Attention layers—and fine-tuning briefly to allow for adaptation.
  3. Auxiliary Loss: To prevent internal activations from drifting or spiking post-removal, a loss term is introduced to encourage consistent standard deviation across token positions.
Training loss across GPT-2 model sizes during the sequential LayerNorm removal process.

Experimental Results

The authors successfully produced LN-free versions of GPT-2 Small, Medium, Large, and XL using the OpenWebText dataset. Broader evaluation was conducted on The Pile and a custom "The Pile-filtered" subset to account for overconfidence issues observed in the XL model on specific control characters.

Performance and Linearity

The GPT-2 XL LN-free model saw a cross-entropy loss increase of only +0.03 compared to a vanilla fine-tuned baseline. The primary benefit of this removal is the "Linearity Win": in LN-free models, Direct Logit Attribution (DLA) becomes mathematically exact, with error rates dropping from approximately 50% to 0%.

Interpretability Benchmarks

Despite the exactness of DLA, the accuracy of attribution patching did not see significant improvements. This suggests that other non-linearities, such as Softmax or GeLU, remain primary bottlenecks for that specific technique.

Comparison of activation and attribution patching across GPT-2 Small variants, showing the impact of LN removal on logit difference.

Mechanistic Insights

The removal of LN allowed the researchers to validate several hypotheses about Transformer internals:

  • Confidence Neurons: Previous research identified neurons that regulate uncertainty by writing high-norm vectors to the residual stream to increase the LN divisor. In LN-free models, these neurons still fire but lose their functional power, confirming LN as their primary mechanism.
  • Attention Sinks: Standard Transformers often exhibit "norm inflation" on the first token to act as an attention "trash can." LN-free models largely abandon this behavior, treating the first token more uniformly.

Conclusion and Future Work

This work demonstrates that LayerNorm is not strictly necessary for high-performance inference in large-scale language models. The sublinear scaling of the data required for removal suggests that this technique could be applied to even larger state-of-the-art models like Llama 3. Future research is needed to determine if these findings translate to models using RMSNorm and to explore parameter-efficient removal methods like LoRA. The full suite of LN-free GPT-2 models has been released to the research community to facilitate further mechanistic study.

Summary updated

BibTeX
@inproceedings{baroni2026small,
  author = {Luca Baroni and Galvin Khara and Joachim Schaeffer and Marat Subkhankulov and Stefan Heimersheim},
  title = {{Small Transformers Don’t Need LayerNorm at Inference Time: Scaling LayerNorm Removal to GPT-2 XL and Implications for Mechanistic Interpretability}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=VPtHqcafIY},
}
Figure