AI Interviews

AI Infra Engineer

What Senior and Staff AI Infra loops test, ranked from reported questions: batching, overload, concurrent coding, parallelism math, GPU scheduling and weight distribution, plus a back-of-envelope sheet to derive out loud.

Researched

On this page

This chapter is for you if you have built backend or distributed systems and want a Senior or Staff role serving models, scheduling GPUs or running an ML platform. You get the loop shape, 13 ranked themes with what a strong answer covers, a back-of-envelope sheet with worked numbers, Senior vs Staff signals and a lab-based prep path. It is built from the 156 questions in the bank tagged AI Infra or both tracks (as of 2026-10-11). The bank leans on two companies: Anthropic appears in 20% of these rows and NVIDIA in 13%, much of it from PracHub listings. Most rows rest on one anonymous account or a prep site, so treat every company claim below as reported, not as policy.

The role at Senior and Staff

AI Infra Engineers keep models running: inference serving, batching and scheduling, GPU fleets, weight distribution, training infrastructure and the platform around them. The research’s main finding is that these loops mostly ask distributed-systems and concurrency questions in inference form: batch requests onto a GPU, distribute a large file to thousands of machines, recover when a node dies mid-job. Anthropic’s careers page says “about half our technical staff had no prior ML experience” (Anthropicofficial).

Postings show the top-end depth. A Google DeepMind Staff inference posting asks for modifying serving codebases, vLLM, TensorRT-LLM, SGLang or Dynamo, and modelling how batch size and utilization trade latency against cost (Google (posting mirrored on AnitaB.org)official · 20 Aug 2026). An NVIDIA inference posting asks for CUDA or Triton, Nsight and vLLM, SGLang or TensorRT-LLM contributions (NVIDIA (via AnitaB.org jobs)official · 28 Apr 2026).

How much CUDA you need is disputed. One prep guide says Senior+ candidates should read or write Triton and CUDA (techinterview.orgsecondary · 2026); another says you only need to know where Python ends and C++/CUDA begins (techinterview.orgsecondary · 2026). It likely depends on whether the role is kernel work or platform work. The research found no first-hand report of a live CUDA or Triton kernel-writing round.

What the loop looks like

A typical reported shape: a recruiter call, an online assessment or coding screen, then four to six onsite rounds from the list below.

RoundWhat candidates reportSources
Online assessmentAnthropic: CodeSignal with progressive levels and many edge-case tests; one commenter finished in 65 of 90 minutes (2024)Blindfirst-hand · 4 Apr 2024
Practical, concurrent codingAnthropic: turn profiler samples into an execution trace; a web crawler, then make it multithreaded; an image-processing pipeline. Baseten: a thread pool, a chunked parallel download. CoreWeave: a Go concurrency challengeAcedfirst-hand, Acedfirst-hand, Acedfirst-hand · 2025, PracHubaggregator · 2026, Glassdoorsnippet only
Classic DSA and C/C++NVIDIA: an LRU cache then a multithreaded one; memcpy versus memmove; plain LeetCode in many loopsAcedfirst-hand · 2025, Acedfirst-hand · 2026
Low-level and storage designDatabricks Staff, AI platform team: a log writer that batches WAL writes, then a KV store with locking, and no LLM questions at allPracHubfirst-hand · 25 Aug 2026
System designAnthropic: a batching layer for one GPU; distributing one large file to thousands of machines; a sampling API designed in a Google DocAcedfirst-hand, Acedfirst-hand · 2025, Acedfirst-hand · 2026
Design-doc reviewAnthropic: a Staff phone screen that was a design-doc review, which became a deep dive on overload protectionAcedfirst-hand · 2026
Domain deep diveAnthropic: performance-model a sharded matmul (aggregator). OpenAI Research Engineer: implement all_gather and bound its rounds. NVIDIA: kernel fusion and launch overhead (snippet)PracHubaggregator · 2026, Acedfirst-hand, Glassdoorsnippet only
Take-homeAnthropic: optimize code for a simulated accelerator, with AI explicitly allowed. Claude Opus 4 beat almost all applicants at 4 hours; Opus 4.5 matched the best human on the 2-hour redesign, so Anthropic moved to puzzle-style problems. Fireworks: a take-home and technical review (prep guide)Anthropicofficial · 21 Jan 2026, PracHubsecondary · 2026
AI-assisted codingMeta: debug a toy codebase, write a naive solution, benchmark it, optimize it. Anthropic bans AI in live rounds unless told otherwise. Most infra-cloud companies: no policy foundYuan Meng (personal blog)first-hand, Anthropicofficial · 10 Jul 2025
Project deep dive and valuesAnthropic: was a project that cost about $20M of engineer time worth it? A Senior Staff infra candidate thinks the culture round sank his loop, and a commenter on his thread says the same of theirs (their reading, not stated feedback)Blindfirst-hand

