Locate the timing boundaries
Optional arithmetic and percentage refresher — return to this activity
Elapsed time is a measured duration. Prefill processes the input; the first selection produces a token; decode processes newly appended tokens. Time to first token includes preparation, prefill and first selection here. Later-token rate uses only subsequent tokens and their measured decode duration.
Instrumented generator: local teaching model contract
All people, records and numbers in this pack are authored teaching examples. They are not records or performance claims about real organizations.
- G1 · The downloadable Python generator uses four token IDs and fixed authored two-number embeddings with causal attention. It is untrained and is not a pretrained language model. It demonstrates execution and cache equivalence, not text quality.
- G2 · Input is 1–16 token IDs; output limit is 0–16 tokens. EOS is token 3. Greedy selection chooses the lowest ID on a tie. Reaching a limit and emitting EOS are reported separately.
- G3 · The clock starts after imports. Validation/token preparation, prefill, first-token selection, decode steps and total generation are timed with a monotonic high-resolution clock. Report serialization and disk writing are outside total generation. Loading/import/terminal display are not measured.
- G4 · Cached attention retains projected keys and values for exactly the prior token prefix. Changed prefixes require a fresh cache or rejection. Every step’s scores, not just chosen IDs, must agree with uncached execution within 1e-12.
- G5 · Timing varies by machine and run. Compare the same prompt, output limit and stopping behavior, repeat runs, report all outcomes and the measurement boundary. Projection and attention-term counts are not milliseconds.
Which interval are you measuring?
- Prepare: 0–2 ms.
- Prefill: 2–9 ms.
- First selection: 9–10 ms. The first token is available at 10 ms.
- Three later tokens: 10–16 ms. Generation ends at 16 ms.
Four tokens total: one first token and three later tokens. Convert 6 milliseconds to 0.006 seconds; 3 ÷ 0.006 = 500 later tokens/second. This hypothetical timeline omits overhead. Real reports include orchestration in total time; imports and writing the report remain outside that interval.
Worked example
If a hypothetical run emits four tokens, first-token time is 10 ms and later decode takes 6 ms, its later rate is 3 ÷ 0.006 = 500 tokens/s. Four divided by total time is a different metric. With fewer than two tokens, later-token rate is unavailable.
Check the boundary
The 500 tokens/s calculation is illustrative. Use the local report for measured values, retain unavailable fields, and state that imports, environment inspection, serialization, storage and display fall outside its generation timer.