Walk me through every stage of a production RAG pipeline, from raw documents to a cited answer.
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
Two paths: an offline ingestion pipeline and an online query pipeline.
Full worked answer with diagram
Two paths: an offline ingestion pipeline and an online query pipeline.
Offline: ingest (connectors to sources - Drive, Confluence, S3 - with change detection), parse (PDF/HTML/DOCX to clean text preserving tables and structure; the highest-defect stage in practice), chunk (split into retrieval units, typically 256-1024 tokens, ideally structure-aware; optionally prepend LLM-generated context per chunk - contextual retrieval), embed (bi-encoder turns each chunk into a vector; batch, cache, version the model), index (vector index like HNSW plus a BM25/lexical index plus metadata: source, timestamp, ACLs, heading path).
Online: query understanding (rewrite conversational queries standalone, optionally expand into multiple queries or route between corpora), retrieve (hybrid: dense ANN search + BM25, both with ACL/metadata filters applied at query time), fuse and rerank (reciprocal rank fusion to merge lists, then a cross-encoder reranks top ~100 down to the 5-20 best), assemble (dedupe, order chunks, respect a token budget, attach source metadata and IDs for citation), generate (prompt instructs the model to answer only from context and cite chunk IDs), verify and respond (optionally check that citations exist and claims are grounded before returning).
Two points interviewers listen for: first, that errors compound - 90% parsing quality × 90% retrieval recall × 90% faithful generation ≈ 73% end-to-end, so you must instrument and evaluate each stage independently; second, that the boring offline stages (parsing, chunking) determine the ceiling, while the flashy online stages only determine how close you get to it.
Worth sketching. Drawing two chains, offline and online, keeps the interviewer with you and gives you somewhere to point when you talk about compounding error.
flowchart LR
S["Sources with<br/>change detection"] --> P["Parse"]
P --> C["Chunk"]
C --> E["Embed"]
E --> X["Vector index, BM25 index,<br/>metadata and ACLs"]
Q["Query"] --> U["Rewrite and route"]
U --> R["Hybrid retrieve,<br/>ACL filter applied here"]
X --> R
R --> RR["Fuse and rerank,<br/>100 down to 10"]
RR --> G["Assemble, generate,<br/>verify citations"]
What a good answer covers
- Two paths: an offline ingestion pipeline and an online query pipeline
- Offline: ingest (connectors to sources - Drive, Confluence, S3 - with change detection), parse…
- Online: query understanding (rewrite conversational queries standalone, optionally expand into multiple…
Key terms: offline ingestion pipeline · online query pipeline · ingest · parse · chunk · embed · index · query understanding · retrieve · fuse and rerank
In the glossary: Contextual retrieval · Bi-encoder · HNSW · BM25 · ANN · Cross-encoder
Interviewer follow-ups to expect
Which stage would you invest in first for a new system and why?
Where do you put ACL enforcement and why does it have to be there?
How do you version the pipeline so you can re-embed safely when you change the embedding model?
Offline: ingest (connectors to sources - Drive, Confluence, S3 - with change detection), parse (PDF/HTML/DOCX to clean text preserving tables and structure; the highest-defect stage in practice), chunk (split into retrieval units, typically 256-1024 tokens, ideally structure-aware; optionally prepend LLM-generated context per chunk - contextual retrieval), embed (bi-encoder turns each chunk into a vector; batch, cache, version the model), index (vector index like HNSW plus a BM25/lexical index plus metadata: source, timestamp, ACLs, heading path).
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