← Google Interview Insights

Google·Software Engineer·Technical Phone Screen·Senior

Senior
Jun 2026

Summary

Conceptual ML foundations interview for a Research Scientist role at Google. No math derivations, just explanations of core ideas, but don't let that fool you into underpreparing. The breadth caught me a little off guard.

Questions Asked (6)

Q1

What is the difference between overfitting and underfitting, and how do you identify each?

Technical Trade-offs
Author's notes

Felt solid here.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Define overfitting and underfitting clearly, then explain how to identify each through training/validation performance patterns and learning curves. Emphasize that the goal is to find the right balance between bias and variance, and mention practical techniques to address each issue.

Pro tip: Demonstrate maturity by discussing the bias-variance trade-off and how it relates to model complexity, and mention that in practice, you often start with a simple model and gradually increase complexity while monitoring validation performance.

1. Define overfitting and underfitting

Clearly state that overfitting occurs when a model learns noise in the training data and performs poorly on new data, while underfitting occurs when a model is too simple to capture underlying patterns.

2. Explain identification via performance metrics

Describe how to compare training and validation metrics: overfitting shows low training error but high validation error, while underfitting shows high training and validation error.

3. Use learning curves for diagnosis

Mention that plotting training and validation error against training set size or model complexity helps visualize the gap and diagnose overfitting or underfitting.

4. Discuss mitigation strategies

Briefly outline solutions: for overfitting, use more data, regularization, or simpler models; for underfitting, use more complex models or better features.

Key Points to Mention

  • Bias-variance trade-off
  • Training vs. validation error gap
  • Learning curves
  • Regularization techniques (L1/L2, dropout)
  • Cross-validation
  • Model complexity and feature engineering

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

Q2

Can you explain Bayesian inference and the concept of likelihood?

Technical Trade-offs
Author's notes

This is where I got a bit tangled.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining Bayesian inference as a method to update beliefs based on evidence, then explain likelihood as the probability of observed data given a hypothesis. Use a simple example like coin flips to illustrate how prior, likelihood, and posterior relate, and connect it to software engineering contexts such as A/B testing or spam filtering.

Pro tip: Emphasize the trade-offs between Bayesian and frequentist approaches, and mention how Bayesian methods can be computationally intensive but provide a principled way to incorporate prior knowledge—showing you understand practical implications.

1. Define Bayesian Inference

Explain that Bayesian inference updates the probability of a hypothesis as more evidence becomes available, using Bayes' theorem.

2. Explain Likelihood

Define likelihood as the probability of observing the data given a specific hypothesis or parameter value, distinct from the probability of the hypothesis.

3. Connect Prior, Likelihood, and Posterior

Describe how the prior belief is combined with the likelihood of the data to produce the posterior distribution, using Bayes' theorem: P(H|D) = P(D|H) * P(H) / P(D).

4. Provide a Concrete Example

Walk through a simple example, such as estimating the bias of a coin after observing flips, to illustrate the concepts.

5. Relate to Software Engineering

Discuss applications like A/B testing, spam filtering, or recommendation systems, and mention trade-offs such as computational cost and the need for prior selection.

Key Points to Mention

  • Bayes' theorem formula: P(H|D) = P(D|H) * P(H) / P(D)
  • Difference between likelihood (P(D|H)) and posterior (P(H|D))
  • Role of prior distribution and how it encodes existing knowledge
  • Conjugate priors and their computational convenience
  • Markov Chain Monte Carlo (MCMC) for approximate inference when exact is intractable
  • Comparison with frequentist methods and when Bayesian is preferred

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

Q3

What is perplexity and what does it measure in the context of language models?

Technical Trade-offs
Author's notes

Blanked for a second.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining perplexity as the exponentiated average negative log-likelihood per token, then explain that it measures how well a language model predicts a sample, with lower values indicating better performance. Emphasize its role as an intrinsic evaluation metric and discuss its limitations, such as sensitivity to tokenization and vocabulary size.

Pro tip: Mention that perplexity is not comparable across models with different tokenizers or vocabularies, and that while it's useful for tracking training progress, it doesn't always correlate with downstream task performance.

