How do you handle structured data (tables, PDFs with layouts) in RAG?
LLM & AILevel: IntermediateChunking & Indexing
How do you handle structured data (tables, PDFs with layouts) in RAG?
Hints
- Break the query into candidate retrieval, context selection and generation.
- How would you locate the stage that lost a fact without using only one end-to-end metric?
Answer
PDFs with tables, charts, and complex layouts are notoriously difficult:
- Table extraction: use specialized parsers (Camelot, pdfplumber, Unstructured) to extract tables as structured data, then serialize to markdown or CSV before embedding
- Multi-modal: use vision models (GPT-4V, LLaVA) to describe image/chart content; embed the descriptions
- Layout-aware chunking: Unstructured's
partition_pdf()preserves element types (title, table, narrative); chunk by element type, not just token count - Separate indexes: maintain separate vector indexes for tables vs. text; route queries to appropriate index based on query type classifier
Source and licence: JustInCache & contributors — Awesome AI Interviews · Apache-2.0