Module 2 of 4
Ingestion and chunking
Turning documents into retrievable passages without losing meaning.
Four lessonsAbout 15 minutes
Pipeline stageOne part of the chain
Self-checkedAnswers are in the text
Lesson 1
Documents and extraction
PDFs, scans, spreadsheets and email all behave differently. Extraction quality decides what the model can see.
Keep the page or section reference with the text so a citation can point somewhere real.
- Run OCR where the text layer is missing.
- Preserve headings and tables.
- Store the source URI with every chunk.
Check yourself. What must travel with extracted text?
Lesson 2
Cleaning
Remove headers, footers, page numbers and duplicated boilerplate. Fix broken hyphenation and encoding.
Do not remove structure: headings carry meaning and help the reader verify the answer.
- Strip noise, keep structure.
- Record what was removed.
- Keep the original file.
Check yourself. Why keep the original after cleaning?
Lesson 3
Chunking
Chunks are the unit of retrieval. Too small and they lose context; too large and they bury the answer in noise.
Split on structure first: headings, sections, clauses. Use overlap to avoid cutting a sentence in half.
- Aim for one idea per chunk.
- Carry the document title into each chunk.
- Test sizes against real questions.
Check yourself. What is the cost of chunks that are too large?
Lesson 4
Metadata and versions
Metadata makes retrieval useful: source, section, date, owner, classification, version.
When a document changes, retire the old chunks rather than adding new ones beside them.
- Date every chunk.
- Mark classification for access control.
- Retire superseded versions explicitly.
Check yourself. Why must superseded versions be removed?