[Benchmark] Measure real decode speed when the server batches stream chunks - #8113
Merged
ZhangYulongg merged 1 commit intoAug 24, 2026
Merged
Conversation
…chunks A server-side reasoning / tool-call parser only emits an SSE chunk once it has user-visible text, so decode steps whose text is still buffered are invisible to the client while their tokens are already counted in usage.completion_tokens. Taking TTFT from the first delta-carrying chunk then charges those tokens to TTFT and shrinks the decode window, which inflates the reported decode speed. - count a chunk whose delta is empty but whose usage.completion_tokens grew as a real token arrival, so TTFT/ITL see every generated token - credit the tokens that only show up in the trailing usage chunk (e.g. tool-call closing markers) to ITL, so the numerator and the denominator cover the same tokens - derive per-request decode speed from len(itl)/sum(itl); the previous (output_tokens - 1) form assumes the first chunk carries exactly one token, which is false under speculative decoding - drop the "TPOT < 1ms is unreliable" filter and its duplicated report block: with the window measured correctly there is nothing to filter
kevincheng2
force-pushed
the
bench/real-decode-speed
branch
from
August 24, 2026 08:38
a81959d to
0ce2c13
Compare
Collaborator
Author
|
/re-run all-failed |
5 tasks
ZhangYulongg
approved these changes
Aug 24, 2026
xiegegege
approved these changes
Aug 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
A server-side reasoning / tool-call parser only emits an SSE chunk once it has user-visible text, so decode steps whose text is still buffered are invisible to the client while their tokens are already counted in
usage.completion_tokens. Taking TTFT from the first delta-carrying chunk then charges those tokens to TTFT and shrinks the decode window, which inflates the reported decode speed.Modifications
usage.completion_tokensgrew as a real token arrival, so TTFT/ITL see every generated tokenlen(itl)/sum(itl); the previous(output_tokens - 1)form assumes the first chunk carries exactly one token, which is false under speculative decodingThis only touches the benchmark client. No engine, kernel or model code is changed.
Usage or Command
No new flags. Run the benchmark as before:
python benchmarks/benchmark_serving.py \ --backend openai-chat \ --model <model> \ --endpoint /v1/chat/completions \ --dataset-name EBChat \ --dataset-path <dataset> \ --num-prompts 100 \ --max-concurrency 16The decode-speed report is now a single section,
解码速度(tok/s, 首token之后), plusRequests in decode stats. The previous解码速度 (过滤TPOT<1ms)block and thes_decode_filtered_*/n_decode_filtered/n_decode_reliablekeys in the JSON result are removed, since the window is now measured correctly and there is nothing to filter.Accuracy Tests
Not applicable — this PR does not affect model outputs. It changes only how the benchmark client attributes timestamps to tokens.
Measurement correctness was verified against a synthetic SSE stream served by a local aiohttp server, driving the real
async_request_eb_openai_chat_completions. Ground truth: 22 tokens, one every 20ms (50 tok/s, real TTFT 20ms), where the first 8 decode steps are swallowed by a parser and 2 tokens appear only in the trailing usage chunk.len(itl)=21, decode 49.55 tok/sSo the reported decode speed matches ground truth in both cases, and the remaining TTFT error in the second case requires the server to emit the per-step usage chunk.
Checklist
[Benchmark])pre-commitbefore commit.benchmarks/have no unit test harness in this repo; correctness was instead verified end-to-end against a synthetic SSE server as described above.releasebranch... — targetsdevelop.