← Twitch Interview Insights

Twitch·Data Scientist·Onsite - System Design / Architecture·Senior

Senior
Jul 2026

Summary

Twitch data scientist system design round, focused entirely on building a real-time recommendation system for live streams. It was a deep, multi-part question and I felt like I was sprinting the whole time.

Questions Asked (6)

Q1

How would you define the objective and construct training labels for a real-time live stream recommendation system, including handling delayed outcomes and streams that end mid-session?

System DesignProduct Analytics & MetricsTechnical Trade-offs
Author's notes

This is where I fumbled a bit at the start.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the product objective (e.g., maximize long-term user engagement or watch time) and how it translates to a label definition. Then discuss the trade-offs between using immediate vs. delayed signals, and propose a labeling scheme that handles censored sessions (e.g., survival analysis or multi-task learning).

Pro tip: Frame the problem as a balance between label freshness and accuracy: use short-term proxies for real-time serving but periodically retrain with delayed labels to correct bias. Mention that Twitch's live nature means you must handle both positive (engagement) and negative (churn) outcomes that may not be observed immediately.

1. Define the product objective

Clarify what the recommendation system is optimizing for (e.g., user watch time, session length, or retention) and how that aligns with business goals. This objective will guide label construction.

2. Choose label type and horizon

Decide between binary (click/watch) vs. continuous (watch duration) labels, and select a time horizon (e.g., next 5 minutes) that balances immediacy with meaningful signal. Consider delayed outcomes like follows or subscriptions.

3. Handle delayed and censored outcomes

For delayed outcomes, use techniques like survival analysis, multi-task learning with auxiliary labels, or time-decayed labels. For streams ending mid-session, treat as censored data or use negative sampling with caution.

4. Address real-time constraints

Design a labeling pipeline that can produce labels with low latency for online learning, while incorporating delayed labels via offline retraining or delayed feedback loops.

5. Evaluate and iterate

Set up offline evaluation metrics (e.g., AUC, calibration) and online A/B tests to validate label choices. Monitor for bias introduced by delayed feedback and adjust as needed.

Key Points to Mention

  • Objective alignment: recommendation goal (e.g., watch time) vs. business metric (e.g., retention).
  • Label definition: binary engagement (click/watch > threshold) vs. continuous watch time; time window selection.
  • Delayed outcomes: use of survival analysis, multi-task learning, or time-decayed labels to incorporate future signals.
  • Censored sessions: streams ending mid-session as censored data; avoid treating as negative without adjustment.
  • Real-time vs. batch: trade-off between immediate proxy labels and delayed accurate labels; online learning with delayed feedback.
  • Evaluation: offline metrics (AUC, calibration) and online A/B testing; monitoring for feedback loops and bias.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

What features would you use across user, creator, stream, and context dimensions, and how do you handle cold-start for brand new creators or users?

System DesignTechnical Trade-offsProduct Sense & Ideation
Author's notes

Cold-start is always a gotcha and I knew it was coming, so I felt decent here.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by framing the problem around Twitch's core recommendation goals: engagement, retention, and discovery. Then walk through feature categories (user, creator, stream, context) with concrete examples and explain how they feed into models. Finally, address cold-start by describing a multi-stage strategy that leverages content-based features, contextual signals, and exploration, while emphasizing evaluation and iteration.

Pro tip: Emphasize that cold-start is not just a modeling problem but a product and data problem—suggest logging rich metadata at creation time and using bandits for exploration to gather feedback quickly. Also, mention that you'd validate offline with time-based splits and online with A/B tests, focusing on long-term retention over short-term clicks.

1. Clarify objectives and constraints

Ask clarifying questions about the goal (e.g., recommendations for viewers, creator discovery, or both) and constraints (latency, scale, privacy). This shows you think before diving into features.

2. Enumerate features across dimensions

List features for each dimension: user (watch history, follows, demographics), creator (content category, past performance, social graph), stream (title, tags, game, visual/audio embeddings), and context (time of day, device, referral source).

3. Explain how features are used

Describe how these features feed into models (e.g., two-tower retrieval, ranking models) and the trade-offs between using real-time vs. batch features. Mention feature stores and online/offline consistency.

4. Address cold-start for new users and creators

For new users: use contextual and demographic features, onboarding preferences, and popularity-based fallbacks. For new creators: use content-based features (stream title, game, tags), creator-provided metadata, and exploration via multi-armed bandits to gather initial feedback.

5. Discuss evaluation and iteration

Outline offline metrics (AUC, NDCG) and online metrics (CTR, watch time, retention). Emphasize A/B testing, bandit algorithms, and the importance of measuring long-term satisfaction to avoid feedback loops.

