Skip to content

CICD-450 · Time-to-first-token benchmarking ​

Encyclopedia · GPU and inference infrastructure · All snippets

Previous · CICD-449 · Next · CICD-451

1. Where it fits ​

  • Placement In the inference benchmark job after the engine is ready on the dedicated runner.
  • Prerequisites dedicated GPU lab, approved images and model revision, fixed benchmark profile.
  • Platforms local-linux, github-actions, gitea-actions.
  • Parameters MODEL_ID.

2. Copy the snippet ​

bash
vllm bench serve --backend openai --base-url http://127.0.0.1:8000 --model "${MODEL_ID:?}" --dataset-name random --random-input-len 256 --random-output-len 64 --num-prompts 80 --request-rate 4 --percentile-metrics ttft,tpot,itl --save-result --result-filename ttft.json

3. How it works ​

The client sends fixed-shape requests at a fixed rate and records first-token timing from streaming responses. Compare only runs with equivalent warm-up, prompts and serving configuration.

The load generator measures the first streamed token separately from later tokens.

flowchart TD
  N1["Fixed input and rate"]
  N2["Benchmark client"]
  N1 --> N2
  N3["Serving engine"]
  N2 --> N3
  N4["First token timing"]
  N3 --> N4
  N5["Later token timings"]
  N3 --> N5
  N6["Benchmark report"]
  N4 --> N6
  N5 --> N6

4. Verify the result ​

TTFT measures wait to first generated token. Use streaming, warm-up, a fixed seed and matching request lengths.

Validation version-dependent (Bash parse). Status definitions.