Track 02 · RetrievalLesson 01 of 11
Parsing and chunking documents that fight back
Tables, headers and scans survive ingestion, so retrieval has something real to find.
- The FDE path · Stage 3 of 6
- 40 min read
- 60 min hands-on
- Pro
What you'll be able to do
01- Explain why a retrieval system can never be better than the text and structure it was given, and trace a wrong answer back to an ingestion defect.
- Choose a parsing route per document (text layer, OCR, layout model, vision-language parser) and justify it on cost, fidelity and determinism.
- Design a chunking strategy for a mixed enterprise corpus: headings, tables, footnotes, versions and multi-language content.
- Implement a heading-aware chunker with overlap, breadcrumb headers, stable chunk IDs and metadata that downstream ACL, freshness and citation layers depend on.
- Evaluate competing chunking configurations with retrieval metrics instead of eyeballing a few chunks.
Before you start
- Tokens, context windows and why answers go wrong: tokens, truncation, why input limits matter.
- Context on a budget: what to keep, compress and cut: chunk size is also a context-budget decision.
- Answers with receipts: grounding and citations: citations need page numbers, section paths and stable IDs, which are created here.
- Comfort with Python dataclasses and regular expressions.
The short version
Ingestion turns messy source files into self-contained, well-labelled pieces of text that a retriever can find and a model can cite. Most "the model hallucinated" complaints in enterprise pilots are really ingestion defects: a table split from its header, two columns read as one, a scanned annex with no text layer, or a chunk that says "the penalty is 2%" without saying which contract. You fix these before you touch embeddings or prompts.
- Parse for structure, not just text: reading order, headings, tables, footnotes and page numbers all matter.
- Route each document (sometimes each page) to the cheapest parser that preserves the structure you need. Scanned pages go to OCR (Scans, forms and OCR at scale).
- Chunk along the document's own boundaries, keep tables whole or split them by row with the header repeated, and prepend a breadcrumb so every chunk stands alone.
- Capture metadata and ACLs at ingest. You cannot filter, cite, expire or secure what you did not record.
- Choose chunk size and strategy by measuring recall on a golden set, not by copying a default.
Practise this in the lab
Pro lesson
The rest of this lesson is in Pro.
The mental model, worked example, field note, failure table, exercise and self-check, with the voice tutor.
Also in Pro
- Every stage and specialisation, in full
- Every lab and every role project
- Halden weeks 2–10, on your record
- Every drill, live in the playground
- All solutions, plus the server judge
- Lab Assistant and every Teach with AI