Tokens per second is not a complete description of a local coding model. A model can start late and then decode quickly, or start quickly and stream slowly. Measure time to first token, the timing after that first token, full completion time and throughput under a declared workload. Report failures too.
Choose the user experience you are measuring
For an interactive code assistant, the delay before useful output matters. For a background batch, completed work over a time interval may dominate. Write down the question before running the benchmark so you do not select a favourable metric afterwards.
Specify the model revision, quantisation, hardware, runtime, context limits and test inputs. Keep cold loading separate from warm inference. If one run loads the model from disk and another reuses a warm process, the comparison measures more than model-generation speed.
Use a monotonic clock and a clear start point
A monotonic timer is suited to elapsed intervals because wall-clock adjustments should not change a duration. Define when timing starts: entering an application queue, sending an HTTP request or starting server execution. Client and server timings can both be useful, but they answer different questions.
In streaming APIs, a keep-alive or metadata event is not necessarily a generated token. Inspect the protocol and identify the first actual output event. Use the provider's reported token count or a documented compatible counting method; do not treat each network chunk as exactly one token.
One request has multiple intervals
A timing model rather than a chart of measured model performance.
Before output
- Submission
Start the client-observed monotonic timer.
- First token
Record when the first actual output token is observed.
After output begins
- Streaming
Observe later output and distinguish tokens from transport chunks.
- Completion
Record final status, output token count and elapsed time.
A transport chunk can contain several tokens. Do not count chunks as tokens without a justified mapping.
Check the arithmetic with a synthetic fixture
The following toy request begins at zero, produces its first token at 800 milliseconds, finishes at 2,800 milliseconds and contains 21 output tokens. The two-second interval after the first token spans 20 token intervals. Its average is 100 milliseconds per interval. These numbers are invented solely to make the calculation inspectable.
const run = { start: 0, first: 800, end: 2800, tokens: 21 };
const ttftMs = run.first - run.start;
const tpotMs = run.tokens > 1
? (run.end - run.first) / (run.tokens - 1)
: null;
console.log({ ttftMs, tpotMs }); // 800 ms, 100 msReport distributions and denominators
Retain raw request observations so you can compute a median and tail values rather than only an average. A few long waits can matter disproportionately in an interactive product. State the number of attempts and how many completed, timed out or failed.
Scroll the table horizontally to see all columns.
| Field | Why retain it | Mistake it prevents |
|---|---|---|
| Input size | Prompt processing affects response timing | Comparing tiny and long-context prompts as equals |
| Output size | Completion time depends on answer length | Rewarding a model merely for stopping early |
| First-output time | Separates initial wait from streaming | Hiding a long silent delay behind fast decoding |
| Final status | Preserves failed attempts | Dropping timeouts from the result |
| Concurrency | Describes offered load | Comparing an idle run with a saturated server |
Distinguish throughput from per-request speed
Aggregate throughput divides completed output by a declared observation interval. It can rise when a server batches more requests even if an individual request becomes slower. State whether the interval includes warmup, queue drain and failures. Different measurement windows can produce different-looking totals from the same workload.
Do not multiply one request's speed by a concurrency setting and call that measured server capacity. Run the concurrent workload and observe it. If you cannot run the hardware, publish the method or a clearly labelled simulation rather than a fabricated ranking chart.
Keep answer quality in the experiment
A coding model that returns invalid code quickly has not necessarily improved the product. Use a fixed set of tasks with meaningful checks such as compilation, tests, schema validation or a reviewed expected behaviour. Keep those quality results beside timing and cost.
Also distinguish model execution from the complete agent workflow. Tool calls, retries, repository inspection and test execution add time and can improve correctness. A raw decoding benchmark does not describe that whole workflow. Report the boundary you actually measured.
Publish enough detail to reproduce the claim
Include configuration, workload, counting method, timing definitions and failure counts with any future results. Use charts generated from the retained data, not image-generated bars. The strongest benchmark is one whose limitations a reader can understand before using it to choose a model or buy hardware.
Frequently asked questions
What is TTFT? Time to first token is the interval from the chosen request start to the first observed output token. State whether your measurement includes client queueing and network time.
How should I calculate TPOT? State your definition. One common post-first-token average divides completion time minus first-token time by the number of output tokens minus one, excluding cases with fewer than two output tokens.
Can I compare two published tokens-per-second numbers directly? Only with compatible definitions and conditions. Model, hardware, quantisation, prompt length, output length, concurrency, warmup and failure handling can all change the result.
Sources
Technical references checked .



