Repository navigation
[Frontend] Add derender output mode to generate - #60082
Conversation
|
Documentation preview: https://vllm--60082.org.readthedocs.build/en/60082/ |
|
This pull request has merge conflicts that must be resolved before it can be |
9927ac6 to
07f3ccd
Compare
|
This pull request has merge conflicts that must be resolved before it can be |
07f3ccd to
8d7a153
Compare
|
I am looking at the ruff error now which was caused by rebase. |
|
Hi @hickeyma, the pre-commit checks have failed. Please run: uv pip install pre-commit>=4.5.1
pre-commit install
pre-commit run --all-filesThen, commit the changes and push to your branch. For future commits, |
Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
|
Ruff error is fixed now. |
|
/ci run |
|
✅ Triggered Buildkite CI #96393 for commit ℹ️ This PR is 1 commit behind upstream |
With include_reasoning=False, both the coupled and inline paths hide token_ids which means the determinism check was comparing None to None. The two greedy runs can still produce different text (seen on ROCm) and the content check then failed. When token ids are hidden, only check that token_ids and reasoning are hidden on both sides and skip the text comparison. The reasoning case still covers content parity for the same prompt. Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
Head branch was pushed to by a user without write access
7769f82 to
caba434
Compare
|
/ci run |
|
✅ Triggered Buildkite CI #96409 for commit |
Adapt to the derender output mode (vllm-project#60082): build each choice's fields in _build_choice_fields, shared by the tokens/text builder (which may still run off the event loop) and an async derender builder that keeps main's logic. Usage is recorded by main's _build_response_fields. Signed-off-by: hao-aaron <aaronhao@inferact.ai> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
Overview
Adds
output_mode="derender"to/inference/v1/generate, so the generate server returns the parsed assistant message itself. This is Phase 2 of #56851 and builds on #60073.Claims
output_mode="derender"returnsmessage(content, reasoning, tool calls) on every choice without a separate/derendercallmessage,finish_reasonandlogprobsmatch coupled/v1/chat/completionseven for parsers whoseadjust_requestchanges decoding./derendercan't match those/v1/chat/completions/renderand/v1/messages/rendernow returnparse_context. Other output modes ignore it, including fields added by a newer render, so prefill legs don't changeparse_contextgets a 400 before generation. When a parser hides the reasoning,token_idsare dropped along with logprobs, like coupled chat/derendernow supportsparallel_tool_calls=false, like coupled chatValidation
The parity tests run R1-Distill with hermes and deepseek_r1 against coupled chat. They cover plain output, reasoning shown and hidden,
tool_choiceauto, required and named,parallel_tool_calls=false, a stop string,n=2and logprobs withtop_logprobs=3andlogprob_token_ids. Every case checksfinish_reasonand the tool call ID shape.Details
The derender level parses the engine's own
output.text. That text already has the stop string cut and was decoded with the flagsadjust_requestset which is where/derenderdrifts from coupled chat (#42729)./renderputs aParseContexton theGenerateRequestwith the tools,tool_choice,parallel_tool_calls,include_reasoning, resolvedchat_template_kwargsand the history tool call count. It's only read whenoutput_mode="derender". I went with always sending it, rather than only on request, so a rendered request works as is (decision 2 on [RFC]: Request level text and derender output on/inference/v1/generate#56851).parse_contextis validated inserve_tokensbefore the request reaches the engine. Unknown fields fail the request only whenoutput_mode="derender"because that's the only level that reads them. At the other levels they're logged once and ignored, so an older generate node keeps serving a newer render.chat_template_kwargsis typed as JSON values to make sure whatever goes in it has to survive the wire. The trade-off is that every rendered request carries the tools list, prefill legs included.ChatCompletionRequestfromparse_contextand reuses_parse_and_assemblefrom [Frontend] Extract parse and assembly out of batch chat derender #60073./renderresolves the template kwargs once and uses them for bothreasoning_parser_kwargsandparse_context. A handler can pass its_engine_chat_template_kwargsto keep API server only state out ofparse_context. Cohere uses this for_position_to_sourceand friends. Tool call IDs keep the parser'stc.id([Bugfix][Frontend] Keep the parser's tool call IDs in batch derender #61852).finish_reasongoes throughresolve_finish_reason([Frontend] Make finish_reason and Responses item status truthful #59324), the same as coupled chat and batch/derender.chat_top_logprobs_limit([Frontend] Apply each endpoint's top_logprobs cut in derender #59518). They're on whenevernum_logprobsis set, sologprob_token_idsworks. When a parser hides the reasoning,logprobsandtoken_idsare both dropped. The tokens and text levels don't change.Limitations:
textlevel still ignoreslogprob_token_ids. That gap was already there.mainyet, so there's a TODO and whichever PR lands second adds the 400.return_tokens_as_token_idsis ignored on derender paths. ([Bug]:return_tokens_as_token_idsis ignored on derender paths #63162)Pull Request Checklist
I used vLLM's
/pr-checklistskill. (Mandatory for agents, optional for humans).AI assistance was used during the creation of this PR.
Design Fit: Minimizes impact on core components, reuses existing functionality, and justifies added complexity.
Testing and Validation: Validates the change and ensures any added tests are meaningful and reliable, with CI coverage or documented CI resource constraints and validation performed outside CI.
Code Quality and Style: Keeps code and comments clear and concise, and updates relevant documentation and examples.
Pull Request Contents: Includes a brief summary and relevant links, supports claims with evidence, explains root causes and implementation trade-offs, and follows the contributing guide.