Lesson 1 of 3 Document Extraction with Content Understanding

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.

Sort into groups

OCR, layout or fields?

Exam skills 5.2.1

Decide which stage of a document pipeline produces each output.

Log in to try this activity Interactive activities are free with an account.

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.

Azure Content Understanding
ModalitiesDocuments, images, audio, video
Field definitionSchema with extract, generate and classify methods using generative models
OutputMarkdown, structure, typed fields, confidence, grounding
Typical choiceMixed media, inferred or classified fields, RAG preparation
Azure Document Intelligence
ModalitiesDocuments and images of documents
Field definitionPrebuilt models, or custom template and neural models trained on labelled samples
OutputText, layout, Markdown (layout model), fields, confidence
Typical choiceHigh-accuracy forms with a trained custom model, existing investments

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.

Sort into groups

Content Understanding or Document Intelligence?

Exam skills 5.2.1

Choose between the two document extraction tools.

Log in to try this activity Interactive activities are free with an account.

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.

A document extraction pipeline. OCR reads words and lines with positions, layout analysis finds paragraphs, tables and selection marks, and field extraction returns typed values with confidence scores and source regions. Fields above their confidence threshold go to business rule validation; fields below it go to human review with the source region highlighted, and corrections are recorded to improve the analyzer.
Each stage builds on the one before it. Thresholds are set per field, so a low-confidence total goes to a person while the rest of the invoice continues automatically.

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.

Content Understanding invoice analyzer with fields AmountDue, BalanceForward, BillingAddress and CustomerId and their confidence scores
A pipeline with a threshold of, for example, 85% would accept AmountDue and send BillingAddress to review.
Worked example

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.

Check yourself

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.