Preserve document structure during ingestion
The first objective is not chunking. It is producing a reliable document model. For every extracted element, preserve:- document, page, and section identity;
- element type, such as paragraph, title, image, caption, or table;
- bounding box and reading order when available;
- relationships between figures, captions, and surrounding text;
- table structure, including headers and merged cells;
- source version and ingestion timestamp;
- access-control metadata.
Create representations for each evidence type
One representation rarely serves every query. I use element-specific views:- clean text for semantic retrieval;
- structured Markdown or JSON for tables;
- captions or generated descriptions for images and diagrams;
- optional visual embeddings for queries that depend on appearance;
- compact parent summaries to recover surrounding context.
Retrieve candidates in stages
Multimodal retrieval benefits from a staged pipeline:- classify the query's likely evidence needs;
- apply tenant, document, date, and permission filters;
- retrieve candidates from the relevant text, table, and image indexes;
- merge and deduplicate results;
- rerank across modalities with a shared relevance policy;
- expand selected elements with their parent section or neighboring context.
Generate answers with precise citations
The generation layer should receive a compact evidence package rather than a dump of every candidate. Each element needs a stable citation identifier and enough metadata to render a useful source reference. The answer policy should require the model to:- distinguish text evidence from inferred interpretation;
- cite the page and element supporting each important claim;
- preserve units, time periods, and table headers;
- state when a visual is unreadable or ambiguous;
- avoid answering when the evidence package is insufficient.
Evaluate by modality and failure layer
A single answer-quality score is not enough. Build test cases for:- native and scanned documents;
- multi-column pages and footnotes;
- charts with legends and units;
- tables with merged headers or missing cells;
- questions requiring text plus a visual;
- conflicting evidence across pages;
- documents with extraction or OCR errors.