Transformers Can Achieve Length Generalization But Not Robustly
Fuente:
arXiv
Saved in:
| Main Authors: | , , , , , |
|---|---|
| Format: | Preprint |
| Published: |
2024
|
| Subjects: | |
| Online Access: | |
| Tags: |
Add Tag
No Tags, Be the first to tag this record!
|
| _version_ | 1866917590293544960 |
|---|---|
| author | Zhou, Yongchao Alon, Uri Chen, Xinyun Wang, Xuezhi Agarwal, Rishabh Zhou, Denny |
| author_facet | Zhou, Yongchao Alon, Uri Chen, Xinyun Wang, Xuezhi Agarwal, Rishabh Zhou, Denny |
| contents | Length generalization, defined as the ability to extrapolate from shorter training sequences to longer test ones, is a significant challenge for language models. This issue persists even with large-scale Transformers handling relatively straightforward tasks. In this paper, we test the Transformer's ability of length generalization using the task of addition of two integers. We show that the success of length generalization is intricately linked to the data format and the type of position encoding. Using the right combination of data format and position encodings, we show for the first time that standard Transformers can extrapolate to a sequence length that is 2.5x the input length. Nevertheless, unlike in-distribution generalization, length generalization remains fragile, significantly influenced by factors like random weight initialization and training data order, leading to large variances across different random seeds. |
| format | Preprint |
| id |
arxiv_https___arxiv_org_abs_2402_09371 |
| institution | arXiv |
| publishDate | 2024 |
| record_format | arxiv |
| spellingShingle | Transformers Can Achieve Length Generalization But Not Robustly Zhou, Yongchao Alon, Uri Chen, Xinyun Wang, Xuezhi Agarwal, Rishabh Zhou, Denny Machine Learning Artificial Intelligence Computation and Language Length generalization, defined as the ability to extrapolate from shorter training sequences to longer test ones, is a significant challenge for language models. This issue persists even with large-scale Transformers handling relatively straightforward tasks. In this paper, we test the Transformer's ability of length generalization using the task of addition of two integers. We show that the success of length generalization is intricately linked to the data format and the type of position encoding. Using the right combination of data format and position encodings, we show for the first time that standard Transformers can extrapolate to a sequence length that is 2.5x the input length. Nevertheless, unlike in-distribution generalization, length generalization remains fragile, significantly influenced by factors like random weight initialization and training data order, leading to large variances across different random seeds. |
| title | Transformers Can Achieve Length Generalization But Not Robustly |
| topic | Machine Learning Artificial Intelligence Computation and Language |
| url | https://arxiv.org/abs/2402.09371 |