The company cards have each reported loop and AI-tool policy with dates. The Together, Fireworks, Baseten and Modal loops rest almost entirely on prep sites.

Ranked themes

Themes are listed in the site’s rank order, which comes from how many sourced rows touched each theme in the first research pass. The number after each heading is how many rows the bank holds today for the theme (AI Infra plus both-track rows). Overload and failure ranks second with only 5 rows of its own because it mostly shows up as follow-ups inside batching and scheduling questions. Each theme links to the filtered bank.

1. Batching and inference scheduling (12)

What gets asked. Design a batching layer for one GPU that takes up to 100 inputs per batch while each caller waits for its result; follow-ups on how to return each response, when to flush a batch, failure points and how to choose among several GPUs (Anthropic, high confidence, Acedfirst-hand, Acedaggregator). Design ChatGPT-style serving with separate budgets for time to first token (TTFT) and inter-token latency, a client that disconnects mid-reply, and a long shared system prompt (OpenAI, aggregator, PracHubaggregator · 2026). Code a continuous-batching decode loop over a mock model (xAI, aggregator, PracHubaggregator).

A strong answer flushes on whichever comes first, a full batch or a wait deadline. It bounds the queue, returns each result through a per-request future, handles timeouts and cancellation, and pushes back with an explicit rejection when full. For generation it batches at the token level, refilling slots as sequences finish, and treats KV-cache memory as the real batch limit (see the headroom formula below). A Baseten guide adds: autoscale on queue depth or TTFT, not GPU utilization, and raise cold starts unprompted (techinterview.orgsecondary · 2026).

Senior vs Staff. The Staff inference candidate in one report believes pushing back on the interviewer’s “unrealistic assumptions” sank them; the interviewer wanted the model treated as a black box (Acedfirst-hand). Accept the framing, then add depth on scheduling, queueing and failure.

Labs. Build Your Own LLM Inference EnginePartial has a real KV cache, but its batching is bookkeeping and it does not stream tokens or measure TTFT. Build Your Own Message Queue (SQS-lite)Partial and Build Your Own Distributed Rate Limiter cover the queue and admission control in front of a batcher. Batching questions.

2. Overload, failure and fault tolerance (5)

What gets asked. A training job on 500 nodes loses one: how fast do you detect it, do you restart or let the cluster catch up, and do you even need 500 nodes (NVIDIA Senior, first-hand, Acedfirst-hand · 2025)? Detect, drain and return GPUs with intermittent ECC errors across 5,000 GPUs (Fluidstack, prep site, techinterview.orgsecondary · 2026). Anthropic’s design-doc review turned into failure handling and overload protection (Acedfirst-hand · 2026).

A strong answer raises these before being asked: heartbeats and timeouts for detection, leases and fencing so a stale worker cannot write, bounded retries with a budget, idempotent requests, load shedding by priority, and how much work a checkpoint restart loses. One guide says reliability counts for more than “exotic architecture” (DesignGurussecondary · 2026). Staff answers challenge the requirement itself, as the 500-node follow-up invites.

Labs. Build Your Own Gossip Protocol (SWIM)Partial for failure detection, Build Your Own L7 Load Balancer for health checks, circuit breakers and retry budgets, Build Your Own Distributed Lock Manager for leases and fencing tokens. Overload questions.

3. Practical concurrent coding (23)

What gets asked. Convert sampled stack traces into an execution trace, with a follow-up that removes one constraint (Anthropic, high confidence, Acedfirst-hand, Acedfirst-hand · 2026). Write a web crawler, then make it multithreaded; that candidate ran out of time (Acedfirst-hand). Build a cache for container-image chunks that coalesces two simultaneous misses (Modal, prep site, techinterview.orgsecondary · Jul 2026). A thread-safe durable event writer shared by thousands of threads (Databricks, aggregator, PracHubaggregator).

A strong answer gets a correct single-threaded version running fast, then adds concurrency deliberately: what each lock protects, a bounded worker pool, single-flight coalescing, cancellation, and tests that build their own fixtures. Rejected Anthropic candidates point to unfinished tasks and follow-ups, not wrong first answers. Yuan Meng writes that without a quick insight “I never get a ‘strong yes’”, that needing hints can still reach a “weak yes”, and that panicking while debugging is “a strong signal for rejection” (Yuan Meng (personal blog)first-hand).

