Repository navigation
[Bugfix][Rust Frontend] Match DeepSeek-V4.1 renderer to the 1017 reference encoding - #62200
Merged
robertgshaw2-redhat merged 3 commits intoOct 19, 2026
Conversation
…rence encoding Tool-result-only user-content blocks no longer start a new user turn, so drop_thinking keeps the reasoning that led to a tool call. Reject literal image placeholder tokens in message text and reasoning. Mirrors the Python encoder fix so both frontends render identical prompts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Robert Shaw <robertgshaw2@gmail.com>
robertgshaw2-redhat
requested review from
BugenZhao and
njhill
as code owners
October 17, 2026 15:51
6 tasks done
sfeng33
approved these changes
Oct 17, 2026
sfeng33
left a comment
Member
There was a problem hiding this comment.
LGTM, cc @BugenZhao in case you want to take another look.
Collaborator
Author
|
/ci run |
|
✅ Triggered Buildkite CI #95626 for commit |
Collaborator
Author
|
/ci retry |
|
✅ Triggered Buildkite CI #95903 for commit |
3 of 5 tasks
bantianyue
pushed a commit
to bantianyue/vllm
that referenced
this pull request
Oct 28, 2026
…rence encoding (vllm-project#62200) Signed-off-by: Robert Shaw <robertgshaw2@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.
Overview
Rust counterpart of #62199: match the DeepSeek V4.1 renderer to the updated reference
encoding/.Affects both V4.1-Flash checkpoints (launch and 1017). DeepSeek fixed the turn handling in both repos (launch
314113f, 1017 release); theirencoding/is now identical. The image-token check has been in the reference since launch.Claims
<|deepseek_image|>in message text or reasoning returns 400.Examples
1. Tool call in thinking mode, with no
toolsfield in the request[{"role": "user", "content": "What's the weather in Paris? Answer in Fahrenheit."}, {"role": "assistant", "content": "", "reasoning": "Tool returns Celsius; convert to Fahrenheit.", "tool_calls": [{"id": "c1", "type": "function", "function": {"name": "get_weather", "arguments": "{\"city\": \"Paris\"}"}}]}, {"role": "tool", "tool_call_id": "c1", "content": "{\"temp_c\": 20}"}]Before (reasoning dropped):
After (reasoning kept, same as the reference encoder):
2. Literal image token in text
[{"role": "user", "content": "hi <|deepseek_image|>"}]Before: accepted, so the prompt has an image placeholder with no image. After: 400.
Validation
cargo test -p vllm-chat --lib renderer::: 210 passed. The new tests fail on main. fmt and clippy are clean.vllm-rs renderon DeepSeek-V4.1-Flash-1017: token IDs now match the Python frontend (113 vs 97 on main); the literal image token returns 400.Details
Not a duplicate: open Rust renderer PRs (#62189, #56334) don't touch turn boundaries or placeholder validation.
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.
🤖 Generated with Claude Code