Building Document Pipelines with OCR, Layout Analysis and Field Extraction
This lesson explains the three stages of a document pipeline, which turns PDFs, scans and photos into text, structure and typed values, and how Azure Content Understanding and Azure Document Intelligence implement them.
Learning outcomes
After completing this lesson, you will be able to:
- Describe OCR, layout analysis and field extraction.
- Choose between Content Understanding and Document Intelligence.
- Route low-confidence values to human review.
Three stages
Organizations receive much of their information as documents designed for people: invoices, application forms, contracts, reports and photos of receipts. Business systems need the same information as data, such as an invoice total in a currency field or a contract end date in a date field. Document extraction bridges the two. It is a pipeline of three stages, and understanding what each stage adds explains why a pipeline fails when one is missing.
Optical character recognition (OCR) reads printed and handwritten text and returns words and lines with positions and confidence.
Layout analysis identifies structure: paragraphs and their roles (title, section heading, page header, footnote), tables with cells, spans and headers, selection marks such as check boxes, and figures.
Field extraction returns named, typed values, such as invoice number, total and line items, each with a confidence score and the region it came from. Each stage builds on the previous one.
An invoice shows how the stages depend on each other. OCR alone returns the words "Total", "1,250.00", "Subtotal" and "1,000.00" with their positions, but not which number belongs to which label. Layout analysis recognizes the table of line items, its rows and columns, and the label-value pairs below it. Field extraction then uses that structure and the meaning of the labels to return InvoiceTotal = 1250.00 as a number, with the confidence and the page region it came from. A pipeline that skips layout analysis tends to mix up values that sit close together, and a pipeline that stops at layout leaves the application to interpret the labels itself.
OCR, layout or fields?
Content Understanding and Document Intelligence
Both Foundry Tools perform all three stages, but they define fields differently. Azure Document Intelligence uses prebuilt models for common document types and custom models trained on labelled examples of an organization's own forms. A custom template model learns a fixed layout, and a custom neural model handles forms whose layout varies. Its strength is high, consistent accuracy on known document types.
Azure Content Understanding defines fields in a schema with a description for each field and uses generative models to fill them, so a new field can often be added by writing a clear description rather than by labelling examples. It can also infer or classify values that are not printed in the document, and it handles audio and video as well as documents. Its strengths are flexibility, mixed media and preparing content for RAG. The following table compares the two.
Content Understanding analyzers use the Foundry resource's model deployments for generative steps, so fields can be inferred ("Is this a final notice?") as well as extracted. Document Intelligence prebuilt models cover invoices, receipts, identity documents, tax forms and more, and custom models learn a company's own forms from a few labelled examples.
Content Understanding or Document Intelligence?
Confidence and human review
Extracted values can be wrong, particularly on poor scans, handwriting or unusual layouts. Pipelines therefore set confidence thresholds per field, send low-confidence fields to human review with the source region highlighted, validate values with business rules (totals equal the sum of line items, dates are plausible) and record corrections to improve the analyzer or model.
The threshold is a business decision that balances cost against risk. A high threshold sends more documents to people, which costs time but rarely lets an error through; a low threshold automates more but accepts more errors. Fields with financial or legal consequences, such as payment amounts and bank details, usually get stricter thresholds than descriptive fields. The corrections that reviewers make become labelled examples, which are used to refine field descriptions or retrain a custom model and to measure accuracy over time.
The following diagram shows the three stages followed by confidence-based routing.

The following screenshot shows the prebuilt invoice analyzer on a sample invoice in the Foundry portal. Each extracted field has a value, the page it came from, a highlighted region on the document and a confidence score, such as 94.40% for AmountDue and 77.90% for BillingAddress.

Accounts payable
A company receives 20,000 invoices a month from 3,000 suppliers in many layouts, plus a smaller number of credit notes. It needs vendor, totals, due date and line items in its ERP system, a flag for invoices that mention late fees, and no manual typing except for uncertain values.
Use a Content Understanding analyzer based on the invoice analyzer, with an added generated or classified field for late-fee mentions and a document type classification (invoice or credit note). Validate totals in code and route fields below the confidence threshold to a review queue.
What should happen to fields extracted with low confidence?
Show answer
They should go to human review and be validated with business rules before they are used.
Exam Tips
Remember for the exam
- OCR reads text; layout adds structure; field extraction returns typed values with confidence.
- Inferred or classified fields and mixed media: Content Understanding.
- Route low-confidence fields to human review and validate with business rules.