Key Points to Mention

  • User features: watch history, follows, subscriptions, chat activity, demographics, and device type.
  • Creator features: content category, average concurrent viewers, stream frequency, social media presence, and past stream performance.
  • Stream features: title, tags, game/category, thumbnail, audio/visual embeddings, and real-time viewer count.
  • Context features: time of day, day of week, device, location, referral source, and current events.
  • Cold-start strategies: content-based filtering, popularity priors, onboarding surveys, and exploration-exploitation via bandits.
  • Evaluation: offline metrics with time-based splits, online A/B tests, and guardrail metrics to monitor long-term health.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q3

Walk through your model architecture choice, loss function, negative sampling strategy, and how you'd deal with severe class imbalance in this setting.

System DesignTechnical Trade-offsAlgorithms & Data Structures
Author's notes

Two-tower retrieval into a re-ranker felt like the obvious answer and I went with it.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the problem context (e.g., recommendation, fraud detection) and then systematically walk through each component: model architecture, loss function, negative sampling, and class imbalance handling. Emphasize trade-offs and justify your choices based on the data characteristics and business goals.

Pro tip: Tie your choices to Twitch's specific use case (e.g., recommending streams to viewers) and mention how you'd evaluate the impact on key metrics like click-through rate or watch time. Show awareness of production constraints like latency and scalability.

1. Clarify the problem and data

Ask questions to understand the task (e.g., binary classification, ranking), data size, features, and class distribution. This ensures your answer is tailored to the scenario.

2. Choose model architecture

Propose a model suitable for the data (e.g., two-tower neural network for recommendations, gradient boosted trees for tabular data) and explain why it fits the constraints.

3. Select loss function

Pick a loss aligned with the objective (e.g., binary cross-entropy for classification, pairwise or listwise loss for ranking) and discuss how it handles imbalance.

4. Design negative sampling strategy

Describe how to generate negatives (e.g., random, hard negatives, in-batch) and the trade-offs between efficiency and model quality.

5. Address class imbalance

Outline techniques like resampling, class weighting, or algorithmic adjustments, and explain how they integrate with the chosen loss and sampling.

Key Points to Mention

  • Two-tower neural networks for large-scale recommendation systems
  • Binary cross-entropy vs. sampled softmax for handling large output spaces
  • In-batch negative sampling and its efficiency benefits
  • Hard negative mining to improve model discrimination
  • Focal loss or class weighting to mitigate severe imbalance
  • Evaluation metrics like AUC, precision@k, and online A/B testing

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q4

How would you detect and mitigate position bias and popularity bias in your training data, and what exploration policy would you use?

A/B Testing & ExperimentationTechnical Trade-offsProduct Analytics & Metrics
Author's notes

I blanked for a second on the counterfactual estimation piece.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining position bias and popularity bias in the context of Twitch's recommendation systems, then outline methods to detect them using data analysis and experimentation. Describe mitigation strategies such as reweighting, regularization, or counterfactual techniques, and finally propose an exploration policy like epsilon-greedy or Thompson sampling to balance exploration and exploitation.

Pro tip: Emphasize the importance of measuring the long-term impact of exploration on user engagement and content diversity, and suggest running A/B tests to validate the effectiveness of bias mitigation strategies.

1. Define and Detect Biases

Clearly define position bias (users prefer items at certain positions) and popularity bias (popular items get more exposure). Detect them by analyzing click-through rates by position, comparing exposure of popular vs. niche content, and using techniques like propensity scoring or counterfactual logging.

2. Mitigation Strategies

Apply methods such as inverse propensity scoring (IPS) to reweight samples, add regularization to penalize overfitting to popular items, or use unbiased learning frameworks like PAL (Position-Aware Learning). For popularity bias, consider diversity constraints or fairness-aware ranking.

3. Exploration Policy Design

Choose an exploration policy that balances exploration and exploitation, such as epsilon-greedy, Thompson sampling, or upper confidence bounds (UCB). Tailor it to Twitch's context: e.g., epsilon-greedy with a small epsilon to occasionally show less popular streams, or Thompson sampling to dynamically adjust based on feedback.

4. Evaluation and Iteration

Evaluate the impact of mitigation and exploration using offline metrics (e.g., diversity, coverage) and online A/B tests measuring user engagement, retention, and satisfaction. Iterate based on results to refine the approach.

Key Points to Mention

  • Position bias: users tend to click on top-ranked items regardless of relevance; detect via position-based CTR analysis and mitigate with IPS or position-aware models.
  • Popularity bias: popular items get more exposure, creating feedback loops; mitigate with diversity constraints, fairness-aware ranking, or debiasing techniques.
  • Exploration policies: epsilon-greedy, Thompson sampling, UCB; discuss trade-offs between exploration and exploitation in a live streaming platform.
  • Counterfactual evaluation: use logged data to estimate performance of new policies without deploying them.
  • A/B testing: design experiments to measure the effect of debiasing and exploration on key metrics like watch time, diversity, and user retention.
  • Long-term effects: consider how exploration impacts content creators and user satisfaction over time, not just short-term clicks.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q5

