DEV Community

Claupt
Claupt

Posted on

Stop AI From Inventing Facts in Document Extraction

AI document extraction often fails in a subtle way: the output looks complete even when the source never contained the answer.

A meeting transcript might omit an owner. A form might not state a deadline. A report may contain two conflicting values. If the prompt only asks for a polished summary, a model may fill those gaps with something plausible.

The fix is not a longer prompt. It is a clearer decision boundary.

1. Make uncertainty part of the output

Instead of asking for a generic list of tasks, define fields that let the model preserve what is unknown.

{
  "task": "",
  "owner": "Unknown | name from source",
  "deadline": "Unknown | date from source",
  "evidence": "short source quote",
  "status": "confirmed | ambiguous | conflicting"
}
Enter fullscreen mode Exit fullscreen mode

This changes the task from “produce a complete answer” to “produce a faithful extraction.”

2. State the rules for missing and conflicting information

Use direct rules that tell the model what to do when the source is incomplete.

Use only information stated in the source.
If an owner or deadline is not stated, write Unknown.
If two source statements conflict, preserve both and mark the item Conflicting.
Do not infer priority, responsibility, or dates.
For every extracted item, include a short supporting quote.
Enter fullscreen mode Exit fullscreen mode

The supporting quote is especially useful. It gives a reviewer a fast way to check the extraction without rereading the entire document.

3. Treat examples as edge-case tests

A good example is not decoration. It shows the model how to behave when the input is messy.

For example, include a short transcript where one person suggests a date and another later changes it. Your expected output should preserve the latest confirmed decision and flag the earlier statement as superseded.

A second example can show an action with no owner. The correct result is not a guessed person; it is Unknown.

4. Separate extraction from writing

Do not ask the model to extract facts, make decisions, and draft a polished email in one step.

First create a structured extraction with evidence. Review it or validate it with simple rules. Then use that approved structure to create the summary, email, or report.

This split makes errors easier to find and lowers the chance that polished wording hides an unsupported claim.

5. Add a lightweight validation pass

Before using the result, check:

  • Does every non-Unknown value have source evidence?
  • Are all required fields present?
  • Did the model flag contradictions?
  • Are dates and names copied exactly from the source?

Some checks can be deterministic. For example, reject an item with a named owner but no evidence field. Keep the model for the ambiguous language work and use rules for clear acceptance criteria.

A practical workflow

  1. Clean and structure the source document.
  2. Extract to a schema with Unknown, Ambiguous, and Conflicting states.
  3. Require short evidence for each claim.
  4. Validate required fields and evidence coverage.
  5. Generate the final human-readable output only after review.

This workflow is useful for meeting notes, forms, support tickets, and any document where a confident but invented detail would create extra work.

For browser-based document cleanup before extraction, you can convert a PDF or Office file into editable Markdown with Claupt’s PDF to Markdown tool.

Top comments (0)