System Design: End-to-End Query Generation to Maximize CTR
Context
You are designing the query-generation layer for a consumer search/recommendation product with a search box and a highly dynamic content feed. The system should:
-
Generate user-facing query suggestions (e.g., autocomplete, related queries) that users can click.
-
Optionally rewrite/expand the user’s typed query into internal retrieval queries to fetch better candidates.
Assume scale is very large, traffic is global and mobile-first, and content is short-form, fast-evolving, and safety-sensitive.
Task
Design an end-to-end system that maximizes click-through rate (CTR) for query suggestions while protecting user experience and safety. Address:
-
Goals, constraints, and metrics
-
Data sources and feature engineering
-
Candidate generation and ranking models
-
Exploration–exploitation (e.g., bandits), feedback loops, and debiasing
-
Offline evaluation (splits, counterfactual evaluation) and online A/B testing
-
Real-time inference architecture, latency/throughput/SLA, and scalability
-
Personalization, cold start, and diversity controls
-
Safety/abuse and privacy compliance
-
Diagrams or pseudocode for critical components
-
How you would iterate after launch