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 efficiency. The proposed architecture is named Length-Extrapolatable (LEX) Transformer. We evaluate different Transformer variants on language modeling. Experimental results show that our model achieves better performance in both interpolation and extrapolation settings. The code will be available at https://aka.ms/LeX-Transformer.
CITATION STYLE
Sun, Y., Dong, L., Patra, B., Ma, S., Huang, S., Benhaim, A., … Wei, F. (2023). A Length-Extrapolatable Transformer. In Proceedings of the Annual Meeting of the Association for Computational Linguistics (Vol. 1, pp. 14590–14604). Association for Computational Linguistics (ACL). https://doi.org/10.18653/v1/2023.acl-long.816
Mendeley helps you to discover research relevant for your work.