Labs. Build Your Own Write-Ahead Log builds group commit, the trade-off behind the Databricks batch-write round. Build Your Own CDN Edge Node builds request coalescing and stale-if-error (its tests pass as of 2026-10-13). Build Your Own Server I/O ModelNeeds measurement covers blocking versus event-driven I/O. Concurrency questions.

4. Parallelism, collectives and sharding math (9)

What gets asked. Estimate FFN compute, memory traffic and communication under three sharding schemes, and explain why FFN-dimension sharding needs an output reduction (Anthropic, aggregator, PracHubaggregator · 2026). Explain data, tensor and pipeline parallelism and why column- and row-parallel layers alternate (Amazon, aggregator, PracHubaggregator · 2025). Serve a 70B model on 4×A100-80GB with tensor parallelism of 2 or 4 (prep site, techinterview.orgsecondary · 2026).

A strong answer says what each GPU holds, which collective runs, and how many bytes it moves (the ring formula below). For the 70B question: at TP=2 each GPU holds 140 ÷ 2 = 70 GB of BF16 weights, leaving about 10 GB of 80 for KV cache and activations. At TP=4 it is 35 GB per GPU, so more cache room and a shorter per-token decode time (17.2 ms against 34.3 ms from the bandwidth bound below), paid for with an all-reduce per layer across four GPUs. No lab covers parallelism yet (planned as training-parallelism); Build Your Own Transformer From Scratch gives you the layer shapes. Parallelism questions.

5. GPU fleet scheduling and fairness (12)

What gets asked. One 8-GPU node serves a large model that needs all 8 GPUs and a small one that needs 1: design routing and placement, then handle one failed GPU in the group and small-model traffic starving the large one (Anthropic, aggregator, PracHubaggregator · 2026). A text-to-video backend as a GPU job scheduler with leases, fencing, bounded retries and a paid tier (OpenAI, aggregator, PracHubaggregator · 2026). A GPU-aware pod scheduler: best-fit versus first-fit and fragmentation (Together, aggregator, PracHubaggregator · 2025).

A strong answer covers gang scheduling (a multi-GPU job gets all its GPUs or none), packing versus spreading, fragmentation, topology (which GPUs share fast links), fair-share queues with priority and preemption, and quotas. Staff answers price the trade-offs, such as when a customer with a tail-latency requirement gets a dedicated endpoint instead of the shared pool (techinterview.orgsecondary · 2026).

Labs. Build Your Own Container OrchestratorPartial has a reconcile loop and first-fit scheduling on CPU and memory, with no GPU resource type or gang scheduling; adding those is the exercise. GPU scheduling and multi-LoRA serving are gaps (planned as gpu-scheduler and multi-lora-serving). Scheduling questions.

6. Weight distribution, cold start and model residency (6)

What gets asked. Distribute one large file to thousands of machines over bandwidth-limited links (Anthropic Staff, first-hand, Acedfirst-hand · 2025). Design a chunk-based model download pipeline: chunk size, pipeline versus tree fan-out, recovery with and without a coordinator (Blind, first-hand, Blindfirst-hand). Keep a warm pool and make the second cold start of a 40 GB model fast (Modal, prep site, techinterview.orgsecondary · Jul 2026).

A strong answer starts with numbers. With one source sending 140 GB of weights to 1,000 machines over an assumed 10 Gbit/s (1.25 GB/s) link, the time is 1,000 × 140 ÷ 1.25 = 112,000 s, about 31 hours. If every receiver forwards chunks onward, as in a pipelined chain or a peer-to-peer swarm, the total approaches one copy’s time, 140 ÷ 1.25 = 112 s, plus a per-hop term. Then add checksums per chunk, a local disk cache, staged rollout and rollback.

Labs. Build Your Own Gossip Protocol (SWIM)Partial, Build Your Own CDN Edge Node (coalescing and stale-while-revalidate), and Build Your Own FaaS Runtime, whose cold start is a simulated sleep, so it teaches the warm-pool logic, not load times. Cold-start questions.

7. Rate limits, credits and quotas (3)

All three rows are low-confidence snippets: a distributed rate limiter for an LLM API (OpenAI, Glassdoorsnippet only), a GPU credit system (Exponentaggregator), compound limits on one request (xAI, University of Miami career blogsnippet only · 14 May 2026). The LLM twist is that you limit tokens, and output length is unknown up front, so you reserve an estimate and reconcile when the request finishes. Build Your Own Distributed Rate Limiter counts requests only; a token-aware gateway is a gap (planned as llm-gateway).

