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

TopicPhone screen QOnsite QResearch QPage link
PerceptronWhat 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 RegressionWhat is MSE and why minimize it?Derive the normal equations from the least-squares objectiveDerive the ridge closed form; explain bias-variance tradeoff for ridge/classical-ml/linear-regression
Logistic RegressionWhat is the sigmoid and why use cross-entropy loss?Derive the gradient of binary cross-entropy with respect to weightsCompare logistic regression to SVM — when does each win?/classical-ml/logistic-regression
Decision TreesWhat is information gain?Derive the Gini impurity and show when it differs from entropyHow does CART differ from ID3/C4.5?/classical-ml/decision-trees
Random ForestsWhat is bagging and why does it reduce variance?Explain feature importance from a random forestBias-variance decomposition for ensembles — what does the ensemble average reduce?/classical-ml/random-forests
Gradient BoostingWhat is boosting?Derive the gradient boosting update (functional gradient descent)Compare XGBoost vs LightGBM vs CatBoost on training algorithm/classical-ml/gradient-boosting
SVMsWhat is the margin maximization intuition?Derive the SVM dual; explain support vectorsExplain the kernel trick — why can you implicitly compute in infinite-dimensional space?/classical-ml/svm
BackpropagationWhat is the chain rule?Derive backprop for a 2-layer MLP from scratchExplain vanishing gradients — why do sigmoid activations cause them?/deep-learning/backprop-and-optimizers
CNNsWhat is weight sharing and why does it help?Compute the output size and parameter count for a conv layerExplain the receptive field growth through a deep CNN/deep-learning/cnns
TransformersWhat 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
AttentionWhat 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 / PEFTWhat is LoRA?Why is LoRA parameter-efficient? Compute the parameter savingsDerive the LoRA update and explain the rank-r assumption on delta W/modern-ai/fine-tuning-and-peft
RAGWhat is retrieval-augmented generation?Walk through the end-to-end RAG pipelineCompare RAG vs fine-tuning — when does each win and why?/modern-ai/rag
RLHFWhat 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 ModelsWhat 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
VAEsWhat is the reparametrization trick?Derive the ELBO (evidence lower bound) for a VAECompare 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: T≤(R/γ)2T \le (R/\gamma)^2 — see Perceptron. The bound states the number of updates is at most (R/γ)2(R / \gamma)^2 where RR is the max norm of any example and γ\gamma is the margin.
  • Normal equations: w^=(X⊤X)−1X⊤y\hat{w} = (X^\top X)^{-1} X^\top y — derived in Linear Regression from setting the gradient of the MSE to zero.
  • Ridge closed form: w^λ=(X⊤X+λI)−1X⊤y\hat{w}_\lambda = (X^\top X + \lambda I)^{-1} X^\top y — same page; shows how regularization adds λ\lambda to the diagonal to fix the ill-conditioned case.
  • SVM dual: max⁡α∑αi−12∑ijαiαjyiyjxi⊤xj\max_\alpha \sum \alpha_i - \frac{1}{2} \sum_{ij} \alpha_i \alpha_j y_i y_j x_i^\top x_j — SVMs. The kernel trick replaces xi⊤xjx_i^\top x_j with k(xi,xj)k(x_i, x_j).
  • Backprop chain rule: ∂L/∂W=∂L/∂z⋅∂z/∂W\partial L / \partial W = \partial L / \partial z \cdot \partial z / \partial W — Backpropagation. Know this for softmax cross-entropy and ReLU activations specifically.
  • VAE ELBO: L=Eqϕ[log⁡pθ(x∣z)]−KL(qϕ(z∣x)∥p(z))\mathcal{L} = \mathbb{E}_{q_\phi}[\log p_\theta(x|z)] - \text{KL}(q_\phi(z|x) \| p(z)) — Autoencoders and VAEs. Reconstruction term minus KL penalty.
  • LoRA parameter budget: if W∈Rm×nW \in \mathbb{R}^{m \times n} and rank r≪min⁡(m,n)r \ll \min(m,n), then ΔW=AB\Delta W = AB with A∈Rm×rA \in \mathbb{R}^{m \times r}, B∈Rr×nB \in \mathbb{R}^{r \times n}; parameters = r(m+n)r(m + n) vs mnmn — see Fine-tuning & PEFT.
  • Scaled dot-product attention: why dk\sqrt{d_k} — see Attention. Without scaling, dot products grow as O(dk)O(d_k) 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 ϵ\epsilon added at step tt — see Diffusion Models. The simplified objective is Et,x0,ϵ[∥ϵ−ϵθ(xt,t)∥2]\mathbb{E}_{t, x_0, \epsilon}[\| \epsilon - \epsilon_\theta(x_t, t) \|^2].

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

