Define LLM inference and explain how it differs from training.
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Inference is the forward-only pass that turns a prompt into tokens with frozen weights; training is the backward pass that updates weights on labeled data.
Picture a chef who studied for years at culinary school. The studying part is training. They read recipes, made mistakes, got corrected, and slowly learned what works. Once they leave the school, the cookbook in their head is locked. Now when you order a meal, they cook it without going back to study. That is inference: using the recipes they already learned to make one specific dish. Training happens once and is enormously expensive because they had to learn from millions of examples. Inference happens every time a customer walks in and is cheap per meal, but the restaurant serves thousands of meals a day, so the total tab adds up fast.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
4 min: forward-only vs forward plus backward, memory footprint comparison, the prefill/decode split inside inference, and why inference cost dominates the lifetime bill of any deployed model.
| Aspect | Training | Inference |
|---|---|---|
| Weight updates | Yes, every step | No, frozen |
| Gradients | Computed in backward pass | Never computed |
| Memory footprint | ~4x parameter count | ~2x parameter count + KV cache |
| Frequency | Once per model release | Every user request |
| Dominant bottleneck | All-reduce bandwidth across cluster | HBM bandwidth on single GPU (decode) |
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Saying inference is 'just a smaller training run'. It is structurally different: no gradients, no optimizer state, no labels, and weights are read-only the entire time.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.