RAG guide
Preparing documents
If a fact is mangled when a document is converted, no model can find it later. Document preparation is unglamorous and decides most of a RAG system's quality.
Hardest contentTables and scans
KeepHeadings and dates
RemoveOld versions
SyncDaily or on change
What makes documents hard
| Content | Problem | What we do |
|---|---|---|
| Tables in PDFs | Rows and columns get scrambled into a stream of numbers | Layout-aware parsing that keeps tables as tables |
| Scanned forms | No text at all until OCR runs | OCR with quality checks; flag pages that cannot be read reliably |
| Slides | Meaning is in layout and images | Extract text per slide and keep the slide title with it |
| Many versions | Old and new policies contradict each other | Keep only current versions searchable, or mark versions clearly |
| Long documents | A passage loses its context | Keep section headings with each passage |
Splitting into passages
- Split by structure, not by character count. Sections and paragraphs make better passages than fixed-size blocks.
- Keep passages a sensible size. Typically a few hundred words: big enough to carry meaning, small enough to be precise.
- Carry metadata. Document title, section, date, owner and permissions travel with every passage.
Keeping it current
- Sync changed documents daily or as they change, and remove deleted ones from the index the same day.
- Give every source an owner who is told when their documents produce wrong answers.
- Often the fastest way to improve answers is to fix the documents themselves.
More RAG guides: How RAG is built · Better retrieval · Permissions · Measuring answers · RAG FAQ · Use case: HR policy assistant
Want answers from your own documents?
Tell us where the documents live, who should be able to ask, and ten questions people ask today. We will come back with a plain view of what it takes to answer them well, and safely.