8. Implement attention and the KV cache (11)

What gets asked. Find the bugs in a few hundred lines of transformer code, then add KV caching (OpenAI Research Engineer, first-hand, Acedfirst-hand). Implement multi-head attention, then a KV cache and grouped-query attention in the same hour (Anthropic, one Blind comment, Blindfirst-hand · 2026). Masked multi-head self-attention from scratch (Meta and Apple, aggregator, PracHubaggregator, PracHubaggregator).

A strong answer writes the shapes at every step, applies the causal mask, subtracts the row max before softmax, appends to the cache along the sequence axis, and implements GQA by sharing each KV head across a group of query heads. Test against a reference implementation. Labs: Build Your Own Transformer From Scratch and Build Your Own LLM Inference EnginePartial. Attention questions.

9. Roofline and performance reasoning (7)

What gets asked. Performance-model a sharded matmul: FLOPs, bytes, network traffic, the ridge point, the small-M decode case, and when K-sharding becomes network-bound (Anthropic, aggregator, PracHubaggregator · 2026). Why is decode memory-bound and prefill compute-bound (prep site, techinterview.orgsecondary · 23 Jul 2026)? The sheet below works these through. No lab measures a GPU. Roofline questions.

10. Linux and Kubernetes diagnosis (5)

A pod stuck in Pending (CoreWeave, snippet, Glassdoorsnippet only); a server saturated by logging and slow networking inside containers (Together, aggregator, PracHubaggregator · 2026); a slow notebook in a deliberately vague Kafka-plus-Jupyter architecture (NVIDIA Senior, first-hand, Acedfirst-hand · 2025). Strong answers form a hypothesis, ask for the metric that tests it, and narrow down. Build Your Own Observability StackPartial and Build Your Own Container RuntimePartial partly cover this; neither builds cleanly yet.

11. Design-doc critique (2)

Review a design doc for a batch sampling service (Anthropic Staff, first-hand, Acedfirst-hand · 2026), or critique a half-built inference design. The engineering-manager report says the emphasis was design judgment, communication and review skills, not calculations (Acedfirst-hand · 2026). Walk the request path, find unbounded queues, missing back-pressure, retry storms and single points of failure, and rank what you found by impact.

12. Quantization, speculative decoding and MoE (6)

Quantize an FP32 tensor to INT8 and back in NumPy, then add per-channel scales (NVIDIA, aggregator, PracHubaggregator · 2026). What does “671B total, 37B active” predict about serving cost (techinterview.orgsecondary · 2026)? Why did throughput drop at high batch sizes after enabling speculative decoding (techinterview.orgsecondary · 2026)? Treat each as a trade-off with a measurable cost, not a buzzword (techinterview.orgsecondary · 2026). Labs: Build Your Own Model Quantizer (GGUF)Partial and Build Your Own Speculative DecodingPartial.

13. Training infrastructure and checkpointing (7)

Design a distributed training environment for a 1-trillion-parameter model; the candidate called it their weakest round because the interviewer asked how they had benchmarked and debugged low GPU utilization and which NVIDIA tools they had used (NVIDIA Senior, first-hand, Acedfirst-hand · 2025). Move 200 TB of media to a cloud GPU cluster in a few days (Apple, first-hand, PracHubfirst-hand · Aug 2026): at 10 Gbit/s that is 200 × 10¹² × 8 ÷ 10¹⁰ = 160,000 s, about 1.85 days of line rate, so link speed decides between the network and shipping disks. Build Your Own Transformer From Scratch has training with checkpoints; sharded checkpoints are a gap (planned as sharded-checkpointing).

Also in most loops: classic DSA (8), behavioral and values (14), AI-assisted coding (21)

Classic coding persists, especially at NVIDIA (see the loop table). Behavioral rounds probe how you allocate limited compute across projects (NVIDIA, Acedfirst-hand · 2025) and whether a project was worth what it cost (Blindfirst-hand). The AI-assisted rows are shared with the AI Engineer chapter, which covers that round; see the AI-assisted questions.

Back-of-envelope sheet

Estimation comes up mostly in the estimation-heavy PracHub items, such as Anthropic’s sharded-matmul and FFN questions. First-hand reports barely mention specific numbers, and the Anthropic engineering-manager report said its design round was not about detailed calculations (Acedfirst-hand · 2026). So learn to derive a number out loud, state your units, and don’t memorize multipliers. Every example below was recomputed for this page; inputs marked “assumed” are round numbers chosen to make the arithmetic concrete.

