This is an IntvML Pro interview question. Upgrade to Pro to unlock the full prompt, diagrams, and solution.
Tag: Ranking
MSD0116 Clinical Data Pipeline
This is an IntvML Pro interview question. Upgrade to Pro to unlock the full prompt, diagrams, and solution.
MSD0111 Review Authenticity Detection
This is an IntvML Pro interview question. Upgrade to Pro to unlock the full prompt, diagrams, and solution.
MSD0107 Event Recommendation Attendance
This is an IntvML Pro interview question. Upgrade to Pro to unlock the full prompt, diagrams, and solution.
MSD0106 Multi-Objective Shopping Ranking
This is an IntvML Pro interview question. Upgrade to Pro to unlock the full prompt, diagrams, and solution.
MSD0104 Comment Ranking System
This is an IntvML Pro interview question. Upgrade to Pro to unlock the full prompt, diagrams, and solution.
MSD0103 Gmail Email Retrieval Ranking
This is an IntvML Pro interview question. Upgrade to Pro to unlock the full prompt, diagrams, and solution.
MSD0102 Short-Video Feed Ranking
This is an IntvML Pro interview question. Upgrade to Pro to unlock the full prompt, diagrams, and solution.
MSD0088 Query Autocomplete Model
Design the model that powers query autocomplete for a search box serving 500,000 queries per second at p99 under 50 milliseconds. Given a typed prefix, the system must return the top-5 most useful completions, balancing the most-likely intent, personalization (a user who just searched flights gets travel completions), freshness (trending queries decay in hours), and spell tolerance for noisy prefixes.
The two main mechanism families pull in opposite directions: a compiled trie / finite-state machine is nearly free at runtime but has no learned generalization, while a neural sequence model generalizes but costs inference time you may not have.
How would you design this mechanism? Cover the candidate generation choice (weighted FST / trie vs a small generative model, and whether a hybrid earns its keep), the ranking signals (historical popularity, time-decayed trending, session personalization) fitted into the 50ms budget, personalization that does not destroy cacheability, noisy-prefix tolerance, and how the model learns from impression-to-completion logs that are position-biased.

The Problem: every keystroke is a request, 500,000 of them per second, and each must fill five slots in under 50 ms while weighing what most people mean, what this user was just doing, what is trending right now, and what the user meant to type.
Answer
The mechanism is a hybrid with a strict division of labor. A compiled weighted FST generates candidates in microseconds for every prefix the logs have seen, and a small mutable trend index injects queries that spiked in the last few hours. A small neural language model runs only as a fallback when the prefix is too rare to yield five candidates. A learned ranker then orders about 50 candidates using historical popularity, time-decayed trend counts, and session features, and it is applied after a cache keyed only by prefix and locale, so personalization never destroys cacheability. The ranker trains on impression logs with inverse-propensity weighting, using propensities measured by small randomized position swaps, so it learns relevance instead of slot order.
(1) Weighted FST / Trie: a minimal automaton compiled from historical queries in which every node stores its subtree’s best weight or a precomputed top-k list, so a prefix walk returns the top completions in time proportional to the prefix length.
(2) Small Generative LM: a character or subword decoder conditioned on the prefix (and optionally the session) that beam-searches completions, including strings never seen in the logs.
(3) Hybrid Retrieve-Then-Rank: the FST plus a fresh trend index produce candidates, a learned ranker reorders them with session features after a shared cache, and the generator is invoked only for long-tail prefixes.
Figure 1: The hybrid mechanism: a shared cache keyed by prefix and locale, a static FST plus a fresh trend index on cache misses, a neural fallback when fewer than 5 candidates exist, and a learned ranker that adds session features after the cache and retrains on IPS-weighted impression logs.
Clarify Before Designing:
(1) Latency Definition: is 50 ms a server-side p99 or client-perceived including the network, and does the client debounce keystrokes and cancel stale requests?
(2) Prefix Coverage: what share of keystroke prefixes appears in the last 90 days of logs? That number decides how often a generator is needed at all.
(3) Serving Hardware: is the fleet CPU-only, or are GPUs available in the serving region for a neural path?
(4) Personalization Scope: may we use logged-in search history, or only in-session signals under privacy limits?
(5) Freshness SLA: must a breaking query appear within minutes, or is next-day acceptable?
(6) Input Noise and Scripts: how noisy is mobile typing, and do we serve languages with input-method composition (CJK) or transliteration?Login to view more contentMSD0086 CPA Auto-Bidding Mechanism
This is an IntvML Pro interview question. Upgrade to Pro to unlock the full prompt, diagrams, and solution.

