Skip to content

[Feature]add reasoning effort#6656

Merged
LiqinruiG merged 12 commits intoPaddlePaddle:developfrom
luukunn:glm
Mar 6, 2026
Merged

[Feature]add reasoning effort#6656
LiqinruiG merged 12 commits intoPaddlePaddle:developfrom
luukunn:glm

Conversation

@luukunn
Copy link
Collaborator

@luukunn luukunn commented Mar 4, 2026

Motivation

💡 If this PR is a Cherry Pick, the PR title needs to follow the format by adding the [Cherry-Pick] label at the very beginning and appending the original PR ID at the end. For example, [Cherry-Pick][CI] Add check trigger and logic(#5191)

💡 如若此PR是Cherry Pick,PR标题需遵循格式,在最开始加上[Cherry-Pick]标签,以及最后面加上原PR ID,例如[Cherry-Pick][CI] Add check trigger and logic(#5191)

Modifications

Usage or Command

Accuracy Tests

Checklist

  • Add at least a tag in the PR title.
    • Tag list: [[FDConfig],[APIServer],[Engine], [Scheduler], [PD Disaggregation], [Executor], [Graph Optimization], [Speculative Decoding], [RL], [Models], [Quantization], [Loader], [OP], [KVCache], [DataProcessor], [BugFix], [Docs], [CI], [Optimization], [Feature], [Benchmark], [Others], [XPU], [HPU], [GCU], [DCU], [Iluvatar], [Metax]]
    • You can add new tags based on the PR content, but the semantics must be clear.
  • Format your code, run pre-commit before commit.
  • Add unit tests. Please write the reason in this PR if no unit tests.
  • Provide accuracy results.
  • If the current PR is submitting to the release branch, make sure the PR has been submitted to the develop branch, then cherry-pick it to the release branch with the [Cherry-Pick] PR tag.

@paddle-bot
Copy link

paddle-bot bot commented Mar 4, 2026

Thanks for your contribution!

@luukunn luukunn changed the title Glm [Feature]add reasoning effort Mar 4, 2026
try:
chat_template_kwargs = task.get("chat_template_kwargs") or {}
chat_template_kwargs.update({"chat_template": task.get("chat_template")})
chat_template_kwargs.update({"reasoning_effort": task.get("reasoning_effort")})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需要判断个 None, 非None 的时候再加进去吧。

chat_template: Optional[str] = None
reasoning_max_tokens: Optional[int] = None
response_max_tokens: Optional[int] = None
reasoning_effort: Literal["low", "medium", "high"] | None = None
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

再加一个 minimal

f"req_id: {data['request_id']}, reasoning_max_tokens exceeds max_tokens, the value of reasoning_max_tokens will be adjusted to {data['max_tokens']}"
)

if data.get("response_max_tokens") is not None:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个是 response_max_tokens, 不是reasoning_max_tokens


if data.get("reasoning_max_tokens") is not None:
if data["reasoning_max_tokens"] < 0:
if data["reasoning_max_tokens"] <= 0:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

等于0 的时候, 不用报错

if data["response_max_tokens"] <= 0:
raise ParameterError("response_max_tokens", "response_max_tokens must be greater than 0")
if data.get("reasoning_effort") is not None:
data["enable_thinking"] = False
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以去掉 reasoning_max_tokens

@codecov-commenter
Copy link

codecov-commenter commented Mar 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (develop@598cce8). Learn more about missing BASE report.

Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #6656   +/-   ##
==========================================
  Coverage           ?   72.04%           
==========================================
  Files              ?      392           
  Lines              ?    53710           
  Branches           ?     8437           
==========================================
  Hits               ?    38698           
  Misses             ?    12222           
  Partials           ?     2790           
Flag Coverage Δ
GPU 72.04% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Collaborator

@LiqinruiG LiqinruiG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@LiqinruiG LiqinruiG merged commit caf73e8 into PaddlePaddle:develop Mar 6, 2026
22 of 24 checks passed
luukunn added a commit to luukunn/FastDeploy that referenced this pull request Mar 6, 2026
* add reasoning_effort

* fix log

* fix reasoning_effort

* add reasoning_effort level

* fix valid_parameters

* fix valid_parameters

* fix

* fix unit test

* add unit test

* add unit test
Jiang-Jia-Jun pushed a commit that referenced this pull request Mar 6, 2026
#6706)

* [Feature]add reasoning effort (#6656)

* add reasoning_effort

* fix log

* fix reasoning_effort

* add reasoning_effort level

* fix valid_parameters

* fix valid_parameters

* fix

* fix unit test

* add unit test

* add unit test

* add arguments string in tool
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