System Design & Interview Loops
End-to-end AI system design with capacity maths, ML infrastructure, estimation and debugging drills, and behavioural rounds by level.
Sections
Interview questions answered at staff level
AI system design
Design ChatGPT-style serving, an eval platform, a coding agent, enterprise search — with numbers.
10 questions02ML infrastructure & serving
Parallelism, GPU scheduling, multi-LoRA serving, autoscaling and prefix-aware routing.
10 questions03Estimation & debugging drills
Back-of-envelope maths and production debugging scenarios, timed like the real round.
10 questions04Behavioural & leadership
Conflict, influence, killing a project, owning a failure — answered at Mid, Senior and Staff.
10 questionsKey terms
46 pages with diagrams and quizzes
A program that learns a pattern from examples instead of being given rules. The machinery under every model on this site.
The learned numbers inside a model. '70B' means 70 billion of them — which sets memory and cost, and on its own says little about quality.
The design inside nearly every modern model: stacked layers where each word gathers context from the others, then refines itself.
The first and most expensive training stage, where a model learns language and world knowledge by guessing the next word, trillions of times.
The one task a model is trained on and runs every time it answers: given the text so far, score every possible next token.
The text, code and examples a model learned from. Its mix, quality, recency and licensing decide what the model knows and how it behaves.
The measured pattern that error falls predictably as parameters, data and compute grow — with each step costing many times more than the last.
Training a base model on pairs of 'instruction' and 'good response', which turns a text continuer into something that answers you.
Training on human preferences: people pick the better of two answers, those picks train a scoring model, and the model learns to score well.
Methods like DPO that train straight from 'chosen vs rejected' answer pairs — RLHF-like results without the reward model or the RL loop.
Fine-tune by training a small add-on while the original weights stay frozen. Cheap, fast, and swappable per task or customer.
A model picking up a task purely from the instructions and examples in your prompt, with nothing about it changed.
Showing the model a handful of worked examples in the prompt so it copies the format, labels and tone you want.
Having the model write its working before the answer. Better on multi-step problems, paid for in tokens.
Models trained to think at length before answering: much better at hard maths, code and planning, slower and pricier per answer.
The dial between predictable and adventurous when the model picks its next word. It changes variety, not knowledge.
Sample only from the smallest group of likely words that together cover p of the probability — 90%, say — and ignore the weird tail.
The raw scores a model gives every possible next word, before they are turned into probabilities.
Running a trained model to get output. Training happens occasionally; this happens on every single request.
The saved intermediate results for earlier words, so each new word doesn't re-read the whole conversation. It eats GPU memory.
Storing a model's weights in 8 or 4 bits instead of 16, to cut memory and speed things up — at a quality cost you have to measure.
How long the user waits before any words appear. With streaming, this is what 'fast' actually means to them.
Running many requests through the GPU together, so one read of the weights serves lots of tokens. More throughput, slightly slower per stream.
A small model guesses the next few words and the big model checks them all in one pass. Same output, fewer slow steps.
A model made of many sub-networks where each word only uses a few, so a huge model computes like a much smaller one.
Models whose trained numbers you can download and run yourself. Closed models live behind an API. You are trading control for convenience.
The date a model's training data stops. Anything after it is unknown — and the model usually doesn't realise that.
Doing something twice leaves things exactly as doing it once. This is the property that makes retries safe.
How a busy system tells its callers to slow down — bounded queues and honest 429s, instead of buffering until everything falls over at once.
A parking spot for messages your workers keep failing on, so one bad item stops blocking everything behind it.
Wait longer after each failed retry — 1s, 2s, 4s — plus a little randomness, so a struggling service isn't hammered by everyone at once.
Run the new version beside the old one, check it on real infrastructure, switch all traffic at once, and keep the old one warm for an instant rollback.
Writing the same change into two stores. Done the obvious way it drifts apart; the outbox pattern plus change data capture makes it stick.
Send a copy of real requests to the new version, show nobody the results, and compare outputs, latency and cost before risking live traffic.
Release to a small slice of real traffic first — 1%, then 5%, then 25% — compare against the old version, and roll back if anything gets worse.
A switch outside the code that turns a path, model or prompt on or off — per user, per customer, per percentage — with no redeploy.
A nickname that points at a real index, so you can build a new one and repoint every reader in a single step.
The background tidy-up that rewrites an index without its deleted entries, winning back space and speed.
Being able to work out why production did something, without shipping new code to find out.
Time to live: how long a stored or cached item stays valid. Too long serves stale answers; too short throws the savings away.
A scheduled audit comparing the source of truth with everything derived from it — index, cache, permissions — and repairing the gaps.
When a dependency dies, serve something smaller but still useful — a lighter model, a cached answer, the sources alone — instead of an error page.
The blameless write-up after an incident: timeline, impact, causes, what went well, and owned actions with dates.
Situation, Task, Action, Result: a shape for interview stories. Spend most of it on what you did and what changed — with numbers.
A choice where getting more of one thing costs you another. Good answers name the axes, the deciding constraint, and when they'd switch.
A senior individual-contributor level whose scope crosses teams: setting direction, de-risking big bets, and making other people better — mostly in writing.