napkin math
AI infra interview questions tagged napkin math, across every topic.
30 questions · 10 unlocked for you
Concepts behind "napkin math"
The curriculum that explains the ideas these questions test.
Foundational
Model Memory FootprintThe first calculation in almost every AI infra loop: how many bytes does this model occupy, for inference and for training, and does it fit on the card in front of you? Inference is parameters times bytes per parameter (2 in bf16), plus a KV cache that grows with users. Training is 16 bytes per parameter before activations. A 70B model is 141 GB to serve and 1.13 TB to train, and a reader who can produce those two numbers from the parameter count, with the reasoning, has passed the first five minutes of the estimation round.🧮 Napkin Math & Capacity
Foundational
KV Cache SizingThe KV cache is the memory that decides how many users a serving replica can hold and how long their context can be. Its size per token comes from four numbers in the model's config file (layers, KV heads, head dimension, bytes per element) and one formula; multiplied by context and concurrency it is the number every capacity plan is built on. This page derives it, works it for four models including an MLA one, and shows the two places candidates get it wrong by a factor of eight.🧮 Napkin Math & Capacity
Foundational
Training FLOPs: 6NDThe compute needed to train a language model is six floating-point operations per parameter per token: two for the forward pass and four for the backward. Multiply by the parameter count and the token count and you have the whole run's compute, which is the number every fleet-sizing, time-to-train and cost question starts from. This page derives the 6, states the attention correction and when it matters, and shows where the 2N of inference comes from, so the reader can rebuild the formula rather than recall it.🧮 Napkin Math & Capacity
Foundational
The AI Infra Design Round PlaybookThe AI infrastructure design round is 45 to 60 minutes with one prompt (design a serving platform, a training scheduler, a 10k-GPU cluster, a fine-tuning service) and one interviewer whose job is to find the edge of what you know. The candidates who pass do the same things in the same order: pin the requirements and the numbers in the first five minutes, draw the reference shape, size it with a stated chain of arithmetic, pick two deep dives, and name the failure modes before being asked. This page gives that structure with a minute-by-minute plan, the numbers to bring in your head, and the mistakes that end the round early.📐 AI Systems Design
Core
GPU-Hours and Time to TrainThe fleet equation turns a training run's FLOPs into a schedule: time = 6ND divided by (GPUs times peak FLOPS times MFU). Every term is a stated assumption, and the interviewer grades the assumptions rather than the digits: which peak, which MFU, and what happens to the answer when MFU falls from 40% to 30%. This page works three runs end to end (an 8B, a 70B and a 405B), inverts the equation for the GPU count a deadline needs, and shows the sensitivity that separates a considered estimate from a lucky one.🧮 Napkin Math & CapacitySign in
Advanced
Bandwidth-Bound Decode ThroughputBecause decode reads every weight once per step, its speed is a division: memory bandwidth over bytes per step. That one formula gives single-stream tokens per second for any model on any card, the batch curve that flattens at the ridge point, the effect of quantization, and the point where the KV cache rather than the weights becomes the thing being read. This page derives it, works it for a 70B model on four accelerators, and shows how to read a vendor throughput claim against it.🧮 Napkin Math & Capacity🔒 Premium
