NeurIPS 2026QuestionsPapersAreasAboutMarkdown

Can Language Models Actually Retrieve In-Context? Drowning in Documents at Million Token Scale

Siddharth Gollapudi, Prasann Singhal, Nilesh Gupta, Sewon Min

NeurIPS page · Open on the map

Category: LLM Reasoning, Memory & RAG › Diffusion Model Extraction and Memorization · Type: new method · Keywords: in-context retrieval, attention control, large-scale language models, document-level sparse attention, length generalization

Areas: Long Context › Long-context mechanisms › Long-context attention mechanisms

Summary

The paper introduces BlockSearch, a 0.6B language model retriever with length-aware attention and document-level sparse attention that enables in-context retrieval at million-token scale and outperforms prior baselines.

Explained to a 5-year-old

Imagine a big book with a million pages. A computer program reads the book and tries to find the page that answers a question. When the book gets too big, the program gets confused because it looks at too many pages at once. The researchers noticed this problem and made the program smarter so it only looks at a few pages at a time. Now the program can find the right page even in the huge book.

Explained to a 5-year-old, longer

Imagine you have a huge library with a million books. You want to find the one book that has the answer to your question. A computer program can read all the books and try to answer the question without looking at a separate index. When there are too many books, the program gets confused because it looks at everything at once. The researchers studied how this confusion grows when the library gets even bigger. They discovered that the program’s attention gets spread out too thin, making the right book less noticeable. To fix this, they changed how the program pays attention, focusing only on a few books at a time. They also added a way to skip irrelevant books while searching. These changes helped the program find the correct answer even in the giant library. The new method works almost as well as traditional search methods that use special indexes. It shows that computer programs can do retrieval directly from large text collections. This could make future search tools faster and use less memory. The work opens up new possibilities for using language models in real-world applications.

For a technical reader

The system reads a massive text corpus directly within the model’s context and learns to retrieve relevant documents by adjusting how attention is computed. By adding length-aware scaling to the softmax and restricting attention to document-level blocks, the model prevents irrelevant text from diluting the score of the correct document. This yields retrieval performance comparable to dense vector methods while operating at scales previously unattainable for pure language models.

Problem

Language models that generate answers from a large in-context corpus struggle as the corpus grows, because irrelevant documents dominate the attention denominator, reducing the normalized probability of the correct answer even when its raw score remains high.

Method

The authors modify the retriever's architecture and training to improve length generalization, then analyze an attention dilution effect and propose length-aware softmax adjustments and document-level sparse attention to control attention under large contexts.

Results

The approach achieves length generalization up to ten times beyond training context sizes and attains performance surpassing a much larger concurrent system while matching dense retrieval results.

Contributions

The work provides the first systematic study of in-context retrieval at million-token scale, identifies an attention dilution problem, and proposes length-aware attention and document-level sparse attention to mitigate it.

Limitations and assumptions

The approach does not fully scale to contexts larger than a million tokens, and the study does not evaluate downstream generation tasks.

Practical relevance

Enabling efficient, retrieval-based language models that can operate on large document collections without external indexes, potentially reducing latency and memory in search applications.

This page was written by language models from the title and abstract of each paper, and the answers were checked by two other models. It can be wrong: check the paper itself. Suggest a correction