LGAICLMay 19, 2024

Your Transformer is Secretly Linear

arXiv:2405.12250v134 citationsh-index: 8Has CodeACL
Originality Highly original
AI Analysis

This challenges the understanding of transformer architectures by showing they may be more linear than assumed, which could impact efficiency and design for AI researchers and practitioners.

The paper reveals that transformer decoders exhibit a near-perfect linear relationship between layers (Procrustes similarity score of 0.99), and experiments show that removing or linearly approximating linear blocks does not significantly affect performance, while a regularization method reduces linearity and improves metrics on benchmarks like Tiny Stories and SuperGLUE.

This paper reveals a novel linear characteristic exclusive to transformer decoders, including models such as GPT, LLaMA, OPT, BLOOM and others. We analyze embedding transformations between sequential layers, uncovering a near-perfect linear relationship (Procrustes similarity score of 0.99). However, linearity decreases when the residual component is removed due to a consistently low output norm of the transformer layer. Our experiments show that removing or linearly approximating some of the most linear blocks of transformers does not affect significantly the loss or model performance. Moreover, in our pretraining experiments on smaller models we introduce a cosine-similarity-based regularization, aimed at reducing layer linearity. This regularization improves performance metrics on benchmarks like Tiny Stories and SuperGLUE and as well successfully decreases the linearity of the models. This study challenges the existing understanding of transformer architectures, suggesting that their operation may be more linear than previously assumed.

Code Implementations1 repo
Foundations

The foundational work for this paper's niche, ranked by how specifically the neighbourhood builds on it — not by global fame.

Your Notes