PracHub
QuestionsCoachesLearningGuidesInterview Prep
|Home/ML System Design/TikTok

Design query generation to maximize CTR

Last updated: Jun 15, 2026

Quick Overview

Design query generation to maximize CTR evaluates ML product requirements, data/labeling, modeling, serving architecture, evaluation, monitoring, and trade-offs in a realistic interview setting. A strong answer states assumptions, handles edge cases, explains trade-offs, and shows how to validate the result clearly.

  • hard
  • TikTok
  • ML System Design
  • Machine Learning Engineer

Design query generation to maximize CTR

Company: TikTok

Role: Machine Learning Engineer

Category: ML System Design

Difficulty: hard

Interview Round: Technical Screen

##### Question Design an end-to-end query-generation system that maximizes click-through rate (CTR) for a large-scale search/recommendation product. Walk through your design and address the following: 1. **Goals, constraints, and metrics.** Define the objective (and how you measure CTR), latency/throughput SLAs, availability, multilingual/multi-locale scope, and guardrail metrics (search success, abandonment, safety, privacy). 2. **Overall architecture.** Sketch the request path and the offline/streaming data platform end to end (diagrams or pseudocode for the critical components are welcome). 3. **Data ingestion and labeling.** Event schema for impressions/clicks, attribution windows, positive/negative labeling, position-bias and propensity logging, and data-quality/ETL handling. 4. **Feature engineering.** Text, embedding, popularity/recency, personalization, context, and presentation features, with online/offline feature parity. 5. **Candidate generation (recall).** Multiple complementary sources (lexical/prefix, popular/trending, embedding/ANN, co-click graph, generative). 6. **Ranking models.** Multi-stage ranking, loss/objective choices (pointwise/pairwise/listwise), calibration, and re-ranking with diversity/safety constraints. 7. **Model training and serving.** Training pipeline, retraining cadence, and the real-time serving stack (feature store, encoders, ANN, ranker, orchestrator) under the latency budget. 8. **Exploration–exploitation, feedback loops, and debiasing.** Bandit strategy (e.g., Thompson Sampling / LinUCB), propensity logging, and correction for position/selection/popularity bias. 9. **Evaluation.** Offline metrics and counterfactual evaluation (IPS/SNIPS/DR) plus online A/B testing methodology (splits, power, guardrails, ramp). 10. **Personalization, cold start, and diversity.** Personalization signals, new-user/new-query/new-market cold start, and diversity/coverage controls. 11. **Safety/abuse and privacy compliance.** Blocklists, classifiers, PII handling, jurisdictional policy, and privacy/compliance. 12. **Scalability, reliability, and post-launch iteration.** How you shard and degrade gracefully, and how you would iterate after launch.

Quick Answer: Design query generation to maximize CTR evaluates ML product requirements, data/labeling, modeling, serving architecture, evaluation, monitoring, and trade-offs in a realistic interview setting. A strong answer states assumptions, handles edge cases, explains trade-offs, and shows how to validate the result clearly.

Related Interview Questions

  • Design video captioning under compute limits - TikTok (medium)
  • Design a model to choose dynamic K - TikTok (medium)
  • Design training for multimodal embedding model - TikTok (medium)
  • What skills are needed for AI infra roles? - TikTok (hard)
  • Design system to detect privacy-leak records - TikTok (medium)
|Home/ML System Design/TikTok

Design query generation to maximize CTR

TikTok logo
TikTok
Jul 31, 2025, 12:00 AM
hardMachine Learning EngineerTechnical ScreenML System Design
3
0

Design query generation to maximize CTR

Design an end-to-end query-generation system that maximizes click-through rate (CTR) for a large-scale search/recommendation product. Walk through your design and address the following:

  1. Goals, constraints, and metrics. Define the objective (and how you measure CTR), latency/throughput SLAs, availability, multilingual/multi-locale scope, and guardrail metrics (search success, abandonment, safety, privacy).
  2. Overall architecture. Sketch the request path and the offline/streaming data platform end to end (diagrams or pseudocode for the critical components are welcome).
  3. Data ingestion and labeling. Event schema for impressions/clicks, attribution windows, positive/negative labeling, position-bias and propensity logging, and data-quality/ETL handling.
  4. Feature engineering. Text, embedding, popularity/recency, personalization, context, and presentation features, with online/offline feature parity.
  5. Candidate generation (recall). Multiple complementary sources (lexical/prefix, popular/trending, embedding/ANN, co-click graph, generative).
  6. Ranking models. Multi-stage ranking, loss/objective choices (pointwise/pairwise/listwise), calibration, and re-ranking with diversity/safety constraints.
  7. Model training and serving. Training pipeline, retraining cadence, and the real-time serving stack (feature store, encoders, ANN, ranker, orchestrator) under the latency budget.
  8. Exploration–exploitation, feedback loops, and debiasing. Bandit strategy (e.g., Thompson Sampling / LinUCB), propensity logging, and correction for position/selection/popularity bias.
  9. Evaluation. Offline metrics and counterfactual evaluation (IPS/SNIPS/DR) plus online A/B testing methodology (splits, power, guardrails, ramp).
  10. Personalization, cold start, and diversity. Personalization signals, new-user/new-query/new-market cold start, and diversity/coverage controls.
  11. Safety/abuse and privacy compliance. Blocklists, classifiers, PII handling, jurisdictional policy, and privacy/compliance.
  12. Scalability, reliability, and post-launch iteration. How you shard and degrade gracefully, and how you would iterate after launch.

Constraints & Assumptions

  • Preserve the scope, facts, inputs, and requested outputs from the prompt above.
  • If the prompt leaves a detail unspecified, state a reasonable assumption before relying on it.
  • Keep the answer interview-ready: concise enough to present, but concrete enough to implement or evaluate.

Clarifying Questions to Ask

  • Clarify users, core use cases, read/write patterns, scale, latency, availability, and data retention.
  • State explicit assumptions before making sizing or architecture decisions.
  • Prioritize the functional path first, then address reliability, security, observability, and rollout.

What a Strong Answer Covers

  • A scoped requirements summary with concrete non-goals and success metrics.
  • ML-specific data, model, evaluation, serving, and monitoring choices.
  • Reasoned trade-offs among simple and scalable designs, including bottlenecks and failure modes.
  • A validation, monitoring, migration, and launch plan appropriate for the risk level.

Follow-up Questions

  • What breaks first at 10x traffic or data volume?
  • How would you degrade gracefully during dependency failures?
  • What metrics and alerts would prove the design is healthy after launch?

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More ML System Design•More TikTok•More Machine Learning Engineer•TikTok Machine Learning Engineer•TikTok ML System Design•Machine Learning Engineer ML System Design

Your design canvas — auto-saved

PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • AI Coding Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.