Long-Context Retrieval · Attention Mechanisms

Drowning
in Documents.
It's the math.

Researchers set out to understand why in-context retrieval collapses as document count grows. The common answer was "context length." The actual answer was simpler and more actionable: a mathematical failure in how attention normalizes probability across many documents, a problem they named attention dilution.

Core mechanism
Attention dilution: as the number of documents in context grows, each additional document inflates the softmax denominator. The gold document's raw relevance score may stay high, but its normalized weight collapses. The model isn't confused about which document matters. The math is diluting it.

First surfaced in Tandemly Briefing — 2026-08-01.

scroll to explore

Accuracy falls as
documents pile up.

Long-context language models can process a million tokens. The assumption was that larger windows meant better retrieval. The empirical result was the opposite.

In-context retrieval is exactly what it sounds like: instead of indexing documents in a separate vector store and querying it, you put all the documents directly into the model's context window and let the model find what it needs by reading. It is conceptually clean, avoids the complexity of external retrieval pipelines, and has become more practical as context windows have expanded to hundreds of thousands or millions of tokens.

The problem is that it does not work reliably at scale. Measured accuracy on retrieval tasks falls as the number of documents in the context increases. Researchers and engineers who have observed this pattern have often attributed it to "context length limitations," as if the model simply runs out of useful memory past some threshold. This explanation is intuitive but vague. It does not tell you what is actually breaking, and it does not point toward a fix.

The more troubling observation is that the failure appears to happen even when the gold document is clearly within the model's context length and even when the model would correctly retrieve it in a shorter context. Something specific goes wrong as the document pool grows. The question is what, exactly, and whether it is fixable without changing the model.

The question this paper asks

Is the failure mode in long-context retrieval a fundamental capacity limit, or is it a specific, diagnosable, and fixable property of how attention normalizes over long sequences? If it is the latter, what is the intervention?

Name the mechanism.
Then fix it.

The researchers built a controlled diagnostic that could separate a capacity failure from a normalization failure. The distinction turns out to matter for which fix you reach for.

The key insight starts with how attention works. When a transformer attends to a sequence, it computes a raw score for each position, then runs those scores through a softmax function. Softmax turns raw scores into a probability distribution that sums to one. The denominator of that distribution grows with every additional position in the context. More tokens means a larger denominator, which means each individual position receives a smaller slice of the total attention budget, regardless of its raw score.

This is attention dilution. A gold document might have the highest raw relevance score in the entire context, but if the context contains a thousand other documents, the softmax math distributes attention across all of them. The gold document's normalized attention weight collapses, not because the model assessed it as less relevant, but because the denominator got bigger. The model is being drowned out by arithmetic, not by confusion.

The researchers confirmed this with a controlled diagnostic: hold the gold document fixed, add distractor documents one at a time, and measure the model's normalized attention weight on the gold document at each step. The result is that normalized weight drops monotonically as distractor count increases, even when the gold document's raw pre-softmax score stays stable. This is the dilution signature, and it separates the failure class from genuine capacity limitations.

Prior assumption
Context length is the binding constraint. As you add more documents, you eventually exceed the model's ability to attend usefully. The intervention is a bigger context window or a better model.
What this paper found
Softmax normalization is the binding constraint. The gold document's raw score is fine. The normalized weight collapses because the denominator grows with every distractor. The intervention is in normalization, not window size.

With the mechanism named, the team proposed two fixes. First, a length-aware adjusted attention softmax that compensates for denominator growth as the sequence lengthens. Second, document-level sparse attention, which directly limits which document positions attend to each other, preventing irrelevant documents from contributing to the denominator of attention over the gold document.

They also built BlockSearch, a 0.6 billion parameter language model trained specifically for block-level retrieval in long contexts. Rather than trying to patch the dilution problem inside a general-purpose large model, BlockSearch is designed from the ground up to work correctly as document counts scale into the millions. It length-generalizes up to ten times beyond its training context length, meaning a model trained on contexts of a given size can handle contexts ten times larger without retraining.

The diagnostic in practice

Insert a gold document into a context. Add distractor documents one at a time. At each step, extract the model's attention weights over the gold document's positions (averaged or summed). If attention mass drops monotonically as distractor count increases, while the gold document's relevance score stays stable, you have attention dilution. The intervention is attention normalization, not a larger model.

The small model beats
the one seven times larger.