Constants, fetched 2026-10-11:

  • Llama-3.1-70B: 80 layers, 64 query heads, 8 KV heads, hidden size 8,192, so head_dim = 8,192 ÷ 64 = 128 (config.jsonsecondary).
  • Llama-3.1-8B: 32 layers, 32 query heads, 8 KV heads, head_dim 128 (config.jsonsecondary).
  • A100 80GB SXM: 2,039 GB/s of HBM bandwidth, 312 TFLOPS BF16 dense (NVIDIAofficial).
  • GB = 10⁹ bytes, GiB = 2³⁰ bytes. Sources mix them; say which you mean.

Memory

KV cache per token (with KV heads)
KV bytes per token = 2 × n_layers × n_kv_heads × head_dim × bytes_per_element
2
one K and one V vector per layer
n_layers
transformer layers
n_kv_heads
KV heads; under grouped-query attention (GQA) fewer than query heads
head_dim
hidden size ÷ number of query heads
bytes_per_element
2 for BF16/FP16, 1 for an 8-bit cache
Worked example

Llama-3.1-70B, BF16: 2 × 80 × 8 × 128 × 2 = 327,680 B = 320 KiB ≈ 0.33 MB per token

One 8K-token request: 8,192 × 327,680 = 2,684,354,560 B = 2.5 GiB ≈ 2.68 GB

One 128K-token request: 131,072 × 327,680 = 42,949,672,960 B = 40 GiB ≈ 42.9 GB

Llama-3.1-8B, BF16: 2 × 32 × 8 × 128 × 2 = 131,072 B = 128 KiB per token

The hidden-size form (2 × layers × hidden × bytes) assumes one KV head per query head. For Llama-3.1-70B it gives 2 × 80 × 8,192 × 2 = 2,621,440 B = 2.5 MiB per token, 8× too high (64 ÷ 8).

Weight memory
weight bytes = n_params × bytes_per_param
n_params
parameter count ("70B" = 70 × 10⁹)
bytes_per_param
BF16/FP16 2, INT8 1, INT4 0.5 plus quantization scales
Worked example

70B: 140 GB in BF16 (130.4 GiB), 70 GB in INT8, 35 GB in INT4 with no scales

INT4 with one FP16 scale per 32 weights: 4 + 16 ÷ 32 = 4.5 bits per weight, so 70 × 10⁹ × 4.5 ÷ 8 = 39.4 GB

14B in 16-bit: 14 × 10⁹ × 2 = 28 GB = 26.1 GiB

The scales cost about 4 GB at 70B and buy a lot of accuracy: see the model-quantizer step in the prep path.

Concurrency headroom
max concurrent requests ≈ (total HBM − weight bytes − overhead) ÷ KV bytes per request
total HBM
GPU memory across the replica
overhead
activations, CUDA context, fragmentation (assumed)
KV bytes per request
KV bytes per token × tokens the request holds
Worked example

Llama-3.1-70B, BF16, 4 × A100-80GB, assumed 20 GB overhead: 320 − 140 − 20 = 160 GB free for KV

At 8K tokens per request: 160 ÷ 2.684 = 59.6, so about 59 requests

At 128K tokens per request: 160 ÷ 42.95 = 3.7, so 3 requests

Worst case: assumes every request holds its full context. Paged allocation reserves cache only as tokens appear, so real headroom is usually higher.

Little's law
L = λ × W
L
requests in the system at once
λ
arrival rate (requests per second)
W
time each request spends in the system (seconds)
Worked example

Assumed traffic of 20 requests/s, each in the system for 10 s: L = 20 × 10 = 200 in flight

With 59 slots per 4-GPU replica at 8K tokens: 200 ÷ 59 = 3.4, so 4 replicas

Sources: the KV-heads form appears in a serving-system prep guide (techinterview.orgsecondary) and in Cloudsoftsecondary, which also gives Little’s law; an LLM inference API guide works the headroom reasoning through without a formula (techinterview.orgsecondary).

Speed

Decode speed limit at batch size 1
tokens/s per sequence ≤ HBM bandwidth ÷ bytes read per token
HBM bandwidth
per GPU (2,039 GB/s on an A100 80GB SXM)
bytes read per token
the weights each GPU holds, plus that sequence’s KV cache
Worked example

8B in BF16 on one A100: 16 × 10⁹ ÷ 2.039 × 10¹² = 7.8 ms per token, at most about 127 tokens/s

70B in BF16 with tensor parallelism 4: 35 × 10⁹ ÷ 2.039 × 10¹² = 17.2 ms per token, at most about 58 tokens/s

