Dataset Viewer (First 5GB)
Auto-converted to Parquet Duplicate
qid
string
reachability_task
string
system_prompt
string
user_prompt
string
question
string
answer
string
question_type
string
answer_type
string
config
unknown
options
list
token_counts
dict
generator_version
string
experiments
list
0584fd1ecb5eae89a689bf2895be0a4631bc0c54c64e22061ade83f689e88518
multiple-choice
"You are a careful research assistant answering questions about academic papers using only the provi(...TRUNCATED)
"# Question\n\nUsing only the relationships described in the context, which of the following is reac(...TRUNCATED)
"Using only the relationships described in the context, which of the following is reachable from Pap(...TRUNCATED)
D
reachability-multiple
REACHABILITY_MULTIPLE
{"traversal_mode":"papers-only","needle_type":"apa-describe","needle_order":"random","alpha":0.1,"nu(...TRUNCATED)
[{"label":"A","text":"Paper \"The language network does not support music perception across a range (...TRUNCATED)
{ "gpt-5.4": 175085, "qwen3.5-397b-a17b": 191867, "gemma-4-31b": 199803 }
create_dataset.v1:4
[{"name":"distractor-type","context_length":200000,"random_seed":1,"slot":0,"path":"output/experimen(...TRUNCATED)
d0edac5ddb7132445e80fdc28ad2ff86dbe4e97a7ab0c1ee3581e0ea749a9518
multiple-choice
"You are a careful research assistant answering questions about academic papers using only the provi(...TRUNCATED)
"# Question\n\nUsing only the relationships described in the context, which of the following is reac(...TRUNCATED)
"Using only the relationships described in the context, which of the following is reachable from Pap(...TRUNCATED)
A
reachability-multiple
REACHABILITY_MULTIPLE
{"traversal_mode":"papers-only","needle_type":"apa-describe","needle_order":"random","alpha":0.1,"nu(...TRUNCATED)
[{"label":"A","text":"Paper \"HindSearch: Trajectory-Level Hindsight Critique for Search-Augmented R(...TRUNCATED)
{ "gpt-5.4": 166616, "qwen3.5-397b-a17b": 175736, "gemma-4-31b": 175513 }
create_dataset.v1:4
[{"name":"distractor-type","context_length":200000,"random_seed":1,"slot":1,"path":"output/experimen(...TRUNCATED)
2824f8780f3454c25ebca2d109d34bcb7a869488b20b68e22bb6cde3228d1ea8
multiple-choice
"You are a careful research assistant answering questions about academic papers using only the provi(...TRUNCATED)
"# Question\n\nUsing only the relationships described in the context, which of the following is reac(...TRUNCATED)
"Using only the relationships described in the context, which of the following is reachable from Pap(...TRUNCATED)
D
reachability-multiple
REACHABILITY_MULTIPLE
{"traversal_mode":"papers-only","needle_type":"apa-describe","needle_order":"random","alpha":0.1,"nu(...TRUNCATED)
[{"label":"A","text":"Paper \"Analysis of anti-icing characteristics for rotating spinners with hot (...TRUNCATED)
{ "gpt-5.4": 163058, "qwen3.5-397b-a17b": 172186, "gemma-4-31b": 167297 }
create_dataset.v1:4
[{"name":"distractor-type","context_length":200000,"random_seed":1,"slot":2,"path":"output/experimen(...TRUNCATED)
e617a4e1e5907bc20569bd2f31b56ed2aad7fe5ab027af0a3d9596c073a93fe6
yes-no
"You are a careful research assistant answering questions about academic papers using only the provi(...TRUNCATED)
"# Question\n\nUsing only the relationships described in the context, can you start from the Paper \(...TRUNCATED)
"Using only the relationships described in the context, can you start from the Paper \"Cohort-amorti(...TRUNCATED)
YES
reachability-yesno
REACHABILITY_YESNO
{"traversal_mode":"papers-only","needle_type":"apa-describe","needle_order":"random","alpha":0.1,"nu(...TRUNCATED)
null
{ "gpt-5.4": 186529, "qwen3.5-397b-a17b": 199979, "gemma-4-31b": 192307 }
create_dataset.v1:4
[{"name":"distractor-type","context_length":200000,"random_seed":1,"slot":3,"path":"output/experimen(...TRUNCATED)
a138ab4efeeaa9f1799102a625d55635f0ef03001156d8203adbbde6a9430271
multiple-choice
"You are a careful research assistant answering questions about academic papers using only the provi(...TRUNCATED)
"# Question\n\nUsing only the relationships described in the context, which of the following is reac(...TRUNCATED)
"Using only the relationships described in the context, which of the following is reachable from Pap(...TRUNCATED)
C
reachability-multiple
REACHABILITY_MULTIPLE
{"traversal_mode":"papers-only","needle_type":"apa-describe","needle_order":"random","alpha":0.1,"nu(...TRUNCATED)
[{"label":"A","text":"Paper \"Hybridized Grey–PCA multi-performance optimization of durable geopol(...TRUNCATED)
{ "gpt-5.4": 188888, "qwen3.5-397b-a17b": 199925, "gemma-4-31b": 195361 }
create_dataset.v1:4
[{"name":"distractor-type","context_length":200000,"random_seed":1,"slot":4,"path":"output/experimen(...TRUNCATED)
36a4dbe37b9b2425cb9708f38d482ec8fd784f3c43bf8ad00f81761cb52874c8
yes-no
"You are a careful research assistant answering questions about academic papers using only the provi(...TRUNCATED)
"# Question\n\nUsing only the relationships described in the context, can you start from the Paper \(...TRUNCATED)
"Using only the relationships described in the context, can you start from the Paper \"DNA and RNA e(...TRUNCATED)
NO
reachability-yesno
REACHABILITY_YESNO
{"traversal_mode":"papers-only","needle_type":"apa-describe","needle_order":"random","alpha":0.1,"nu(...TRUNCATED)
null
{ "gpt-5.4": 149409, "qwen3.5-397b-a17b": 164387, "gemma-4-31b": 185577 }
create_dataset.v1:4
[{"name":"distractor-type","context_length":200000,"random_seed":1,"slot":5,"path":"output/experimen(...TRUNCATED)
fe4b9009bcd74410d3d2ec8a22e9abbfd5cb4a595421aa441788d366e4d92e2b
counting
"You are a careful research assistant answering questions about academic papers using only the provi(...TRUNCATED)
"# Question\n\nUsing only the relationships described in the context, how many distinct papers are r(...TRUNCATED)
"Using only the relationships described in the context, how many distinct papers are reachable from (...TRUNCATED)
163
reachability-counting
REACHABILITY_COUNTING
{"traversal_mode":"papers-only","needle_type":"apa-describe","needle_order":"random","alpha":0.1,"nu(...TRUNCATED)
null
{ "gpt-5.4": 173590, "qwen3.5-397b-a17b": 182396, "gemma-4-31b": 182862 }
create_dataset.v1:4
[{"name":"distractor-type","context_length":200000,"random_seed":1,"slot":6,"path":"output/experimen(...TRUNCATED)
5a49e3382d05193a1b2ef2112afadb1d46a09070f5214823b6f12e604c65f8ca
yes-no
"You are a careful research assistant answering questions about academic papers using only the provi(...TRUNCATED)
"# Question\n\nUsing only the relationships described in the context, can you start from the Paper \(...TRUNCATED)
"Using only the relationships described in the context, can you start from the Paper \"Eel‐Inspire(...TRUNCATED)
YES
reachability-yesno
REACHABILITY_YESNO
{"traversal_mode":"papers-only","needle_type":"apa-describe","needle_order":"random","alpha":0.1,"nu(...TRUNCATED)
null
{ "gpt-5.4": 164823, "qwen3.5-397b-a17b": 171386, "gemma-4-31b": 168113 }
create_dataset.v1:4
[{"name":"distractor-type","context_length":200000,"random_seed":1,"slot":7,"path":"output/experimen(...TRUNCATED)
1be5f13c8e20fdd94786741ecb21bcfca018163a2c77aa3c0c8b12932e51595f
yes-no
"You are a careful research assistant answering questions about academic papers using only the provi(...TRUNCATED)
"# Question\n\nUsing only the relationships described in the context, can you start from the Paper \(...TRUNCATED)
"Using only the relationships described in the context, can you start from the Paper \"Control strat(...TRUNCATED)
NO
reachability-yesno
REACHABILITY_YESNO
{"traversal_mode":"papers-only","needle_type":"apa-describe","needle_order":"random","alpha":0.1,"nu(...TRUNCATED)
null
{ "gpt-5.4": 186678, "qwen3.5-397b-a17b": 199704, "gemma-4-31b": 191729 }
create_dataset.v1:4
[{"name":"distractor-type","context_length":200000,"random_seed":1,"slot":8,"path":"output/experimen(...TRUNCATED)
78a16b53655b97217d96939fdacf9f9338244a7a238df872ae122448a8a03c5a
multiple-choice
"You are a careful research assistant answering questions about academic papers using only the provi(...TRUNCATED)
"# Question\n\nUsing only the relationships described in the context, which of the following is reac(...TRUNCATED)
"Using only the relationships described in the context, which of the following is reachable from Pap(...TRUNCATED)
A
reachability-multiple
REACHABILITY_MULTIPLE
{"traversal_mode":"papers-only","needle_type":"apa-describe","needle_order":"random","alpha":0.1,"nu(...TRUNCATED)
[{"label":"A","text":"Paper \"Self-healing of asphalt materials–Part 1: Mechanisms, influencing fa(...TRUNCATED)
{ "gpt-5.4": 188501, "qwen3.5-397b-a17b": 199901, "gemma-4-31b": 193974 }
create_dataset.v1:4
[{"name":"distractor-type","context_length":200000,"random_seed":1,"slot":9,"path":"output/experimen(...TRUNCATED)
End of preview. Expand in Data Studio

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

Minh-Nam Tran, Abulhair Saparov

Paper Code Project Page BibTeX

GraphNIAH is a needle-in-a-haystack (NIAH) benchmark for long-context, non-linear reasoning over real citation graphs. Each example writes a subgraph of the Semantic Scholar citation graph as text, hides it among distracting content in a 200k–922k-token prompt, and asks whether (or how many) papers are reachable from a source paper through cites / cited_by relationships.

  • Real data, no contamination: every paper on the sampled citation paths was published on or after April 1, 2026, after the evaluated models' knowledge cutoffs.
  • Non-linear reasoning: the model must search many possible paths, not just follow one obvious chain. To answer NO, it must check every paper that is reachable from the source.
  • Verifiable answers: every answer is computed directly from the subgraph. There is no human or LLM annotation.
  • Updatable: the code builds new examples automatically as new papers are published.

Three kinds of NIAH tests: single-hop NIAH, linear multi-hop NIAH, and GraphNIAH.

Tasks

Examples of the YES/NO, counting, and multiple-choice reachability tasks.

Each subgraph has several connected components that share no paper. Reachability is defined only by the relationships written in the context, not by the full Semantic Scholar graph.

reachability_task Question answer
yes-no Is target paper t reachable from source paper s? "YES" or "NO" (balanced)
multiple-choice Which of the options is reachable from s? Exactly one of four options is reachable. "A"–"D" (balanced)
counting How many distinct papers are reachable from s, not counting s? An integer as a string, e.g. "169"

The appended-"None" variant of multiple choice adds a fifth option, E. None of these targets is reachable from the source., which is never correct.

Dataset structure

Files

File Content
examples.jsonl 8,686 unique examples (the test split), one JSON object per line. Each example is listed once, even when several experiments use it.
pipeline_outputs/experiments.v1_data.2026-04-01.zip Full experiment outputs for reproduction (about 4.7 GB). Not part of the test split. See Raw experiment files.

GraphNIAH is an evaluation benchmark. It has no training or validation split.

Fields

Field Type Description
qid string Unique example ID (SHA-256 hex).
reachability_task string yes-no, multiple-choice, or counting.
system_prompt string System message sent to the model.
user_prompt string Full user message: question, context (papers + distractors), and answer-format instructions. This is the long field (about 0.2M–0.9M tokens).
question string The question alone, including the options for multiple choice.
answer string Ground-truth answer (see the table above).
question_type string Internal task name: reachability-yesno, reachability-multiple, reachability-counting.
answer_type string Internal answer type, e.g. REACHABILITY_COUNTING.
options list of {label, text} Multiple-choice options. Present only for multiple-choice examples.
config object Settings used to build the example (see below).
token_counts object Prompt length in tokens for each tokenizer: gpt-5.4 (o200k_base), qwen3.5-397b-a17b, gemma-4-31b.
generator_version string Generator identifier, create_dataset.v1:4.
experiments list of objects The experiments that use this example (see below).

Main config keys:

Key Meaning Values
question_depth Papers on the true path from source to target (including both ends) 4, 8, 16, 32
component_node_count Papers in each connected component 100–250
question_format Task reachability-yesno, reachability-multiple, reachability-counting
distractor_type Distracting content code, essays, books, wikipedia, disjoint-tree (called disjoint-component in the paper)
context_length Target prompt length in tokens 200000, 500000, 922000
answer_condition Planned label (YES/NO or option letter) Not set for counting
none_option 1 if the "None" option was appended 0 or 1
source_qid Original example of a converted "None" example Only when none_option is 1
alpha Preferential-attachment parameter of subgraph growth 0.1
cutoff_date Earliest publication date of the path papers 2026-04-01

The other config keys (traversal_mode, needle_type, needle_order, num_options, yes_ratio, ...) are fixed construction settings.

Each item of experiments has:

Key Meaning
name Experiment name (see the next table).
context_length Target context length of that experiment.
random_seed Seed of that experiment (1).
slot Position of the example in that experiment's ordered list (0-based).
path The experiment file inside the zip archive (repo-relative path).

Experiments

Each experiment varies one variable. All other variables are drawn at random for each example.

experiments[].name Context Varied values Examples in the list Evaluated in the paper
question-depth 200k depth 4, 8, 16, 32 2,000 (500 per value) 100 per value
node-count 200k component size 100, 150, 200, 250 2,000 (500 per value) 100 per value
question-format 200k YES/NO, multiple choice, counting 1,500 (500 per value) 100 per value
distractor-type 200k 5 distractor types 2,500 (500 per value) 100 per value
reasoning_effort 200k low / medium / high (same examples) 500 100
context_length 500k – 500 50
context_length 922k – 500 50
question-format/none-option/reasoning_effort=low/model=<model> 200k appended "None" option 100 per model 100

The 200k context-length point in the paper reuses the reasoning_effort examples. The three "None"-option lists (gpt-5.6-luna, qwen3.5-35b-a3b, gemini-3.8-flash) contain the same 100 converted examples.

Some examples appear in more than one list, because identical settings produce the same example. This is why the 9,800 list entries contain only 8,686 unique examples.

Getting the evaluated subset. Within an experiment, examples are ordered round-robin over the varied values (slot 0 = value 1, slot 1 = value 2, ...). So the first N examples of every value are the slots 0 … N × (number of values) − 1. The paper evaluated 1,760 distinct examples in total.

Usage

from datasets import load_dataset

ds = load_dataset("minhnam/GraphNIAH", split="test")

# Number of varied values per experiment, and examples evaluated per value in the paper.
EVALUATED = {
    ("question-depth", 200_000): (4, 100),
    ("node-count", 200_000): (4, 100),
    ("question-format", 200_000): (3, 100),
    ("distractor-type", 200_000): (5, 100),
    ("reasoning_effort", 200_000): (1, 100),
    ("context_length", 500_000): (1, 50),
    ("context_length", 922_000): (1, 50),
}

def in_paper_subset(example, name, context_length=200_000):
    values, per_value = EVALUATED[(name, context_length)]
    return any(
        e["name"] == name
        and e["context_length"] == context_length
        and e["slot"] < values * per_value
        for e in example["experiments"]
    )

depth = ds.filter(lambda ex: in_paper_subset(ex, "question-depth"))
print(len(depth))  # 400

example = depth[0]
messages = [
    {"role": "system", "content": example["system_prompt"]},
    {"role": "user", "content": example["user_prompt"]},
]

Scoring. Each prompt asks the model to end with one line \answer{...}. The paper reads the answer as follows and compares it with answer, after light normalization of both sides (for example, whitespace, Markdown or LaTeX emphasis, trailing punctuation, and letter case):

  • YES/NO and counting: the last \answer{} block. If there is none, the end of the response (last 100 characters for YES/NO, last 30 for counting) counts only when it is exactly a label or an integer.
  • Multiple choice: one option letter, taken from the whole response (e.g. C, C., Option C), from the \answer{} block, or from the last non-empty line.

Responses without a readable answer count as wrong. A simplified version that reads only the \answer{} block:

import re

def extract_answer(response: str) -> str | None:
    matches = re.findall(r"\\answer\{([^{}]*)\}", response)
    return matches[-1].strip() if matches else None

correct = extract_answer(model_response) == example["answer"]

The full scorer, with confidence intervals and per-label breakdowns, is run_eval.py in the code repository.

The prompts are very long. Most examples need a model with a context window of at least 200k tokens; the context_length examples need about 500k and 922k tokens. Check token_counts for your tokenizer before sending a request.

Raw experiment files

pipeline_outputs/experiments.v1_data.2026-04-01.zip holds the complete outputs behind the paper. Download it and unzip it in the root of the code repository to restore the original folder structure:

hf download minhnam/GraphNIAH pipeline_outputs/experiments.v1_data.2026-04-01.zip \
    --repo-type=dataset --local-dir .
unzip pipeline_outputs/experiments.v1_data.2026-04-01.zip

The archive contains:

output/data.2026-04-01/hops=<10|22|46|94>/papers-only/
    sampled_paths.json            # sampled citation paths (path lengths count papers)
    disjoint_path_groups.json     # path groups used to build disjoint components
output/experiments.v1/
    pool.jsonl                    # every built example, with full metadata
    inference_pool*.jsonl         # cached model responses
    cutoff_date=2026-04-01/hops=10-22-46-94/context_length=<200k|500k|922k>/seed=1/alpha=0.1/
        vary=<experiment>/experiment.jsonl                # ordered list of qids
        vary=<experiment>/experiment.jsonl.settings.json  # experiment settings
        vary=<experiment>/inference/reasoning_effort=<effort>/model=<model>.json  # model responses
        vary=<experiment>/eval/reasoning_effort=<effort>/model=<model>.json       # scores

pool.jsonl has more fields than examples.jsonl. For example, it contains the rendered needles, the paper IDs of each component, the visible citation graph, and the source of every distractor. The zip also has results for gemini-3.7-flash, which is not reported in the paper. The alpha-search pools are not included.

How the examples are built

  1. Backbone: sample a real undirected citation path of 3k − 2 papers (all published on or after 2026-04-01). Split it into a distractor path, the true path from s to t (k papers), and another distractor path. So at least k − 1 search steps are needed from either end.
  2. Subgraph growth: add real neighboring papers with a preferential-attachment rule (α = 0.1), which mimics the scale-free degree distribution of citation graphs. Every component stays a tree.
  3. Rendering: write each paper that cites another paper in its component as a text block (title, authors, publication information) with an APA-style reference list.
  4. Distractors and packing: add distractors until the target context length is full, then shuffle all blocks. The distractor types are: Linux kernel source files (code), Paul Graham essays (essays), PG-19 books (books), Wikipedia passages (wikipedia), or extra citation components (disjoint-tree).

YES-label and NO-label examples differ only in where t is placed, and all components of an example are sampled in the same way. This prevents shortcuts such as guessing from topic similarity.

Limitations

  • The examples cover citation graphs of papers from one Semantic Scholar release (2026-10-06 download recipe) and one cutoff date (2026-04-01). Models trained on later data may have seen these papers.
  • Paper metadata (titles, authors, venues) comes from Semantic Scholar and may contain errors. Answers are still correct by construction, because they are computed from the relationships written in the prompt.
  • The paper evaluated 100 examples per value (50 for 500k/922k), so small accuracy differences are not statistically significant.
  • token_counts were measured with three tokenizers. Other tokenizers may give different prompt lengths.

Licensing

The prompts contain text from third-party sources, each under its own terms:

Source Used for Terms
Semantic Scholar Academic Graph Paper metadata and citations ODC-BY 1.0 (attribution required)
Linux kernel code distractors GPL-2.0
Paul Graham essays (sgoel9/paul_graham_essays) essays distractors Copyright of the author
PG-19 books distractors Public-domain books (Project Gutenberg); dataset under Apache-2.0
Wikipedia (wikipedia-dpr-100w, Pyserini) wikipedia distractors CC BY-SA 4.0

Citation

@article{tran2026graphniah,
  title   = {{GraphNIAH}: A Benchmark for Long-Context Reasoning over Real-World Graphs},
  author  = {Tran, Minh-Nam and Saparov, Abulhair},
  journal = {arXiv preprint arXiv:2610.41704},
  year    = {2026},
  url     = {https://arxiv.org/abs/2610.41704}
}

Contact

Please open a discussion on this dataset page or an issue in the code repository, or contact Minh-Nam Tran (tran555@purdue.edu).

Downloads last month
190

Paper for minhnam/GraphNIAH