← Google Interview Insights

Google·Machine Learning Engineer·Technical Phone Screen·Senior

Senior
May 2026

Summary

ML Engineer loop at Google, pretty heavy on fundamentals across the board. Five questions back to back covering everything from classic algorithms to transformer internals. Felt like a breadth test more than a depth one, which I wasn't fully expecting.

Questions Asked (5)

Q1

Walk through the core principles and assumptions behind logistic regression.

Technical Trade-offsAlgorithms & Data Structures
Author's notes

I knew this one cold so I led with the linear decision boundary assumption and the sigmoid output, then hit the independence of features and the log-odds interpretation.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining logistic regression as a probabilistic linear classifier, then systematically explain its core principles (linear decision boundary, sigmoid link, MLE) and assumptions (linearity in log-odds, independence, no multicollinearity). Conclude by discussing practical implications and trade-offs, showing awareness of when the model works well and its limitations.

Pro tip: Emphasize that logistic regression is a discriminative model that directly estimates P(y|x), and mention that its assumptions are often violated in practice but the model remains robust—demonstrating nuanced understanding beyond textbook definitions.

1. Definition and Core Idea

Define logistic regression as a linear model for binary classification that models the log-odds of the positive class as a linear combination of input features. Highlight that it outputs probabilities via the sigmoid function.

2. Mathematical Formulation

Explain the equation: log(p/(1-p)) = w·x + b, and the sigmoid function p = 1/(1+e^{-(w·x+b)}). Mention that parameters are estimated by maximizing the likelihood (or minimizing log loss).

3. Key Assumptions

List assumptions: linearity of log-odds with continuous features, independence of errors, no perfect multicollinearity among predictors, and a large sample size for stable estimates. Note that it does not assume normally distributed features.

4. Trade-offs and Practical Considerations

Discuss pros (interpretability, probabilistic output, efficiency) and cons (sensitivity to outliers, limited to linear boundaries, need for feature engineering). Mention regularization (L1/L2) to handle overfitting and multicollinearity.

5. When to Use and Extensions

Explain appropriate use cases (baseline model, interpretable models, linearly separable data) and extensions (multinomial, ordinal, kernel logistic regression) to show depth.

Key Points to Mention

  • Log-odds (logit) transformation and sigmoid function
  • Maximum likelihood estimation and cross-entropy loss
  • Assumption of linearity between log-odds and continuous predictors
  • Independence of observations and no multicollinearity
  • Regularization techniques (L1/L2) to prevent overfitting
  • Interpretability of coefficients as odds ratios

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

Q2

How does Naive Bayes work, and under what conditions does it tend to perform well?

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

The conditional independence assumption is the crux of it and I said that upfront.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by explaining the core idea of Naive Bayes: it's a probabilistic classifier based on Bayes' theorem that assumes conditional independence of features given the class. Then discuss its performance characteristics, including when it works well (e.g., small data, high-dimensional, text classification) and its limitations (e.g., violated independence assumption).

Pro tip: Mention that despite the 'naive' independence assumption, Naive Bayes often performs surprisingly well in practice, especially for text classification, because it only needs the decision boundary to be correct, not the exact probabilities.

1. Define Naive Bayes

State that it's a generative probabilistic classifier that applies Bayes' theorem with the assumption that features are conditionally independent given the class label.

2. Explain the math

Briefly describe how it computes posterior probability P(class|features) ∝ P(class) * ∏ P(feature_i|class), and picks the class with highest probability.

3. Discuss variants

Mention common variants like Gaussian, Multinomial, and Bernoulli, and when each is used (e.g., continuous vs. discrete features).

4. Conditions for good performance

Explain that it performs well when the independence assumption approximately holds, with small datasets, high-dimensional data, and when features are informative and not highly correlated.

5. Limitations and trade-offs

Acknowledge that it can be outperformed by more complex models when dependencies exist, but it's fast, requires little data, and is interpretable.

Key Points to Mention

  • Bayes' theorem and conditional independence assumption
  • Generative vs. discriminative models
  • Variants: Gaussian, Multinomial, Bernoulli
  • Works well with small data and high dimensions
  • Common use cases: text classification, spam filtering
  • Limitations: feature independence often violated, probability estimates may be poor

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

Q3

Describe the transformer architecture and explain how self-attention contributes to its effectiveness.

System DesignTechnical Trade-offs
Author's notes

This one I actually enjoyed.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start with a high-level overview of the transformer architecture, emphasizing its encoder-decoder structure and the role of self-attention. Then, dive into the mechanics of self-attention, explaining how it computes contextual relationships and enables parallel processing. Finally, connect these technical details to the architecture's effectiveness, highlighting scalability, long-range dependency capture, and empirical success in NLP and beyond.

Pro tip: Relate self-attention to real-world impact at Google, such as its use in BERT and Transformer-XL, and mention trade-offs like quadratic complexity and solutions like sparse attention to show depth.

