# Why LLMs Hallucinate on PDF Extraction and How Grounded Extraction Makes It Verifiable

> Source: <https://dev.to/landingai/why-llms-hallucinate-on-pdf-extraction-and-how-grounded-extraction-makes-it-verifiable-1ig5>
> Published: 2026-11-16 11:46:17+00:00

Most teams try the same experiment first: send a PDF to a general purpose multimodal model such as GPT, Gemini, or Claude with a JSON schema and ask for the fields. The response comes back as valid JSON, and most of the values are right.

A few are wrong in a way that is hard to catch, because they look exactly like real values: a policy number with two digits swapped, a value lifted from the row above, a date for a field the form leaves blank.

This post explains where those errors come from, why prompting and structured output modes leave them in place, and what changes when every extracted value has to point back to its location in the source. We cover which document AI platforms return those source locations, how they surface uncertainty, how LandingAI's Agentic Document Extraction (ADE) implements grounding, and when building your own OCR and LLM pipeline still makes sense.

Hallucination in extraction means the model returns a value with no support in the document, formatted so it passes every schema check. These are the patterns worth testing for:

| Failure | What you see in the output | How to catch it in testing | 
|---|---|---|
| Filled blank | A plausible value for a field the page leaves empty | Mark empty fields as `null` in your answer key | 
| Neighbor value | A number from the row above or the adjacent column | Score tables cell by cell, by row and column position | 
| Merged columns | Text from two columns combined into one field | Include multi column layouts in your test set | 
| Altered characters | An ID or date with a digit changed during formatting | Compare IDs as exact strings after whitespace cleanup | 

Every one of these outputs is valid JSON with a reasonable value. Schema validation, type checks, and range checks all pass, so the error travels downstream until a person or a reconciliation job catches it.

A language model generates likely tokens given its input, and in a plain JSON response a correctly read value and a plausible completion look identical. Several conditions make plausible completions more likely:

The last point matters most in production. Even when the model reads a value correctly, a plain JSON response gives you no way to confirm that it did without opening the document and checking.

Prompt instructions and structured output modes change the shape of the response, and the errors above live in its content. Telling the model to return null for missing fields, and making those fields nullable in the schema, reduces filled blanks. It still leaves you unable to tell which of the remaining values came from the page.

