Applied AI / Forward Deployed Engineer · Retrieval-Augmented Generation · Lesson 4 of 4
Better retrieval: hybrid search, reranking, and RAG failure modes
Naive vector search is a baseline. Production RAG layers on precision techniques:
- Hybrid search: combine semantic (vector) with keyword/BM25 search. Vectors catch meaning; keywords catch exact terms, IDs, and rare jargon vectors miss.
- Reranking: retrieve a broad top-50, then a cross-encoder reranker scores each against the query and keeps the best 5. Big precision win for modest cost.
- Query rewriting / expansion: use an LLM to clarify or expand the query, or decompose multi-part questions before retrieval.
- Metadata filtering: restrict search by date, source, or user permissions (critical for access control).
The failure modes interviewers probe
- Retrieved but ignored: model has the context but answers from priors — instruct 'answer only from context; if absent, say you don't know.'
- Right chunk missing: fix chunking/hybrid/reranking.
- Stale index: source changed but you didn't re-index.
- Conflicting sources: retrieval returns contradictory chunks — need dedup/recency/authority handling.
- Injection via documents: a malicious doc contains 'ignore your instructions' — treat retrieved text as untrusted.
◆ Lock it in
- Layer hybrid search + reranking for precision; add query rewriting and metadata/permission filters.
- Instruct the model to answer only from context and admit ignorance.
- Know the failure modes: missing chunk, ignored context, stale index, conflicts, doc-borne injection.
Feynman drill — say it out loudA RAG system misses answers when users search by exact part numbers. What technique fixes this and why?
Step 1 rate your confidence · Step 2 pick your answer
Users search by exact SKU codes and semantic vector search keeps missing them. Best fix?
Step 1 — how sure are you?