PropertyXGBoostLightGBMCatBoost
Tree growth strategyLevel-wise (breadth-first)Leaf-wise (best-first)Symmetric (oblivious) trees
Categorical featuresRequires manual encodingRequires manual encodingNative ordered target encoding
Training speedSlower (level-wise)Fastest (leaf-wise, histogram)Moderate
Overfitting riskModerateHigher (deep leaves)Lower (symmetric trees regularize)
GPU supportYesYesYes
Best forBenchmark default, tabular competitionsVery large datasets, speedHigh-cardinality categoricals, low tuning

Transformer vs Mamba vs RWKV vs RetNet

PropertyTransformerMambaRWKVRetNet
Training parallelismFull (matmul)Full (parallel scan)Full (parallel scan)Full (parallel mode)
Inference per tokenO(n) — reads KV cacheO(1) — fixed stateO(1) — fixed stateO(1) — fixed state
Memory at inferenceO(n) KV cacheO(N) stateO(N) stateO(N) state
Long-context qualityBest (exact attention)Very goodGoodGood
Selective attentionYes (softmax over all tokens)Yes (input-dependent SSM)Partial (fixed decay)Partial (fixed decay)

BERT vs GPT vs T5

PropertyBERTGPTT5
ArchitectureEncoder onlyDecoder onlyEncoder-decoder
Training objectiveMasked language model + NSPAutoregressive LMText-to-text span corruption
Attention maskBidirectionalCausal (left-to-right)Bidirectional in encoder, causal in decoder
Best forClassification, NER, extractive QAText generation, completionTranslation, summarization, generative QA
Parameter efficiencyGood (no decoder)GoodLess efficient (full seq2seq)

Adam vs AdamW vs SGD + momentum

PropertySGD + momentumAdamAdamW
Adaptive learning ratesNo (one global rate)Yes (per-parameter)Yes (per-parameter)
L2 regularization handlingCorrect (decoupled)Incorrect (L2 interacts with adaptive rates)Correct (Loshchilov fix: decouple weight decay from adaptive scaling)
Memory2x params (gradient + momentum)3x params (gradient + m1 + m2)3x params
Best forCV with careful tuning; still used in SGD-heavy trainingNLP, transformers — fast convergenceTransformers, LLMs — standard default

Dropout vs Batch Norm vs Layer Norm

PropertyDropoutBatch NormLayer Norm
MechanismRandomly zeros activations at trainingNormalizes over the batch dimensionNormalizes over the feature dimension
Batch size dependencyNoneStrong (fails at batch size 1)None
Inference behaviorScales by keep rate (or equivalent)Uses running statisticsUses same formula as training
Use in TransformersYes (after attention/FFN)RarelyStandard (pre-norm in modern LLMs)
Primary effectReduces co-adaptation (regularization)Stabilizes activations, speeds trainingStabilizes activations across sequence length

RAG vs Fine-tuning

PropertyRAGFine-tuning
Knowledge updateReal-time (update index, not weights)Requires retraining or continual learning
Source attributionNatural (cite retrieved chunks)Hard (knowledge is in weights)
CostInference cost + retrieval infraTraining compute + storage
Style/format adaptationPoor (LLM style unchanged)Excellent
Domain specializationModerate (retrieval quality matters)Strong (weights adapt to domain)
Hallucination riskLower (grounded in context)Higher for unknown facts

5. Common pitfalls interviewers probe

  1. 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.

  2. 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: 2×80 layers×2×8192 hidden×100,000 tokens×2 bytes≈500 GB2 \times 80 \text{ layers} \times 2 \times 8192 \text{ hidden} \times 100{,}000 \text{ tokens} \times 2 \text{ bytes} \approx 500 \text{ GB}, which exceeds the 80 GB VRAM of an A100.

  3. 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.

  4. 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.

  5. 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.

  6. 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.

  7. 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.

  8. 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.

  9. 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.

  10. 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.

WeekFocusPages to read
Week 1 (Days 1-7)Foundations + Classical MLFoundations: all 9 pages. Classical ML: linear regression, logistic regression, SVMs, decision trees, random forests.
Week 2 (Days 8-14)Deep Learning coreGradient boosting. Deep Learning: MLP, backprop-and-optimizers, regularization, CNNs.
Week 3 (Days 15-21)Modern AI: sequence models + LLMsDeep 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 blitzModern 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.