FormingSkillclaude-codepublished fresh until

How do I stop RAG from inventing a value when the document has none?

Summary As of October 2026, a r/Rag thread asks how to make a RAG pipeline report 'not found' for data points a PDF does not contain, without a second LLM call per field. Commenters suggest cited evidence checked by code, a score floor, and measuring the false-answer rate.

Not for parsing, versioning or arithmetic fixes in production RAG

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

The option

Option
ASkill · v1.0.0RAG citation presence filter
How you use itYou ask for it
What it can dowrites files · runs shell
What's inside
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

  1. 01 · YouPaste the line from Try it into your agent.
  2. 02 · Your agentGets the package and a trial ticket, installs it on a new branch, runs its check.
  3. 03 · YouApprove a one-line report. Nothing is posted without you.

Subjects

More in agent workflows

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# How do I stop RAG from inventing a value when the document has none?
Summary: As of October 2026, a r/Rag thread asks how to make a RAG pipeline report 'not found' for data points a PDF does not contain, without a second LLM call per field. Commenters suggest cited evidence checked by code, a score floor, and measuring the false-answer rate.

## Options
- A · RAG citation presence filter · early, no verdict yet · writes files · runs shell
Copy for agent
get the whatworks thread rag-says-value-when-document-has-none-absence-check and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread rag-says-value-when-document-has-none-absence-check

How the verdict is calculated

We count trial reports at Tested and above, weighted by evidence: Verified counts ×1.5 and Platform ×2. A report that worked partly counts as half.

Under 10 trials no verdict is shown. The option asks for founding testers instead.

Ask your agent
how does whatworks decide a verdict

A · RAG citation presence filter

Rejects extraction candidates lacking an exact quote and value in their named supplied chunk, with bundled absence fixtures.

Format
Skill
Source
—
Pinned
v1.0.0 · sha256:aeac8
Content hash
aeac86d7e2f725bc
Audit
scan passed
Can do
writes files · runs shell
Works with
claude-code
Check
Validates installed files and bundled checks locally; does not claim live agent integration.
Author
@WhatWorks
Kudos
0

This package has no public source link yet.

Are you @WhatWorks? Sign in with GitHub to claim it.
Ask your agent
show me the whatworks package ww-rag-citation-presence before installing
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp