asmit dash
Open-source library

corroborate

Open source · shipped to PyPI

Deterministic answer-grounding for LLM/RAG outputs.

What it is

A deterministic answer-grounding check for LLM and RAG outputs. Verifies that every number, date, and quoted string in an LLM answer is actually supported by the retrieved chunks - with no LLM-judge calls, sub-100ms per answer, CI-gateable. Pure Python stdlib.

Why it's needed

LLM-as-judge eval (RAGAS, TruLens, DeepEval) is the dominant way to measure RAG faithfulness. It is also expensive, slow, and inconsistent - multiple studies show LLM judges disagree 23-48% of the time on the same input. You can't run it on every PR, and the cost compounds at scale. You don't need an LLM to catch the common hallucinations: 1944 when context says 1945, 9,200 metres when context says 8,849, paraphrases wrapped in quotation marks as direct quotes.

What it does

corroborate runs before LLM-as-judge eval as a deterministic floor. It catches numbers, quantities, percentages, and money in the answer that don't appear in any chunk after normalisation ($1,234 ≡ 1234 ≡ 1,234.00); dates and years in the answer that don't appear in any chunk across formats; and quoted spans that aren't a verbatim substring of any chunk. These three signals are intentionally the deterministic spine and produce near-zero false positives on real LLM output.

How to use it

Install it:

pip install corroborate

Then call it:

import corroborate

report = corroborate.check_answer(
    query="When did WW2 end?",
    retrieved_chunks=["World War II ended in 1945 with the surrender of Japan."],
    answer="World War II ended in 1944 with Germany's surrender.",
)
print(report)
if not report.ok():
    raise SystemExit("Block this answer; it's hallucinating a date.")

Links