Skip to content

Commit ddd6fbc

Browse files
zhecfyclaudeBugenZhao
authored
[Bugfix][Frontend][Rust Frontend] Update DeepSeek V4.1 Flash reasoning effort mappings (#58316)
Co-authored-by: Claude <[email protected]> Co-authored-by: Bugen Zhao <[email protected]> Signed-off-by: zhec <[email protected]>
1 parent 5840d95 commit ddd6fbc

9 files changed

Lines changed: 20 additions & 20 deletions

File tree

‎rust/src/chat/src/renderer/deepseek.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,8 @@ pub(super) fn resolve_reasoning(
289289
DsDialect::V41 => {
290290
let budget = match effort {
291291
EffortValue::String(effort) => match effort.as_str() {
292-
"low" => 25,
293-
"high" => 50,
292+
"low" => 50,
293+
"high" => 75,
294294
"xhigh" => 75,
295295
"max" => 100,
296296
_ => return Err(invalid_v41_reasoning_effort()),

‎rust/src/chat/src/renderer/deepseek_v41/fixtures/test_output_1.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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)
22

33
You are a helpful assistant.
44

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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)
22

33
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|>

‎rust/src/chat/src/renderer/deepseek_v41/fixtures/test_output_developer_tools.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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)
22

33
<|User|>question<|User|>policy
44

‎rust/src/chat/src/renderer/deepseek_v41/tests.rs‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,9 @@ fn image_part(uuid: &str) -> ChatContentPart {
165165
#[test]
166166
fn maps_reasoning_effort_to_reference_numeric_budget() {
167167
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),
171171
(Some(EffortValue::from("xhigh")), 75),
172172
(Some(EffortValue::from("max")), 100),
173173
(Some(EffortValue::Number(37.into())), 37),
@@ -189,7 +189,7 @@ fn accepts_numeric_template_effort_with_top_level_precedence() {
189189
(json!(1), 1),
190190
(json!(42), 42),
191191
(json!(100), 100),
192-
(json!("low"), 25),
192+
(json!("low"), 50),
193193
] {
194194
let mut request = request();
195195
request.chat_options.template_kwargs.insert("reasoning_effort".into(), effort);
@@ -286,11 +286,11 @@ fn system_after_dropped_developer_becomes_leading_system() {
286286
],
287287
..ChatRequest::for_test()
288288
};
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"]
290290
.assert_eq(&render(&request));
291291

292292
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>"]
294294
.assert_eq(&render(&request));
295295
}
296296

@@ -322,7 +322,7 @@ fn last_user_turn_omits_generation_prompt_when_disabled() {
322322
let mut request = request();
323323
request.chat_options.generation_prompt_mode = GenerationPromptMode::NoGenerationPrompt;
324324

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"]
326326
.assert_eq(&render(&request));
327327
}
328328

‎tests/tokenizers_/fixtures/deepseek_v41/test_output_1.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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)
22

33
You are a helpful assistant.
44

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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)
22

33
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|>

‎tests/tokenizers_/test_deepseek_v41.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ def test_reference_encoder_fixtures(case_id):
3535
@pytest.mark.parametrize(
3636
("effort", "budget"),
3737
[
38-
(None, 50),
39-
("low", 25),
40-
("high", 50),
38+
(None, 75),
39+
("low", 50),
40+
("high", 75),
4141
("xhigh", 75),
4242
("max", 100),
4343
(1, 1),
@@ -138,7 +138,7 @@ def test_top_level_effort_overrides_template_effort():
138138
chat_template_kwargs={"reasoning_effort": 100},
139139
)
140140
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)
142142

143143

144144
def test_encode_uses_one_bos_and_forwards_truncation():

‎vllm/tokenizers/deepseek_v41_encoding.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ def sort_tool_results_by_call_order(
181181
"(range 1-100, the higher the value, the more thorough the reasoning)\n\n"
182182
)
183183
REASONING_EFFORT_MAPPINGS: Dict[str, int] = {
184-
"low": 25,
185-
"high": 50,
184+
"low": 50,
185+
"high": 75,
186186
"xhigh": 75,
187187
"max": 100,
188188
}

0 commit comments

Comments
 (0)