Document types and needs
| Document type | Needs to preserve | Parser approach |
|---|---|---|
| Born-digital PDFs, Word, HTML | Headings, lists, paragraphs | Text extraction with structure (to Markdown) |
| Documents with important tables (price lists, specs) | Table rows/columns | Layout model with table extraction |
| Scanned PDFs, photos | Text at all | OCR (cloud service or open-source) |
| Forms | Key-value pairs | Form/layout models |
| Slides | Slide titles, bullet hierarchy, speaker notes | Office parsers |
| Diagrams, charts, screenshots | Meaning of visuals | Vision LLM descriptions (costly; selective) |
Options
| Option | Strengths | Watch |
|---|---|---|
| Open-source text extraction | Free, fast | Weak on tables, no OCR |
| Open-source layout/conversion tools | Structure to Markdown/JSON, tables, runs locally | Needs compute; quality varies by layout |
| Cloud document AI (layout/OCR) | Strong OCR and tables, many languages, managed | Per-page cost; data residency |
| Vision LLMs | Understand complex pages and images | Highest cost; possible hallucinated content |
Output format
- Convert to Markdown (headings, lists, tables) or structured JSON with element types.
- Keep page numbers and section paths for citations.
- Chunk by structure (sections/headings) rather than fixed characters (see the chunk size post).
Evaluate on a sample
- Pick 30–50 documents across types.
- Parse with 2–3 candidate approaches.
- Check: missing text, broken tables, wrong reading order, lost headings.
- Run retrieval tests on questions that depend on tables and headings.
Cost control
- Route by type: OCR/layout only for scanned or table-heavy documents (see the ingestion cost post).
- Cache parsed output by content hash.
- Use vision LLMs only for pages where visuals carry the information.
Tip
Look at the parsed Markdown of your ten most important documents with your own eyes. Many "the model is wrong" complaints trace back to a table that was turned into a jumble of numbers during parsing.
Checklist
- Documents classified by type
- Parser chosen per type
- Structured output with page/section metadata
- Sample evaluated, including tables
- Expensive parsing only where needed
- Parsed output cached