Count reasoning_content in the restful chat benchmark - #5020
Open
David-Wu1119 wants to merge 1 commit into
Open
David-Wu1119 wants to merge 1 commit into
David-Wu1119 wants to merge 1 commit into
Conversation
With --backend lmdeploy-chat, profile_restful_api.py only treated delta.content as output. A server started with --reasoning-parser streams the model's thinking as delta.reasoning_content, so TTFT was measured to the first answer token after all the reasoning, or stayed 0.0 when the whole budget went to reasoning, and ITL and the retokenized output count dropped those tokens. Count reasoning_content as output too, as benchmark_chat_completion.py and sglang's bench_serving do, and tolerate chunks with an empty choices list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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
With
--backend lmdeploy-chat,benchmark/profile_restful_api.pyonly treatsdelta.contentas output. A server started with--reasoning-parserstreams the model's thinking asdelta.reasoning_content, so:0.0when the wholemax_tokensbudget goes to reasoning (the request still counts as successful, so the 0 is averaged in);Against a fake OpenAI-compatible server streaming 64 tokens per request (first token after 100 ms, then one every 10 ms), 20 prompts:
lmdeploy's own
benchmark/benchmark_chat_completion.pyalready countscontent or reasoning_contentas the first token, and sglang'sbench_serving.py(which this script follows) countsreasoning_contentas content too.Modification
In
async_request_openai_chat_completions, countreasoning_content + contentof each delta as output, reading both withor ''since either can benull. The same lines also stop assumingchoicesis non-empty, so a usage-only chunk withchoices: []no longer raisesIndexError.No open issue or PR covers this (searched for reasoning_content, profile_restful_api reasoning, TTFT reasoning, reasoning-parser benchmark).
BC-breaking (Optional)
No. Non-reasoning output is measured as before.
Checklist
Written with AI assistance (Claude Code).
🤖 Generated with Claude Code