The proposed fixes restore accuracy at scale. BlockSearch reaches million-token retrieval at a fraction of the parameter count of competing approaches.

Finding 1: BlockSearch outperforms a 7x-larger competitor

On MS MARCO and Natural Questions, BlockSearch (0.6 billion parameters) outperforms a concurrent retrieval model seven times its size. The performance gap is not marginal. A small model trained with the dilution problem explicitly in scope beats a large model that was not.

This inverts the usual scaling assumption. The authors are not arguing for smaller models in general. They are arguing that the architectural target matters: a model built to handle block-level retrieval correctly at scale, rather than a general-purpose large model that happens to be used for retrieval, can be dramatically more efficient.

Finding 2: Length-generalization up to 10x

BlockSearch generalizes to contexts ten times longer than its training contexts without degradation. This is unusual. Most retrieval models trained on a given context length degrade sharply when deployed at longer lengths. The architecture, shaped around the attention dilution mechanism, produces a model that does not share that failure mode.

Finding 3: The two fixes restore attention correctly

The length-aware adjusted softmax and the document-level sparse attention both restore retrieval accuracy as document count scales. This validates the mechanistic diagnosis: if the problem were capacity, fixing the normalization math would not help. The fact that it does confirms that attention dilution is the primary failure mode in this setting, not window size.

Note on access

This synthesis is based on the arXiv abstract, briefing summary, and published findings. Full benchmark tables, ablation details, and implementation specifics appear in the paper at arXiv:2607.01538. The specific accuracy numbers for MS MARCO and NQ are in the paper.

Run the diagnostic
before scaling context.

Attention dilution is separable, measurable, and fixable. That makes it actionable in a way that "context length limitation" is not.

1
For engineers debugging retrieval degradation
Before concluding your context window is too small, run the attention-dilution diagnostic. Add distractor documents to your context one at a time and measure the model's attention weight on the gold document. If the weight drops while the raw relevance score stays stable, you have an attention normalization problem. The fix is normalization, not a bigger model or a smaller context.
2
For teams building million-token retrieval
BlockSearch offers a path to million-token retrieval at 0.6 billion parameters with demonstrated quality on MS MARCO and NQ. If your workload is block-level retrieval at scale, evaluate purpose-built small retrievers before defaulting to large general-purpose models. The parameter count difference is substantial.
3
For teams already using context compression
Compression-based approaches (training compaction into the agent policy, reordering context for cache reuse, removing irrelevant chunks pre-retrieval) address what enters the window. This paper addresses what happens inside the window after that. The two interventions are orthogonal. If you are using compression and still seeing retrieval degradation, attention dilution is a plausible remaining cause.
4
For researchers evaluating long-context claims
Accuracy-versus-context-length curves may be measuring attention dilution rather than capacity. Before attributing degradation to window size, run the diagnostic separating dilution (normalized weight drops, raw score stable) from capacity (both drop together). The distinction changes what you conclude about the model's ceiling.

Where to go
from here.

The diagnostic and the fix are both implementable without changing model weights.

1
Read the paper
Gollapudi, Gupta, Singhal, Min et al. (2026). Can Language Models Actually Retrieve In-Context? Drowning in Documents at Million Token Scale. arXiv:2607.01538. The full benchmark tables and implementation details are in the paper.
2
Run the attention-dilution diagnostic on your system
Set up a controlled experiment: one gold document, a growing set of distractors, and instrumented attention extraction. Measure normalized attention mass on the gold document at each distractor count. A monotonic drop while the raw score stays high is the dilution signature. Your existing eval infrastructure can likely run this today.
3
Try length-aware softmax normalization as a first intervention
If the diagnostic confirms dilution, implement a simple length-aware adjustment to the softmax temperature or normalization before making architectural changes. The paper describes this as a lightweight fix, not a full retraining. Verify that retrieval accuracy recovers before investing in more complex interventions.
4
Evaluate BlockSearch for production retrieval workloads
If your use case is long-context block-level retrieval, BlockSearch is worth a direct comparison to your current retriever. At 0.6 billion parameters, the inference cost is substantially lower than larger competing models. Measure on your actual task distribution, not just published benchmarks.
5
Pair with compression-layer work
See the related Tandemly synthesis on context compression: CompactionRL and ContextPilot. Those address what enters the context window. Attention dilution addresses what happens inside it. Combined, the two layers address separate failure modes.