Interview prep / Amazon ML breadth, math & LLM concepts
Amazon interview practice Candidates report rapid ML breadth questions, math derivations, end-to-end problem solving, and LLM concepts in recent loops.
Each question was reported by a candidate in a public interview write-up, linked on the question. We reword the prompt and write our own answer checkpoints. Reports are candidate accounts, not statements from Amazon, and the company may have changed its questions since.
Coding progress comes from your submissions. Use the answer checkpoints below to review your explanations and design decisions.
Target roleAll roles ML Engineer Applied Scientist Data Scientist Question typeAll rounds Coding ML fundamentals System design DifficultyAll difficulties Easy Medium Hard Search questions
9 questions · 200 min suggested practice
Answer checkpoints & follow-up Our checkpoints for a strong answer (not from the report)
Write mean squared error for regression and cross-entropy for classification. Derive the gradients: (ŷ − y) times the inputs for both linear regression with MSE and logistic regression with cross-entropy. Compute the loss from logits in a numerically stable way. Follow-up: Why is cross-entropy preferred to MSE for classification?
Answer checkpoints & follow-up Our checkpoints for a strong answer (not from the report)
Write the penalized objective for L2 and L1, and the closed form for ridge regression. Explain why L1 gives sparse weights and L2 shrinks them. Connect L2 to a Gaussian prior and L1 to a Laplace prior on the weights. Follow-up: How do you choose the regularization strength?
Answer checkpoints & follow-up Our checkpoints for a strong answer (not from the report)
Write the LSTM gate equations and explain how the cell state carries information across steps. Write scaled dot-product attention and explain that every position attends to every other in one step. Compare sequential versus parallel computation, path length between tokens, and O(n²) attention cost. Follow-up: Why do Transformers need positional encodings and LSTMs do not?
Answer checkpoints & follow-up Our checkpoints for a strong answer (not from the report)
Q, K, and V are learned projections of the token representations; attention weights come from softmax(QKᵀ/√d). BERT attends in both directions for understanding; GPT masks future tokens because it predicts the next token. Encoder-decoder models add cross-attention from the decoder to the encoder outputs. Follow-up: What breaks if you remove the causal mask during GPT training?
Answer checkpoints & follow-up Our checkpoints for a strong answer (not from the report)
A point estimator is a function of the data that estimates a parameter; give its bias and variance. Write expected error as bias² + variance + noise. With little data, prefer a simpler or regularized (higher-bias) model, because variance dominates. Follow-up: Give an example of a biased estimator that is still preferred.
Answer checkpoints & follow-up Our checkpoints for a strong answer (not from the report)
The main source is sampling from the next-token distribution; greedy decoding removes it. Temperature divides the logits: low values sharpen the distribution, high values flatten it. Top-k keeps the k most likely tokens; top-p keeps the smallest set whose probability reaches p. Mention hardware nondeterminism as a smaller source. Follow-up: Why can temperature 0 still give different outputs on different runs?
Answer checkpoints & follow-up Our checkpoints for a strong answer (not from the report)
Pretraining on large data gives general features, so the task needs only a small adjustment. Parameter-efficient methods such as LoRA change few parameters, which limits variance. In-context learning uses examples in the prompt with no weight updates at all. Follow-up: When would you fine-tune instead of using prompts?
System design Hard 45 min
Solve a team problem end to end Reported by a candidate · Applied Scientist · Phone screen + onsite · Sep 2021 · LeetCode Discuss · Amazon Applied Scientist ↗
You get a real problem the team works on. Go through problem formulation, data collection and processing, model choice, evaluation metrics, and how you would explain the metrics to non-technical stakeholders. Expect the interviewer to challenge each choice.
Review MLOps and Data Processing → Answer checkpoints & follow-up Our checkpoints for a strong answer (not from the report)
Turn the business goal into an ML target and a simple baseline before picking a model. For each choice, say what you rejected and why, for example model A over model B. Explain the main metric in business terms, and say how you would monitor it after launch. Follow-up: Your labels are expensive. How do you reduce how many you need?
Answer checkpoints & follow-up Our checkpoints for a strong answer (not from the report)
Define dp[i][j] as the cost to turn the first i characters into the first j characters. Take the minimum of insert, delete, and substitute at each cell. Give O(mn) time, and reduce memory to two rows. Follow-up: How would you also return the sequence of edits?