arXiv:2610.41704cs.CLOct 2026

Manuscript Offprint

arXiv:2610.41704

GraphNIAH: A Benchmark for Long-Context Reasoning over Real-World Graphs

Minh-Nam Tran, Abulhair Saparov

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

The needle-in-a-haystack (NIAH) benchmark was introduced as a test for measuring a model's ability to find small relevant facts within a very large body of input text. However, existing NIAH benchmarks each suffer from one or more of the following limitations: (1) reliance on synthetic data, so their evaluations may not generalize to real-world settings; (2) reuse of previously published datasets, leading to the risk of benchmark contamination; (3) dependence on manual annotation, which requires human effort to create and update data and is prone to future benchmark contamination; and (4) unrealistic simplification of long-context multi-hop reasoning where each next step is trivial given previous steps, while real-world reasoning often requires planning over multiple possible proof paths. To address these limitations, we introduce GraphNIAH, a dynamic benchmark built from real citation relationships among scientific papers published after the evaluated models' knowledge cutoff date, which utilizes real-world information while ensuring no benchmark contamination. The fully automated benchmark construction pipeline samples representative subgraphs of the citation graph formed by these papers and converts each subgraph into a long-context QA example with a verifiable answer. We use GraphNIAH to evaluate eight LLMs from the GPT-5.6, GEMINI-3, and QWEN3.5 families. We find that accuracy falls as questions require longer reasoning paths: at question depths of 16 and 32, the GPT-5.6 and QWEN3.5 models answer YES/NO questions no better than random guessing, mostly by answering NO; four of the eight models answer no counting example correctly, and the others model get worse as the subgraph size increases. These findings suggest that current LLMs often stop searching the citation relationships in their context before they reach the answer, even though every fact they need is in the context.

1 Introduction

Single-hop NIAH e.g., Kamradt (2023)

LLM input context Needle

“The best thing to do in San Francisco is eat a sandwich and sit in ...”

Q: What is the best thing to do in San Francisco?

Search space

one lookup

Multi-hop, linear e.g., RULER, BABILong

Q: Find all variables that are assigned the value 12345.

VAR X1 = 12345

VAR X2 = X1

VAR X3 = X2

next step is unambiguous

GraphNIAH (ours) non-linear, real citations

Title: {real paper}

References:

  • {reference paper 1}

  • {reference paper 2}

Q: Is Paper t reachable from Paper s by following one or more citation relationships?

Figure

must search among many paths

FIGURE 1: Three kinds of NIAH tests. In each row, the left column shows the LLM input context with its needles, and the yellow boxes show the text of needles; the right column shows the question and its search space from s to t. Single-hop NIAH (Kamradt, 2023) needs one lookup, and in RULER (Hsieh et al., 2024) and BABILong (Kuratov et al., 2024) the next step is unambiguous. In GraphNIAH, needles describe papers and their references; s and t lie in different connected components (dashed line), so the model must search all paths from s to answer NO.

With the rapid evolution of large language models (LLMs) in recent years, their native context length has also increased significantly from 2,048 tokens of GPT-3 (Brown et al., 2020) to 128k tokens of LLAMA-3.2 (Grattafori et al., 2024), and now, to 1M tokens of DEEPSEEK-V4 (DeepSeek-AI, 2026). With context extension techniques, such as RoPE-based scaling (Liu et al., 2024b; Ding et al., 2024) and long-context training (Hu et al.,

BenchmarkMulti-hop ReasoningReal DataUpdatableConstruction without Human AnnotationNon-linear Reasoning
Naive NIAH (Kamradt, 2023)✕✕✓✓✕
RULER (Hsieh et al., 2024)✓✕✕✓✕
BABILong (Kuratov et al., 2024)✓✕✓✓✕
LV-Eval (Yuan et al., 2025)✓✓✕✕✕
NeedleBench (Li et al., 2025a)✓✕✓✓✓
Counting-Stars (Song et al., 2025)✓✕✓✓✕
Sequential-NIAH (Yu et al., 2025)✓✕✕✓✕
NeedleChain (Moon and Lim, 2025)✓✕✓✓✕
NoLiMa (Modarressi et al., 2025)✓✕✓✓✕
U-NIAH (Gao et al., 2026)✓✕✓✕✕
GraphNIAH (Ours)✓✓✓✓✓

TABLE 1: Comparison of NIAH benchmarks across five desiderata: (1) support for multi-hop reasoning, (2) use of real data, (3) the ability to update benchmark data in the future, (4) construction without manual annotation, and (5) support for non-linear reasoning. Here, non-linear reasoning requires searching among possible proof paths to find a valid proof or establish that none exists, which is in contrast with linear reasoning, where each next proof step is unambiguous given the previous steps.

2025; Gao et al., 2025), context length can be extended to upwards of 4M tokens. With this ability to receive extremely long input text sequences, LLMs have been adopted for many complex long-context tasks, such as deep research (Du et al., 2026), long-context summarization (Laban et al., 2024; Wright et al., 2025), and long-horizon reasoning and planning (Chen et al., 2025a; Erdogan et al., 2025). Furthermore, as downstream tasks increase in complexity and input prompts increase in length, it is becoming increasingly important for LLMs to be able to process key information in very long contexts, and then combine it with other information to solve such tasks (Koh et al., 2022; Pal et al., 2025; Adams et al., 2025). The needle-in-a-haystack (NIAH) test (Kamradt, 2023) evaluates whether LLMs can retrieve a small relevant fact, called a needle, from a long context containing unrelated information. However, single-hop NIAH tests do not accurately reflect real-world scenarios where relevant facts are often derived from multiple parts of the context or conversation. Hence, several multi-hop NIAH benchmarks have been proposed, including RULER (Hsieh et al., 2024), Sequential-NIAH (Yu et al., 2025), and U-NIAH (Gao et al., 2026), which require models to connect multiple facts.

