← Meta Interview Insights

Meta·Machine Learning Engineer·Technical Phone Screen·Senior

Senior
Jun 2026

Summary

Fundamentals round at Meta for an MLE role covering optimizers, neural scaling laws, and clustering. Pretty broad for a single session but the questions were genuinely deep, not just name-dropping methods.

Questions Asked (9)

Q1

Walk through the progression from plain SGD to Adam. What does each step add, and why is Adam the default for training transformers?

Technical Trade-offsAlgorithms & Data Structures
Author's notes

I traced the chain fine: gradient descent, then momentum to smooth updates, then RMSProp to scale per-parameter, then Adam combining both with bias correction.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Structure your answer as a chronological narrative, explaining the motivation and mechanism of each optimizer (SGD, SGD+Momentum, AdaGrad, RMSProp, Adam) and the specific problem it solves. Then, connect Adam's properties (adaptive per-parameter learning rates, momentum, bias correction) to the challenges of training transformers, such as sparse gradients, varying parameter scales, and large embedding layers.

Pro tip: Mention that while Adam is the default, recent work like AdamW (decoupled weight decay) and Lion have shown improvements, and that for some tasks SGD with momentum can still match Adam with careful tuning—showing you understand trade-offs beyond defaults.

1. Start with plain SGD

Explain that SGD updates each parameter using a fixed learning rate multiplied by the gradient. Highlight its simplicity but note issues: slow convergence, sensitivity to learning rate, and poor performance on ill-conditioned or sparse problems.

2. Add momentum

Introduce momentum (e.g., SGD with momentum) which accumulates a velocity vector to smooth updates, accelerate convergence, and escape local minima. Mention Nesterov momentum as a refinement.

3. Introduce adaptive learning rates

