What this lesson covers.
This module is one of 42 in the curriculum. Below is the canonical interactive lesson — tabs, cards, and diagrams from the source repo, rendered inside the course shell. An audio narration runs alongside it - the sticky player at the top of the page plays the full Module 17 clip.
If you prefer to read first and play with the demos after, the interactive lesson sits below this section. If you'd rather hear it narrated while you scroll, hit play on the sticky audio bar at the top — or just let it autoplay.
Read / reason / test
Measure the request beyond the model
High school · build the intuition
A request can wait in a queue, be tokenized, run on a model and return through a server. Measuring only model computation misses those delays. Trace arrival, first visible token and completion separately. That helps distinguish queueing from slow generation and explains why a system with strong throughput can still feel slow to one learner waiting for a response.
College · work the example
In a toy trace, queueing 300 ms, preparation 50 ms and prefill 150 ms total roughly 500 ms before the first token, excluding network/display effects. Another 2 seconds of generation makes completion roughly 2.5 seconds. Averages can hide long waits; inspect percentiles and workload mix. These invented timings clarify measurement boundaries, not server performance.
Explain it back
Describe the process in your own words. Identify the assumption that makes this example work, then explain one conclusion it cannot establish.
Read the primary source or official documentation →
The numerical examples are authored teaching exercises, not measured model benchmarks. This extension adds context to the original lesson.
The lesson itself.
The Inference Highway
Generating tokens requires running the entire transformer neural network for every single word. See why native generation is slow, how the KV Cache prevents redundant work, and how Speculative Decoding uses a smaller model to predict the future.
Redundant Computation
State Reuse
Draft & Validate
Further reading.
The canonical references for this module. External links open in a new tab.
What to read next.
Use the pager below to move sequentially through the curriculum, or jump to any module from the course index. Each track has a "Prereq: ↑ foundation" callout so you can backfill anything that wasn't clear.