← Google Interview Insights

Google·Data Scientist·Technical Phone Screen·Senior

SeniorPrefer not to say
Jul 2026Remote

Summary

Brutal technical screen for a DS role at Google. The whole thing was basically one giant search evaluation problem broken into four parts, and I was not as prepared as I thought I was for the statistics depth they expected.

Questions Asked (4)

Q1

You have a search engine handling 100M queries per day with a heavy-tailed query distribution. Design a stratified sampling scheme with Neyman allocation and an importance-weighted estimator to measure overall and long-tail NDCG@10 changes between two rankers, given a budget of 2,000 human judgments per week. Provide the estimator formula and its variance.

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

This is where I spent most of my mental energy and still felt shaky at the end.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining the strata based on query frequency (head, torso, tail) and explain how to allocate the 2,000 weekly judgments using Neyman allocation to minimize variance for the overall NDCG@10 estimate. Then, present the importance-weighted estimator that combines stratified sampling with inverse probability weighting to correct for the non-uniform sampling, and derive its variance formula. Finally, discuss how to extend this to measure long-tail NDCG@10 changes by focusing on the tail strata and possibly using a separate estimator.

Pro tip: Emphasize that Neyman allocation requires estimating the variance of NDCG@10 within each stratum, which can be approximated from historical data or pilot studies; also note that the importance weights should be the inverse of the sampling probabilities, and that the estimator's variance can be computed using the delta method or bootstrap for ratio metrics like NDCG.

1. Define strata and sampling units

Divide queries into strata based on their frequency (e.g., head: top 1%, torso: next 9%, tail: remaining 90%) and define the sampling unit as a query. Determine the population size N_h for each stratum.

2. Allocate judgments using Neyman allocation

Allocate the 2,000 judgments per week across strata proportionally to N_h * S_h, where S_h is the standard deviation of NDCG@10 within stratum h. This minimizes the variance of the overall NDCG@10 estimate for a fixed budget.

3. Construct the importance-weighted estimator

For each sampled query i in stratum h, compute its NDCG@10 for both rankers, then form the importance-weighted estimator: \hat{\mu} = \sum_{h} \sum_{i \in S_h} w_{hi} * NDCG_{hi}, where w_{hi} = 1 / \pi_{hi} and \pi_{hi} is the inclusion probability. Normalize weights to sum to 1 if needed.

4. Derive the variance of the estimator

The variance of \hat{\mu} is approximately \sum_{h} (1 - n_h/N_h) * S_h^2 / n_h, where n_h is the number of samples in stratum h. For the difference between two rankers, use the variance of the difference, accounting for paired sampling.

5. Measure long-tail NDCG@10 changes

For the long-tail, focus on the tail stratum and use a similar estimator but with weights adjusted to represent the tail population. Alternatively, use a separate Neyman allocation for the tail if the budget allows, or combine with the overall estimator by conditioning on the tail.

Key Points to Mention

  • Heavy-tailed query distribution requires stratification to ensure adequate representation of rare queries.
  • Neyman allocation minimizes variance by allocating more samples to strata with higher variability and larger population size.
  • Importance weighting corrects for the unequal selection probabilities inherent in stratified sampling.
  • The variance formula for the stratified estimator depends on within-stratum variances and sampling fractions.
  • For comparing two rankers, use paired differences within each stratum to reduce variance.
  • Long-tail NDCG@10 can be estimated by focusing on the tail stratum, but may require oversampling and careful weighting.

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

Q2

How would you combine a small set of human-judged query-document pairs with counterfactual evaluation using click logs via IPS or doubly robust estimation? What are the propensity requirements and how would you collect them?

A/B Testing & ExperimentationTechnical Trade-offs
Author's notes

Knew IPS in theory but when they pushed on propensity requirements I got a bit vague.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by framing the problem as combining a small unbiased human-labeled set with large-scale biased click data to estimate ranking performance. Propose using doubly robust estimation to combine a propensity-weighted IPS estimator from clicks with a direct method (outcome model) trained on human labels, ensuring robustness if either model is misspecified. Then detail the propensity requirements (positivity, correct specification, logging policy) and how to collect them via randomization or exploration.

Pro tip: Emphasize that propensity scores must reflect the probability of observation under the logging policy, and that even small amounts of randomization in production can enable unbiased evaluation. Also, mention that doubly robust estimation can reduce variance by incorporating a reward model, making it practical for Google-scale data.

1. Clarify the goal and data sources

Explain that the goal is to estimate the performance of a new ranking model using limited human judgments and abundant click logs. Highlight that human labels are unbiased but scarce, while clicks are biased but plentiful.

2. Introduce counterfactual evaluation with IPS

Describe IPS as a technique that reweights clicked documents by the inverse probability of being observed under the logging policy. Note that this yields an unbiased estimate if propensities are known and positive.

3. Combine with doubly robust estimation

Propose using doubly robust estimation, which combines an IPS estimator with a direct method (e.g., a regression model trained on human labels). This provides robustness: if either the propensity model or the outcome model is correct, the estimate remains unbiased.

4. Specify propensity requirements and collection

State that propensities must be strictly positive for all query-document pairs and correctly specified. Collect them by logging the probability of each document being shown under the production policy, or by injecting randomization (e.g., epsilon-greedy) to ensure exploration.

5. Address practical challenges and validation

Discuss challenges like high variance, propensity estimation errors, and distribution shift. Suggest validating with A/B tests or simulation, and using techniques like clipping or normalization to stabilize IPS weights.