1. Define Perplexity

State that perplexity is the exponential of the cross-entropy loss, representing the model's uncertainty in predicting the next token. Formally, it's 2^H or e^H, where H is the average negative log-likelihood.

2. Explain What It Measures

Describe perplexity as a measure of how well a probability model predicts a sample. In language modeling, it quantifies the model's confidence in its predictions; lower perplexity means the model is less 'perplexed' and assigns higher probability to the actual data.

3. Interpret Values

Explain that a perplexity of k means the model is as uncertain as if it were choosing uniformly among k equally likely options at each step. For example, perplexity equal to vocabulary size indicates random guessing.

4. Discuss Limitations and Trade-offs

Highlight that perplexity depends on tokenization and vocabulary, so it's not comparable across models with different tokenizers. Also, it may not reflect performance on downstream tasks, and optimizing perplexity can sometimes lead to overfitting or less useful representations.

5. Connect to Practical Use

Mention that perplexity is commonly used during training to monitor convergence and compare models with identical tokenization, but for final evaluation, task-specific metrics are preferred.

Key Points to Mention

  • Perplexity is the exponentiated average negative log-likelihood per token.
  • It measures how well the model predicts the next token; lower is better.
  • Perplexity is not comparable across models with different tokenizers or vocabularies.
  • It can be interpreted as the effective number of equally likely choices the model considers at each step.
  • Perplexity is useful for tracking training progress but may not correlate with downstream performance.
  • Trade-offs: optimizing perplexity can lead to overfitting or poor generalization to specific tasks.

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

Q4

Why do Transformers generally outperform RNNs, particularly for long sequences?

Technical Trade-offsSystem Design
Author's notes

My strongest answer of the session.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by contrasting the sequential nature of RNNs with the parallelizable architecture of Transformers, emphasizing how this impacts training efficiency and long-range dependency modeling. Then, discuss the self-attention mechanism and its ability to capture global context without recurrence, and finally touch on practical trade-offs like computational complexity and memory usage.

Pro tip: Acknowledge that Transformers have quadratic complexity in sequence length, but highlight that their parallelizability and effective long-range modeling often outweigh this for many tasks, especially with modern optimizations like sparse attention.

1. Define the core difference

Explain that RNNs process sequences step-by-step, creating a sequential bottleneck, while Transformers process all positions simultaneously via self-attention.

2. Highlight parallelization benefits

Discuss how Transformers enable parallel computation across sequence positions, leading to faster training on modern hardware like GPUs/TPUs.

3. Address long-range dependencies

Explain that RNNs struggle with vanishing/exploding gradients over long sequences, while Transformers' self-attention directly connects any two positions, capturing long-range dependencies effectively.

4. Discuss computational trade-offs

Mention that Transformers have O(n^2) complexity in sequence length, but this is often manageable with optimizations, and the benefits outweigh the costs for many applications.

5. Conclude with practical impact

Summarize that these advantages have led to Transformers' dominance in NLP and beyond, despite RNNs' theoretical efficiency for certain tasks.

Key Points to Mention

  • Sequential processing in RNNs vs. parallel processing in Transformers
  • Vanishing/exploding gradients in RNNs for long sequences
  • Self-attention mechanism and direct modeling of all pairwise interactions
  • Parallelizability leading to better hardware utilization and faster training
  • Quadratic complexity of self-attention and potential optimizations
  • Empirical success of Transformers in tasks requiring long-range context

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

Q5

What is the computational complexity of matrix multiplication, and how does it relate to autoregressive decoding in Transformers?

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

The matrix multiplication part is straightforward but linking it to autoregressive decoding tripped me up a bit.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by stating the standard O(n^3) complexity for multiplying two n×n matrices, then mention sub-cubic algorithms like Strassen and the theoretical lower bound. Next, connect this to autoregressive decoding in Transformers, explaining that each token generation step involves matrix-vector multiplications (O(n^2) per step) and that the overall decoding is O(n^3) for a sequence of length n, but with different constants and parallelization characteristics.

