Saved in:
| Main Authors: | , , , |
|---|---|
| Format: | Preprint |
| Published: |
2025
|
| Subjects: | |
| Online Access: | https://arxiv.org/abs/2504.02827 |
| Tags: |
Add Tag
No Tags, Be the first to tag this record!
|
| _version_ | 1866916673318027264 |
|---|---|
| author | Li, Ruining Boduljak, Gabrijel Jensen Zhou |
| author_facet | Li, Ruining Boduljak, Gabrijel Jensen Zhou |
| contents | It is a widely known issue that Transformers, when trained on shorter sequences, fail to generalize robustly to longer ones at test time. This raises the question of whether Transformer models are real reasoning engines, despite their impressive abilities in mathematical problem solving and code synthesis. In this paper, we offer a vanishing variance perspective on this issue. To the best of our knowledge, we are the first to demonstrate that even for today's frontier models, a longer sequence length results in a decrease in variance in the output of the multi-head attention modules. On the argmax retrieval and dictionary lookup tasks, our experiments show that applying layer normalization after the attention outputs leads to significantly better length generalization. Our analyses attribute this improvement to a reduction-though not a complete elimination-of the distribution shift caused by vanishing variance. |
| format | Preprint |
| id |
arxiv_https___arxiv_org_abs_2504_02827 |
| institution | arXiv |
| publishDate | 2025 |
| record_format | arxiv |
| spellingShingle | On Vanishing Variance in Transformer Length Generalization Li, Ruining Boduljak, Gabrijel Jensen Zhou Machine Learning Artificial Intelligence It is a widely known issue that Transformers, when trained on shorter sequences, fail to generalize robustly to longer ones at test time. This raises the question of whether Transformer models are real reasoning engines, despite their impressive abilities in mathematical problem solving and code synthesis. In this paper, we offer a vanishing variance perspective on this issue. To the best of our knowledge, we are the first to demonstrate that even for today's frontier models, a longer sequence length results in a decrease in variance in the output of the multi-head attention modules. On the argmax retrieval and dictionary lookup tasks, our experiments show that applying layer normalization after the attention outputs leads to significantly better length generalization. Our analyses attribute this improvement to a reduction-though not a complete elimination-of the distribution shift caused by vanishing variance. |
| title | On Vanishing Variance in Transformer Length Generalization |
| topic | Machine Learning Artificial Intelligence |
| url | https://arxiv.org/abs/2504.02827 |