Length Generalization of Causal Transformers without Position Encoding

Jie Wang, Tao Ji, Yuanbin Wu, Hang Yan, Tao Gui +3 more
4/18/2024
cs.CL

No official code found. Best implementation: AntNLP/nope_head_scale (29 stars, MIT, last commit 2024-05-04).

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

View on arXivView PDF

Code Implementations(1)

MIT
292Shell, PythonApr 18, 20242 years agoMIT

Similar Papers

Cite this paper

@article{wang2024length,
  title  = {Length Generalization of Causal Transformers without Position Encoding},
  author = {Jie Wang and Tao Ji and Yuanbin Wu and Hang Yan and Tao Gui and Qi Zhang and Xuanjing Huang and Xiaoling Wang},
  year   = {2024},
  eprint = {2404.12224},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2404.12224v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2404.12224.svg)](https://codeofpaper.com/paper/2404.12224)

Discussion