Pro tip: Emphasize the practical distinction: during training, matrix multiplications are batched and highly parallelizable, while autoregressive decoding is sequential and memory-bandwidth-bound, making it latency-sensitive despite similar asymptotic complexity.

1. Define matrix multiplication complexity

State that multiplying two n×n matrices takes O(n^3) time using the naive algorithm, and mention that sub-cubic algorithms like Strassen (O(n^2.807)) exist but are rarely used in practice due to overhead.

2. Explain autoregressive decoding in Transformers

Describe that autoregressive decoding generates one token at a time, where each step involves computing attention and feed-forward layers using matrix-vector products, not full matrix-matrix products.

3. Relate complexity to decoding

Show that for a sequence of length n, the total decoding cost is O(n^3) because each of the n steps involves operations on growing key/value caches, but per-step cost is O(n^2) and sequential.

4. Discuss practical implications

Highlight that despite similar asymptotic complexity, decoding is often memory-bound and latency-limited due to sequential dependencies, unlike training which is compute-bound and parallelizable.

5. Mention optimizations

Briefly note techniques like KV caching, quantization, and speculative decoding that mitigate the sequential bottleneck in practice.

Key Points to Mention

  • Naive matrix multiplication is O(n^3); Strassen's algorithm is O(n^2.807) but not commonly used.
  • Autoregressive decoding generates tokens sequentially, each step involving matrix-vector multiplications.
  • Total decoding complexity for a sequence of length n is O(n^3) due to cumulative operations on the KV cache.
  • Decoding is memory-bandwidth-bound and latency-sensitive, unlike training which is compute-bound and parallelizable.
  • KV caching reduces redundant computation but does not change asymptotic complexity.
  • Optimizations like speculative decoding and quantization improve practical performance.

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

Q6

What are the differences between SGD, Adam, and AdamW as optimizers?

Technical Trade-offs
Author's notes

Covered momentum in SGD, adaptive learning rates in Adam, and then AdamW decoupling weight decay from the gradient update.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining each optimizer's core mechanism, then compare their update rules and practical implications. Highlight how AdamW addresses a key flaw in Adam's weight decay implementation, and discuss when to choose each based on problem characteristics.

Pro tip: Mention that AdamW's decoupled weight decay often leads to better generalization, especially in large-scale deep learning tasks, and that SGD with momentum can still outperform adaptive methods in some computer vision tasks when tuned properly.

1. Define SGD

Explain that Stochastic Gradient Descent updates parameters using the gradient of the loss with respect to each parameter, optionally with momentum to accelerate convergence. Mention that it uses a single learning rate for all parameters.

2. Define Adam

Describe Adam as an adaptive optimizer that computes individual learning rates for each parameter using estimates of first and second moments of the gradients. Note that it incorporates bias correction and typically includes L2 regularization via weight decay added to the loss.

3. Define AdamW

Explain that AdamW modifies Adam by decoupling weight decay from the gradient update, applying it directly to the weights. This corrects the issue where Adam's L2 regularization is scaled by the adaptive learning rate, leading to suboptimal regularization.

4. Compare update rules

Contrast the update equations: SGD uses a fixed learning rate, Adam scales updates by the inverse of the square root of the second moment, and AdamW separates weight decay. Emphasize how these differences affect convergence and generalization.

5. Discuss practical trade-offs

Summarize when to use each: SGD for simplicity and sometimes better generalization in vision, Adam for fast convergence and sparse gradients, AdamW for improved regularization in large models like Transformers. Mention that hyperparameter tuning is crucial.

Key Points to Mention

  • SGD uses a single learning rate; Adam and AdamW use per-parameter adaptive learning rates.
  • Adam incorporates momentum and bias correction; SGD may use momentum separately.
  • AdamW decouples weight decay from the gradient update, unlike Adam which uses L2 regularization.
  • Decoupled weight decay in AdamW often improves generalization and is standard in modern architectures like Transformers.
  • SGD can outperform adaptive methods in some tasks (e.g., image classification) when well-tuned.
  • Choice depends on problem, data scale, and computational budget; no single optimizer is universally best.

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