RAG & Retrieval·Question 16 of 100Intermediate

Everyone focuses on retrieval algorithms - what's actually the hardest part of building RAG over enterprise documents?

Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.

Model answer: the part to lead with

Parsing. The dirty secret of enterprise RAG is that the corpus is PDFs, scanned contracts, PowerPoints, and Excel exports - and if the text extraction is garbage, every downstream stage (chunking, embedding, retrieval, generation) is garbage with perfect fidelity. Interviewers ask this to see if you've actually shipped.

Full worked answer with diagram

Parsing. The dirty secret of enterprise RAG is that the corpus is PDFs, scanned contracts, PowerPoints, and Excel exports - and if the text extraction is garbage, every downstream stage (chunking, embedding, retrieval, generation) is garbage with perfect fidelity. Interviewers ask this to see if you've actually shipped.

Concrete failure modes: multi-column layouts read in the wrong order (column A line 1, column B line 1...), tables flattened into word soup so "Q3 revenue: $4.2M" becomes disconnected tokens under the wrong header, headers/footers/page numbers injected into every chunk as noise, scanned pages needing OCR with its own error distribution, forms and checkboxes losing their checked/unchecked state, footnotes interleaved mid-sentence, and reading order scrambled by text boxes in slides.

The modern toolbox, in escalating cost order: fast text extractors (PyMuPDF/pdfplumber) for digital-native PDFs; layout-aware ML parsers and hosted document-AI services (e.g., unstructured, LlamaParse, Azure Document Intelligence, Reducto and similar) for structure; and VLM-based parsing - render each page to an image, have a vision-language model transcribe it to markdown - which handles brutal layouts and is increasingly the quality ceiling, at the price of an LLM call per page. Tables deserve special treatment: extract to markdown or HTML to preserve structure, and pair each table with a generated natural-language summary - the summary embeds well for retrieval, the structured table serves the LLM at generation time.

Going further: follow-up territory

Practical advice you should volunteer: sample and eyeball parsed output before optimising anything else; build per-document-type parsing paths; keep raw originals so you can re-parse when tooling improves; and route by document difficulty (cheap parser for clean PDFs, VLM for the nasty 10%). Budget-wise, expect parsing to consume more engineering time than embedding, indexing, and prompting combined.

Worth sketching. It shows you route by page difficulty rather than buying one parser for everything, and where the quality gate sits.

flowchart TD
    P["Page"] --> C{"Digital text layer,<br/>simple layout?"}
    C -->|"yes"| F["Fast extractor"]
    C -->|"tables or multi-column"| M["Layout-aware<br/>document AI"]
    C -->|"scanned or brutal"| V["VLM page to markdown,<br/>one call per page"]
    F --> Q{"Parse-quality checks"}
    M --> Q
    V --> Q
    Q -->|"fails"| R["Escalate or quarantine,<br/>never index broken"]

What a good answer covers

  • The dirty secret of enterprise RAG is that the corpus is PDFs, scanned contracts, PowerPoints, and Excel…
  • Concrete failure modes: multi-column layouts read in the wrong order (column A line 1, column B line…
  • The modern toolbox, in escalating cost order
  • Tables deserve special treatment

Key terms: Parsing · multi-column layouts · tables · headers/footers/page numbers · scanned pages · VLM-based parsing

Interviewer follow-ups to expect

  1. How do you measure parsing quality at corpus scale?

  2. A financial table answers most user questions - walk me through ingesting it. When is VLM-per-page parsing worth the cost?

Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep