---
title: The corpus is scanned PDFs with tables, and users ask aggregate questions such as which suppliers had more than three…
url: https://gurkanozkan.ai/learn/questions/applied-llm-rag-11/
markdown: https://gurkanozkan.ai/learn/questions/applied-llm-rag-11.md
kind: question
role: Applied LLM
stage: Technical
difficulty: Hard
json: https://gurkanozkan.ai/api/learn/questions/applied-llm-rag-11.json
robots: noindex
---

# The corpus is scanned PDFs with tables, and users ask aggregate questions such as which suppliers had more than three incidents last year. What does plain chunk-and-embed get wrong, and what would you build instead?

Applied LLM · Technical · Hard

## Answer

*Model answer, written in a candidate's voice*

### In short

- Plain chunk-and-embed loses table structure and cannot enumerate or count across the corpus.
- Parse first: OCR/layout models, table extraction to rows, VLM parsing for messy tables, with parsing quality measured separately.
- Store extracted entities/fields in a database and answer aggregates with SQL or tool calls, not top-k passages.
- Use graph-based retrieval for multi-hop or corpus-level summaries, accepting LLM extraction cost and staleness.
- Route queries by type: lookup, aggregate, summary, and multi-hop, with provenance and freshness checks.

### In full

The core problem is that chunk-and-embed optimizes for similarity, not completeness: a table split into chunks can look relevant while still missing rows, and top-k retrieval cannot answer which suppliers had more than three incidents last year because that requires an exhaustive scan and a count. I would build an ingestion pipeline that runs OCR and layout analysis, extracts tables into structured rows with cell-level provenance, and uses VLM-based parsing for difficult or inconsistent tables, while measuring parsing quality separately from retrieval quality. The extracted entities and fields would land in a database or warehouse, so aggregate questions are answered with SQL or tool calls over the structured data rather than by asking a model to infer a count from a few retrieved chunks. For multi-hop or corpus-level summaries, I would add graph-based retrieval over entities and relationships, but I would treat LLM extraction as a costly, potentially stale layer and keep it refreshable and auditable. Finally, I would route queries by type: lookup questions to hybrid or vector retrieval, aggregates to structured queries, and summaries or multi-hop questions to graph or agentic retrieval, with citations and freshness checks so the system does not present a partial top-k result as a complete answer.

*Checked against sources by an independent AI reviewer.*

## What a strong answer covers

- Parsing: OCR/layout models, table extraction to structured rows, VLM-based parsing; parsing quality measured separately
- Top-k retrieval cannot count across a corpus → extract entities/fields into a database and answer with SQL or tool calls
- Graph-based retrieval for multi-hop or corpus-level summarisation, with the cost of LLM extraction and staleness
- Routes queries by type (lookup vs aggregate vs summary)

## Common mistakes

- Expecting top-k retrieval to answer corpus-wide aggregates
- skipping parse-quality checks

## Topic guides

- [Retrieval-augmented generation](https://gurkanozkan.ai/learn/topics/rag.md)
---

*Study material compiled with AI: drafted by a local model (Inkling 2 Mini) from public sources, then checked against those sources by independent AI reviewers (Claude) in November 2026. Not reviewed line by line by a person.*
