[Bugfix][Frontend][Rust Frontend] Update DeepSeek V4.1 Flash reasoning effort mappings (#58316)
Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Bugen Zhao <i@bugenzhao.com> Signed-off-by: zhec <chengyunfei@ruc.edu.cn>
zhec committed
Sep 26, 2026 at 10:18 UTC
ddd6fbca148a867aad1fcab7ec72f582b9977db4
9 files changed
+20
-20
rust/src/chat/src/renderer/deepseek.rs
+2
-2
@@ -289,8 +289,8 @@ pub(super) fn resolve_reasoning(
289
DsDialect::V41 => {
290
let budget = match effort {
291
EffortValue::String(effort) => match effort.as_str() {
292
- "low" => 25,
293
- "high" => 50,
292
+ "low" => 50,
293
+ "high" => 75,
294
"xhigh" => 75,
295
"max" => 100,
296
_ => return Err(invalid_v41_reasoning_effort()),
rust/src/chat/src/renderer/deepseek_v41/fixtures/test_output_1.txt
+1
-1
@@ -1,4 +1,4 @@
1
-<|begin▁of▁sentence|><|System|>Reasoning Effort: 50 (range 1-100, the higher the value, the more thorough the reasoning)
1
+<|begin▁of▁sentence|><|System|>Reasoning Effort: 75 (range 1-100, the higher the value, the more thorough the reasoning)
2
3
You are a helpful assistant.
4
rust/src/chat/src/renderer/deepseek_v41/fixtures/test_output_2.txt
+1
-1
@@ -1,3 +1,3 @@
1
-<|begin▁of▁sentence|><|System|>Reasoning Effort: 50 (range 1-100, the higher the value, the more thorough the reasoning)
1
+<|begin▁of▁sentence|><|System|>Reasoning Effort: 75 (range 1-100, the higher the value, the more thorough the reasoning)
2
3
You are a helpful assistant.<|User|>Hello<|Assistant|></think>Hi there! How can I help you?<|end▁of▁sentence|><|User|>What is the capital of France?<|Assistant|><think>The user asks about the capital of France. It is Paris.</think>The capital of France is Paris.<|end▁of▁sentence|>
\ No newline at end of file
rust/src/chat/src/renderer/deepseek_v41/fixtures/test_output_developer_tools.txt
+1
-1
@@ -1,4 +1,4 @@
1
-<|begin▁of▁sentence|><|System|>Reasoning Effort: 50 (range 1-100, the higher the value, the more thorough the reasoning)
1
+<|begin▁of▁sentence|><|System|>Reasoning Effort: 75 (range 1-100, the higher the value, the more thorough the reasoning)
2
3
<|User|>question<|User|>policy
4
rust/src/chat/src/renderer/deepseek_v41/tests.rs
+7
-7
@@ -165,9 +165,9 @@ fn image_part(uuid: &str) -> ChatContentPart {
165
#[test]
166
fn maps_reasoning_effort_to_reference_numeric_budget() {
167
for (effort, budget) in [
168
- (None, 50),
169
- (Some(EffortValue::from("low")), 25),
170
- (Some(EffortValue::from("high")), 50),
168
+ (None, 75),
169
+ (Some(EffortValue::from("low")), 50),
170
+ (Some(EffortValue::from("high")), 75),
171
(Some(EffortValue::from("xhigh")), 75),
172
(Some(EffortValue::from("max")), 100),
173
(Some(EffortValue::Number(37.into())), 37),
@@ -189,7 +189,7 @@ fn accepts_numeric_template_effort_with_top_level_precedence() {
189
(json!(1), 1),
190
(json!(42), 42),
191
(json!(100), 100),
192
- (json!("low"), 25),
192
+ (json!("low"), 50),
193
] {
194
let mut request = request();
195
request.chat_options.template_kwargs.insert("reasoning_effort".into(), effort);
@@ -286,11 +286,11 @@ fn system_after_dropped_developer_becomes_leading_system() {
286
],
287
..ChatRequest::for_test()
288
};
289
- expect!["<|begin▁of▁sentence|><|System|>Reasoning Effort: 50 (range 1-100, the higher the value, the more thorough the reasoning)\n\nsys"]
289
+ expect!["<|begin▁of▁sentence|><|System|>Reasoning Effort: 75 (range 1-100, the higher the value, the more thorough the reasoning)\n\nsys"]
290
.assert_eq(&render(&request));
291
292
request.messages.push(ChatMessage::user("question"));
293
- expect!["<|begin▁of▁sentence|><|System|>Reasoning Effort: 50 (range 1-100, the higher the value, the more thorough the reasoning)\n\nsys<|User|>question<|Assistant|><think>"]
293
+ expect!["<|begin▁of▁sentence|><|System|>Reasoning Effort: 75 (range 1-100, the higher the value, the more thorough the reasoning)\n\nsys<|User|>question<|Assistant|><think>"]
294
.assert_eq(&render(&request));
295
}
296
@@ -322,7 +322,7 @@ fn last_user_turn_omits_generation_prompt_when_disabled() {
322
let mut request = request();
323
request.chat_options.generation_prompt_mode = GenerationPromptMode::NoGenerationPrompt;
324
325
- expect!["<|begin▁of▁sentence|><|System|>Reasoning Effort: 50 (range 1-100, the higher the value, the more thorough the reasoning)\n\n<|User|>question"]
325
+ expect!["<|begin▁of▁sentence|><|System|>Reasoning Effort: 75 (range 1-100, the higher the value, the more thorough the reasoning)\n\n<|User|>question"]
326
.assert_eq(&render(&request));
327
}
328
tests/tokenizers_/fixtures/deepseek_v41/test_output_1.txt
+1
-1
@@ -1,4 +1,4 @@
1
-<|begin▁of▁sentence|><|System|>Reasoning Effort: 50 (range 1-100, the higher the value, the more thorough the reasoning)
1
+<|begin▁of▁sentence|><|System|>Reasoning Effort: 75 (range 1-100, the higher the value, the more thorough the reasoning)
2
3
You are a helpful assistant.
4
tests/tokenizers_/fixtures/deepseek_v41/test_output_2.txt
+1
-1
@@ -1,3 +1,3 @@
1
-<|begin▁of▁sentence|><|System|>Reasoning Effort: 50 (range 1-100, the higher the value, the more thorough the reasoning)
1
+<|begin▁of▁sentence|><|System|>Reasoning Effort: 75 (range 1-100, the higher the value, the more thorough the reasoning)
2
3
You are a helpful assistant.<|User|>Hello<|Assistant|></think>Hi there! How can I help you?<|end▁of▁sentence|><|User|>What is the capital of France?<|Assistant|><think>The user asks about the capital of France. It is Paris.</think>The capital of France is Paris.<|end▁of▁sentence|>
\ No newline at end of file
tests/tokenizers_/test_deepseek_v41.py
+4
-4
@@ -35,9 +35,9 @@ def test_reference_encoder_fixtures(case_id):
35
@pytest.mark.parametrize(
36
("effort", "budget"),
37
[
38
- (None, 50),
39
- ("low", 25),
40
- ("high", 50),
38
+ (None, 75),
39
+ ("low", 50),
40
+ ("high", 75),
41
("xhigh", 75),
42
("max", 100),
43
(1, 1),
@@ -138,7 +138,7 @@ def test_top_level_effort_overrides_template_effort():
138
chat_template_kwargs={"reasoning_effort": 100},
139
)
140
kwargs = request.build_chat_params(None, "auto").get_apply_chat_template_kwargs()
141
- assert "Reasoning Effort: 25 " in render(request.messages, **kwargs)
141
+ assert "Reasoning Effort: 50 " in render(request.messages, **kwargs)
142
143
144
def test_encode_uses_one_bos_and_forwards_truncation():
vllm/tokenizers/deepseek_v41_encoding.py
+2
-2
@@ -181,8 +181,8 @@ REASONING_EFFORT_TEMPLATE = (
181
"(range 1-100, the higher the value, the more thorough the reasoning)\n\n"
182
)
183
REASONING_EFFORT_MAPPINGS: Dict[str, int] = {
184
- "low": 25,
185
- "high": 50,
184
+ "low": 50,
185
+ "high": 75,
186
"xhigh": 75,
187
"max": 100,
188
}