English

A Length-Extrapolatable Transformer

Computation and Language 2022-12-21 v1

Abstract

Position modeling plays a critical role in Transformers. In this paper, we focus on length extrapolation, i.e., training on short texts while evaluating longer sequences. We define attention resolution as an indicator of extrapolation. Then we propose two designs to improve the above metric of Transformers. Specifically, we introduce a relative position embedding to explicitly maximize attention resolution. Moreover, we use blockwise causal attention during inference for better resolution. We evaluate different Transformer variants with language modeling. Experimental results show that our model achieves strong performance in both interpolation and extrapolation settings. The code will be available at https://aka.ms/LeX-Transformer.

Keywords

Cite

@article{arxiv.2212.10554,
  title  = {A Length-Extrapolatable Transformer},
  author = {Yutao Sun and Li Dong and Barun Patra and Shuming Ma and Shaohan Huang and Alon Benhaim and Vishrav Chaudhary and Xia Song and Furu Wei},
  journal= {arXiv preprint arXiv:2212.10554},
  year   = {2022}
}

Comments

9 pages

R2 v1 2026-06-28T07:45:27.235Z