Key Points to Mention

  • Inverse Propensity Scoring (IPS) and its unbiasedness under known propensities
  • Doubly Robust (DR) estimation: combining IPS with a direct method for robustness
  • Propensity requirements: positivity (overlap), correct specification, and logging policy
  • Collection of propensities via randomization, exploration, or logging production probabilities
  • Variance reduction techniques (e.g., clipping, normalization, reward modeling)
  • Validation through A/B tests or simulation to ensure reliability

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

Q3

Do a back-of-envelope power analysis for detecting a 0.01 absolute difference in NDCG@10 between two rankers at 95% confidence. What variance assumptions do you need to make?

A/B Testing & ExperimentationProduct Analytics & Metrics
Author's notes

Probably my best moment in the interview.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the metric and test design: NDCG@10 is a per-query metric, so you need to estimate the variance of the difference in mean NDCG@10 between two rankers. Use the standard sample size formula for comparing two means, but explicitly state assumptions about the variance of NDCG@10 and the correlation between paired observations (if using a paired test). Then compute the required number of queries (or sessions) and discuss how variance assumptions affect the result.

Pro tip: Mention that NDCG@10 is bounded between 0 and 1, so its variance is at most 0.25, but in practice it's often much smaller (e.g., 0.01–0.05). Also note that using a paired test (same queries for both rankers) can dramatically reduce required sample size by accounting for correlation.

1. Clarify the metric and test design

Confirm that NDCG@10 is computed per query and averaged over queries. Determine whether the test is paired (same queries evaluated by both rankers) or unpaired, as this affects variance calculation.

2. State variance assumptions

Assume a variance for NDCG@10 (e.g., from historical data or pilot). For a paired test, also assume a correlation between the two rankers' scores on the same query, or directly assume the variance of the difference.

3. Choose the appropriate sample size formula

For an unpaired test: n = 2 * (z_{α/2} + z_β)^2 * σ^2 / Δ^2. For a paired test: n = (z_{α/2} + z_β)^2 * σ_diff^2 / Δ^2, where σ_diff^2 = Var(NDCG_A - NDCG_B).

4. Plug in values and compute

Use Δ = 0.01, 95% confidence (z_{α/2}=1.96), and power 80% (z_β=0.84). For example, if σ = 0.1 (unpaired), n ≈ 2 * (2.8)^2 * 0.01 / 0.0001 = 1568 per group. If paired with σ_diff = 0.05, n ≈ (2.8)^2 * 0.0025 / 0.0001 = 196 per group.

5. Discuss sensitivity and practical considerations

Highlight that the required sample size is highly sensitive to variance assumptions. Suggest using pilot data or historical A/B tests to estimate variance, and consider clustering (e.g., queries within sessions) if applicable.

Key Points to Mention

  • NDCG@10 is a per-query metric; variance depends on query distribution and ranker performance.
  • Paired vs. unpaired test: paired designs exploit correlation and reduce sample size.
  • Variance of NDCG@10 is bounded (0 to 0.25) but typically much smaller; need empirical estimate.
  • Sample size formula for two means: n ∝ σ^2 / Δ^2, with Δ=0.01.
  • Power and significance level: 95% confidence (α=0.05) and typically 80% power (β=0.2).
  • Practical constraints: number of queries available, traffic, and minimum detectable effect.

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

Q4

Describe an active learning loop to prioritize labeling budget toward long-tail queries and reduce overall annotation cost. How would you monitor distribution drift week over week?

Product Analytics & MetricsTechnical Trade-offsAdaptability & Ambiguity
Author's notes

I gave a reasonable answer about using model uncertainty (entropy or margin sampling) to select which query-doc pairs to label next, and prioritizing the long-tail stratum since that's where label coverage is worst.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by framing the problem as a budget-constrained optimization: maximize model improvement per labeling dollar by targeting high-uncertainty, high-impact examples. Describe a concrete active learning loop that combines uncertainty sampling with diversity and representativeness, and explain how you'd measure its ROI. Then outline a monitoring plan for distribution drift using statistical tests and business metrics, emphasizing proactive retraining triggers.

Pro tip: Tie the active learning loop to a clear business metric (e.g., reduction in annotation cost per F1 point gained) and propose a small-scale A/B test to validate the strategy before full rollout. This shows you think like a product-minded data scientist, not just a modeler.

1. Define the objective and constraints

Clarify the goal: minimize annotation cost while maximizing model performance on long-tail queries. Identify budget, labeling capacity, and target metrics (e.g., recall on rare classes).

2. Design the active learning loop

Use a hybrid acquisition function: combine uncertainty (e.g., entropy, margin) with diversity (e.g., clustering in embedding space) and representativeness (e.g., density weighting). Prioritize long-tail by upweighting rare classes or using class-balanced sampling.

3. Implement and iterate

Train a model on the current labeled set, score unlabeled data, select a batch for labeling, and retrain. Track cost per improvement and adjust acquisition strategy based on feedback.

4. Monitor distribution drift

Week over week, compute drift metrics (e.g., KL divergence, PSI) on input features and predicted labels. Use statistical tests (e.g., KS test) and track changes in query distribution, especially long-tail frequency.

5. Set up alerts and retraining triggers

Define thresholds for drift metrics and automate alerts. When drift exceeds threshold, trigger model retraining or re-prioritization of labeling budget toward newly emerging long-tail queries.

Key Points to Mention

  • Uncertainty sampling (entropy, margin, least confidence) and its limitations for long-tail
  • Diversity and representativeness techniques (core-set, clustering, density weighting)
  • Cost-sensitive active learning: incorporate annotation cost per example
  • Distribution drift detection methods: PSI, KL divergence, KS test, and monitoring feature distributions
  • Business impact: reduction in annotation cost, improvement in long-tail recall, ROI of active learning
  • Feedback loop: using model predictions and human-in-the-loop to continuously refine the acquisition strategy

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