Ignores KV reads and the all-reduce between GPUs, so real numbers are lower. Batching is how you get past it: one weight read serves every sequence in the batch.

Matmul FLOPs, arithmetic intensity and the ridge point
FLOPs = 2 × M × K × N      bytes = (M×K + K×N + M×N) × bytes_per_element      AI = FLOPs ÷ bytes      ridge = peak FLOP/s ÷ bandwidth
M, K, N
an (M×K)·(K×N) matmul; in decode, M is the number of tokens processed together
AI
arithmetic intensity, FLOPs per byte moved
ridge
above it a matmul is compute-bound, below it memory-bound
Worked example

A100 ridge, BF16 dense: 312 × 10¹² ÷ 2.039 × 10¹² = 153 FLOP/byte

M = K = N = 4,096: 1.37 × 10¹¹ FLOPs over 1.01 × 10⁸ bytes, AI = 1,365 (4,096 ÷ 3). Compute-bound: 440 µs of compute against 49 µs of memory

Decode, M = 1, K = N = 8,192: 134,217,728 FLOPs over 134,250,496 bytes, AI = 1.0. Memory-bound by about 150×

Estimate compute, memory and network time separately; take the max if they overlap and the sum if they don't.

The small-M case is where “decode is memory-bound, prefill is compute-bound” comes from. With K = N = 8,192 in BF16 on an A100:

M (tokens together)FLOPsBytesAICompute timeMemory timeBound
1134,217,728134,250,4961.00.43 µs65.8 µsmemory, by ~150×
648,589,934,592136,314,88063.027.5 µs66.9 µsmemory
15320,535,312,384139,231,232147.565.8 µs68.3 µsabout balanced
25634,359,738,368142,606,336240.9110.1 µs69.9 µscompute

The weight matrix dominates the bytes, so for small M the intensity is roughly M itself. Batching pays until M nears the ridge point; past it, extra tokens cost real compute.

Ring all-reduce traffic
steps = 2 × (N − 1)      bytes sent per GPU = 2 × (N − 1) ÷ N × S
N
GPUs in the ring
S
size of the buffer being reduced (bytes)
Worked example

N = 8, S = 1 GB of gradients: 14 steps, 2 × 7 ÷ 8 × 1 GB = 1.75 GB sent per GPU

At an assumed 100 GB/s per-GPU link: 1.75 ÷ 100 = 17.5 ms, bandwidth term only

K-sharding a 4,096 × 4,096 × 4,096 BF16 matmul 8 ways: 2 × 4,096 × 4,096 × 512 = 1.72 × 10¹⁰ FLOPs, 55 µs per GPU. The 33.5 MB partial sum needs 2 × 7 ÷ 8 × 33.5 = 58.7 MB sent per GPU, 587 µs at 100 GB/s: network-bound by about 10×

Each of the 2(N − 1) steps moves S ÷ N bytes per GPU, which gives the byte count. Naive all-to-all exchange needs O(N²) messages.

Sources: the decode bound is implied, not written out, in a speculative-decoding guide (techinterview.orgsecondary · 2026); the roofline method and K-sharding partial sums come from the Anthropic-attributed PracHub items (PracHubaggregator · 2026, PracHubaggregator · 2026); the ring step count is from Yuan Meng’s ML infra notes (Yuan Meng (personal blog)secondary).

Model tricks and money

Speculative decoding: tokens per target pass
E[tokens per target pass] = (1 − a^(g+1)) ÷ (1 − a)
a
per-token acceptance rate of the draft
g
draft length: tokens the draft proposes per round
Worked example

a = 0.6, g = 4: (1 − 0.6⁵) ÷ 0.4 = (1 − 0.0778) ÷ 0.4 = 2.31 tokens

a = 0.82, g = 5: (1 − 0.82⁶) ÷ 0.18 = (1 − 0.304) ÷ 0.18 = 3.87 tokens

Assumes each draft token is accepted independently with the same probability, and counts the bonus token the target adds. It is not wall-clock speedup: draft passes cost time, and the verify pass checks g + 1 tokens per sequence. At batch 64 with g = 4 the verify pass has M = 320, past the ridge point, which is one way gains vanish at high batch (an inference from the roofline table, not a claim from the source).

Mixture of experts: active versus total parameters
FLOPs per token ≈ 2 × active params      weight memory = total params × bytes_per_param
active params
parameters each token actually uses
total params
every expert, all of which must sit in memory
Worked example

"671B total, 37B active": 2 × 37 × 10⁹ = 74 GFLOP per token, against 1,342 GFLOP if dense; 671 ÷ 37 = 18× fewer FLOPs

