ACL 2024findings12 citations

Length Generalization of Causal Transformers without Position Encoding

Jie Wang, Tao Ji, Yuanbin Wu, Hang Yan, Tao Gui, Qi Zhang, Xuanjing Huang, Xiaoling Wang

Abstract

Generalizing to longer sentences is important for recent Transformer-based language models. Besides algorithms manipulating explicit position features, the success of Transformers without position encodings (NoPE) provides a new way to overcome the challenge. In this paper, we study the length generalization property of NoPE. We find that although NoPE can extend to longer sequences than the commonly used explicit position encodings, it still has a limited context length. We identify a connection between the failure of NoPE’s generalization and the distraction of attention distributions. We propose a parameter-efficient tuning for searching attention heads’ best temperature hyper-parameters, which substantially expands NoPE’s context size. Experiments on long sequence language modeling, the synthetic passkey retrieval task and real-world long context tasks show that NoPE can achieve competitive performances with state-of-the-art length generalization algorithms. The source code is publicly accessible

BibTeX
@inproceedings{wang-etal-2024-length,
    title = "Length Generalization of Causal Transformers without Position Encoding",
    author = "Wang, Jie  and
      Ji, Tao  and
      Wu, Yuanbin  and
      Yan, Hang  and
      Gui, Tao  and
      Zhang, Qi  and
      Huang, Xuanjing  and
      Wang, Xiaoling",
    editor = "Ku, Lun-Wei  and
      Martins, Andre  and
      Srikumar, Vivek",
    booktitle = "Findings of the Association for Computational Linguistics: ACL 2024",
    month = aug,
    year = "2024",
    address = "Bangkok, Thailand",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2024.findings-acl.834/",
    doi = "10.18653/v1/2024.findings-acl.834",
    pages = "14024--14040"
}
Length Generalization of Causal Transformers without Position Encoding · ACL 2024