[PR #4327] [Engine] DeepSeek: send the medium effort to the template as 62 #5009

Open
opened 2026-11-07 16:31:59 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/4327
Author: @nayuta-yanagisawa
Created: 10/27/2026
Status: 🔄 Open

Base: main ← Head: engine-deepseek-effort-medium


📝 Commits (1)

  • 2fb2b59 serve: DeepSeek's medium effort goes to the template as 62

📊 Changes

2 files changed (+26 additions, -6 deletions)

View changed files

📝 serve/frontend.py (+6 -4)
📝 serve/test_dsv41.py (+20 -2)

📄 Description

Problem and result

DeepSeek-V4.1's effort words are low, high and max, or a number from 1 to 100. medium comes from Unsloth's template (the fixture in serve/fixtures/deepseek41), which maps it to 62. The server passed the word medium to the template as it was.

ISTA's shard 1 of 2026-10-26, which setup accepts since 94d7aab2, carries a template with DeepSeek's three words only, and pick_template keeps it. On a pack built from it, every request that asks for medium fails with HTTP 400:

Invalid reasoning effort: medium, should be int within [1,100] or one of "low", "high", "max"

This covers reasoning_effort, output_config.effort, reasoning.effort and an Anthropic thinking budget of 2K to 8K tokens. When the config or the shared Chat settings say medium, every request that names no effort fails too.

With this change, medium reaches the template as 62. The fixture template renders the same prompt as before.

None. This is a focused fix.

Approach

EFFORT_DEEPSEEK maps medium to 62, and budget_effort takes medium from that table. The rest of the server treats "medium" and 62 alike. Qwen is unchanged.

pick_template could swap out templates without medium instead, but it only decides how tool calls are spelled. The server already maps the API's words to the template's values, so the fix goes there.

Validation

Passed:

  • python -m unittest serve.test_dsv41 serve.test_effort_paths serve.test_responses on 5e8a4cca with this change (Linux, Python 3.14): 116 tests, OK. The new test serves the fixture template with medium removed and sends medium over Chat Completions and over Messages (budget 4000). It fails with HTTP 400 without the change, and passes with it.
  • ISTA's current IQ2_XXS shard 1, identified by its size in DSV41_NEW_SHARD1 (I read only its first 16 MB, so the SHA-256 was not checked). Its template is identical to their chat_template.jinja, and pick_template keeps it. After the change it renders Reasoning Effort: 62 for medium. Every other effort word, the numbers 1, 40 and 100, and the thinking-off words render the same prompt with this template as with the fixture.
  • The fixture template renders a byte-identical prompt for "medium" and for 62.

Failed:

  • The full serve suite on 2fb2b59a: 1,218 tests, 1 failure (test_server.GpuChoice.test_hip_ordinal), which fails the same way without this change.

Not run:

  • A real engine with a pack built from the new shard 1.
  • Engine or backend builds: the change is in serve/ only.

Limits

On DeepSeek the server now always sends 62 for medium, so a template's own value for medium is not used. 62 is Unsloth's value, not DeepSeek's.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/4327 **Author:** [@nayuta-yanagisawa](https://github.com/nayuta-yanagisawa) **Created:** 10/27/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `engine-deepseek-effort-medium` --- ### 📝 Commits (1) - [`2fb2b59`](https://github.com/Niko1221/Strata/commit/2fb2b59af42e5813552b56ff9b00a119df593d4a) serve: DeepSeek's medium effort goes to the template as 62 ### 📊 Changes **2 files changed** (+26 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `serve/frontend.py` (+6 -4) 📝 `serve/test_dsv41.py` (+20 -2) </details> ### 📄 Description ## Problem and result DeepSeek-V4.1's effort words are low, high and max, or a number from 1 to 100. `medium` comes from Unsloth's template (the fixture in `serve/fixtures/deepseek41`), which maps it to 62. The server passed the word `medium` to the template as it was. ISTA's shard 1 of 2026-10-26, which setup accepts since 94d7aab2, carries a template with DeepSeek's three words only, and `pick_template` keeps it. On a pack built from it, every request that asks for medium fails with HTTP 400: ``` Invalid reasoning effort: medium, should be int within [1,100] or one of "low", "high", "max" ``` This covers `reasoning_effort`, `output_config.effort`, `reasoning.effort` and an Anthropic thinking budget of 2K to 8K tokens. When the config or the shared Chat settings say medium, every request that names no effort fails too. With this change, medium reaches the template as 62. The fixture template renders the same prompt as before. ## Related discussion None. This is a focused fix. ## Approach `EFFORT_DEEPSEEK` maps `medium` to 62, and `budget_effort` takes medium from that table. The rest of the server treats `"medium"` and `62` alike. Qwen is unchanged. `pick_template` could swap out templates without medium instead, but it only decides how tool calls are spelled. The server already maps the API's words to the template's values, so the fix goes there. ## Validation **Passed:** - `python -m unittest serve.test_dsv41 serve.test_effort_paths serve.test_responses` on 5e8a4cca with this change (Linux, Python 3.14): 116 tests, OK. The new test serves the fixture template with medium removed and sends medium over Chat Completions and over Messages (budget 4000). It fails with HTTP 400 without the change, and passes with it. - ISTA's current IQ2_XXS shard 1, identified by its size in `DSV41_NEW_SHARD1` (I read only its first 16 MB, so the SHA-256 was not checked). Its template is identical to their `chat_template.jinja`, and `pick_template` keeps it. After the change it renders `Reasoning Effort: 62` for medium. Every other effort word, the numbers 1, 40 and 100, and the thinking-off words render the same prompt with this template as with the fixture. - The fixture template renders a byte-identical prompt for `"medium"` and for 62. **Failed:** - The full `serve` suite on 2fb2b59a: 1,218 tests, 1 failure (`test_server.GpuChoice.test_hip_ordinal`), which fails the same way without this change. **Not run:** - A real engine with a pack built from the new shard 1. - Engine or backend builds: the change is in `serve/` only. ## Limits On DeepSeek the server now always sends 62 for medium, so a template's own value for medium is not used. 62 is Unsloth's value, not DeepSeek's. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#5009
No description provided.