Building an extraction pipeline
The machinery every extraction shares: reading order, schema design, validation rules, per-field confidence, review queues and audit trails.
An extraction pipeline is usually described as a model with a schema attached. That framing hides where the work actually is. By the time a model sees a page, somebody has already decided which text runs belong to which column, which order the paragraphs go in, what the fields are called, what a valid value looks like, and what happens to the eleven percent of documents that do not fit. Those decisions determine the accuracy of the system far more than the choice of model does, and none of them is a prompting problem.
These pages are the general machinery, written once so that pages about a particular document type do not have to repeat it. Reading order and table geometry first, because they run before anything else and destroy information silently when they are wrong. Then schema shape, then validation rules that can actually reject a value rather than merely flagging it, then confidence, review and the audit trail that lets you answer, eighteen months later, why a field says what it says.
Extracting a Table That Uses Merged Cells Across a Header Row
Why a merged header label lands on one column and leaves the rest blank, and how to propagate it across the columns it actually covers.
9 min read
Extracting a Table Whose Columns Don't Align Between Pages
Why values jump into the wrong column partway through a multi-page table, and how to key columns by header identity instead of by x position.
10 min read
Extracting Text From a Two-Column Academic PDF in Reading Order
Why text comes out interleaved across both columns, and the projection-profile method that recovers the real reading order.
10 min read
Extracting Data From a Document With a Sidebar and Main Column
How pull quotes and call-out boxes get spliced into body text, and a bounding-box method that separates them without discarding what they contain.
9 min read
Extracting Text From a Scanned Fax With Header Noise on Every Page
Where the transmission header on every fax page comes from, why cropping it is the wrong fix, and how to detect it by cross-page repetition.
10 min read
Extracting Data From a Fax Cover Sheet
The routing fields a cover sheet carries, and why its claimed page count is the most useful field on it.
9 min read
Designing an Extraction Schema Before You've Seen Every Document Variant
Why a schema built from the common case breaks on the fifth format, and how to design one that can absorb a variant it has never met.
10 min read
Choosing Between a Nested and a Flat Schema for Document Extraction
One invoice modelled both ways, and the cardinality rule that decides which shape a field belongs in.
10 min read
Designing an Extraction Schema That Survives a Multi-Entity Document
How to name fields on a document that carries several parties, dates or amounts of the same kind without inventing unstable numbered fields.
9 min read
Writing a Validation Rule for a Date Field That Rejects Impossible Dates
A shape check plus a real calendar parse plus a range rule, and why the middle one must not be a regular expression.
9 min read
Writing a Validation Rule for a Currency Amount Field
A parser that decides the decimal separator from evidence rather than configuration, and stores the result in integer minor units.
10 min read
Writing a Validation Rule for an Extracted Identifier Field With a Checksum
Luhn, ISO 7064 mod 97-10 and modulo-11 side by side, with what each catches and what a passing check does not prove.
10 min read
Writing a Cross-Field Validation Rule That Compares Two Extracted Amounts
How to check that an invoice's subtotal, tax and total agree, in integer minor units, with a rounding tolerance you can derive rather than guess.
10 min read
Handling a Required Field That Is Missing From the Source Document
Why a field the document does not contain and a field your pipeline failed to read are different results, and what collapsing both to null costs you downstream.
9 min read
Handling a Field That Is Present but Illegible
When to store a low-confidence best guess and when to store an explicit illegible flag, worked through the downstream error cost of each choice.
9 min read
Scoring Confidence Per Field Instead of Per Document
Why one score for a document hides the one field that is wrong, and why the correct document-level rollup is a product or a minimum rather than a mean.
10 min read
Calibrating an Extraction Model's Confidence Scores Against Actual Error Rate
How to bucket extracted fields by reported confidence, measure each bucket's real accuracy, and fit a correction that turns a score into a probability.
12 min read
Setting a Confidence Threshold That Sends a Field to Human Review
Deriving the review cut-off from the cost of a review and the cost of an escaped error, including the reviewer's own error rate, instead of defaulting to 0.8.
10 min read
Building a Review Queue That Shows the Source Location for Each Extracted Field
How to carry a page, a bounding box and the verbatim source text through extraction so a reviewer checks a crop instead of re-reading the document.
11 min read
Prioritizing a Human Review Queue by Financial Impact, Not Arrival Order
Ranking a capacity-constrained review queue by expected loss avoided per reviewer-minute, and the measurement it quietly destroys if you do not compensate.
10 min read
Correcting One Extracted Field Without Re-Running the Whole Document
A patch-shaped correction model where a reviewer's fix is stored as a field-level event, so it survives concurrent edits and a later re-extraction.
10 min read
Feeding Human Corrections Back Into an Extraction Prompt Without Overfitting to One Document
How to tell a correction that reveals a real prompt gap from a one-off document oddity, and a rule for which corrections earn a change.
10 min read
Building an Audit Trail That Shows Who Corrected an Extracted Field and When
A field-level correction trail — prior value, new value, reviewer, timestamp, reason — that is append-only, verifiable, and survives the record being superseded.
10 min read
Keeping an Audit Trail of Which Model Version Extracted Each Field
Why every extracted field needs a composite version stamp covering model, prompt, schema and preprocessing, and why a model alias is not a version.
9 min read
Other topics
- LLM fundamentals & architecture
- Tokens, tokenization & context windows
- Prompt engineering
- Reasoning models & test-time compute
- Multimodal AI: vision, audio, video
- RAG & retrieval
- Embeddings & vector search
- AI agents & tool use
- Structured output & function calling
- Fine-tuning & post-training
- Local inference errors, string by string
- Running local models day to day
- Testing code that calls an LLM
- Snapshot and property testing for model output
- Regression suites for prompts
- Eval gates in CI
- Flaky tests against a model
- Determinism and the cost of testing
- Contract and streaming tests
- Testing tool calls and retrieval
- Inference, serving & latency
- Rolling out a prompt change
- Testing AI systems in practice
- Forecasting a time series
- Machine learning on tabular data
- Geospatial data and models
- Understanding audio that is not speech
- Understanding video
- Core computer vision tasks
- Machine learning on graphs
- Point clouds and 3D
- Evaluation, benchmarks & LLM-as-judge
- Sensor and IoT data
- Logs and event streams
- Models over biological sequences
- Machine learning on molecules
- Embedding and searching code
- Extracting invoices and purchase orders
- Receipts, statements and tax forms
- Insurance policies and contracts
- Deeds, court filings and patents
- Extracting from medical records
- Observability & LLMOps
- CVs, certificates and identity documents
- Shipping, customs and technical documents
- Meetings, email, chat and filled-in forms
- Business, property and inspection documents
- Contract clauses and insurance claims
- Regulated and compliance documents
- Consumer, travel and closing documents
- Mapping one chat API onto another
- SDK and framework migrations
- Hallucination & failure modes
- Re-embedding and model deprecation
- Cutting over between providers
- Parity gaps, shims and legacy endpoints
- Moving between model versions
- Migrating vector stores and caches
- Mapping capabilities and parameters
- Migrating pipelines and agents
- Contracts, runbooks and rollback
- Auditing a codebase before a cutover
- Compliance and fine-tune migration
- LLM cost engineering
- Routing, cost tracking and multi-tenancy
- What a migration does to your prompts
- AI security & prompt injection
- Privacy, compliance & data residency
- AI governance, policy & society
- Building reliable AI applications
- AI hardware, GPUs & compute
- Open-weight models & local inference
- AI for developers & coding agents
- AI in industry: vertical playbooks
- AGI, superintelligence, alignment & the long future
- Machine learning foundations
- NLP fundamentals & classical tasks
- Data engineering for AI
- Synthetic data & dataset curation
- AI product design & UX
- Search, ranking & recommendation
- Enterprise adoption & change management
- AI careers, skills & teams
- Reading AI research
- AI in science & discovery
- Robotics & embodied AI
- AI economics, markets & business models
- AI myths, hype & media literacy
- Context engineering
- Shipping AI features: patterns & anti-patterns
- Build it: end-to-end AI tutorials
- Python for AI: hands-on recipes
- TypeScript, React and the web
- Frameworks and SDKs
- Errors and troubleshooting
- AI facts, numbers and statistics
- The history of AI
- The maths behind AI
- Architectures beyond the transformer
- Reinforcement learning
- Diffusion and generative media
- Speech, audio and voice engineering
- Benchmarks, one at a time
- AI search visibility
- Infrastructure and operations
- Databases and storage for AI
- Knowledge graphs and structured knowledge
- Classical ML in production
- Regulation, jurisdiction by jurisdiction
- Prompt recipes and pattern library
- AI for people who do not write code
- Writing, media and creative work
- Edge and on-device AI
- Interpretability and model internals
- Field notes
- OpenAI model behaviour
- Claude model behaviour
- Gemini model behaviour
- Llama model behaviour
- Mistral model behaviour
- Qwen model behaviour
- DeepSeek model behaviour
- Cohere model behaviour
- Grok model behaviour
- Small model behaviour
- Hybrid model architectures
- Token cost by language and script
- Transliteration, romanization and script handling
- Locale-correct output
- Multilingual generation quality
- Multilingual pipelines
- The EU AI Act, article by article
- AI under the GDPR and EU data law
- US AI regulation, state and sector
- International AI governance and standards
- AI litigation and enforcement
- Running AI workloads on AWS
- Running AI workloads on Google Cloud
- Running AI workloads on Azure
- AI at the edge: Workers, Vercel and Netlify
- Serving models on Kubernetes
- Operating AI infrastructure
- Quantization formats and what they cost
- llama.cpp, flag by flag
- Ollama and the desktop local-model runtimes
- Local models on Apple Silicon
- Hardware for local inference
- Running speech and embedding models locally
- Model files, adapters and conversion
- VRAM arithmetic for local models