Lost in the Middle: How Language Models Use Long Contexts
Nelson F. Liu, Kevin Lin, John Hewitt, Ashwin Paranjape, Michele Bevilacqua, Fabio Petroni and 1 more
- Published
- Lab
- Stanford, UC Berkeley
- arXiv
- 2307.03172
- Topic
- Context & memory
- Citations
- 6,238
Summary
Language models use information at the start and end of long contexts much better than the middle.
Why builders care
Context order and size matter. More context is not automatically better.
How to apply it
- 1Put the most important instructions and evidence at the start or end of the prompt.
- 2Trim retrieved context instead of maxing out the window.
Key results
- 1
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.
- 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.
- 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.
- 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.
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.
Everything on this page is written from this abstract. For methods and full results, read the paper PDF.
Ask the paper
Try one of these about “Lost in the Middle: How Language Models Use Long Contexts”: