Panagiotis Gkilis

Case Study • RAG Evaluation • Long-Document QA

LongBook Verifier

Evidence-grounded evaluation of retrieval (RAG) strategies and AI-generated answers on long documents. Five retrieval methods implemented and benchmarked, nine AI systems scored, and one core finding: answer quality and evidence grounding are different properties — and they diverge.

240,767-word corpus 80 gold questions 5 retrieval strategies 9 AI systems scored Fully local — no data leaves the machine Zenodo DOI release

The research package is published on Zenodo: DOI 10.5281/zenodo.20513116. The method ships as a working product: BookProof — AI Book Summary Auditor.

What I built

A fully local, reproducible evaluation lab. No remote model calls are required for retrieval evaluation, so confidential text never leaves the environment — the same constraint client data imposes in production.

Five retrieval strategies

Implemented and benchmarked head-to-head: naive first-context and last-context baselines, flat chunk RAG over the whole document, a chapter-summary chain (rank extractive chapter summaries, then retrieve chunks inside the best chapters), and hierarchical book RAG (score chapters → retrieve chunks within → expand to neighboring chunks).

Measured per method
Context precision Context recall Answer score Latency Token cost

Grounding measured separately from correctness

A gold-question benchmark (JSONL: gold answer, evidence terms, expected source location per question) scores evidence-term coverage and answer-term coverage independently — because a system can produce a correct-sounding answer without ever finding the evidence. Outputs of nine consumer and enhanced-access AI systems (ChatGPT, Claude, Gemini, Copilot, Grok variants) were scored on the same gold sets under separated, clearly-labeled protocols.

Productized
BookProof — verification-only FastAPI service .txt / .md / .docx

Results — retrieval at scale

Experiment A: a ~64,000-word single book, 40 gold questions. Experiment B: a five-book corpus of 240,767 words (~320,220 tokens), 80 gold questions. Same five methods on both.

Context recall by retrieval method, Experiment A (64k words) vs Experiment B (240k words): chapter-summary chain wins both; naive first-context collapses at scale.

Retrieval — Experiment B (240k words)

MethodContext recallPrecision
naive first-context0.14580.1475
naive last-context0.33020.4150
flat chunk RAG0.43020.3375
chapter-summary chain0.47710.4000
hierarchical book RAG0.33650.3475

Structure-aware retrieval beat the naive baseline 3.27× on context recall. Retrieval quality degraded measurably as the corpus grew from 64k to 240k words — retrieval strategy must be re-benchmarked per corpus, not assumed.

Experiment C — follow-up ablation. Because hierarchical book RAG underperformed even flat chunking, I ran a stage-level ablation to find out why. Removing neighbor expansion alone raised hierarchical recall from 0.3365 to 0.4771 (matching the chapter-summary chain), and forcing the correct chapter (oracle) raised it to 0.7844 with perfect hit@1. The loss came from two failure modes on this corpus — wrong first-stage chapter selection (27 of 80 questions) and neighbor-expansion dilution (32 of 80) — which supports, but refines, the error-compounding hypothesis. Multi-stage retrieval pipelines need stage-level ablation before their failures can be interpreted. Published separately: DOI 10.5281/zenodo.20692451.

Evidence-term coverage vs gold-answer-term coverage per AI system: answer quality and evidence grounding diverge.

Model outputs — the divergence

System (free tier, Exp. A)Evidence cov.Answer cov.
Gemini0.91080.7930
Copilot0.80370.8010
ChatGPT0.51711.0000
Grok0.49631.0000

The two systems with perfect answer-term coverage had the worst evidence grounding. Confident, correct-sounding answers — weakest factual support. This failure mode is invisible unless grounding is measured separately from answer quality.

How the nine AI systems scored

Each system answered the same gold questions about the books. Scores measure two different things: evidence coverage (is the answer grounded in the actual text?) and answer coverage (does the answer contain the expected key terms?). Free-tier and enhanced-access runs used different protocols and are reported separately — they are not comparable to each other.

Evidence-term coverage per free-tier AI system on Experiment A: Gemini 0.911, Copilot 0.804, Claude Sonnet 0.756, ChatGPT 0.517, Grok 0.496.

Free-tier protocol — Experiment A

64,000-word book · 40 gold questions · consumer free-tier access.

SystemEvidence cov.Answer cov.Zero-evidence
Gemini0.91080.79300
Microsoft Copilot0.80370.80100
Claude Sonnet0.75620.79160
ChatGPT0.51711.00003
Grok0.49631.00005

"Zero-evidence" counts answers containing none of the expected evidence from the book — ChatGPT and Grok produced perfectly-phrased answers (1.0000 answer coverage) while having the weakest grounding and the only zero-evidence answers in the set.

Enhanced-access comparison on Experiment B: Claude Code Opus 4.8 high thinking leads both evidence (0.918) and answer (0.942) coverage.

Enhanced-access protocol — Experiment B

240,767-word five-book corpus · 80 gold questions · full-access agentic runs.

SystemEvidence cov.Answer cov.Zero-evidence
Claude Code Opus 4.8 (high thinking)0.91770.94150
Claude Code Sonnet 4.6 (high thinking)0.86980.89290
ChatGPT Plus GPT-5.5 Thinking0.73540.90621
Claude Code Sonnet 4.6 (low)0.72810.85564

Reasoning depth mattered more than brand: the same model family moved from 0.7281 to 0.8698 evidence coverage when thinking effort increased.

These are task-specific results on long-manuscript question answering under documented protocols — not a universal model ranking. The full per-question scoring (520 scored rows across both experiments) is in the Zenodo research package.

How the benchmark works — gold questions

Every question in the benchmark is a gold question — written in advance with three things attached: the gold answer (what a correct answer must contain), a list of evidence terms (the specific facts and phrases that exist in the source text and prove the answer), and the expected source location (which chapter the evidence lives in).

  • Answer-term coverage asks: does the system's answer contain the key terms of the gold answer? This measures whether the answer sounds correct and complete.
  • Evidence-term coverage asks: does the answer contain the actual evidence from the book? This measures whether the answer is grounded in the source — not reconstructed from the model's general knowledge or invented.
  • Zero-evidence questions count answers with none of the expected evidence at all — the most dangerous case: a fluent, confident answer with no factual support.
  • Retrieval metrics (context precision / recall) are scored against the expected source location: did the retrieval step actually fetch the passages that contain the evidence?

The two coverages are reported separately because they diverge — that divergence is the central finding of this work, and it is exactly what an evaluation that only grades "answer quality" can never see.

Why this matters for enterprise RAG

  • Grounding must be a first-class metric. A RAG system evaluated only on answer quality will ship hallucinations that read well.
  • Document structure is leverage. Chapter/section-aware retrieval outperformed flat chunking on long documents — most real corpora (contracts, filings, manuals) have exploitable structure.
  • Evaluation must be reproducible and local. Gold sets, versioned runs, and deterministic fallbacks make results auditable — and confidential data never leaves the environment.
  • Cost and latency are part of the result. Every method is reported with latency and token estimates, because the best-scoring method is not automatically the deployable one.
Stack
Python sentence-transformers FAISS (optional) FastAPI python-docx Matplotlib JSONL gold schema