← Amazon Interview Insights

Amazon·Machine Learning Engineer·Technical Phone Screen·Senior

Senior
Jul 2026

Summary

Technical screen for an MLE role at Amazon, heavy on ML fundamentals with a fraud-detection framing running through basically everything. The questions were interconnected in a way that made it feel like one long diagnostic rather than six separate topics.

Questions Asked (6)

Q1

You have a fraud detection dataset where only about 1% of examples are positive. How do you detect and characterize the class imbalance, and why is accuracy a bad metric here?

Product Analytics & MetricsRoot Cause AnalysisTechnical Trade-offs
Author's notes

I jumped straight to 'just use AUC' and the interviewer pushed back asking how I'd even know there's a problem in the first place.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by explaining how to detect and quantify class imbalance using summary statistics and visualization, then discuss why accuracy is misleading with imbalanced data by relating it to the majority class baseline. Finally, propose appropriate evaluation metrics and techniques to handle imbalance, emphasizing the business context of fraud detection.

Pro tip: Always tie your answer back to the business impact: in fraud detection, false negatives (missed fraud) are often far more costly than false positives, so metrics like recall or precision-recall AUC are more relevant than accuracy. Mention that you would align the metric choice with the cost matrix of the specific application.

1. Detect and Quantify Imbalance

Compute the class distribution (e.g., value_counts, percentage) and visualize it with bar plots or pie charts. Calculate the imbalance ratio (e.g., 99:1) to understand the severity.

2. Explain Why Accuracy Fails

Show that a naive model predicting all negatives achieves 99% accuracy, yet fails to detect any fraud. Accuracy is misleading because it doesn't account for the cost of misclassifying the minority class.

3. Choose Appropriate Metrics

Recommend metrics like precision, recall, F1-score, precision-recall AUC, and Matthews correlation coefficient. Discuss how to choose based on business costs (e.g., recall for minimizing missed fraud).

4. Address Imbalance in Modeling

Mention techniques such as resampling (oversampling minority, undersampling majority, SMOTE), class weighting, and using algorithms robust to imbalance (e.g., tree-based ensembles).

5. Validate and Monitor

Use stratified cross-validation and ensure evaluation on a representative test set. Monitor model performance over time as fraud patterns evolve.

Key Points to Mention

  • Class imbalance ratio and its impact on model training
  • Accuracy paradox: high accuracy but poor fraud detection
  • Precision, recall, F1-score, and precision-recall AUC as better metrics
  • Cost-sensitive learning and business context (false negatives vs false positives)
  • Resampling techniques (SMOTE, undersampling) and class weighting
  • Stratified sampling and proper validation strategies

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

Q2

What techniques would you use to handle class imbalance, and how do you decide between data-level approaches like SMOTE versus algorithm-level ones like class weights or focal loss?

Technical Trade-offsAlgorithms & Data Structures
Author's notes

Talked through oversampling and undersampling fine, but when they asked me to compare SMOTE variants like Borderline-SMOTE versus ADASYN I got a bit vague.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by acknowledging that class imbalance is common in real-world ML and that the choice of technique depends on the problem context, data size, and evaluation metric. Then compare data-level and algorithm-level approaches, highlighting their trade-offs and when each is preferable, and conclude with a decision framework based on experimentation and business impact.

Pro tip: Emphasize that the evaluation metric should drive the choice: for example, if you care about ranking or probability calibration, algorithm-level methods like focal loss may be better; if you need to boost minority class recall without changing the model, SMOTE can help. Always validate with a holdout set and consider the cost of false positives vs. false negatives.

1. Define the problem and metrics

Clarify the business objective and choose appropriate evaluation metrics (e.g., F1, AUC-PR, recall at fixed precision) that reflect the cost of misclassification.

2. Understand the data and imbalance ratio

Assess the severity of imbalance, dataset size, and whether the minority class is well-separated or noisy, as these influence technique effectiveness.

3. Compare data-level and algorithm-level approaches

Discuss pros and cons: data-level (e.g., SMOTE, undersampling) can cause overfitting or information loss; algorithm-level (e.g., class weights, focal loss) adjusts learning without altering data distribution.

4. Decide based on constraints and experimentation

Consider computational resources, interpretability, and pipeline complexity; run controlled experiments with cross-validation to compare techniques using the chosen metric.

5. Monitor and iterate

Deploy the model, monitor performance on minority class, and be ready to switch or combine techniques if data drift or business needs change.

