Skip to content

Reliability and Evaluation Research · Feb – Aug 2026

ragwell: RAG with Verified Citation Grounding

126× token cost difference between retrieval and long context

Source

The problem

Every AI tool shows sources now. Almost none verify the sources actually say what the answer claims.

Approach

A claim type that cannot exist without a chunk id and a verbatim quote, which makes citations checkable by string containment: no second model, no cost, and it runs on every answer rather than on a sample. Five search strategies from keyword matching to hypothetical document expansion. A three-rung verification ladder: quote containment, lexical overlap, entailment. InsufficientEvidence is a first-class answer, because a system with no way to say that will say something else instead. 381 tests, benchmarked on four real regulatory annual reports.

How it works

Key decisions

Verification that costs nothing runs on everything
String containment is free and deterministic, so it runs on every answer rather than on a sample. Only the entailment rung costs a model call, and it sits last precisely because it is the expensive one.
Publish the calibration curve, not a threshold
The confidence score is not a probability: ECE is 15.1%. No threshold paid for itself on this corpus, so the curve is published rather than a number that would imply a precision the score does not have.
Quote the limits at their real size
Eight labelled cases is small and is described that way. Ten questions per cell, one regulator's annual reports, dense and numeric and English. Strong enough for the cost and trap findings, not for accuracy differences.

Interface

Ragwell declining to answer a question its corpus does not support
Asked to compare Nigeria's coverage limit with Zambia's, the system declines rather than answering: no chunk mentions Zambia. Confidence reads 0.00 and is marked as not applicable, because a declined answer has nothing to be confident about.

What the measurements showed

What broke

Running it

python -m uvicorn app.main:app --port 8000

Full setup, configuration and API reference are in the repository README.

Stack

Written up in