Attention Sorting Combats Recency Bias In Long Context Language Models

Alexander Peysakhovich, Adam Lerer
9/28/2023
cs.CLcs.AI

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

Abstract

Current language models often fail to incorporate long contexts efficiently during generation. We show that a major contributor to this issue are attention priors that are likely learned during pre-training: relevant information located earlier in context is attended to less on average. Yet even when models fail to use the information from a relevant document in their response, they still pay preferential attention to that document compared to an irrelevant document at the same position. We leverage this fact to introduce ``attention sorting'': perform one step of decoding, sort documents by the attention they receive (highest attention going last), repeat the process, generate the answer with the newly sorted context. We find that attention sorting improves performance of long context models. Our findings highlight some challenges in using off-the-shelf language models for retrieval augmented generation.

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{peysakhovich2023attention,
  title  = {Attention Sorting Combats Recency Bias In Long Context Language Models},
  author = {Alexander Peysakhovich and Adam Lerer},
  year   = {2023},
  eprint = {2310.01427},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2310.01427v1}
}

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

Discussion