06 — Interview & Assessment Mastery

The ML interview in 2025 at top-tier companies is not a test of whether you know ML. It is a test of whether you can think about ML under time pressure, explain your reasoning precisely, and demonstrate that you have made real decisions in production. Most candidates fail not because they lack knowledge but because they’ve prepared for the wrong test — grinding LeetCode for a role that will ask them to design a recommendation system from scratch.

This file is a precise specification of what the interview actually tests, with concrete preparation strategies for each component. The goal is not to get lucky — it is to have nothing left to chance.


The Full Interview Loop: What Top Companies Actually Run

Structure (2025 data — FAANG + AI labs + well-funded startups)

Round 1: Initial Screen (30-45 min)
  └── Recruiter: background, compensation, motivations
  └── Hiring Manager OR Senior Engineer: quick technical probe

Round 2: Coding (45-60 min)
  └── 1-2 DSA problems (medium difficulty, occasionally ML-specific)
  └── Sometimes: implement a simple ML function from scratch

Round 3: ML Theory / Model Depth (45-60 min)
  └── Conceptual depth: "explain transformer attention from first principles"
  └── Applied judgment: "you have these two models, which do you deploy and why?"
  └── Debugging: "your loss is oscillating at epoch 3 — walk me through the diagnosis"

Round 4: ML System Design (60 min)
  └── Design a recommendation system, fraud detection, content moderation
  └── This is the senior-differentiating round
  └── Evaluated on: decomposition, trade-off reasoning, constraint awareness, deployment

Round 5: Behavioral (30-45 min)
  └── STAR format: Situation, Task, Action, Result
  └── Emphasis on ambiguous technical decisions, team impact, failure recovery

Round 6 (senior+): Bar Raiser / Cross-team (45-60 min)
  └── Amazon specifically: external bar raiser ensures bar consistency
  └── Culture and leadership principles alignment

What most people get wrong: They spend 80% of their time on coding prep and arrive unprepared for ML System Design, which is the actual differentiator for senior and staff roles. A strong system design round can override a mediocre coding round. The reverse is rarely true.


Round 2: ML Coding — What’s Actually Tested

This is NOT competitive programming. It is implementation fluency. The questions test whether you can translate mathematical definitions into working code under time pressure.

High-frequency questions (implement from scratch):

Attention mechanism:

import torch
import torch.nn.functional as F

def scaled_dot_product_attention(Q, K, V, mask=None):
    """
    Q: (batch, heads, seq_len, d_k)
    K: (batch, heads, seq_len, d_k)
    V: (batch, heads, seq_len, d_v)
    """
    d_k = Q.size(-1)
    # Scaled dot-product
    scores = torch.matmul(Q, K.transpose(-2, -1)) / (d_k ** 0.5)
    if mask is not None:
        scores = scores.masked_fill(mask == 0, float('-inf'))
    attn_weights = F.softmax(scores, dim=-1)
    return torch.matmul(attn_weights, V), attn_weights

Backpropagation (manual, for a 2-layer MLP): Be able to derive and implement the chain rule through a sigmoid, ReLU, and softmax. Know the gradient of cross-entropy loss. This is asked more often than candidates expect.

K-Means from scratch: Implement initialization, assignment, update, convergence check. Know that K-Means is NP-hard in general but Lloyd’s algorithm is practically fast.

Gradient descent variants: SGD, momentum, Adam — implement the update rule from the formula, not from memory of library calls.

Beam search / greedy decoding: For text generation roles.

Preparation strategy:

  • Implement attention, backprop, and a basic transformer block from scratch at least twice before interviews.

  • Do this without referencing any existing code until you’re done, then compare to Karpathy’s nanoGPT as ground truth.

  • Time yourself: attention implementation should take <25 minutes. If it takes 45, you need more practice.


Round 3: ML Theory Depth — What “First Principles” Actually Means

Interviewers at AI labs (Anthropic, OpenAI, DeepMind) specifically probe whether your understanding is shallow or deep. The tell: shallow candidates can explain what something does; deep candidates can explain why it is designed that way and what would break if you changed the design.

High-value question: “Explain transformer attention from first principles.”

Weak answer: “Attention computes a weighted sum of values where weights are computed from query-key dot products.”

Strong answer:

“The problem attention solves is that RNNs compress an entire context into a fixed-size hidden state, losing information proportional to sequence length. The core insight is: instead of one summary vector, let each output position directly attend to all input positions. We project input tokens into Q, K, V spaces. The Q-K dot product measures compatibility between a query and each key — scaled by √d_k to prevent the softmax from saturating in high-dimensional spaces (Vaswani et al. ablate this explicitly). Softmax converts scores to a probability distribution over positions. The weighted sum of V produces an output that aggregates information from wherever the query found relevant keys. Multi-head attention runs this in parallel from multiple projection subspaces so the model can attend to different aspects of the input simultaneously. The whole thing is differentiable end-to-end, which is why it can be learned.”

The difference is causal reasoning — why each design choice exists, with reference to what would fail without it.

Diagnostic questions to prepare for:

