RAG & Retrieval·Question 41 of 100Advanced

Your product has several distinct corpora - docs, tickets, code, CRM. How do you route queries?

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

Options in ascending sophistication, and the honest answer blends them:

Search everything, let ranking sort it out: query all corpora in parallel, fuse with RRF, rerank jointly. Simple, no routing errors possible - but scores across corpora are poorly comparable (a mediocre docs hit can outrank the perfect ticket), it wastes compute at scale, and some backends aren't vector search at all (CRM might need structured queries), so "search everything" isn't even always well-defined.

Full worked answer

Options in ascending sophistication, and the honest answer blends them:

Search everything, let ranking sort it out: query all corpora in parallel, fuse with RRF, rerank jointly. Simple, no routing errors possible - but scores across corpora are poorly comparable (a mediocre docs hit can outrank the perfect ticket), it wastes compute at scale, and some backends aren't vector search at all (CRM might need structured queries), so "search everything" isn't even always well-defined.

Classifier routing: a fast model (fine-tuned small classifier, or a cheap LLM call with corpus descriptions) picks target corpora per query, ideally multi-label with confidence. Add ~50-200ms and you cut cost and noise substantially. Failure mode: hard routing on an ambiguous query ("why did the customer's export fail?" - ticket? code? docs?) means a wrong guess kills the answer irrecoverably. Mitigations: route to top-2 when confidence is low; keep a "search all" fallback when the routed corpus returns weak scores (reranker scores are usable as this signal).

Agentic routing: expose each corpus as a named search tool with a good description (increasingly via MCP) and let the model decide - it can query docs, read results, then pivot to tickets. Most flexible, handles multi-corpus questions naturally, costs latency and predictability; right for complex assistants, wrong for the high-QPS search box.

Cross-cutting design points that score interview credit: per-corpus retrieval configs (code wants different chunking/embedders than prose - routing lets each corpus be tuned independently); ACLs differ per corpus and must be enforced per backend at retrieval time; the router needs its own eval (routing accuracy on a labelled query set) because router errors masquerade as retrieval failures in end-to-end metrics - triage must distinguish "routed wrong" from "retrieved wrong"; and log routing decisions for exactly that triage.

What a good answer covers

  • Search everything, let ranking sort it out: query all corpora in parallel, fuse with RRF, rerank jointly
  • Simple, no routing errors possible - but scores across corpora are poorly comparable (a mediocre docs…
  • Classifier routing: a fast model (fine-tuned small classifier, or a cheap LLM call with corpus…
  • Add ~50-200ms and you cut cost and noise substantially
  • Failure mode: hard routing on an ambiguous query ("why did the customer's export fail?" - ticket? code?…

Key terms: Classifier routing · Agentic routing

Interviewer follow-ups to expect

  1. How do you build the routing eval set and what accuracy is acceptable?

  2. A query needs docs and tickets joined - how does each architecture cope?

  3. How do you make relevance scores comparable when fusing across corpora?

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