TL;DR
While we know large language models (LLMs) struggle to find information hidden in long contexts, this paper uncovers a new variable: the size of the "needle" itself. Through over 150k controlled runs, the authors demonstrate that smaller answer-containing documents drastically degrade LLM retrieval performance and amplify positional biases. This "small needle" vulnerability poses a significant challenge for RAG and agentic systems that aggregate fine-grained, scattered data.
What Problem Does This Paper Address?
In Needle-in-a-Haystack (NIAH) evaluations, an LLM is tasked with finding a specific piece of relevant information (the "gold context" or needle) embedded within a vast sea of irrelevant text (the "distractor context" or haystack). While prior research has extensively studied how the position of the needle (e.g., the "lost in the middle" effect) or the volume of the haystack impacts performance, the physical size of the needle document itself has been largely ignored.
This paper addresses this gap by systematically analyzing how the length of the gold context influences an LLM's ability to successfully answer questions. Understanding this is critical for modern agentic and retrieval-augmented generation (RAG) systems, where autonomous agents frequently aggregate heterogeneous information streams consisting of documents that vary widely in length.
Methods
The authors designed a rigorous, large-scale experimental setup involving more than 150,000 controlled runs across eleven state-of-the-art LLMs (including frontier reasoning models like OpenAI's o3-mini and DeepSeek-R1).
To isolate the effect of gold context size, they constructed three hierarchically nested variants of the needle for each evaluation prompt:
- Small Gold: The minimal text span sufficient to answer the question.
- Medium Gold: The minimal span plus additional explanatory or supporting content.
- Large Gold: The complete reasoning process or extended relevant context.
They embedded these varying needle sizes at six different positions within a fixed-length sequence of topically relevant distractor documents (targeting a total distractor budget of ~20k tokens). Finally, to ensure that the observed drop in performance wasn't caused by hidden correlations, they performed a multivariate logistic regression to control for five potential confounders: gold context position, answer token repetition, gold-to-distractor ratio, distractor volume, and domain specificity.
Datasets
The study adapts three established question-answering benchmarks to create controlled NIAH settings, spanning different reasoning domains:
- CARDBiomedBench (CBB): A biomedical dataset focused on neurodegenerative diseases. The gold variants scale from a simple text answer (Small) up to SQL queries combined with database rows and the answer (Large).
- NaturalQuestions (NQ): An open-domain general knowledge dataset based on Google queries. Gold sizes scale from a single sentence containing the answer up to a full Wikipedia paragraph surrounded by adjacent paragraphs.
- NuminaMath1.5 (NM): A high-difficulty mathematical reasoning dataset. The gold variants range from just the final answer to textbook-style solutions, up to full model-generated chains-of-thought from DeepSeek-R1.
Key Insights and Ideas
- Smaller Needles are Inherently Harder to Find: Across all models and benchmarks, LLM performance drops sharply as the gold context shrinks, even when the smaller needle contains all the necessary information to answer the question.
- Richer Context Acts as an Attention Anchor: Larger gold contexts provide a stabilizing effect. Spreading semantically relevant information across more tokens makes the signal resilient to surrounding noise and helps the model retain focus.
- Gold Size Modulates Positional Bias: Smaller gold contexts drastically amplify an LLM's sensitivity to where information is placed. Models exhibit a severe "primacy bias" with small needles, performing well if the needle is at the very beginning of the context window but failing catastopically if it appears later.
- Domain-Specific Tasks are More Vulnerable: The negative impact of small gold context sizes is significantly more pronounced in specialized domains like mathematics and biomedicine than in general knowledge tasks.
Key Results
The quantitative results reveal a consistent monotonic improvement in accuracy as gold context size increases across all tested models.
As illustrated in Figure 1, the performance gap between large gold contexts (solid lines) and small gold contexts (dashed lines) widens dramatically as the information moves deeper into the text. For example, on the CARDBiomedBench dataset:
- Gemini-2.0-Flash accuracy climbs from 48% with a small needle to 62% (medium) and 73% (large).
- GPT-4o performance rises from 77% (small) to 98% (large), nearly recovering its perfect "gold-only" baseline performance.
- LLaMA-3.1-405B improves from 74% to 92% when given the larger context.
The multivariate regression confirmed that gold context size remains a decisive, independent predictor of success ($p < 0.01$) even after strictly controlling for answer token repetition and the gold-to-distractor ratio.
Limitations and Future Work
The authors acknowledge a few key limitations in their study:
- Varying Gold-to-Distractor Ratios: Because they fixed the distractor lengths to simulate real-world conditions, changing the gold context size inherently altered the relative proportion of gold-to-distractor tokens.
- Single-Needle Focus: The evaluation was restricted to scenarios where a single document contains the answer. Real-world agentic workflows often require synthesizing information across multiple scattered needles (multi-hop reasoning).
Future work will focus on extending this analysis to multi-needle settings and exploring whether existing long-context mitigation strategies (like attention calibration or context compression) can alleviate this small-needle fragility.
Summary updated