Attention Alignment and Flexible Positional Embeddings Improve Transformer Length Extrapolation

Ta-Chung Chi, Ting-Han Fan, Alexander I. Rudnicky
11/1/2023
cs.CLcs.LG

No confident code implementation found for this paper. 1 possible match can be shown below.

Abstract

An ideal length-extrapolatable Transformer language model can handle sequences longer than the training length without any fine-tuning. Such long-context utilization capability relies heavily on a flexible positional embedding design. Upon investigating the flexibility of existing large pre-trained Transformer language models, we find that the T5 family deserves a closer look, as its positional embeddings capture rich and flexible attention patterns. However, T5 suffers from the dispersed attention issue: the longer the input sequence, the flatter the attention distribution. To alleviate the issue, we propose two attention alignment strategies via temperature scaling. Our findings show improvement on the long-context utilization capability of T5 on language modeling, retrieval, multi-document question answering, and code completion tasks without any fine-tuning. This suggests that a flexible positional embedding design and attention alignment can go a long way toward Transformer length extrapolation.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. 1 weaker match is hidden by default — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{chi2023attention,
  title  = {Attention Alignment and Flexible Positional Embeddings Improve Transformer Length Extrapolation},
  author = {Ta-Chung Chi and Ting-Han Fan and Alexander I. Rudnicky},
  year   = {2023},
  eprint = {2311.00684},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2311.00684v2}
}

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/2311.00684.svg)](https://codeofpaper.com/paper/2311.00684)

Discussion