What offline and online metrics would you track, and how would you validate that offline metric improvements actually translate to online gains?

A/B Testing & ExperimentationProduct Analytics & MetricsTechnical Trade-offs
Author's notes

PR-AUC over AUC for imbalanced data, calibration because you're using probabilities downstream, NDCG for ranking quality.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining offline metrics (e.g., model precision, recall, latency) and online metrics (e.g., CTR, watch time, retention) relevant to Twitch's streaming platform. Then explain how you would validate translation using A/B tests, causal inference, and guardrail metrics to ensure offline improvements yield online gains.

Pro tip: Emphasize the importance of aligning offline metrics with business KPIs and using online experiments as the ultimate validation, while being mindful of potential discrepancies like Simpson's paradox or novelty effects.

1. Identify Offline and Online Metrics

List key offline metrics (e.g., model accuracy, AUC, latency) and online metrics (e.g., engagement, retention, revenue) that align with Twitch's goals. Ensure they are measurable and actionable.

2. Establish Validation Strategy

Design A/B tests or switchback experiments to compare offline improvements against online outcomes. Use holdout groups and control for confounders.

3. Analyze Translation and Causality

Apply statistical methods (e.g., hypothesis testing, causal inference) to determine if offline gains cause online improvements. Check for correlation and effect size.

4. Monitor Guardrail Metrics

Track guardrail metrics (e.g., system latency, user complaints) to ensure offline changes don't harm user experience or other business aspects.

5. Iterate and Refine

Use results to refine models and metrics, creating a feedback loop between offline and online evaluations for continuous improvement.

Key Points to Mention

  • Offline metrics: precision, recall, F1, AUC, latency, throughput
  • Online metrics: click-through rate, watch time, session length, retention, churn, revenue
  • A/B testing and experimentation frameworks (e.g., randomized controlled trials)
  • Causal inference methods (e.g., difference-in-differences, propensity score matching)
  • Guardrail metrics to monitor unintended consequences
  • Alignment with business objectives and Twitch-specific KPIs (e.g., streamer growth, viewer engagement)

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q6

Describe the end-to-end serving architecture for this system with a sub-100ms p95 latency budget, including how you'd keep embeddings and stream availability signals fresh in near-real time.

System DesignTechnical Trade-offsAPI & Integrations
Author's notes

The latency budget question forced me to actually think in milliseconds, which I don't always do explicitly.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the system's scope and the latency budget, then walk through the serving path from client to model inference, highlighting where caching and precomputation can meet the p95 target. Finally, explain the data pipelines that keep embeddings and availability signals fresh, emphasizing trade-offs between freshness and latency.

Pro tip: Quantify the latency budget: allocate ~20ms for network, ~30ms for retrieval/feature fetch, and ~50ms for model inference, leaving buffer for p95. This shows you understand real-world constraints and can design within them.

1. Clarify requirements and constraints

Ask about scale (QPS, number of users/items), definition of p95, and what 'near-real-time' means for freshness. Confirm the system's components (e.g., recommendations, search) and whether embeddings are for users, items, or both.

2. Design the serving path

Outline the request flow: client -> API gateway -> feature/embedding retrieval -> model inference -> response. Propose caching layers (e.g., Redis) for embeddings and features, and consider model optimizations (quantization, distillation) to meet latency.

3. Address freshness of embeddings

Describe how embeddings are updated: batch vs. streaming. For near-real-time, use a stream processing pipeline (e.g., Kafka + Flink) to update embeddings incrementally and push to a low-latency store (e.g., Redis). Discuss trade-offs (e.g., approximate updates vs. full recompute).

4. Handle stream availability signals

Explain how live/offline status is ingested (e.g., via webhooks or event streams), processed, and made available to the serving layer with minimal delay. Use a pub/sub system to push updates to edge caches or a global cache with TTLs.

5. Monitor and iterate

Propose monitoring p95 latency, cache hit rates, and freshness metrics (e.g., staleness). Discuss fallbacks (e.g., default embeddings) and how to handle failures gracefully.

Key Points to Mention

  • Latency budget breakdown and p95 vs. p99 considerations
  • Caching strategies (e.g., Redis, CDN) for embeddings and features
  • Stream processing for real-time updates (Kafka, Flink, Spark Streaming)
  • Model optimization techniques (quantization, pruning, ONNX runtime)
  • Trade-offs between freshness and cost/complexity
  • Fallback mechanisms and graceful degradation

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.