Key Points to Mention

  • SMOTE and its variants (e.g., Borderline-SMOTE, ADASYN) generate synthetic samples but can introduce noise and overfit if not careful.
  • Class weights adjust the loss function to penalize minority class errors more, simple to implement and often effective.
  • Focal loss down-weights easy examples and focuses on hard ones, useful for extreme imbalance and deep learning.
  • Evaluation metrics: accuracy is misleading; use precision-recall AUC, F1, or cost-sensitive metrics.
  • Trade-offs: data-level methods change data distribution and may not generalize; algorithm-level methods keep data intact but may require tuning.
  • Combine approaches: e.g., use class weights with a resampling technique, and always validate on a balanced test set or with proper cross-validation.

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

Q3

How would you design a validation pipeline for this fraud setting that avoids data leakage and actually reflects the real class distribution?

A/B Testing & ExperimentationSystem DesignRoot Cause Analysis
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 emphasizing that the validation strategy must mirror production conditions, especially the temporal and class distribution aspects. Then outline a time-based split with stratification and discuss how to handle class imbalance without leakage. Finally, mention monitoring and iterative refinement.

Pro tip: Always simulate the production data pipeline for validation, including any preprocessing or feature engineering steps, to catch leakage that might occur during transformation. Also, consider using a holdout set that is chronologically after the training set to mimic real-world deployment.

1. Understand the fraud detection context

Clarify the business problem, data sources, and how fraud patterns evolve over time. Identify the key metrics (e.g., precision-recall, cost-sensitive) and the real class distribution.

2. Choose a time-based split

Use a temporal split (e.g., train on past data, validate on future data) to prevent leakage from future information. Ensure the split respects the chronological order of transactions.

3. Preserve class distribution

Apply stratification on the time-based split to maintain the same fraud-to-non-fraud ratio in each fold. Avoid oversampling before splitting to prevent leakage.

4. Handle class imbalance correctly

Use techniques like class weighting or SMOTE only on the training set, never on validation. Evaluate with metrics robust to imbalance (e.g., AUPRC, recall at fixed precision).

5. Validate and monitor

Simulate production by applying the same preprocessing pipeline to validation data. Set up monitoring for distribution shifts and retrain periodically.

Key Points to Mention

  • Time-based splitting to avoid temporal leakage
  • Stratification to preserve class distribution
  • Avoid oversampling before splitting
  • Use of class weights or SMOTE only on training data
  • Evaluation metrics for imbalanced data (AUPRC, recall at fixed precision)
  • Simulating production pipeline for validation

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

Q4

Walk me through the bias-variance tradeoff. How do you diagnose which problem you have, and what do you actually do about it?

Technical Trade-offsAlgorithms & Data Structures
Author's notes

Pretty standard, used learning curves to frame the diagnosis which landed well.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining the bias-variance tradeoff and its impact on model performance, then explain how to diagnose bias vs. variance using learning curves and error analysis. Finally, detail concrete remediation strategies for each case, emphasizing iterative experimentation and validation.

Pro tip: Frame your answer around a real project where you diagnosed and fixed bias or variance, highlighting the metrics and business impact. At Amazon, tie it to customer obsession by showing how reducing error improved user experience.

1. Define the tradeoff

Explain that bias is error from overly simplistic assumptions (underfitting), variance is error from sensitivity to training data (overfitting), and total error is their sum plus irreducible noise.

2. Diagnose with learning curves

Describe how to plot training and validation error vs. training set size: high bias shows both errors converging to a high value; high variance shows a large gap between low training error and high validation error.

3. Analyze errors and model complexity

Look at validation errors, feature importance, and residuals to identify patterns. Compare performance across model complexities (e.g., polynomial degree, tree depth) to see if more capacity helps or hurts.

4. Apply remedies for high bias

For high bias, increase model complexity, add more relevant features, reduce regularization, or use a more expressive algorithm (e.g., from linear to ensemble).

5. Apply remedies for high variance

For high variance, get more training data, use regularization (L1/L2, dropout), simplify the model, or use bagging/ensemble methods. Validate with cross-validation.

Key Points to Mention

  • Learning curves as a diagnostic tool
  • Regularization techniques (L1, L2, dropout, early stopping)
  • Cross-validation for reliable performance estimation
  • Ensemble methods (bagging reduces variance, boosting reduces bias)
  • Feature engineering and selection to address bias
  • The role of irreducible error and avoiding overfitting to validation set

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

Q5

For an extremely imbalanced classification problem, which evaluation metrics would you use and when? Compare things like ROC-AUC, PR-AUC, F-beta, precision at k, and calibration metrics.

Product Analytics & MetricsTechnical Trade-offs
Author's notes