Cover AdaGrad (per-parameter learning rates that decay based on historical squared gradients) and RMSProp (fixes AdaGrad's aggressive decay by using exponential moving average). Explain how they help with sparse features and varying scales.

4. Combine momentum and adaptive rates: Adam

Describe Adam as combining momentum (first moment) and RMSProp (second moment) with bias correction. Explain its update rule and why it works well out-of-the-box.

5. Why Adam for transformers

Connect to transformers: large number of parameters, sparse gradients (e.g., embeddings), varying parameter scales, and need for fast convergence. Mention that Adam's adaptive per-parameter updates handle these well, and that it reduces hyperparameter tuning burden.

Key Points to Mention

  • SGD: fixed learning rate, no adaptation, slow on sparse data.
  • Momentum: accelerates convergence by accumulating gradients, reduces oscillation.
  • AdaGrad: per-parameter learning rates, but learning rate decays too aggressively.
  • RMSProp: fixes AdaGrad's decay with exponential moving average of squared gradients.
  • Adam: combines momentum and RMSProp, includes bias correction for initial steps.
  • Transformers: large embedding layers, sparse gradients, varying parameter scales, need for fast convergence; Adam's adaptivity and momentum address these.

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

Q2

What is the actual difference between L2 regularization added to the loss and decoupled weight decay as in AdamW?

Technical Trade-offsAlgorithms & Data Structures
Author's notes

This one tripped me up more than I expected.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining both methods mathematically: L2 regularization adds a penalty term to the loss, while decoupled weight decay directly updates the weights. Then explain how they differ in optimization dynamics, especially with adaptive optimizers like Adam, and why AdamW was introduced to fix the issue of L2 regularization not being equivalent to weight decay in Adam.

Pro tip: Mention that in Adam, L2 regularization interacts with the adaptive learning rates, effectively scaling the regularization by the second moment estimate, which can lead to suboptimal regularization. AdamW decouples weight decay from the gradient update, making it equivalent to traditional SGD weight decay and often improving generalization.

1. Define L2 Regularization

Explain that L2 regularization adds a penalty term (λ/2 * ||w||^2) to the loss function, which results in a gradient contribution of λw. This is then combined with the data gradient before the optimizer update.

2. Define Decoupled Weight Decay

Explain that decoupled weight decay directly shrinks the weights by a factor (1 - ηλ) at each step, independent of the gradient-based update. In AdamW, this is done after the adaptive gradient update.

3. Contrast in Adaptive Optimizers

Highlight that in Adam, L2 regularization is added to the gradient, which then gets scaled by the adaptive learning rate (1/√v). This means the effective regularization strength varies per parameter and is coupled with the gradient magnitude.

4. Explain the AdamW Fix

Describe how AdamW decouples weight decay from the gradient update, applying it directly to the weights. This makes the regularization strength consistent across parameters and independent of the adaptive learning rate.

5. Discuss Practical Implications

Mention that decoupled weight decay often leads to better generalization and is now standard in training transformers and other deep models. Also note that L2 regularization in Adam can be tuned to mimic weight decay but is not equivalent.

Key Points to Mention

  • L2 regularization adds λ/2 * ||w||^2 to the loss, contributing λw to the gradient.
  • In Adam, the gradient is scaled by 1/(√v + ε), so L2 regularization is also scaled, making it adaptive per parameter.
  • Decoupled weight decay directly updates weights: w ← w - ηλw, independent of the gradient.
  • AdamW applies weight decay after the adaptive update, decoupling it from the gradient.
  • Decoupled weight decay is equivalent to traditional SGD weight decay, while L2 regularization in Adam is not.
  • Empirically, AdamW often improves generalization and is widely used in practice, e.g., for training transformers.

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

Q3

How does learning rate scheduling with warmup and decay fit into optimizer design, and why is warmup particularly important?

Technical Trade-offs
Author's notes

Answered this one pretty cleanly.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by framing learning rate scheduling as a critical component of optimizer design that controls the effective step size during training. Explain how warmup and decay address distinct challenges: warmup stabilizes early training by gradually increasing the learning rate, while decay refines convergence by reducing it over time. Emphasize why warmup is particularly important for large models and adaptive optimizers, and tie your answer to practical trade-offs like batch size and optimizer choice.

Pro tip: Mention that warmup is especially crucial for adaptive optimizers like Adam because their second-moment estimates are unreliable early on, and that linear warmup followed by cosine decay is a robust default in many state-of-the-art models.

1. Define learning rate scheduling

Explain that learning rate scheduling adjusts the learning rate during training to balance exploration and convergence, and that it is an integral part of optimizer design.

2. Describe warmup

Detail how warmup gradually increases the learning rate from a small value to the base rate over initial steps, preventing large, destabilizing updates early in training.

3. Describe decay

Explain how decay reduces the learning rate over time (e.g., step, exponential, cosine) to fine-tune weights and improve final convergence.

4. Explain why warmup is important

Discuss how warmup mitigates issues like exploding gradients, unstable adaptive optimizer statistics, and large batch training instabilities, especially in transformers and other large models.

5. Connect to optimizer design and trade-offs

Relate scheduling to optimizer choice (e.g., Adam vs. SGD), batch size, and model architecture, highlighting trade-offs like training time vs. stability and final performance.

Key Points to Mention

  • Warmup prevents early training instability by avoiding large updates when gradients or optimizer states are unreliable.
  • Decay schedules (e.g., cosine, linear, step) help the model converge to a better minimum by reducing learning rate over time.
  • Adaptive optimizers like Adam benefit from warmup because their variance estimates are biased initially.
  • Large batch training often requires warmup to maintain stability and avoid divergence.
  • Learning rate scheduling interacts with other hyperparameters like batch size and weight decay.
  • Common practice: linear warmup followed by cosine decay is a strong default for many deep learning tasks.

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

Q4

State the power-law form of neural scaling laws and explain what the compute-optimal result says about splitting a fixed compute budget between model size and training tokens.

Technical Trade-offsAlgorithms & Data Structures
Author's notes

The math part was fine.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by stating the power-law form of neural scaling laws, then explain the compute-optimal trade-off between model size and training tokens. Conclude with the practical implication: for a fixed compute budget, model size and training tokens should be scaled proportionally, as shown by the Chinchilla scaling laws.

Pro tip: Mention the Chinchilla paper and its empirical validation, and note that while the power-law exponents are specific to the setup, the key takeaway is that most large models are undertrained. This shows you understand both theory and practice.

1. State the power-law form

Define the loss L as a function of model size N and dataset size D, typically L(N, D) = a N^{-α} + b D^{-β} + c, where α and β are scaling exponents.

2. Explain compute-optimal trade-off

Given a fixed compute budget C ≈ 6ND, the optimal allocation balances N and D such that N ∝ C^{β/(α+β)} and D ∝ C^{α/(α+β)}. This yields a specific ratio, e.g., in Chinchilla, N and D should scale equally.

3. Discuss implications

Emphasize that for a fixed compute budget, increasing model size without increasing training tokens leads to suboptimal performance. The compute-optimal result suggests training smaller models on more data than previously thought.

4. Connect to practical examples

Mention that models like GPT-3 were undertrained relative to Chinchilla optimal, and that following the scaling laws can lead to more efficient training.

Key Points to Mention

  • Power-law relationship: loss decreases as a power law with model size and dataset size.
  • Compute budget constraint: C ≈ 6ND (FLOPs).
  • Optimal allocation: N and D should be scaled proportionally, e.g., N ∝ D.
  • Chinchilla scaling laws: empirical validation that models should be trained on more data.
  • Implication: many large language models are undertrained; smaller models with more data can outperform larger models with less data.
  • Practical takeaway: for a fixed compute budget, balance model size and training tokens to minimize loss.

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

Q5

If you have a fixed compute budget but a hard inference latency constraint, how does that change which model size you'd actually ship?

Technical Trade-offsProduct Strategy
Author's notes

Good follow-up that I wasn't ready for.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Frame the answer around the trade-off between model capacity and inference latency under a fixed compute budget. Emphasize that you would prioritize meeting the latency constraint by selecting a smaller model, then optimize training and inference efficiency to maximize performance within that constraint.

Pro tip: Mention that you would consider techniques like knowledge distillation from a larger model or using a mixture-of-experts with conditional computation to get more capacity without increasing latency.

1. Clarify constraints and objectives

Confirm the exact latency target (e.g., p99 < 100ms), the compute budget (e.g., GPU hours for training and inference cost per query), and the primary metric (e.g., accuracy, F1).

2. Estimate latency vs. model size

Use known scaling laws or benchmark data to estimate how latency scales with model size (parameters, FLOPs) on the target hardware. Identify the maximum model size that meets the latency constraint.

3. Select model size within budget

Choose the largest model that fits within the latency constraint and can be trained within the compute budget. If the budget allows, consider training a larger model and then compressing it.

4. Optimize for efficiency

Apply techniques like quantization, pruning, distillation, or efficient architectures (e.g., MobileNet, EfficientNet) to push the performance-latency Pareto frontier.

5. Validate and iterate

Measure actual latency and accuracy on target hardware, and iterate on model size and optimizations until both constraints are satisfied.

Key Points to Mention

  • Latency constraint is hard, so model size must be capped by inference time, not just compute budget.
  • Compute budget affects training (e.g., how large a model you can train) but inference latency affects deployment.
  • Trade-off between model capacity and latency: smaller models may underfit, so use efficiency techniques.
  • Knowledge distillation: train a large model then distill to a smaller one that meets latency.
  • Quantization and pruning: reduce model size and latency with minimal accuracy loss.
  • Hardware-aware model selection: consider the target deployment hardware (e.g., mobile, server) when choosing architecture.

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

Q6

Compare k-means and GMM fitted by EM: what objective does each optimize, what's the difference in how they assign points to clusters, and what's the formal relationship between the two algorithms?

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

Solid ground for me.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clearly stating the objective each algorithm optimizes: k-means minimizes within-cluster sum of squares, while GMM maximizes the likelihood of the data under a mixture of Gaussians. Then contrast the hard assignment of k-means with the soft, probabilistic assignment of GMM, and explain that k-means is a special case of GMM with spherical, equal-variance Gaussians and hard assignments. Conclude by discussing the formal relationship: k-means is equivalent to EM for GMMs in the limit as variance goes to zero.

Pro tip: Emphasize that k-means is not just a heuristic but can be derived as a limiting case of GMM, which shows deep understanding. Also, mention that while k-means optimizes a non-convex objective and converges to local minima, GMM's EM also converges to local optima but provides uncertainty estimates.

1. State the objectives

Clearly define what each algorithm optimizes: k-means minimizes the sum of squared distances from points to their cluster centroids (inertia), while GMM maximizes the log-likelihood of the data under a mixture of Gaussian distributions.

2. Compare assignment methods

Explain that k-means performs hard assignment (each point belongs to exactly one cluster), whereas GMM performs soft assignment (each point has a probability of belonging to each cluster).

3. Describe the algorithms

Briefly outline the iterative process: k-means alternates between assigning points to the nearest centroid and updating centroids; GMM uses EM, alternating between computing responsibilities (E-step) and updating parameters (M-step).

4. Explain the formal relationship

Show that k-means is a special case of GMM where all Gaussians are spherical with equal variance, and as the variance approaches zero, the soft assignments of EM converge to hard assignments, making k-means equivalent to EM for GMMs in that limit.

5. Discuss practical implications

Mention that GMM provides richer information (e.g., uncertainty, cluster shapes) but is more computationally expensive and sensitive to initialization, while k-means is simpler and faster but assumes spherical clusters of similar size.

Key Points to Mention

  • K-means objective: minimize within-cluster sum of squares (WCSS).
  • GMM objective: maximize log-likelihood of data under mixture of Gaussians.
  • Hard vs. soft assignment: k-means assigns each point to one cluster; GMM gives probabilities.
  • K-means is a limiting case of GMM with spherical, equal-variance Gaussians and variance → 0.
  • Both algorithms are iterative and converge to local optima; k-means uses Lloyd's algorithm, GMM uses EM.
  • GMM can model elliptical clusters with different orientations and sizes, while k-means assumes isotropic clusters.

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

Q7

Your GMM's EM is diverging because covariance matrices are collapsing toward zero. What's going wrong and how do you fix it?

Root Cause AnalysisTechnical Trade-offs
Author's notes

A component is collapsing onto a single data point, making its likelihood spike to infinity.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by explaining the root cause: singular or near-singular covariance matrices due to too few points per component or numerical issues. Then discuss practical fixes like regularization, better initialization, or constraining covariance structures, emphasizing trade-offs and Meta-scale considerations.

Pro tip: Mention that at Meta's scale, you'd also monitor for numerical stability and consider distributed EM with sufficient data per component to avoid collapse, showing you think beyond textbook fixes.

1. Diagnose the root cause

Explain that covariance collapse occurs when a component's covariance becomes singular, often due to too few data points assigned to it or numerical underflow. This leads to infinite likelihood and divergence.

2. Identify contributing factors

Discuss factors like poor initialization, too many components for the data, outliers, or lack of regularization. Mention that in high dimensions, this is more likely.

3. Apply regularization

Propose adding a small value to the diagonal of covariance matrices (e.g., epsilon * I) or using a Bayesian prior like inverse-Wishart to prevent singularity.

4. Improve initialization and constraints

Suggest better initialization (e.g., k-means++), reducing the number of components, or constraining covariance to be shared, diagonal, or spherical to reduce parameters.

5. Monitor and iterate

Emphasize monitoring log-likelihood and covariance condition numbers during training, and iterating on hyperparameters like regularization strength or component count.

Key Points to Mention

  • Singular covariance matrices cause infinite likelihood and numerical instability.
  • Regularization techniques: adding epsilon to diagonal, using priors, or shrinkage estimators.
  • Initialization strategies: k-means++ or multiple restarts to avoid bad local optima.
  • Model constraints: reducing components, sharing covariance, or using diagonal/spherical covariance.
  • Data preprocessing: removing outliers, dimensionality reduction, or ensuring enough samples per component.
  • Scalability considerations: distributed EM, sufficient data per component, and monitoring for numerical stability.

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

Q8

How would you choose the number of clusters k for k-means versus the number of components for a GMM, and do the model selection tools differ?

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

For k-means I mentioned the elbow method on inertia and silhouette scores.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by explaining that both k-means and GMM are clustering algorithms but with different assumptions, so model selection criteria differ. For k-means, focus on methods like elbow, silhouette, gap statistic; for GMM, use information criteria (BIC, AIC) and cross-validation. Conclude by discussing practical trade-offs and when to prefer one over the other.

Pro tip: Mention that GMM's probabilistic framework allows for likelihood-based model selection (BIC/AIC), while k-means lacks a likelihood, so you often rely on heuristics or downstream metrics. Also note that GMM can model elliptical clusters and soft assignments, which affects how you evaluate k.

1. Clarify the difference in model assumptions

Explain that k-means assumes spherical clusters of equal size and hard assignments, while GMM assumes Gaussian distributions with full covariance and soft assignments. This impacts how you choose the number of clusters/components.

2. Discuss k-means model selection methods

Describe common techniques: elbow method (plotting within-cluster sum of squares), silhouette score, gap statistic, and domain knowledge. Note that these are heuristics and may not always give a clear answer.

3. Discuss GMM model selection methods

Explain that GMM is a probabilistic model, so you can use likelihood-based criteria like BIC (Bayesian Information Criterion) and AIC (Akaike Information Criterion), which penalize complexity. Also mention cross-validation on held-out likelihood.

4. Compare and contrast the tools

Highlight that while both can use cross-validation or information criteria, k-means lacks a proper likelihood, so BIC/AIC are not directly applicable. GMM's BIC is a principled way to select the number of components. However, you can use silhouette for both if you treat GMM as a hard clustering after assignment.

5. Discuss practical considerations and trade-offs

Mention scalability, computational cost, and interpretability. For large datasets, k-means is faster; GMM is more flexible but slower. Also note that if clusters are non-spherical, GMM may be better even if k-means with more clusters could approximate it.

Key Points to Mention

  • Elbow method, silhouette score, gap statistic for k-means
  • BIC, AIC, and cross-validated likelihood for GMM
  • K-means assumes spherical clusters and hard assignments; GMM assumes Gaussian distributions and soft assignments
  • BIC is not directly applicable to k-means due to lack of likelihood
  • GMM can model covariance structures, so number of components may differ from k in k-means
  • Practical trade-offs: scalability, interpretability, and domain knowledge

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

Q9

Why does Adam sometimes generalize worse than well-tuned SGD with momentum, and when does that gap actually matter in practice?

Technical Trade-offsAlgorithms & Data Structures
Author's notes

I knew the rough intuition: Adam finds flatter-looking minima in the adaptive metric but those can be sharper in the actual parameter space, which hurts generalization.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying that Adam's adaptive per-parameter learning rates can lead to suboptimal generalization compared to well-tuned SGD with momentum, especially in overparameterized regimes. Then explain the theoretical and practical reasons, and discuss when this gap is significant in real-world ML engineering at Meta.

Pro tip: Emphasize that the gap often disappears with proper hyperparameter tuning (e.g., learning rate schedules, weight decay) and that Adam's advantages in training speed and robustness often outweigh the generalization gap in practice. Mention that Meta often uses Adam for large-scale models but may switch to SGD for final fine-tuning when generalization is critical.

1. Define the generalization gap

Acknowledge that Adam sometimes achieves lower training loss but higher test loss than well-tuned SGD with momentum, indicating a generalization gap.

2. Explain why the gap occurs

Discuss reasons: adaptive learning rates can lead to sharper minima, less effective regularization, and bias towards solutions that don't generalize as well. Also mention that SGD with momentum often finds flatter minima.

3. Discuss when the gap matters

Highlight scenarios: small datasets, tasks requiring high generalization (e.g., few-shot learning), or when deploying models to production where overfitting is costly. In large-scale industrial settings with massive data, the gap may be negligible.

4. Provide practical mitigation strategies

Suggest techniques: tuning Adam's hyperparameters (e.g., β2, ε), using decoupled weight decay (AdamW), learning rate schedules, or switching to SGD for fine-tuning.

5. Relate to Meta's context

Connect to Meta's scale: with billions of examples, Adam's generalization gap often diminishes, but for specialized models or low-data regimes, SGD may still be preferred.

Key Points to Mention

  • Adaptive learning rates in Adam can lead to sharper minima and poorer generalization compared to SGD with momentum.
  • Well-tuned SGD with momentum often finds flatter minima, which correlate with better generalization.
  • The gap is most pronounced in small-data regimes or when regularization is weak.
  • Practical mitigations: AdamW (decoupled weight decay), learning rate warmup and decay, and switching to SGD for final training.
  • In large-scale industrial settings (like Meta), the gap often diminishes due to massive datasets and extensive tuning.
  • Meta's production models often use Adam for training efficiency, but may use SGD for fine-tuning when generalization is critical.

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