The interview problem
Design a search router across product documentation, support tickets and incident reports. Queries such as “Mercury timeout” can refer to several collections. At 5,000 queries/second, keep search within a 200 ms server deadline without querying every index every time. Explain when to choose one index, search two, ask a clarifying question or decline an unsupported request.
Original ML-design practice, not a reported company interview. Numerical examples are hypothetical. Primary research retrieved September 27, 2026; interview date not applicable.
1. Route to useful evidence, not just a label
The router predicts which permitted collections can provide useful evidence. It does not choose an LLM provider or execute a business action. More than one route can be correct. “Mercury outage workaround” may need incident status and a documentation procedure; a single exclusive intent label would lose part of the answer.
Define outcomes: useful evidence retrieved by the deadline, downstream task success, clarification burden and backend work. Keep unsupported intent distinct from ambiguity between supported routes. A fluent query is not necessarily in scope. Larson and colleagues' intent benchmark explicitly includes out-of-scope queries, motivating separate evaluation of this failure mode rather than assuming every input belongs to a known class.
Apply tenant and user authorization before selecting searchable collections and again when retrieving records. Router confidence cannot grant access. A user who cannot read incident reports must not learn their titles or existence through the clarification choices.
2. Separate policy, retrieval and fusion
query + authorized context → scope/route scores
↓
budgeted route policy or clarification
↓
permitted indexes searched in parallel
↓
normalize/fuse → rerank → authorized results
↓
route decisions + candidate and outcome telemetryBegin with explicit collection selection, identifier rules and a lightweight text classifier. Add embeddings or a richer model only when they improve held-out routing quality enough to justify latency. Use trusted page context as a feature; do not let text inside the query override access policy or the route budget.
Separate scoring from action policy. Inputs to the latter include ambiguity, out-of-scope evidence, collection health, expected retrieval usefulness and remaining time. A predicted route probability is not automatically the probability of finding a relevant document: the index can be stale or incomplete.
Version route taxonomy, label policy, classifier and thresholds together. Each result records its source collection and retrieval version. Deduplicate documents that appear in multiple indexes. Raw scores from different retrieval engines are not necessarily comparable; use an evaluated fusion method followed by a common reranker where appropriate.
3. Work through hard routing versus selective fan-out
Consider 1,000 supported queries with a judged relevant collection. A hard router chooses a useful collection for 850 queries. Suppose retrieval finds relevant evidence for 80% of correctly routed queries and never recovers a routing mistake. End-to-end evidence success is 850×0.8=680 queries, or 68%. The multiplication uses conditional retrieval success, not an assumption of independence.
A second policy adds another route for 200 ambiguous queries. Suppose this recovers a useful collection for seventy previously misrouted queries, with no change to the other outcomes or retrieval success rate. Success becomes (850+70)×0.8=736, or 73.6%. Backend calls rise from 1,000 to 1,200: 20% more work for 5.6 percentage points of evidence success in this hypothetical dataset.
At 5,000 queries/second, mean fan-out 1.2 produces 6,000 index calls/second before retries. This aggregate does not prove each index has capacity: traffic may concentrate in the ticket index. Track per-route load and use admission controls. Real fan-out may also reduce success if extra candidates crowd out useful evidence during fusion; measure the entire pipeline.
For a query needing both an incident and a procedure, “at least one useful collection” is too weak. Also measure coverage of all required evidence types, and whether the final answer actually supports each requested part.
4. Make clarification a deliberate action
If two allowed collections have plausible evidence and spare retrieval budget exists, search both. If the ambiguity changes the meaning of the user's task and results alone cannot resolve it, ask a short question using permitted categories, such as whether they want product setup guidance or help with an existing support case.
Clarification is not free: some users abandon. In a separate toy decision, suppose searching two routes yields expected utility 0.78 after its latency/work penalty. On the same utility scale, and with clarification costs already included in the outcome values, clarifying yields utility 0.95 if the user responds, with response probability 0.7 and zero utility otherwise: expected utility is 0.665. Under those assumptions fan-out wins. If response probability is 0.9, clarification yields 0.855 and wins. These utilities must be defined and estimated for the product; they are not interchangeable with raw classifier confidence.
For unsupported queries, provide an honest scope response or an approved general-search fallback if that exists. A low maximum softmax score can be a signal, but confident predictions on novel inputs remain possible. Evaluate near-scope negatives, unfamiliar entities, languages and adversarially misleading phrasing separately.
5. Label routes with independent evidence
Create labels identifying all useful collections, whether multiple are required, and whether clarification is necessary. Have assessors inspect evidence under the intended permissions. Include supported, ambiguous and out-of-scope queries. Resolve disagreement rather than forcing every example into an exclusive class.
Clicks from the existing router are incomplete labels: users cannot click evidence the router never searched. Build a bounded offline evaluation pool using broader authorized retrieval and human judgments. Keep this evaluation work separate from live access grants. Record annotation coverage so an unjudged collection is not automatically treated as irrelevant.
Split by time and group paraphrases, repeated ticket templates and related incidents to reduce leakage. Keep taxonomy changes visible in the evaluation manifest. Tune thresholds on validation data and freeze them before the final comparison. Evaluate new collections explicitly instead of assuming their scores share the calibration of old ones.
6. Enforce a real deadline
Allocate 15 ms to routing, 120 ms to parallel retrieval, 40 ms to fusion/reranking and 25 ms to overhead within 200 ms. These are stage budgets, not a sum of independently measured percentile latencies. Parallel retrieval waits for the slowest required response only until its deadline; cancel remaining optional work and label the result partial when appropriate.
If one route returns no hits, distinguish a healthy empty result from a timeout, authorization rejection or stale-index failure. A timeout is not evidence that the query belongs elsewhere. Bounded fallback may use remaining time and capacity, but unrestricted retries can double load during an outage.
A learned router failure can fall back to explicit rules and a small set of permitted healthy routes. It must not silently search all tenant data. Cache decisions only with the relevant query normalization, authorized collection set, context and model version; do not share a cached privileged route across users with different access. Recompute current permissions before using a cached decision, and enforce document authorization on the result path. A cache hit is not permission to reuse previously authorized results after revocation.
7. Diagnose failures at the correct stage
Report useful-route coverage, all-required-route coverage, out-of-scope false acceptance, unnecessary rejection, evidence success, answer quality, clarification abandonment, fan-out and deadline misses. Slice by tenant, collection, query length, language and newly introduced terms. Router accuracy alone can hide a strong classifier feeding a weak index.
Investigate wrong route, missing document, retrieval miss, fusion truncation and answer-generation error separately. Evaluate matched queries under the old and new policy before a bounded launch. Online tests must preserve authorization and avoid treating repeated queries as independent evidence. Monitor new taxonomy gaps and stale labels after product changes.
Follow-ups: Why not always search everything? Backend cost, tail latency and noisy fusion. Why not always use the highest score? Ambiguity and unsupported inputs. Can a second route improve route coverage but hurt answers? Yes, through crowding or misleading evidence. Does a router replace access control? No.
Score 0–2 each for multi-route semantics, out-of-scope handling, conditional arithmetic, deadline/capacity policy and unbiased evaluation labels.
Sources and next steps
- Larson et al.: An Evaluation Dataset for Intent Classification and Out-of-Scope Prediction — submitted September 4, 2019.
Architecture and worked policies are original. See retrieval score fusion for combining results after routes are selected.
Continue your preparation
Choose a connected learning path or browse more ML system design questions. Read our editorial method and attribution policy.