Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Click any words you think contain an error. Click again to unmark.
Output costs several times more than input because decode runs one sequential bandwidth-bound forward pass per token, while prefill processes the whole prompt in one parallel compute-bound pass.
Imagine a bakery. Reading the customer's whole order at once is fast: one glance at the slip and you know everything they want. That is the input prompt. Now you have to bake each cake one at a time, and before every single cake you must walk to the back room and haul out the entire recipe book. That trip to the back room is the slow part, and you repeat it for every cake. That is generating output tokens: each one drags the whole model out of memory again. So reading the order is cheap and amortized, while producing each new item is repeated heavy lifting. That is why providers charge more per output token than per input token, not because of any random dice roll.
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.
3 min: name all three errors, then explain prefill (parallel, compute-bound) versus decode (sequential, bandwidth-bound) and map throughput to per-token price.
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.
Attributing output cost to RNG sampling, or claiming input tokens skip the forward pass. Sampling is microseconds; input runs a real, parallel prefill pass.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.