feat: support DeepSeek V4 0731 reasoning effort handling and template. - #2126
Merged
Conversation
chenchuw886
requested review from
Clement-Wang26,
DongheJin,
DragonFive,
JimHsiung,
Kang-Meng,
RobbieLeung,
XuZhang99,
liujinguang0125,
liutongxuan,
walsonyang,
xiao-yu-chen,
yingxudeng,
yq33victor and
zhang-minchao
as code owners
August 5, 2026 05:18
chenchuw886
force-pushed
the
dsv4_0731_adapt
branch
from
August 5, 2026 05:32
124ecb2 to
667da1c
Compare
yingxudeng
approved these changes
Aug 5, 2026
guojinrong-nn
approved these changes
Aug 5, 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.
Description
This PR aligns xLLM's DeepSeek V4 C++ chat template with the reasoning-effort behavior introduced by DeepSeek-V4-Flash-0731, following the upstream implementations in vLLM #50580.
Previously, xLLM only recognized
reasoning_effort=maxand rendered the oldAbsolute maximumprompt. Requests without an explicit thinking flag also defaulted to chat mode. This did not match the updated DeepSeek V4 behavior.This PR updates the effort normalization and prompt rendering as follows:
noneminimal,low,mediumlowtier with no reasoning-effort prefixhigh,xhighhightier with theAbsolute maximumprefixmaxmaxtier with the newBeyond maximumprefixhightierIt also updates thinking-mode resolution so that:
thinkingorenable_thinkingflag default to thinking mode.reasoning_effortwithout a thinking flag enables thinking mode.thinking=falseselects chat mode.reasoning_effort=noneselects chat mode even when thinking is explicitly enabled.The implementation introduces separate prompt constants for the
highandmaxtiers and centralizes request-level effort normalization before rendering.Unit tests have been expanded to cover:
higheffort.Beyond maximumprompt formax.lowtier.none.Change Type
Pull Request Checklist
Thank you for contributing to xLLM. Before requesting review, please make sure the following items are complete.
PR Title and Commit Messages
<type>: <subject>.Pre-commit Checks
pre-commitby runningpip install pre-commitor an equivalent command.pre-commit install.pre-commit run --all-filesand fixed any reported issues.Self Review
.agents/skills/code-review/references/custom-code-style.md, especially code written or assisted by AI.mainbranch.Build and Test Coverage
python setup.py build testhas passed on a CUDA machine.python setup.py build testhas passed on an NPU machine.python setup.py build testhas passed on an MLU machine.Reviewer Notes
Please focus on the reasoning-effort normalization table, the default transition from chat mode to thinking mode when no flag is supplied, and the exact
high/maxprompt prefixes.