Preprint
Large Language Models

Attention sorting combats recency bias in long context language models

October 1, 2023

0

Citations

0

Influential Citations

Venue

2023

Year

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 …

Analysis

Why This Paper Matters

Long-context language models are increasingly important for tasks like document analysis, code generation, and conversational AI. However, they often fail to effectively use information from early parts of the context, a phenomenon known as recency bias. This paper identifies a novel cause: attention priors that are learned during training, which bias the model toward recent tokens. This insight is significant because it shifts the focus from architectural changes to the learned attention patterns themselves.

The proposed solution, attention sorting, is a simple yet effective technique that reorders attention computation to prioritize relevant tokens regardless of their position. This could be a practical fix for existing models without requiring retraining, making it highly relevant for practitioners who need to deploy long-context models efficiently.

Technical Contributions

  • Identification of attention priors: The paper shows that attention priors, not just positional encoding, contribute to recency bias.
  • Attention sorting mechanism: A method that sorts keys/values by relevance before applying softmax, reducing the influence of position.
  • Compatibility: The method can be applied to existing transformer architectures with minimal changes.

Results

The abstract does not provide specific numerical results, but it claims that attention sorting combats recency bias and improves long-context performance. The paper likely includes experiments on benchmarks like long-document QA or language modeling perplexity, but those details are not in the abstract.

Significance

This work has the potential to improve the reliability of LLMs in long-context scenarios, which is critical for real-world applications. By addressing a root cause of recency bias, it offers a path to better utilization of context without major architectural overhauls. Future research could build on this by exploring adaptive sorting strategies or combining with other context-extension methods.