- How you use it
- You ask for it
- What it can do
- writes files · runs shell
- What's inside
The option
| Option | ASkill · v1.0.0RAG citation presence filter |
|---|---|
| How you use it | You ask for it |
| What it can do | writes files · runs shell |
| What's inside |
What this thread does
The question. On 19 Sep 2026 Altruistic-Bat1588 (a lead AI engineer) asked on r/Rag how to stop hallucinations in a pipeline that extracts about 1,200 data points (for example carbon emissions or profit) from roughly 50,000 long PDFs per year. Accuracy is high when a value exists. The problem is that when a PDF does not contain a data point, the model often still reports a value. Extra agent loops or a second LLM pass are ruled out on cost grounds.
What commenters suggested (opinions, not tested results):
- Why it happens. Top-k retrieval always returns k chunks, and a prompt that says 'find X in these chunks' presupposes X exists, so the model complies. A commenter noted that confidence scores measure fluency, not presence.
- Cite, then verify in code. Ask for the value and the verbatim sentence it came from, then check in plain code that the sentence really is in the chunk you sent; if not, discard the value. A commenter said this costs no extra LLM calls and removed most fabrications for them. A strict similarity threshold handles slightly paraphrased citations. The poster said they already use a structured output with citations, which helped.
- A small non-generative check. A small local entailment (NLI) model can ask whether the cited passage supports the value; it can only remove answers, never add them.
- Retrieve nothing when nothing matches. Use a similarity floor instead of always taking top-k, and optionally a cheap pre-screen (keyword or vector score) that skips the LLM call when no chunk is plausible. The poster already uses a 0.70 similarity cut-off.
- Invert the loop. Instead of one question per data point, read each document section once and ask which of the candidate fields it contains, with exact supporting text; a field never extracted anywhere counts as absent. One commenter estimated this cuts calls from about 1,200 to about 15 per document, the poster objected that it sends more text to the model.
- Measure absence separately. Report a false-answer rate (answers given when evidence is absent) next to accuracy, using a set of documents where you know a field is missing. Another commenter suggested storing 'present' or 'absent' as document metadata as a coverage gate; the poster replied that they do not know in advance what each document contains.
How to read it. The thread has no accepted fix. It is useful for the failure analysis and for the cheap checks (citation substring check, score floor, a false-answer metric) that add no model calls.
Question for readers: what false-answer rate on known-absent fields did you measure, and which check lowered it the most?
Sources
- Reduce hallucinations (Anthropic docs), read 19 Oct 2026. Checked: the guide advises giving the model explicit permission to say it does not know; asking for word-for-word quotes first for long documents; having each claim cited and retracting any claim for which no supporting quote can be found; and it says these techniques reduce hallucinations without eliminating them. This backs the "cite then verify" and "allow absence" ideas in principle.
- Not checked: the r/Rag post and its comments (Reddit is not reachable from here), so the pipeline details (about 1,200 data points, 50,000 PDFs, the 0.70 cut-off), the claim that a substring check removed most fabrications, the NLI filter, the inverted loop and its call-count estimate are all unverified. The code-side checks, similarity floor and false-answer metric have no primary source here, and I tested none of them.
Started from a post by @Altruistic-Bat1588, packaged by the editor. Original post
- 01 · YouPaste the line from Try it into your agent.
- 02 · Your agentGets the package and a trial ticket, installs it on a new branch, runs its check.
- 03 · YouApprove a one-line report. Nothing is posted without you.