Skip to content

feat(server): encode DeepSeek V4 reasoning effort - #630

Merged
davide221 merged 1 commit into
Luce-Org:mainfrom
pepuscz:feat/deepseek4-reasoning-effort
Aug 26, 2026
Merged

feat(server): encode DeepSeek V4 reasoning effort#630
davide221 merged 1 commit into
Luce-Org:mainfrom
pepuscz:feat/deepseek4-reasoning-effort

Conversation

@pepuscz

@pepuscz pepuscz commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Add the official DeepSeek V4 Flash low, high, and max reasoning-effort
encodings to the native renderer.

  • low adds no model-facing prefix
  • high and max use the exact official prompt prefixes
  • accepts reasoning.effort, top-level reasoning_effort, and
    chat_template_kwargs.reasoning_effort
  • maps API-compatible medium and xhigh to DeepSeek Flash high
  • keeps Lucebox's hyphenated x-high extension as a separate budget tier,
    using the model-facing max encoding
  • uses DeepSeek's high model-facing default when thinking is enabled without
    an effort; disabling thinking suppresses all effort prefixes and budgets
  • keeps bare chat_template_kwargs.thinking and enable_thinking booleans
    renderer-only; only thinking.type: enabled or an explicit effort opts into
    the force-close budget envelope and finish_details
  • advertises the official DeepSeek effort set through /props
  • uses the shared rendering helper for normal requests, FlowKV rerenders, and
    agent-turn-cache canonicalization

Official references:

Rebase

Rebased onto main at c994209, including PRs #640 and #647. The server
rendering-helper conflict was resolved by preserving add_generation_prompt
and passing the normalized effort through the shared helper.

Validation

  • fail-before/pass-after regressions for renderer-only DeepSeek and Qwen
    controls versus budget-envelope opt-in
  • request-policy tests for all effort aliases, all three request spellings,
    precedence, default effort, renderer overrides, and explicit token budgets
  • exact full-prefix renderer tests for low, high, max, thinking-disabled,
    and no-generation-prompt rerenders
  • full HIP test_server_unit: 423/423 passing on gfx1201
  • git diff --check
  • full GitHub CI matrix green on final head 10514b5: Windows, hosted
    CUDA/C++ server tests, R9700, Strix Halo, RTX 3090, DGX GB10, workspace, and
    speed-profile workflows

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 6 files

Re-trigger cubic

@pepuscz
pepuscz force-pushed the feat/deepseek4-reasoning-effort branch from 610b970 to 1924d7c Compare August 19, 2026 11:44
@pepuscz

pepuscz commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (e79f1b6), preserving the merged DeepSeek named-tool-call coverage while resolving the documentation and unit-test conflicts. The rebased commit is 1924d7c. Validation on the gfx1151 ROCm host: dflash_server builds successfully; test_server_unit passes 370/370; test_feature_gate passes 1/1; and the focused reasoning-prefix, tool-capability, and reasoning-capability tests each pass independently. GitHub Actions for the new head are currently awaiting maintainer approval.

@davide221
davide221 force-pushed the feat/deepseek4-reasoning-effort branch 2 times, most recently from a4a1f20 to 1616e3d Compare August 25, 2026 20:30
@davide221

Copy link
Copy Markdown
Contributor

Rebased and requalified against current main (c994209, including #640 and #647).

Final head: 1616e3d

Key corrections made during the rebase/review:

  • preserved the shared current-main renderer for normal requests, FlowKV rerenders, and agent-turn-cache canonicalization
  • corrected DeepSeek Flash aliases: medium/xhigh use model-facing high; Lucebox's hyphenated x-high extension uses model-facing max while retaining its own budget tier
  • defaulted explicitly enabled DeepSeek thinking without an effort to high
  • ensured disabling thinking removes the effort prefix and request budget caps
  • added exact full-prefix rendering coverage plus request precedence, alias, toggle, and budget tests

Validation is green on the rebased head: full GitHub CI (Windows, hosted Linux/CUDA and C++ server tests, Strix Halo gfx1151, R9700 gfx1201, RTX 3090, and DGX GB10), focused tests against the R9700-built test_server_unit binary, and git diff --check.

The PR is now conflict-free and ready for merge. It has not been merged.

@davide221
davide221 force-pushed the feat/deepseek4-reasoning-effort branch from 1616e3d to 21fddbc Compare August 25, 2026 23:14
@davide221

Copy link
Copy Markdown
Contributor

Correction to my earlier ready-for-merge note: a second contract audit found one real blocker in the previous head. Bare chat_template_kwargs.thinking / enable_thinking booleans were incorrectly setting thinking_opt_in. That could activate force-close budgets and finish_details even though these compatibility booleans are renderer controls, and the behavior also leaked into Qwen requests.

Fixed in 21fddbc:

  • renderer-only booleans now change prompt rendering without activating the budget envelope
  • thinking.type: enabled and explicit reasoning effort remain the two budget opt-ins
  • a final disable clears prior effort opt-in and per-request caps
  • DeepSeek renderer-only enable still uses the model-facing high default, but without an implicit force-close cap
  • the canonical budget spec and DS4 documentation now state this distinction

The regression tests were run against both versions: they fail on 1616e3d at the incorrect cap/opt-in assertions and pass on 21fddbc. The rebuilt gfx1201 HIP unit binary passes 423/423 tests, including focused DeepSeek request, prefix-rendering, and Qwen compatibility coverage. git diff --check is clean.

The PR remains one commit directly on current main (c994209) and is conflict-free. Please wait for the new GitHub CI matrix before merging; the old green checks belong to the superseded head.

@davide221
davide221 force-pushed the feat/deepseek4-reasoning-effort branch from 21fddbc to 10514b5 Compare August 25, 2026 23:25
@davide221

Copy link
Copy Markdown
Contributor

Final audit follow-up: head 10514b5 changes the no-explicit-effort request log label from low to default. The previous label was misleading for renderer-enabled Qwen requests; this is diagnostics-only and does not change request behavior. The rebuilt gfx1201 HIP unit binary still passes 423/423. A fresh GitHub matrix is now running for this final head.

@davide221

Copy link
Copy Markdown
Contributor

Final status for 10514b5: all required validation is green.

  • local gfx1201 HIP unit binary: 423/423
  • GitHub hosted CUDA/C++ build and server tests: pass
  • Windows MSVC + CUDA library/server build and smoke test: pass
  • R9700, Strix Halo, RTX 3090, and DGX GB10 jobs: pass
  • workspace/import and speed-profile workflows: pass
  • PR is one commit on c994209, conflict-free, and git diff --check is clean

With the renderer-only budget-opt-in regression fixed and covered, I now consider this head ready to merge. It has not been merged.

@davide221
davide221 merged commit b9d37b3 into Luce-Org:main Aug 26, 2026
9 checks passed
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.

2 participants