I defaulted to PR-AUC over ROC-AUC for imbalanced settings and explained why (ROC can look optimistic when negatives dominate).

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by emphasizing that the choice of metric depends on the specific business objective and the cost of false positives vs. false negatives. Then systematically compare each metric's strengths and weaknesses for imbalanced data, and recommend when to use each based on the problem context.

Pro tip: Always tie the metric back to the business impact—e.g., for fraud detection, missing a fraud (false negative) is costly, so recall or PR-AUC is more relevant than ROC-AUC. Also, mention that calibration is crucial when predicted probabilities are used for decision-making, not just ranking.

1. Clarify the business objective and cost matrix

Understand what the model's predictions will be used for and the relative costs of false positives and false negatives. This determines whether you prioritize precision, recall, or a balance.

2. Evaluate ranking metrics: ROC-AUC vs. PR-AUC

Explain that ROC-AUC can be misleading for imbalanced data because it incorporates true negatives, which are abundant. PR-AUC focuses on the positive class and is more informative when the positive class is rare.

3. Consider threshold-dependent metrics: F-beta and precision at k

F-beta allows you to weight precision and recall according to business needs. Precision at k is useful when you can only act on the top k predictions (e.g., limited resources).

4. Assess calibration for probability reliability

If the model outputs probabilities that will be used directly (e.g., for expected value calculations), calibration metrics like Brier score or reliability diagrams are essential to ensure probabilities are meaningful.

5. Recommend a combination and justify

Suggest using PR-AUC for model selection, then choose a threshold based on F-beta or precision at k, and finally check calibration if probabilities matter. Emphasize that no single metric suffices.

Key Points to Mention

  • ROC-AUC can be overly optimistic for imbalanced data because it includes true negatives.
  • PR-AUC is more sensitive to the positive class and better for rare events.
  • F-beta allows tuning the precision-recall trade-off; F2 favors recall, F0.5 favors precision.
  • Precision at k is useful when only top k predictions can be acted upon.
  • Calibration metrics (e.g., Brier score, reliability diagrams) ensure predicted probabilities are accurate.
  • The choice of metric should align with business costs and the decision threshold.

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

Q6

Compare Transformers and CNNs in terms of their inductive biases, computational complexity, and when you'd choose one over the other, including for tabular fraud features.

Technical Trade-offsSystem DesignAlgorithms & Data Structures
Author's notes

The tabular fraud part caught me off guard.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Structure your answer by first defining inductive biases for each architecture, then comparing computational complexity, and finally discussing selection criteria with a concrete example for tabular fraud detection. Emphasize that the choice depends on data modality, scale, and interpretability requirements, and that hybrid approaches are often used in practice.

Pro tip: Mention that for tabular fraud data, gradient-boosted trees (e.g., XGBoost) often outperform both CNNs and Transformers, but if you must choose a neural approach, a simple MLP or a hybrid CNN-Transformer can be effective. This shows you understand the broader ML landscape and avoid overengineering.

1. Define inductive biases

Explain that CNNs have locality and translation equivariance biases, making them ideal for grid-like data (images, time series). Transformers have minimal inductive bias, relying on self-attention to learn relationships, which allows them to capture long-range dependencies but requires more data.

2. Compare computational complexity

Discuss that CNNs have linear complexity in sequence length for convolutions, while Transformers have quadratic complexity in self-attention, making them more expensive for long sequences. Mention memory and parallelization differences.

3. Outline selection criteria

Describe when to choose CNNs (limited data, local patterns, efficiency) vs Transformers (large datasets, long-range dependencies, multimodal tasks). Highlight that Transformers excel with massive pretraining but CNNs are still strong for vision and efficient inference.

4. Apply to tabular fraud features

For tabular fraud data, note that neither CNNs nor Transformers are typically first choice; tree-based models often dominate. If using neural nets, MLPs or hybrid models (e.g., CNN for feature extraction + Transformer for interactions) can work, but be mindful of overfitting and interpretability.

5. Conclude with practical recommendation

Summarize that the choice depends on data size, modality, and business constraints. For fraud detection at Amazon, consider a hybrid approach or gradient-boosted trees, and always validate with proper metrics like AUC-PR due to class imbalance.

Key Points to Mention

  • Inductive biases: locality/translation equivariance in CNNs vs. minimal bias in Transformers.
  • Computational complexity: O(n) for CNNs vs. O(n^2) for Transformers in sequence length.
  • Data efficiency: CNNs perform well with less data; Transformers require large datasets or pretraining.
  • Long-range dependencies: Transformers capture global context; CNNs focus on local patterns.
  • Tabular data: tree-based models often outperform neural networks; if using neural nets, MLPs or hybrids are preferred.
  • Fraud detection specifics: class imbalance, interpretability, and feature engineering are critical.

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