Interview Prep Guide
This page aggregates the highest-signal interview material from across the hub. There is no new theory here — everything links back to the page where it is derived. Use this as a navigator for focused preparation.
1. Interview levels explained
Phone screen (30—45 min): Concept recognition and high-level intuition. Expect: “What is regularization?”, “Why use batch norm?”, “What is the bias-variance tradeoff?”. No derivations. The bar is: could you explain this to a junior engineer?
Onsite technical (45—60 min per round): You will be asked to derive things on a whiteboard. Expect: “Derive the normal equations for linear regression”, “Walk me through backpropagation”, “How does the attention mechanism work — write the formula”. You should be able to get from “definition” to “working formula” for all core topics. Mathematical comfort matters.
Research interview (60 min): Deep engagement with a specific paper or research area. Expect: “What are the limitations of RLHF compared to DPO?”, “Explain the Mamba selective state space”, “Why does LoRA work — what assumption does it make about weight updates?”. The bar is paper-level understanding plus the ability to critique and extend.
Staff / principal interview: System design + technical depth. Expect: “Design an ML system for X at Google-scale”, “How would you evaluate a large-scale retrieval system?”, “What would you change about the Transformer architecture and why?”. Combines all levels plus architectural judgment.
2. Topic-by-topic question map
| Topic | Phone screen Q | Onsite Q | Research Q | Page link |
|---|---|---|---|---|
| Perceptron | What is a perceptron and what can it not learn? | Prove the perceptron convergence theorem (give the bound) | What does the convergence bound tell us about the geometry of the problem? | /foundations/perceptron |
| Linear Regression | What is MSE and why minimize it? | Derive the normal equations from the least-squares objective | Derive the ridge closed form; explain bias-variance tradeoff for ridge | /classical-ml/linear-regression |
| Logistic Regression | What is the sigmoid and why use cross-entropy loss? | Derive the gradient of binary cross-entropy with respect to weights | Compare logistic regression to SVM — when does each win? | /classical-ml/logistic-regression |
| Decision Trees | What is information gain? | Derive the Gini impurity and show when it differs from entropy | How does CART differ from ID3/C4.5? | /classical-ml/decision-trees |
| Random Forests | What is bagging and why does it reduce variance? | Explain feature importance from a random forest | Bias-variance decomposition for ensembles — what does the ensemble average reduce? | /classical-ml/random-forests |
| Gradient Boosting | What is boosting? | Derive the gradient boosting update (functional gradient descent) | Compare XGBoost vs LightGBM vs CatBoost on training algorithm | /classical-ml/gradient-boosting |
| SVMs | What is the margin maximization intuition? | Derive the SVM dual; explain support vectors | Explain the kernel trick — why can you implicitly compute in infinite-dimensional space? | /classical-ml/svm |
| Backpropagation | What is the chain rule? | Derive backprop for a 2-layer MLP from scratch | Explain vanishing gradients — why do sigmoid activations cause them? | /deep-learning/backprop-and-optimizers |
| CNNs | What is weight sharing and why does it help? | Compute the output size and parameter count for a conv layer | Explain the receptive field growth through a deep CNN | /deep-learning/cnns |
| Transformers | What is self-attention? | Write the scaled dot-product attention formula; explain why sqrt(d_k) | Derive the parameter count per Transformer block; explain pre-norm vs post-norm | /modern-ai/transformers |
| Attention | What is the difference between self-attention and cross-attention? | Explain multi-head attention — why multiple heads? | Derive the O(n^2) cost; compare to linear attention approximations | /modern-ai/attention |
| LoRA / PEFT | What is LoRA? | Why is LoRA parameter-efficient? Compute the parameter savings | Derive the LoRA update and explain the rank-r assumption on delta W | /modern-ai/fine-tuning-and-peft |
| RAG | What is retrieval-augmented generation? | Walk through the end-to-end RAG pipeline | Compare RAG vs fine-tuning — when does each win and why? | /modern-ai/rag |
| RLHF | What is the purpose of the reward model in RLHF? | Explain the three-stage RLHF pipeline (SFT -> RM -> PPO) | Derive the DPO loss from the KL-regularized RL objective | /modern-ai/fine-tuning-and-peft |
| Diffusion Models | What is the forward and reverse process in diffusion? | Explain the DDPM objective — what is the model actually predicting? | Derive the ELBO for diffusion; explain the connection to score matching | /modern-ai/diffusion-models |
| VAEs | What is the reparametrization trick? | Derive the ELBO (evidence lower bound) for a VAE | Compare VAE vs GAN — mode collapse vs posterior collapse | /deep-learning/autoencoders-and-vaes |
3. Derivations you must know cold
These are the derivations that recur most frequently across research-track interviews. Each item links to the page where it is worked through in full. Practice doing each from memory in under 5 minutes.
- Perceptron convergence: — see Perceptron. The bound states the number of updates is at most where is the max norm of any example and is the margin.
- Normal equations: — derived in Linear Regression from setting the gradient of the MSE to zero.
- Ridge closed form: — same page; shows how regularization adds to the diagonal to fix the ill-conditioned case.
- SVM dual: — SVMs. The kernel trick replaces with .
- Backprop chain rule: — Backpropagation. Know this for softmax cross-entropy and ReLU activations specifically.
- VAE ELBO: — Autoencoders and VAEs. Reconstruction term minus KL penalty.
- LoRA parameter budget: if and rank , then with , ; parameters = vs — see Fine-tuning & PEFT.
- Scaled dot-product attention: why — see Attention. Without scaling, dot products grow as in magnitude, pushing softmax into the saturation region with near-zero gradients.
- BPE tokenization: greedy merge of the most frequent byte-pair until vocabulary size is reached — see Tokenization & Embeddings.
- DDPM ELBO: the training objective reduces to predicting the noise added at step — see Diffusion Models. The simplified objective is .
4. Comparison tables interviewers love to ask
These comparisons come up in nearly every ML interview. Study the key axes, not just the names.
XGBoost vs LightGBM vs CatBoost
| Property | XGBoost | LightGBM | CatBoost |
|---|---|---|---|
| Tree growth strategy | Level-wise (breadth-first) | Leaf-wise (best-first) | Symmetric (oblivious) trees |
| Categorical features | Requires manual encoding | Requires manual encoding | Native ordered target encoding |
| Training speed | Slower (level-wise) | Fastest (leaf-wise, histogram) | Moderate |
| Overfitting risk | Moderate | Higher (deep leaves) | Lower (symmetric trees regularize) |
| GPU support | Yes | Yes | Yes |
| Best for | Benchmark default, tabular competitions | Very large datasets, speed | High-cardinality categoricals, low tuning |
Transformer vs Mamba vs RWKV vs RetNet
| Property | Transformer | Mamba | RWKV | RetNet |
|---|---|---|---|---|
| Training parallelism | Full (matmul) | Full (parallel scan) | Full (parallel scan) | Full (parallel mode) |
| Inference per token | O(n) — reads KV cache | O(1) — fixed state | O(1) — fixed state | O(1) — fixed state |
| Memory at inference | O(n) KV cache | O(N) state | O(N) state | O(N) state |
| Long-context quality | Best (exact attention) | Very good | Good | Good |
| Selective attention | Yes (softmax over all tokens) | Yes (input-dependent SSM) | Partial (fixed decay) | Partial (fixed decay) |
BERT vs GPT vs T5
| Property | BERT | GPT | T5 |
|---|---|---|---|
| Architecture | Encoder only | Decoder only | Encoder-decoder |
| Training objective | Masked language model + NSP | Autoregressive LM | Text-to-text span corruption |
| Attention mask | Bidirectional | Causal (left-to-right) | Bidirectional in encoder, causal in decoder |
| Best for | Classification, NER, extractive QA | Text generation, completion | Translation, summarization, generative QA |
| Parameter efficiency | Good (no decoder) | Good | Less efficient (full seq2seq) |
Adam vs AdamW vs SGD + momentum
| Property | SGD + momentum | Adam | AdamW |
|---|---|---|---|
| Adaptive learning rates | No (one global rate) | Yes (per-parameter) | Yes (per-parameter) |
| L2 regularization handling | Correct (decoupled) | Incorrect (L2 interacts with adaptive rates) | Correct (Loshchilov fix: decouple weight decay from adaptive scaling) |
| Memory | 2x params (gradient + momentum) | 3x params (gradient + m1 + m2) | 3x params |
| Best for | CV with careful tuning; still used in SGD-heavy training | NLP, transformers — fast convergence | Transformers, LLMs — standard default |
Dropout vs Batch Norm vs Layer Norm
| Property | Dropout | Batch Norm | Layer Norm |
|---|---|---|---|
| Mechanism | Randomly zeros activations at training | Normalizes over the batch dimension | Normalizes over the feature dimension |
| Batch size dependency | None | Strong (fails at batch size 1) | None |
| Inference behavior | Scales by keep rate (or equivalent) | Uses running statistics | Uses same formula as training |
| Use in Transformers | Yes (after attention/FFN) | Rarely | Standard (pre-norm in modern LLMs) |
| Primary effect | Reduces co-adaptation (regularization) | Stabilizes activations, speeds training | Stabilizes activations across sequence length |
RAG vs Fine-tuning
| Property | RAG | Fine-tuning |
|---|---|---|
| Knowledge update | Real-time (update index, not weights) | Requires retraining or continual learning |
| Source attribution | Natural (cite retrieved chunks) | Hard (knowledge is in weights) |
| Cost | Inference cost + retrieval infra | Training compute + storage |
| Style/format adaptation | Poor (LLM style unchanged) | Excellent |
| Domain specialization | Moderate (retrieval quality matters) | Strong (weights adapt to domain) |
| Hallucination risk | Lower (grounded in context) | Higher for unknown facts |
5. Common pitfalls interviewers probe
-
Confusing L1 and L2 regularization effects: L2 (ridge) shrinks all weights proportionally. L1 (lasso) produces exact zeros. Interviewers often ask “which produces sparse models and why?” — the answer is L1, because the L1 ball has corners on the axes.
-
KV cache memory calculation: interviewers often ask “why can’t you run Llama-2-70B with 100k context on a single A100?” The answer is the KV cache: , which exceeds the 80 GB VRAM of an A100.
-
Train-test leakage subtlety: scaling features (normalize, impute, etc.) using statistics computed on the full dataset (including test) constitutes leakage. Always fit preprocessors on training data only, then apply to test. See Data & Leakage.
-
Accuracy is a bad metric for class imbalance: a model that predicts the majority class always can achieve 99% accuracy on a 1% positive-class dataset. Always report precision, recall, F1, and AUC for imbalanced problems.
-
Confusing correlation and feature importance: a feature can have low Pearson correlation with the label but high tree feature importance (because importance is marginal over splits, which can capture interactions). Pearson correlation measures linear marginal dependence only.
-
The deadly triad in RL: off-policy learning + function approximation + bootstrapping can diverge. This is why DQN needs target networks and experience replay — the combination without those stabilizers diverges in practice. See Foundations of RL.
-
Assuming softmax outputs are probabilities: softmax outputs are valid probabilities (sum to 1, all positive), but they are not calibrated probabilities unless the model has been explicitly calibrated. Overconfident softmax outputs are common in deep models.
-
LoRA vs full fine-tuning on new tasks: LoRA is not always better. For tasks that require substantial distribution shift from the base model (entirely new format, new language), full fine-tuning of all layers often outperforms LoRA at the same parameter budget. LoRA is best for tasks that are stylistically similar to the base training distribution.
-
Cross-validation leakage with time-series data: random k-fold CV on time-series data leaks future information into training. Use temporal splits (train on past, validate on future) or time-series cross-validation.
-
Gradient accumulation changes effective batch norm behavior: if you use gradient accumulation to simulate a large batch, but with batch normalization, the batch norm statistics are computed on the small actual batch at each step, not the accumulated large batch. This can cause inconsistency. Prefer layer norm or group norm when using gradient accumulation.
6. 30-day study plan
A suggested order for someone starting from a solid math and Python foundation with 30 days before an interview. Adjust pace based on existing familiarity.
| Week | Focus | Pages to read |
|---|---|---|
| Week 1 (Days 1-7) | Foundations + Classical ML | Foundations: all 9 pages. Classical ML: linear regression, logistic regression, SVMs, decision trees, random forests. |
| Week 2 (Days 8-14) | Deep Learning core | Gradient boosting. Deep Learning: MLP, backprop-and-optimizers, regularization, CNNs. |
| Week 3 (Days 15-21) | Modern AI: sequence models + LLMs | Deep Learning: RNNs/LSTMs/GRUs, autoencoders/VAEs, GANs. Modern AI: attention, transformers, tokenization, encoder-decoder-models, fine-tuning-and-peft. |
| Week 4 (Days 22-30) | Advanced topics + interview blitz | Modern AI: RAG, agents, diffusion-models, scaling-laws. Production: serving-and-inference, evaluation-and-benchmarks. Cutting Edge: reasoning-models, post-transformer-architectures. Then: review this interview prep page, re-derive all items in Section 3 from memory. |