Despite these advances, existing NIAH benchmarks face at least one of four limitations (see Table 1). First, many of them are built on synthetic data (Vodrahalli et al., 2024; Song et al., 2025; Hsieh et al., 2024; Yu et al., 2025; Modarressi et al., 2025) or LLM-generated content (Gao et al., 2026), which may poorly reflect real-world use cases. Second, some benchmarks, including Zero-SCROLLS (Shaham et al., 2023), LongBench (Bai et al., 2024), InfiBench (Li et al., 2024b), LongGen-Bench (Liu et al., 2024a), and ICR² (Qiu et al., 2025), are built on previously published NLP datasets. Relying on these published datasets leads to benchmark contamination when the data appears in the model's training corpus (Sainz et al., 2023; Xu et al., 2024; Choi et al., 2025; Cheng et al., 2025). Third, some NIAH benchmarks rely on human effort to create new datasets (Yuan et al., 2025; Gao et al., 2026). Expanding or updating these benchmarks requires additional human effort, making them difficult to scale; once the data is published, it is invariably incorporated into later LLMs' training data, resulting in future benchmark contamination. Finally, most current NIAH benchmarks require LLMs to connect retrieved facts along a single fixed logical path, where the next retrieval step is unambiguous given the previous step, to derive the final answer (Hsieh et al., 2024; Yu et al., 2025; Song et al., 2025; Moon and Lim, 2025). However, downstream tasks and applications often involve interconnected information in the context, where the next retrieval step is not always unambiguous and the model must perform search over multiple potential proof paths (Wang et al., 2026a; Edge et al., 2025; Wang et al., 2026b). We use non-linear reasoning to describe this kind of reasoning, which requires proof search to find the correct proof in a large space of possible proofs (or to find that no such proof exists). Most NIAH benchmarks (see Table 1) do not fully evaluate this kind of proof search; Figure 1 illustrates the difference.

To address these gaps, we propose GraphNIAH, a dynamic NIAH benchmark built from real scientific papers and their citation relationships. For each example, the benchmark construction pipeline samples a representative subgraph of the real citation graph from Semantic Scholar (Kinney et al., 2023), in which each node is a paper published after the evaluated LLM's training cutoff date and nodes are connected by cites and cited_by edges. The pipeline then converts each subgraph into a long-context QA example, where the papers in the subgraph and their bibliographies comprise the context, and the ground truth answer is computed directly from the subgraph. This process requires no manual annotation, so new examples can be generated automatically as new papers are published. GraphNIAH focuses on reachability: whether a target paper is reachable from a source paper, i.e., connected to it by a sequence of citation relationships stated in the input text. Each sampled subgraph contains several connected components, so that some papers are reachable from the source paper while others are not. GraphNIAH supports three tasks: (1) YES/NO reachability, (2) multiple-choice reachability, and (3) reachability counting (see Figure 2). To measure and analyze LLMs' ability to perform non-linear reasoning over facts from very long contexts, GraphNIAH is designed with many different variables as "control knobs", including question depth (i.e., the number of nodes on the path from the source paper to the target paper in the component), the subgraph size, the target context length, and various types of distracting content, i.e., information not supporting the correct reasoning or the answer.

We evaluate eight LLMs on GraphNIAH: GPT-5.6-SOL and GPT-5.6-LUNA (OpenAI, 2026), GEMINI-3.1-PRO (Google, 2026a), GEMINI-3.8-FLASH (Google, 2026c), GEMINI-3.6-FLASH (Google, 2026b), and three QWEN3.5 models (Qwen Team, 2026): QWEN3.5-397B-A17B, QWEN3.5-122B-A10B, and QWEN3.5-35B-A3B. Our analysis shows three main findings. First, accuracy decreases as question depth grows, and at large depths, GPT-5.6 and QWEN3.5 models answer YES/NO questions no better than random guessing, mostly by answering NO (§4.2).

Second, reachability counting is the hardest task: half of the models fail to correctly answer any counting question, and the other models struggle as the component size grows (§4.2 and §4.3). Third, neither the type of distracting content nor a higher level of reasoning effort reliably changes accuracy (§4.5 and §4.6). We make the code and the benchmark data publicly available at https://github.com/trminhnam/GraphNIAH.

References (31)