← All questions
RAGMedium· RAG & Retrieval

How do you handle a document corpus where half the valu...

This is an underrated problem, especially in regulated industries where the answer is often sitting in a rate table or a term sheet rather than in prose. Naive text extraction destroys table structure and produces chunks that read as word salad — rows and columns flattened into a sequence of numbers with no relationship between them.

The fix is layout-aware parsing that preserves table structure, then chunking the table as a single unit with its caption and headers attached, rather than letting rows get split across chunk boundaries.

For genuinely numeric questions — totals, comparisons, lookups — I go further: extract the tables into a structured store (even just typed rows in a database) and query them directly rather than through similarity search. Retrieval is the wrong tool for arithmetic; it’s built to find relevant text, not to compute.

Code playground (Python)