Memory is still 671 GB at FP8 or 1,342 GB at BF16

Router skew, 80% of tokens to 3 of 32 experts: each hot expert gets 80 ÷ 3 = 26.7% of tokens against a uniform 100 ÷ 32 = 3.125%, 8.5× its share

The GPU holding a hot expert does 8.5× the expert work and sets the step time.

Cost per token
$ per token ≈ GPU-hour cost ÷ tokens per GPU-hour
GPU-hour cost
what one GPU costs per hour (assumed, not a quoted price)
tokens per GPU-hour
output tokens across the whole batch × 3,600
Worked example

Assumed $2.00 per GPU-hour and 1,000 output tokens/s per GPU across the batch: 1,000 × 3,600 = 3.6M tokens/hour, so $2.00 ÷ 3.6M = $0.56 per million tokens

Same price, no batching: 70B at TP=4 decodes about 58 tokens/s on 4 GPUs ($8.00/hour). 58 × 3,600 = 208,800 tokens/hour, so $8.00 ÷ 0.2088M = $38 per million, about 69× worse

This is the cost case for batching.

Sources: speculative decoding (techinterview.orgsecondary · 2026), MoE (techinterview.orgsecondary · 2026), cost per token (PracHub concept page, PracHubsecondary).

Latency targets. The serving guide (techinterview.orgsecondary) cites TTFT of “a few hundred ms” and inter-token latency of about 50–100 ms, which is 10–20 tokens/s per stream, so a 500-token reply takes 25–50 s plus TTFT. The 17.2 ms decode bound for 70B on 4×A100 fits a 50 ms budget with 50 ÷ 17.2 = 2.9× room for batching to slow each step.

Where sources disagree

  1. KV-cache form. The KV-heads form is right for GQA models. The hidden-size form, used on a PracHub concept page (PracHubsecondary) and in the Baseten guide (techinterview.orgsecondary · 2026), overstates Llama-3.1-70B by 8×. An LLM inference API guide uses the hidden-size form as well, then drops its own factor of 2 in its 70B example (techinterview.orgsecondary).
  2. Units. The serving guide’s “0.31 MB/token” for 70B (techinterview.orgsecondary) is really 0.3125 MiB (320 KiB, 0.33 MB), and its “about 42 GB at 128K” is decimal GB (40 GiB).
  3. INT4 size. “0.5 bytes per weight” leaves out the scales; with one FP16 scale per 32 weights, 70B is 39.4 GB, not 35 GB.
  4. Continuous-batching gain. Quoted as about 2× (techinterview.orgsecondary · 2026), 3–5× (techinterview.orgsecondary) and 10–20× (techinterview.orgsecondary). Don’t quote a multiplier. Derive it: batching amortizes the weight read until M nears the ridge point, so the gain depends on how far below the ridge you started and how uneven request lengths are.
  5. 70B cold start. “Tens of seconds to a couple of minutes” (techinterview.orgsecondary) against “5–10 minutes” (techinterview.orgsecondary). Load time = weight bytes ÷ effective read bandwidth: 140 GB at an assumed 2 GB/s from local NVMe is 70 s, at 1.25 GB/s over a 10 Gbit/s link 112 s, at 250 MB/s 560 s (9.3 minutes). Both quotes fit; ask where the weights live.

Senior vs Staff signals

No AI lab publishes a rubric. This is pieced together from candidate reports and prep guides.

AI Infra loops

Senior

Staff

  • Judgment-first formats: critiquing an existing inference design, where review skill mattered more than calculation (Acedfirst-hand · 2026), and a design-doc review as the phone screen (Acedfirst-hand · 2026).
  • Accepts the interviewer’s framing, then adds depth (Acedfirst-hand).
  • Business value and scope: defending whether a $20M project was worth it (Blindfirst-hand). For Meta E6, Hello Interview calls design “the part of the loop that most drives your E6 level determination” and says behavioral stories are separated by blast radius and impact beyond your team (Hello Interviewsecondary).
  • Takes the values round at Anthropic as seriously as the technical ones: a Senior Staff infra candidate and a commenter on his thread blame it for their rejections, in their own reading (Blindfirst-hand).

Why candidates get rejected

