Skip to content

fix: thinking not actually disabled for DeepSeek models (bench reads ~35% low) - #54

Open
y1618 wants to merge 1 commit into
MiaAI-Lab:mainfrom
y1618:fix/deepseek-thinking-flag
Open

fix: thinking not actually disabled for DeepSeek models (bench reads ~35% low)#54
y1618 wants to merge 1 commit into
MiaAI-Lab:mainfrom
y1618:fix/deepseek-thinking-flag

Conversation

@y1618

@y1618 y1618 commented Aug 19, 2026

Copy link
Copy Markdown

Problem

applyThinkingFlags disables thinking via chat_template_kwargs.enable_thinking, but DeepSeek V4 chat templates only honor thinking and silently ignore enable_thinking.

When the server is launched with a thinking-on default (the DSpark stacks use --default-chat-template-kwargs '{"thinking":true,"reasoning_effort":"max"}'), the decode bench's entire fixed-length window is spent inside <think>. Reasoning text has much lower MTP/speculative acceptance, so the bench under-reads sustained decode throughput. The recorded bench results confirm it: reasoningChunks: 175 on a 512-token c=1 stream that was supposed to have thinking off.

Measured on a 2x DGX Spark DeepSeek-V4-Flash-0731 stack (c=1, 512 tokens, temp 0):

decode tok/s reasoningChunks
before (enable_thinking:false, ignored) 44.1 175
after (thinking:false) 70.4 0

Fix

  • applyThinkingFlags: model ids containing deepseek also get chat_template_kwargs.thinking (everyone else keeps enable_thinking, mirroring the existing MiniMax thinking_mode special case)
  • stripThinkingFlags: also removes thinking so the HTTP-400 retry path stays clean
  • unit tests for the mapping (LlmStreaming.thinking.test.js, 5 cases)

node --test 'server/collectors/__tests__/*.test.js': 110 pass, 1 pre-existing unrelated failure (ComfyProbe.test.js needs the ws package outside the container).

🤖 Generated with Claude Code

https://claude.ai/code/session_01NRSGQ8VRdFgB76tz9JbtMX

The decode bench and showcase disable thinking via
`chat_template_kwargs.enable_thinking`, but DeepSeek V4 templates only
honor `thinking` and silently ignore `enable_thinking`. With a server
default of `{"thinking":true,"reasoning_effort":"max"}` the whole bench
window is spent inside `<think>`, where MTP acceptance is much lower —
on a 2x DGX Spark DeepSeek-V4-Flash stack the c=1 decode bench read
44.1 tok/s; with thinking actually off it reads 70.4 tok/s.

Map deepseek model ids to `thinking` in applyThinkingFlags (keeping
enable_thinking for everyone else), strip it in stripThinkingFlags for
the 400-retry path, and add unit tests.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NRSGQ8VRdFgB76tz9JbtMX
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.

1 participant