1. High-level architecture

Describe the transformer as a stack of encoder and decoder layers, each containing multi-head self-attention and feed-forward networks, with residual connections and layer normalization.

2. Self-attention mechanism

Explain how self-attention computes query, key, and value vectors for each token, and uses scaled dot-product attention to weigh the importance of other tokens, enabling dynamic context aggregation.

3. Multi-head attention

Discuss how multiple attention heads allow the model to focus on different representation subspaces and positions, capturing diverse linguistic relationships.

4. Effectiveness factors

Highlight how self-attention provides global context, parallel computation, and flexibility, leading to superior performance on tasks like translation, summarization, and question answering.

5. Trade-offs and scalability

Acknowledge the quadratic complexity of self-attention and mention optimizations like sparse attention or linear approximations, showing awareness of practical constraints.

Key Points to Mention

  • Encoder-decoder structure with stacked layers
  • Scaled dot-product attention and softmax normalization
  • Multi-head attention for diverse representations
  • Parallel processing and long-range dependency capture
  • Positional encodings to inject sequence order
  • Quadratic complexity and efficient attention variants

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

Q4

What metrics would you use to evaluate a multi-class classification model, and why those specifically?

Product Analytics & MetricsTechnical Trade-offs
Author's notes

Went with macro vs micro F1, confusion matrix, and per-class precision/recall.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by acknowledging that metric choice depends on the problem context, such as class balance and business costs. Then, present a hierarchy of metrics: overall accuracy, per-class precision/recall/F1, macro and micro averages, and top-k accuracy. Finally, discuss trade-offs and recommend specific metrics based on the scenario.

Pro tip: Always tie metrics to business impact—e.g., in a medical diagnosis model, recall for the disease class is critical even if overall accuracy drops. This shows you think beyond technical correctness.

1. Clarify the problem context

Ask about class distribution, misclassification costs, and whether the problem is balanced or imbalanced. This determines which metrics are meaningful.

2. List core metrics

Mention accuracy, precision, recall, F1-score, and confusion matrix. Explain that accuracy alone can be misleading for imbalanced classes.

3. Discuss averaging methods

Explain macro-average (treats all classes equally) vs. micro-average (aggregates contributions of all classes) vs. weighted-average (weights by support). Choose based on whether you care about rare classes.

4. Consider top-k accuracy

For problems where the correct class is among the top k predictions (e.g., image classification with many classes), top-k accuracy is useful.

5. Recommend metrics based on trade-offs

Conclude with a recommendation: e.g., for imbalanced classes, use macro F1 and per-class recall; for balanced classes, accuracy and top-k may suffice. Tie to business goals.

Key Points to Mention

  • Accuracy is not sufficient for imbalanced datasets; it can be misleadingly high.
  • Precision and recall trade-off: precision focuses on false positives, recall on false negatives.
  • F1-score balances precision and recall, useful when you need a single metric.
  • Macro-average treats all classes equally, highlighting performance on rare classes.
  • Micro-average aggregates all instances, dominated by frequent classes.
  • Top-k accuracy is relevant when the exact class is less critical than having it in the top k predictions.

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

Q5

Compare bagging and boosting as ensemble methods. How does each one reduce model error?

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

Variance vs bias reduction, that's the core split.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining bagging and boosting, highlighting their core difference: parallel vs. sequential training. Then explain how each reduces error—bagging through variance reduction and boosting through bias reduction—and discuss trade-offs like overfitting and computational cost.

Pro tip: Mention that boosting can overfit if not carefully regularized, while bagging is more robust to noisy data. Also, note that in practice, boosting often achieves higher accuracy but requires more tuning.

1. Define Bagging

Explain that bagging (Bootstrap Aggregating) trains multiple models independently on bootstrap samples and aggregates their predictions (e.g., by voting or averaging).

2. Define Boosting

Explain that boosting trains models sequentially, where each new model focuses on the errors of the previous ones, and combines them via weighted sum.

3. Error Reduction Mechanisms

Describe how bagging reduces variance by averaging diverse models, and how boosting reduces bias by iteratively correcting errors.

4. Trade-offs and Practical Considerations

Discuss when to use each: bagging for high-variance models (e.g., deep trees), boosting for high-bias models (e.g., shallow trees). Mention overfitting risks and computational differences.

Key Points to Mention

  • Bagging reduces variance by averaging independent models trained on bootstrap samples.
  • Boosting reduces bias by sequentially focusing on misclassified examples.
  • Bagging is parallelizable; boosting is inherently sequential.
  • Boosting can overfit if not regularized (e.g., learning rate, early stopping).
  • Bagging is robust to noisy data and outliers; boosting is sensitive to noise.
  • Examples: Random Forest (bagging), AdaBoost/Gradient Boosting (boosting).

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