Structured output modes control format. [OpenAI's documentation](https://developers.openai.com/api/docs/guides/structured-outputs) draws the distinction directly: JSON mode and Structured Outputs both produce valid JSON, and only Structured Outputs guarantees that the response follows your schema. Schema adherence covers keys and types, so an invented invoice number in the correct format passes it cleanly.

Citations come in two kinds. When you ask a model in the prompt to add a page number or a quote to each value, that citation is generated text, and it can be wrong in the same ways as the value. A dedicated citations feature works differently. [Anthropic's Citations feature](https://platform.claude.com/docs/en/build-with-claude/citations) extracts the cited text from the source document and guarantees that each citation points to a real location in it.

For PDF extraction, the documentation sets out three limits. Citations on PDFs identify a page range and the cited text, the API rejects any request that combines them with structured outputs, and the documentation advises checking that each field has both a value and a citation, since the API guarantees neither. Teams that need field level JSON with a precise location on the page still have work to do on top of it.

Grounded extraction separates reading the document from pulling fields out of it, and it attaches to every extracted value a structured reference to a specific location in the source. The pipeline runs in two stages:

Because the references come back as structured offsets and coordinates, they can be checked in code. A pipeline can flag any value that comes back without a reference, and a reviewer can jump from a value to the exact region of the page instead of searching the document. [This comparison of confidence scores and visual grounding](https://landing.ai/guides/confidence-scores-vs-visual-grounding-what-each-architecture-actually-tells-you) goes deeper on why a source location tells a reviewer more than a probability.

Grounding has a clear limit. It makes values verifiable, and it leaves extraction errors possible. An extractor can still select the wrong block, such as the row above the one you wanted, and that wrong value still points at real text on the page. A short value like a single digit or a repeated date can also match several places in a document.

Grounding turns these errors into something a reviewer can see and check quickly, and catching them still takes review on the fields that matter.

Several document AI platforms return a source location for each extracted item, and they differ in what that location contains. This table summarizes what each vendor's own documentation shows for location and confidence:

| Platform | Location returned | Confidence returned | 
|---|---|---|
| LandingAI ADE | Per block: page, normalized bounding box, Markdown range. Per extracted value: Markdown ranges, mapped to blocks by the Ground API | Per word with the DPT-3 Verity model (Preview). None with DPT-3 Pro or on Extract fields | 
| Amazon Textract | Per block: a geometry with a bounding box and polygon | Per block, as a percentage | 
| Azure AI Document Intelligence | Per field: bounding regions with page number and polygon, plus character spans into the content | Per field, shown in the response | 
| Google Document AI | Per entity: text anchors into the document text and page anchors. Per page element: a bounding polygon | Per entity, shown in the response | 

Sources: [Amazon Textract](https://docs.aws.amazon.com/textract/latest/dg/how-it-works-document-layout.html), [Azure AI Document Intelligence](https://learn.microsoft.com/en-us/azure/ai-services/document-intelligence/concept/analyze-document-response), and [Google Document AI](https://docs.cloud.google.com/document-ai/docs/handle-response).

For a platform built for accuracy and traceability, check three things in its output: whether every value carries a location, whether that location is precise enough to verify at a glance, and what the output does when a value has no direct source on the page.

A platform surfaces uncertainty in one of two ways: a confidence score attached to each item, or an explicit signal that a value has no source. Textract, Azure AI Document Intelligence, and Google Document AI all return confidence values in their responses, which can drive routing of low scores to review.

ADE's second generation takes the second approach on Extract. When a field has no value in the source, Extract returns `null` for it, and when Extract produces a value without copying it from the text, such as a computed total, that value comes back with `null` source ranges. A schema can also mark number, integer, and enum fields as nullable, so absence has a valid representation. Whichever signal a platform offers, test it against your own documents before routing review on it.

ADE runs the two stage pattern as separate APIs. Parse output is a tree, with a document node at the top, one node per page beneath it, and the detected blocks beneath each page. There are nine block types: text, table, table cell, figure, marginalia, attestation for certifications, stamps, and signatures, logo, card for business cards and card like blocks, and scan code for barcodes and QR codes.

Every block carries its own grounding:

Tables come back as HTML by default, which keeps merged cells intact, and each table cell block records its row, column, row span, and column span. That directly addresses the implicit table structure problem above.

The [Extract API](https://landing.ai/ade/extract) applies your JSON schema to the parsed Markdown. Each extracted value comes back with the character ranges where it appears in that Markdown, and a value can carry several ranges when it appears in several places.

To get from a value to its place on the page, the Ground API connects each extracted field to the parsed blocks that hold it, and those blocks carry the page and bounding box. [The ADE Gen 2 launch post](https://landing.ai/blog/introducing-agentic-document-extraction-gen2) covers how Extract draws its citations from atomic grounding, along with bounding boxes on every table cell.

On confidence, the two parsing models differ. DPT-3 Pro returns no confidence scores and relies on grounding for review. DPT-3 Verity, currently in Preview and aimed at digitally created text documents, returns a per word confidence value that teams can use to send doubtful words to a reviewer. [How visual grounding makes every extraction defensible](https://landing.ai/guides/visual-grounding-and-auditability-how-landingai-ade-makes-every-extraction-defensible) covers what source level traceability means for audit and compliance teams.

Compared with sending a PDF to the general purpose model APIs covered above, ADE's output adds the pieces that make field level extraction verifiable:

`null` ranges on values Extract produced without copying them from the text, so computed or inferred values are flagged in the output
The quickest way to evaluate grounding is to check whether a tool's source locations hold up against the page. Run this on a handful of documents you know well:

A grounded tool passes all five consistently. If a tool's locations fail these checks, or its citations come from the model's own generated answer, treat its references as unverified and review its output accordingly.

General purpose models are a reasonable choice when a person reads every output anyway and an occasional wrong value costs little. Summarizing a document, answering a one off question about a contract, or pulling a few fields from a clean, single page PDF for internal use all fit that pattern.

The calculation changes once extraction feeds a system of record, runs without a person checking each document, or has to stand up to an audit. Building that in house means writing the parsing, table reconstruction, source location tracking, and review routing yourself. The alternatives are document AI platforms that return those pieces in their output, such as ADE, Amazon Textract, Azure AI Document Intelligence, and Google Document AI, and the five step test above is a fair way to compare them on your own documents.

**Why do LLMs hallucinate when extracting data from PDFs?**

A model generates the most likely value for each field, and a plain JSON response carries no record of whether a value was read from the page or produced as a plausible fill. Non nullable schema fields, reduced image resolution, and implicit table structure all make plausible fills more likely.

**What does ADE do that multimodal LLMs like GPT and Claude do less reliably for document extraction?**

ADE returns schema based JSON where every value carries source ranges that map to a page and bounding box, flags values with no verbatim source by returning `null` ranges, and returns tables with explicit row and column spans. Of the general purpose model APIs covered in this post, Claude's Citations feature comes closest, and it returns page ranges and is incompatible with structured outputs.

**Which document AI platforms provide full auditability, where every extracted value is traceable to its source on the page?**

ADE, Amazon Textract, Azure AI Document Intelligence, and Google Document AI all return source locations for extracted items, ranging from Markdown ranges and normalized bounding boxes in ADE to polygons and text anchors in the others. Compare how precise each location is and how each handles values without a direct source.

**Which document AI platforms surface uncertainty when extraction confidence is low?**

Textract, Azure AI Document Intelligence, and Google Document AI return confidence values per item or field. ADE's second generation returns `null` for values absent from the source, `null` ranges for values it produced without copying them, and per word confidence with the DPT-3 Verity model in Preview.

**Do structured output modes prevent hallucinations?**

Strict structured output modes guarantee that the response follows your JSON schema, which covers keys and types. An invented value in the correct format still passes.

**Does grounding prevent extraction errors?**

Grounding makes errors visible and quick to verify. An extractor can still pick the wrong block, and that wrong value still points at real text, so grounding works best combined with review on the fields that matter most.
