Skip to content

feat: support DeepSeek V4 0731 reasoning effort handling and template. - #2126

Merged
guojinrong-nn merged 1 commit into
xLLM-AI:mainfrom
chenchuw886:dsv4_0731_adapt
Aug 6, 2026
Merged

feat: support DeepSeek V4 0731 reasoning effort handling and template.#2126
guojinrong-nn merged 1 commit into
xLLM-AI:mainfrom
chenchuw886:dsv4_0731_adapt

Conversation

@chenchuw886

@chenchuw886 chenchuw886 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

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=max and rendered the old Absolute maximum prompt. 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:

Request value Resolved behavior
none Disable thinking and use chat mode
minimal, low, medium Use the low tier with no reasoning-effort prefix
high, xhigh Use the high tier with the Absolute maximum prefix
max Use the max tier with the new Beyond maximum prefix
Omitted or unrecognized Default to the high tier

It also updates thinking-mode resolution so that:

  • Requests without an explicit thinking or enable_thinking flag default to thinking mode.
  • Supplying reasoning_effort without a thinking flag enables thinking mode.
  • An explicit thinking=false selects chat mode.
  • reasoning_effort=none selects chat mode even when thinking is explicitly enabled.

The implementation introduces separate prompt constants for the high and max tiers and centralizes request-level effort normalization before rendering.

Unit tests have been expanded to cover:

  • Default thinking with high effort.
  • Canonical effort levels and compatibility aliases.
  • The new Beyond maximum prompt for max.
  • No prefix for the low tier.
  • Thinking disablement through none.
  • Explicit thinking overrides.
  • Existing chat, tool-call, and message-rendering behavior under the new defaults.

Change Type

  • Bug fix
  • New feature
  • Performance improvement
  • Refactor
  • Documentation
  • Test
  • Build or CI

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

  • The PR title and each commit message follow the xLLM commit format: <type>: <subject>.

Allowed types: feat, bugfix, docs, test, refactor, chore, style, revert, perf, model, build, release.
The subject should use clear English, start with a verb, include at least 4 words, and end with ..

Pre-commit Checks

  • I have installed pre-commit by running pip install pre-commit or an equivalent command.
  • I have installed the hooks with pre-commit install.
  • I have run pre-commit run --all-files and fixed any reported issues.

If you are unsure how to set up pre-commit, see the pre-commit documentation.

Self Review

  • I have self-reviewed the code according to .agents/skills/code-review/references/custom-code-style.md, especially code written or assisted by AI.
  • I have rebased this PR onto the latest main branch.

Build and Test Coverage

  • Tests have been added or updated as needed.
  • CUDA: python setup.py build test has passed on a CUDA machine.
  • NPU: python setup.py build test has passed on an NPU machine.
  • MLU: python setup.py build test has 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/max prompt prefixes.

@chenchuw886 chenchuw886 changed the title feat: support DeepSeek V4 0731 reasoning effort handling and template feat: support DeepSeek V4 0731 reasoning effort handling and template. Aug 5, 2026
@guojinrong-nn
guojinrong-nn merged commit 027c925 into xLLM-AI:main Aug 6, 2026
7 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants