Transformer FFN Linearity Varies, Not an Architectural Property

Stuart Whipp· June 19, 2026 View original

▶ The 60-second brief

Summary

Research shows that the linearity of Transformer feed-forward network (FFN) blocks is a learned property, not determined by architecture or activation functions. A new measure, linear recoverability (R^2_lin), reveals significant heterogeneity in linearity across different blocks within models like GPT-2 and Pythia-160m.

This research investigates the degree of linearity within the feed-forward network (FFN) blocks of Transformer models. By introducing a metric called linear recoverability (R^2_lin), which quantifies how much of an FFN block's output can be explained by a linear approximation, the study reveals that linearity is a highly variable and learned characteristic. The findings indicate that linearity is not a fixed architectural property or solely dependent on the activation function. Instead, individual FFN blocks within models like GPT-2 and Pythia-160m exhibit diverse linearity profiles, ranging from nearly linear to highly nonlinear, even between adjacent blocks. This suggests that the training process significantly shapes the computational nature of these components. The proposed measurement also offers practical implications for model compression, identifying blocks that are amenable to simpler linear replacements without substantial performance loss. It further highlights a methodological challenge in evaluating linear baselines for Transformer activations.

Why it matters

Understanding the learned linearity of FFN blocks can inform more efficient model compression strategies and provide deeper insights into how Transformers process information, potentially leading to more interpretable and performant AI systems.

How to implement this in your domain

  1. 1Analyze FFN linearity in custom Transformer models using the R^2_lin metric to identify potential compression targets.
  2. 2Experiment with replacing highly linear FFN blocks with simpler linear layers to reduce model size and inference cost.
  3. 3Investigate the impact of different training regimes on the learned linearity profiles of FFNs to optimize model efficiency.
  4. 4Apply the linearity diagnostic to identify areas where model behavior is more predictable or less complex.

Who benefits

AI/ML DevelopmentCloud ComputingEdge AIResearch & Development

Key takeaways

  • Transformer FFN block linearity is a learned property, not solely architectural.
  • Linear recoverability (R^2_lin) measures the degree of linearity in FFN blocks.
  • Linearity varies significantly across different blocks within the same model.
  • This understanding can guide targeted model compression and optimization efforts.

Original post by Stuart Whipp

"arXiv:2606.19379v1 Announce Type: new Abstract: Transformer feed-forward networks (FFNs) are often treated as nonlinear stores of computation, yet how nonlinear a trained FFN block actually is has rarely been measured. We treat each FFN as a position-wise input-to-output map and…"

View on X

Originally posted by Stuart Whipp on X · view source

Want to go deeper?

Turn these trends into skills with Learnijoy's hands-on AI & tech courses.

Explore courses