Lost in the Middle: How Language Models Use Long Contexts

Nelson F. Liu, Kevin Lin, John Hewitt, Ashwin Paranjape, Michele Bevilacqua +2 more
7/6/2023
cs.CL

No official code found. Best implementation: nelson-liu/lost-in-the-middle (386 stars, MIT, last commit 2024-01-04).

Abstract

While recent language models have the ability to take long contexts as input, relatively little is known about how well they use longer context. We analyze the performance of language models on two tasks that require identifying relevant information in their input contexts: multi-document question answering and key-value retrieval. We find that performance can degrade significantly when changing the position of relevant information, indicating that current language models do not robustly make use of information in long input contexts. In particular, we observe that performance is often highest when relevant information occurs at the beginning or end of the input context, and significantly degrades when models must access relevant information in the middle of long contexts, even for explicitly long-context models. Our analysis provides a better understanding of how language models use their input context and provides new evaluation protocols for future long-context language models.

View on arXivView PDF

Code Implementations(1)

MIT

Code and data for "Lost in the Middle: How Language Models Use Long Contexts"

38641PythonJul 6, 20232 years agoMIT

Similar Papers

Cite this paper

@article{liu2023lost,
  title  = {Lost in the Middle: How Language Models Use Long Contexts},
  author = {Nelson F. Liu and Kevin Lin and John Hewitt and Ashwin Paranjape and Michele Bevilacqua and Fabio Petroni and Percy Liang},
  year   = {2023},
  eprint = {2307.03172},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2307.03172v3}
}

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

Discussion