Repository navigation
[Bugfix][Frontend] Match DeepSeek-V4.1 encoder to the 1017 reference encoding - #62199
Merged
robertgshaw2-redhat merged 7 commits intoOct 19, 2026
Conversation
…encoding Tool-result-only user turns no longer end the current turn, so drop_thinking keeps the reasoning that led to a tool call. Reject literal image placeholder tokens in message text and reasoning. Vendor the reference encoder's golden fixtures from DeepSeek-V4.1-Flash-1017; DeepSeek-V4.1-Flash carries the same encoding/ since 2026-10-16. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Robert Shaw <robertgshaw2@gmail.com>
robertgshaw2-redhat
requested review from
DarkLight1337 and
njhill
as code owners
October 17, 2026 15:51
6 tasks done
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Robert Shaw <robertgshaw2@gmail.com>
robertgshaw2-redhat
enabled auto-merge (squash)
October 17, 2026 22:08
Collaborator
Author
|
/ci run |
|
✅ Triggered Buildkite CI #95627 for commit |
Contributor
|
This pull request has merge conflicts that must be resolved before it can be |
…1-1017-encoder-parity # Conflicts: # tests/tokenizers_/test_deepseek_v41.py
…gshaw2-redhat/vllm into dsv41-1017-encoder-parity
Collaborator
Author
|
/ci retry |
|
✅ Triggered Buildkite CI #95915 for commit |
6 tasks done
reputationly
added a commit
to reputationly/vllm-backport
that referenced
this pull request
Oct 21, 2026
上游来源:vllm-project/vllm#62199 (ddefe40e16)、#60792 (3c8245b73d)、 #62200 (2cea893821),适配点: - tokenizer 路径沿用本仓 deepseek_v41 / deepseek_v4_1 命名,手工逐 hunk 合入; - FakeHfTokenizer 测试工装保留,fixture 从 1017 reference 整体替换; - effort 别名按 deepseek-recipe 补齐 minimal/medium/xhigh/ultra; - Rust renderer 同步 starts_user_turn / 图片占位符拒绝(测试用 new() 适配本仓)。 Co-authored-by: DSH Agent <dsh-agent@local> Signed-off-by: DSH Agent <dsh-agent@local> Signed-off-by: reputationly <197039020@qq.com>
5 of 6 tasks
3 of 5 tasks
1 of 5 tasks
Morrowmake
pushed a commit
to Morrowmake/vllm-cmp170hx
that referenced
this pull request
Oct 24, 2026
A user message that holds only tool results no longer counts as the last user turn, as in the 1017 reference encoder. With drop_thinking on (a request that declares no tools) the old rule dropped the reasoning of every earlier tool round of the current turn and closed the thinking block right after each of those tool results. This is the find_last_user_index change of upstream vllm-project#62199; it goes away when the base includes that commit.
Morrowmake
pushed a commit
to Morrowmake/vllm-cmp170hx
that referenced
this pull request
Oct 26, 2026
Upstream vLLM vllm-project#61455 tags draft groups on the global KV cache groups and keeps is_eagle_group when it projects them onto a worker that owns none of a group's layers, so every worker's config already carries the flag merge_eagle_group_flags restored. Remove it, its call, its test and its seam pin. The DeepSeek-V4.1 encoder fix for tool results (upstream vLLM vllm-project#62199) is now upstream's own text: drop the stale modification notice from that file.
bantianyue
pushed a commit
to bantianyue/vllm
that referenced
this pull request
Oct 28, 2026
…encoding (vllm-project#62199) 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
Match the Python DeepSeek V4.1 encoder to the updated reference
encoding/. Rust counterpart: #62200.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
pytest tests/tokenizers_/test_deepseek_v41.py tests/tokenizers_/test_deepseek_v4.py: 84 passed. The new tests fail on main.Details
Not a duplicate: #60792 (image order) and other open V4.1 tokenizer PRs don't change turn boundaries or placeholder validation. Fixtures are copied from the 1017 repo (MIT).
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