RAG Citation Debugger
Check a RAG answer's citations against the retrieved chunks: uncited claims, wrong sources, numbers.
How it works
Paste a generated answer with citation markers ([1], [doc2], [^3], ^1, 【4】) and the retrieved chunks. Each sentence is mapped to the chunks it cites and checked for lexical support: uncited claims, citations to chunks that do not support the sentence, numbers that are not in the cited chunk, better-matching chunks, markers pointing to non-existent chunks, and retrieved chunks that were never used.
- Markers recognised: [1], [1, 3], [doc2], [^1], ^1, 【4】 and (source: x). Markers placed after the full stop are attached to the preceding sentence. Labels resolve to chunk ids exactly, then by trailing number (doc2 ↔ 2), then a bare number n to the n-th chunk.
- Support = share of the sentence's content words (stop words removed, light stemming) found in the cited chunk; the best cited chunk counts. ≥ threshold → supported, ≥ half the threshold → weak support, below → unsupported citation.
- Numbers in the sentence must appear in at least one cited chunk, otherwise number-mismatch. Sentences with ≥ 3 content words or a number but no marker are uncited claims.
- If another chunk covers the sentence clearly better (≥ threshold and +0.2), it is suggested as the correct citation. Chunks never cited are unused, or relevant-but-uncited if they would support a sentence.
- This is lexical overlap, not entailment: paraphrases can look unsupported and negations can look supported. Treat results as pointers for review.
Use this tool in an app
These free programs for your browser have this tool built in, next to everything else the task needs.
-
Agentlab AI-agent & LLM workbench
Test an AI agent before release: permissions, traces, costs, citations and output checks.
Related tools
- AI Answer Verifier – Split an AI answer into claims and see which ones your sources actually support.
- Model Behavior Regression Explorer – Compare eval results of two model versions: accuracy, regressions, McNemar p-value, flaky items.
- Structured Output Validator – Validate AI JSON output against a JSON Schema: parse errors with line/column, plain-language fixes.
How to use the RAG Citation Debugger
Check a RAG answer sentence by sentence against the retrieved chunks to find uncited claims, wrong citations, wrong numbers and unused sources.
What it is for
A retrieval-augmented answer with neat [1] [2] markers looks trustworthy. Often it isn't: the model cites the wrong chunk, changes a year, or adds a fact that came from its training data rather than from your documents.
Paste the generated answer and the retrieved chunks (as JSON [{"id":"doc1","text":"…"}] or as blocks starting with [id]). The debugger splits the answer into sentences, resolves each citation marker to a chunk and measures how many of the sentence's content words appear in that chunk. It flags uncited claims, citations that don't support their sentence, numbers missing from the cited chunk, markers that point nowhere, and chunks that were retrieved but never used, or that should have been cited.
It measures word overlap, not meaning. A faithful paraphrase can look unsupported, and "is not" can look like support for "is". Use the verdicts as a list of things to check.
Worked example
The built-in example answer about the Eiffel Tower has four sentences, with five retrieved chunks:
The Eiffel Tower is 330 metres tall [1]. It was completed in 1888 for the World's Fair [2]. It was designed by the engineering company of Gustave Eiffel [3]. Around 7 million people visit it every year.
Result: 1 of 4 claim sentences supported by their citations; 1 uncited, 1 with weak or wrong citations, 1 number mismatch; 2 of 5 chunks unused.
Sentence by sentence:
- Supported. Chunk 1 contains every content word, including 330.
- Number mismatch. Chunk 2 covers 80 % of the words, but it says the tower was completed in 1889. The year 1888 isn't in the cited chunk, which is exactly the kind of error a reader would miss.
- Unsupported citation. Chunk 3 is about Paris's population (coverage 0). The debugger suggests chunk 4 instead, which covers 80 % and names Gustave Eiffel's company.
- Uncited claim. It has a number but no marker, and no chunk supports it. The visitor figure came from somewhere other than retrieval.
In the chunk list, chunk 3 is "cited but not supporting", chunk 4 is "relevant but uncited", and chunk 5 (the Louvre) is unused.
How to read the result
- Sentence verdicts — supported, weak support, unsupported citation, number mismatch, uncited claim, or no claim (too short to need a source).
- Coverage — the share of content words found in the best cited chunk. Best chunk and suggested citation show when another chunk fits clearly better.
- Chunk status — used, cited but not supporting, relevant but uncited, or unused. Many unused chunks usually mean retrieval is pulling in noise.
- Unknown markers — citations such as
[7]when there are only five chunks.
Tips and common mistakes
- Number mismatches are the most valuable finding. Wrong years, prices and doses look plausible and survive casual review.
- The default threshold of 0.5 suits short factual sentences. For long, paraphrase-heavy answers, try 0.35 before deciding citations are broken.
- Keep chunk ids identical to the markers your prompt asks for.
doc2resolves to chunk2, and a bare number n falls back to the n-th chunk, which can mislead if your ids aren't in order. - An uncited claim with no supporting chunk anywhere is a hallucination candidate. Tighten the prompt ("only state facts from the sources") or improve retrieval.
FAQ
Which citation formats are recognised?
[1], [1, 3], [doc2], [^1], ^1, 【4】 and (source: x). A marker placed after the full stop still counts for the sentence before it.
Does "supported" mean the sentence is true?
No. It means the cited chunk contains most of the sentence's words. A negation or a reversed relation can still slip through.
Why is a sentence without a marker not flagged?
Sentences with fewer than three content words and no number count as "no claim", for example transitions like "Here is a summary."
Can I use it in an automated eval?
Yes. The JSON API returns per-sentence verdicts and counts, so you can track the supported rate across prompt or retriever versions.
Guide last updated:
For scripts and AI agents
- JSON API:
POST https://ragcitationdebugger.usefulweb.site/api/v1/calculate(same calculation as this page) - Interface description: OpenAPI 3.1 · AI guide: llms.txt
- MCP server (Streamable HTTP):
https://ragcitationdebugger.usefulweb.site/mcp· tool namerag_citation_debugger
Example request
curl -s -X POST https://ragcitationdebugger.usefulweb.site/api/v1/calculate \
-H 'content-type: application/json' \
-d '{…see OpenAPI examples…}'