Technical Interview Questions

Ad Serving and Real-Time Bidding System

"Design a real-time ad serving system for TikTok that selects the optimal ad within 100ms while maximizing revenue and user experience."

Why Interviewers Ask This

Advertising accounts for the majority of ByteDance's revenue. The ad serving system must balance revenue maximization with user experience at extreme throughput — billions of ad requests daily. This question tests your ability to design latency-critical systems with ML integration, a combination central to ByteDance's business.

How to Answer

  1. 1

    Outline the ad serving pipeline: request enrichment → candidate retrieval → ranking → auction → creative selection → delivery.

  2. 2

    Explain the two-phase ranking: a lightweight model filters thousands of candidates to hundreds, then a deep model with user features does fine-grained ranking.

  3. 3

    Describe the auction mechanism — typically a generalized second-price (GSP) or VCG auction — and how it incentivizes truthful bidding.

  4. 4

    Discuss latency optimization: pre-computed user embeddings, feature caching, model distillation, and speculative execution of pipeline stages.

Sample Answer

The system handles an ad request in four stages within 100ms. First, request enrichment (5ms): user features are fetched from a pre-computed embedding store, and context signals (time, location, content type) are attached. Second, candidate retrieval (15ms): an inverted index narrows millions of eligible ads to ~5,000 candidates based on targeting criteria (demographics, interests, budget constraints). Third, ranking (50ms): a two-tower retrieval model scores all 5,000 candidates, selecting the top 200, which are then ranked by a deep CTR prediction model using cross-features between user and ad. The final score is eCPM = predicted CTR × bid price. Fourth, auction and delivery (30ms): top candidates enter a GSP auction with a quality-adjusted reserve price, the winner's creative is selected based on A/B test assignments, and the response is returned. To meet latency requirements, user embeddings are refreshed offline every hour, the retrieval model runs on GPU with batched inference, and we use feature caching with 5-minute TTL for slowly-changing signals.

Pro Tips

  • Know the eCPM formula (CTR × bid) and explain why it balances advertiser value with user relevance.

  • Mention pacing — spreading budget evenly over the campaign period rather than burning it early.

  • Discuss the cold-start problem for new ads with no CTR history and how exploration strategies address it.

Frequently Asked Questions

Why use a two-phase ranking approach instead of running the deep model on all candidates?

The deep CTR model is too computationally expensive to score millions of candidates within the latency budget. A lightweight first-pass model quickly narrows the field, allowing the deep model to focus on the most promising candidates.

How do you prevent ad fatigue on TikTok?

Frequency capping limits how many times a user sees the same ad within a time window. Additionally, diversity constraints in the auction ensure users see ads from different advertisers, and negative feedback signals (skips, hides) down-rank repetitive creatives.

Worried About Going Blank in Your Interview?

HireMe AI listens to your interview in real-time, detects questions, and generates instant answer suggestions — so you never freeze up again.

Try HireMe AI Free