As reported, mostly one candidate each:

  1. Unfinished practical coding or follow-ups: three Anthropic reports (Acedfirst-hand, Acedfirst-hand, Acedfirst-hand · 2025).
  2. The culture or values round at Anthropic, in one Senior Staff candidate’s own reading and a commenter’s (Blindfirst-hand).
  3. Fighting the design premise in an inference design round (Acedfirst-hand).
  4. Being “too wordy” in the hiring-manager round, by the same candidate’s account (Acedfirst-hand).
  5. Running out of time on a debugging task: fix a training data pipeline, then explain why it is slow (Acedfirst-hand).
  6. An unfamiliar round format: a Databricks candidate prepared data-writer patterns, met a concurrent remote-file cache instead, and thinks that round cost the offer (PracHubfirst-hand · 24 Aug 2026).
  7. ML-fundamentals gaps on phone screens at companies that still test them (Yuan Meng (personal blog)first-hand).

The most representative rows for this track. The full bank filters by theme, round, company, source type and confidence: all AI Infra questions.

All questions in the bank →

A prep path through the labs

Build these in order. Each step says what it lets you claim. Partial labs show their caveats on each card, and only the labelled numbers below are quoted; most lab benchmark tables are estimates.

  1. The KV cache, for real. “I can size the cache for any model from its config.” The lab’s GPT-2 figure is arithmetic, not a measurement: 75.5 MB (calculated · llm-inference lab).
    Build Your Own LLM Inference EnginePartly covers itPartialpython

    A real KV cache on GPT-2; paged attention and continuous batching are bookkeeping only.

    Partial: the KV cache is real, but paged attention is bookkeeping only, continuous batching runs one forward pass per request, and there is no token streaming or TTFT/TPOT measurement.

  2. Attention from scratch. “I’ve written causal attention and a training loop with checkpoints.”

    Attention, a transformer block, a small GPT, then training, checkpointing and a server.

  3. The front door of a batcher. “My queue is bounded, rejects when full, retries with a budget and routes around unhealthy backends.”

    Visibility timeouts, dead-letter queues, delays and FIFO with dedup.

    Partial: the code is real, but its tests don't pass yet (the delayed-message test panics, as of 2026-10-11).

    Health checks, circuit breaking, least-connections and retry budgets.

  4. A scheduler you then extend. Add a GPU resource type and gang scheduling to the reconcile loop; that extension is the interview story.
    Build Your Own Container OrchestratorPartly covers itPartialgo

    Reconcile loop, first-fit placement, rolling updates, informers and a work queue.

    Partial: the code is real, but its tests don't pass yet (the informer test fails and the suite times out, as of 2026-10-11).

  5. Failure detection and fan-out. Build Your Own Gossip Protocol (SWIM)Partial and Build Your Own CDN Edge Node.
  6. Group commit. “Batching writes per fsync trades caller latency for throughput, and here is the knob.”
    Build Your Own Write-Ahead LogProves itProof labrust

    File-backed WAL with fsync, crash recovery and group commit.

    A torn-tail bug (an acknowledged write after a crash could be lost on the next recovery) was fixed on 2026-10-13 with regression tests; run cargo test in labs/wal to confirm.

  7. Quantization with a measured cost. On GPT-2, INT4 with one scale per 32 weights had a mean weight error of 10.5 % (measured on Apple M1 Ultra, 64 GB RAM, Python 3.13.7, numpy (CPU), 2026-10-11 · model-quantizer lab), against 74.3 % (measured on Apple M1 Ultra, 64 GB RAM, Python 3.13.7, numpy (CPU), 2026-10-11 · model-quantizer lab) with one scale per tensor: outliers set a per-tensor scale. The lab’s perplexity figures are illustrations, not measurements.
    Build Your Own Model Quantizer (GGUF)Partly covers itPartialpython

    INT8 and grouped INT4 with real size math and measured weight error.

    Partial: sizes and GPT-2 weight error are measured; the perplexity figures are an illustration, not a measurement.

  8. Speculative decoding math. The closed form gives 3.87 tokens (calculated · speculative-decoding lab) per target call, but with a draft costing 10% of the target per token the net speedup is only 2.58 x (calculated · speculative-decoding lab). A simulation with the lab’s mock models matched the closed form for its observed acceptance rate: 4.64 tokens (measured on Apple M1 Ultra, 64 GB, Python 3.13.7, torch 2.14.1 (CPU), 2026-10-11 · speculative-decoding lab).
    Build Your Own Speculative DecodingPartly covers itPartialpython

    Draft-and-verify, batched and tree variants, on mock models.

    Partial: the acceptance math is correct, but the draft and target are mock models.

Five topics that come up often have no lab yet: a GPU-aware scheduler, multi-LoRA serving, training parallelism, sharded checkpoints, and LLM observability (TTFT, tokens and cost per request). Building one of them on real hardware and publishing measured numbers is the kind of validated work the transition chapter recommends.