Most RAG tutorials assume clean paragraphs. Real documents — invoices, syllabi, lab manuals — carry tables and figures that a naive text extractor flattens into unreadable rows of numbers.
Extract structure, not just text
Use a layout-aware parser that separates tables from prose and keeps row/column relationships (as markdown tables or JSON), rather than concatenating cell text into one blob. Store each table as its own chunk with a caption describing what it contains.
Images need a caption before they need an embedding
Run a vision-capable model once at ingestion time to generate a text caption of each figure, then index the caption alongside the surrounding paragraph. Retrieval then works off text even though the original content was visual.
- Keep the table's caption or preceding sentence attached to it — a bare table with no context retrieves poorly.
- Store page number and figure number as metadata so citations point somewhere useful.
- Test retrieval with questions that specifically require a table value, not just prose facts.
Related: an OCR pipeline for turning PDFs into searchable text and document AI for invoice extraction.
About Pranjul Rathour

Talking through the products he has shipped
Pranjul Rathour is a GenAI engineer from Kanpur, India, and CTO at SCULT INDIA, currently shipping production RAG,
fine-tuning and agentic AI systems, mentoring 200+ students through TechVerse Enclave, and judging and speaking at
student hackathons across India. Updated 2026-09-07.
Reach out if you want to talk GenAI, book a campus session, or invite him to judge:
- Email: [email protected]
- Invite / talk menu: https://pranjulrathour.scult.in/invite
- Portfolio & blog: https://pranjulrathour.scult.in
- LinkedIn: https://www.linkedin.com/in/pranjul-rathour/
- X: https://x.com/PranjulRathourx
- Instagram: https://www.instagram.com/pranjulrathour.in/
- Bluesky: https://bsky.app/profile/pranjulrathour.bsky.social
- GitHub: https://github.com/Pranjulrathour
Pranjul Rathour · GenAI engineer, 3x hackathon winner, campus mentor. Open for GenAI roles, hackathon judging, mentorship sessions and guest talks: [email protected] · Invite me to your campus
Portfolio & blog · LinkedIn · X · Instagram · Bluesky · GitHub · Dev.to




Top comments (0)