TL;DR
This paper introduces "HaystackCraft," a new benchmark for evaluating Large Language Models (LLMs) on long-context reasoning. It addresses the limitation of existing benchmarks by simulating realistic retrieval scenarios where distractors are not random but are generated by various retrieval systems, revealing significant performance drops in LLMs as context grows and highlighting the importance of how information is presented.
What Problem Does This Paper Address?
Large Language Models (LLMs) are increasingly capable of processing and reasoning over very long contexts. To evaluate this capability, "needle-in-a-haystack" (NIAH) benchmarks have been developed, where an LLM must find a specific piece of information (the "needle") within a large document (the "haystack"). However, existing NIAH benchmarks often use randomly selected distractors, which doesn't reflect real-world applications like Retrieval-Augmented Generation (RAG). In RAG, the context provided to an LLM is typically the output of a retrieval system, which is inherently biased and imperfect. These retrievers can introduce "near misses" (semantically related but incorrect) or lexically similar but irrelevant documents. This paper argues that evaluating LLMs with these realistic, engineered distractors is crucial for understanding their true long-context performance and for developing more robust RAG systems.
Methods
The authors introduce HaystackCraft, a new NIAH benchmark that focuses on "context engineering." This involves constructing the haystack by using a variety of retrieval strategies to generate distractors, mimicking real-world RAG pipelines.
Key methodological components include:
- Diverse Retrievers: HaystackCraft utilizes a spectrum of retrievers to generate distractors:
- Sparse Retrievers (e.g., BM25): Rely on lexical similarity.
- Dense Retrievers (e.g., Qwen3-Embedding-0.6B): Capture semantic similarity.
- Hybrid Retrievers: Combine sparse and dense methods using reciprocal rank fusion.
- Graph-Based Retrieval: For multi-hop questions where relevant documents are interconnected (like in Wikipedia's hyperlink network), they employ Personalized PageRank (PPR) to rerank retrieved documents. This leverages the structural importance of documents.
- Retriever-Ranked Ordering: Unlike previous benchmarks that often use random document ordering, HaystackCraft evaluates LLMs with documents ordered as they would be by a retriever in a practical RAG system. They also compare this to random ordering to isolate positional biases.
- English Wikipedia Corpus: The benchmark is built on the full English Wikipedia hyperlink network, providing a rich and interconnected corpus.
Datasets
- Corpus: The benchmark uses the English Wikipedia dump (as of April 4, 2025), comprising over 6.9 million articles and 97 million hyperlinks. Full articles are used as retrieval units.
- Question Answering Datasets:
- Natural Questions (NQ): Used for single-hop questions.
- MuSiQue: Used for multi-hop questions.
- The authors filtered samples from these datasets to ensure validity against their updated Wikipedia corpus.
Key Insights and Ideas
- Real-world distractors matter: Random distractors in traditional NIAH benchmarks can be misleading. The composition of distractors, influenced by the retriever used, significantly impacts LLM performance.
- Semantic similarity is harder: Distractors that are semantically similar (from dense retrievers) pose a greater challenge to LLMs than lexically similar ones (from sparse retrievers).
- Graph structure is beneficial: Exploiting the relational structure of documents (via graph-based reranking like PPR) can significantly mitigate the harmful effects of distractors, especially for multi-hop questions.
- Ordering is complex: The order in which documents are presented to an LLM has a non-trivial, model-dependent impact on performance. Evaluating with retriever-ranked order is crucial for realistic RAG assessment.
Key Results
- Performance Degradation: All 10 LLMs tested showed significant performance drops as context size increased, with decreases ranging from 7.6% to 61.8% up to 128K tokens.
- Retriever Effectiveness: Dense retrievers generally outperformed sparse retrievers, and hybrid approaches further improved performance. Graph-based reranking (PPR) substantially boosted performance across all LLMs and base retrievers, with improvements as high as 44% for Llama-3.1-70B-Instruct.
- Distractor Impact: Semantic distractors led to performance drops of up to 9.6% for some models compared to lexical distractors.
- Ordering Impact: While some models benefited significantly from retriever-ranked ordering (e.g., Gemma-3, Qwen2.5-1M), others showed more volatile or even negative responses, highlighting model-specific positional biases.
Limitations and Future Work
- Data Contamination: While the benchmark design aims to mitigate contamination (using a recent Wikipedia dump and focusing on in-context reasoning), the authors acknowledge that all models achieve non-zero F1 scores without context, indicating some degree of parametric knowledge contamination. They suggest that multi-hop questions are less susceptible to this.
- Future Work: The paper emphasizes the need for future evaluations to mirror canonical, retriever-ranked input to faithfully assess practical long-context utility in RAG. Further research could explore more sophisticated context engineering strategies and their impact on LLM reasoning.
Summary updated