Pattern · Retrieval and RAG
RAG pipeline
Answer from your own documents: retrieve the right passages at question time and make the model answer only from them, with citations.
Say it in the interview
I would use a RAG pipeline: index the documents in structure-aware chunks, retrieve with hybrid search and a reranker, and make the model answer only from numbered passages with citations. I would measure retrieval recall separately from answer faithfulness, so I know which half broke.
When to use it
- The answer lives in documents that change (policies, manuals, tickets)
- You need citations a person can check
- The data is too big or too private to fine-tune on
How it works
- Documents → Parse and chunk
- Parse and chunk → Embed
- Embed → Vector index
- Question → Retrieve top k
- Retrieve top k → Vector index
- Retrieve top k → Rerank
- Rerank → Prompt with numbered passages
- Prompt with numbered passages → Answer with citations
Trade-offs
- Cheap to update: re-index instead of retraining
- Every answer can be traced to a source
- Quality is capped by retrieval: if the passage is not found, the model cannot use it
- Adds latency and a store to run
Pitfalls interviewers probe
- Skipping evaluation of retrieval itself
- Chunks that cut tables and topics in half
- Letting the model answer when nothing relevant was found