Question

What They’re Testing

“Why does LayerNorm go before the sublayer in modern transformers, not after?”

Awareness of Pre-LN vs Post-LN stability issues

“Why does beam search not always produce the highest-probability sequence?”

Understanding that beam search is approximate; global optimum is NP-hard

“What is the fundamental problem with supervised fine-tuning alone for alignment?”

Distribution shift, reward hacking, inability to specify all failure modes

“Why does GQA reduce memory without reducing model quality significantly?”

Keys and values are less query-position-specific; grouped sharing is sufficient

“Your training loss diverges at step 5000. What do you check first?”

Systematic debugging: LR, gradient norms, weight norms, data corruption, batch stats


Round 4: ML System Design — The Senior Differentiator

This round has the highest variance in preparation quality. Most candidates either describe an architecture without discussing trade-offs, or discuss trade-offs without grounding them in real constraints. The evaluator is looking for the thinking pattern of someone who has shipped systems.

The canonical ML system design questions:

  1. Design a recommendation system for a video platform (YouTube-scale)

  2. Design a content moderation system for a social platform

  3. Design a real-time fraud detection system for a payments company

  4. Design a news feed ranking system

  5. Design a search system with semantic understanding

The framework that works:

Step 1: Clarify constraints (3-5 minutes)
  - Scale: QPS, daily active users, latency SLA
  - Data: What do we have? Labels? Historical behavior?
  - Business objective: Optimize for what? Clicks? Watch time? Safety?
  - Constraints: Regulatory? Explainability required?

Step 2: Define the ML problem formally (2-3 minutes)
  - What are inputs, outputs, labels?
  - Is this classification, ranking, generation?
  - What is the training/serving distribution mismatch risk?

Step 3: Data pipeline
  - Feature engineering: user features, item features, context features
  - Training data collection, labeling strategy
  - Data freshness requirements (real-time vs batch)

Step 4: Model architecture
  - Start simple. Justify every complexity increase.
  - Offline vs online evaluation metrics (and why they diverge)

Step 5: Serving infrastructure
  - Latency budget breakdown
  - Caching, approximate nearest neighbor, two-tower architecture for retrieval
  - A/B testing framework

Step 6: Monitoring and feedback
  - What can go wrong post-deploy?
  - Model degradation signals
  - Data drift detection

The over-engineering pitfall: Candidates propose Kubernetes clusters, Kafka pipelines, and transformer models for Day 1. The evaluator wants to see: “Start with logistic regression and collaborative filtering. Here is the specific performance characteristic that would force an upgrade to a neural architecture.” Premature complexity signals that you’ve read about systems, not run them.

Salary context (2025 data, India with international positioning):

Role

India (top-tier product companies)

Remote/Relocation (US)

Senior MLE (5-7 yrs)

₹40-80 LPA

$180K-$250K TC

Staff MLE (8-12 yrs)

₹80-150 LPA

$280K-$400K TC

ML Research Engineer

₹50-100 LPA

$200K-$350K TC

Meta E4 (equivalent)

$270K-$330K TC

TC = total compensation (base + equity + bonus). Numbers from Levels.fyi 2025 data.

The leverage for Indian engineers: remote-first AI labs (Cohere, Hugging Face, Mistral, EleutherAI) now hire globally for research-grade applied engineers. The differentiator is a public portfolio, not just a resume.


The Portfolio Walk-Through

In every senior interview, expect: “Walk me through the most technically complex ML project you’ve worked on.”

Weak version: “I built a recommendation model that improved CTR by 12%.”

Strong version:

“We had a cold-start problem for new users in a ranking system. I ran an experiment comparing content-based features vs collaborative filtering vs a hybrid approach. Collaborative filtering had the highest offline AUC (0.82 vs 0.74) but lowest online CTR delta (+3.1% vs +5.4% for hybrid) — which forced us to understand the AUC-to-CTR calibration gap and led to changing our offline evaluation metric to NDCG@10. The key technical decision was implementing a two-tower architecture with separate user/item encoders so we could pre-compute item embeddings offline and reduce serving latency from 210ms to 38ms p99.”

The strong version has: a precise technical decision, a measurement that revealed something non-obvious, a consequence, and a specific metric. This is not a coincidence — prepare this story with those elements deliberately.


Demonstrating “Research-Grade Applied Engineer”

The specific positioning that opens AI lab doors:

  1. You have read primary sources, not summaries. Drop a reference to a paper’s specific ablation, not its general conclusion.

  2. You can critique methodology. “The benchmark used in that paper has known contamination issues from training data overlap.”

  3. You have reproduced something. “I implemented Flash Attention’s tiling algorithm from the paper — here is what the paper underspecified.”

  4. You have a public contribution. GitHub PR, open-source merged contribution, or a technical post with measurable engagement.

  5. You have formed and shared opinions. A blog post, a tweet thread with technical depth, a talk.

None of these require a PhD. All of them require deliberate work. That is the whole point.


Return to README.md · Previous: 05_staying_current_system.md · Next: 07_the_applied_phd_identity.md