Skip to content

5080deploy 4/9: merge upstream #475, enable_thinking=false with tools - #12

Open
gdevenyi wants to merge 2 commits into
5080/03-developer-role-391from
5080/04-thinking-tools-475
Open

gdevenyi wants to merge 2 commits into
5080/03-developer-role-391from
5080/04-thinking-tools-475

Conversation

@gdevenyi

@gdevenyi gdevenyi commented Sep 15, 2026 •

Copy link
Copy Markdown
Owner

Merges upstream FlashML-org#475 (fix(tokenizer): respect explicit enable_thinking=false even when tools present, head 5a212bea, for FlashML-org#474). Stacked on #11.

Changes

Testing

Tested together with the previous PR (FlashML-org#391) at 805e347.

Unit tests: pytest tests/tokenizer tests/server -m "not slow": 852 passed, 4 skipped.

Live (one get_weather tool, "What is the weather in Paris? Use the tool."):

  • Before (at 150c95d), chat_template_kwargs: {enable_thinking: false}: reasoning_content already empty, tool call {"city": "Paris"}. The bug fix(tokenizer): respect explicit enable_thinking=false even when tools present FlashML-org/FreeToken#475 fixes does not show on this model's chat template, so this merge can't be confirmed as a fix here.
  • After, enable_thinking: false: reasoning_content empty, content empty, tool call {"city": "Paris"}.
  • After, no chat_template_kwargs: reasoning_content 151 characters, tool call {"city": "Paris"}, so default thinking still works.

No regression; the fix itself is unverified on this model.


Environment:

  • RTX 5080 16 GB (sm_120), AMD Ryzen 9 9950X (16 cores), 123 GB RAM
  • Ubuntu 24.04.4, kernel 7.1.9-x64v3-xanmod1
  • Driver 610.57.04, CUDA 13.3, torch 2.11.0+cu130, triton 3.6.0, FreeToken 0.1.2 (editable install)
  • Checkpoint: nvidia/Qwen3.8-Flash-Next-NVFP4

Stack: the 5080deploy branch is main e0886cc plus upstream PRs merged one at a time for a single-user, full-context (262,144-token) deployment on this card. Each PR in the stack is based on the previous one, so its diff is exactly one merge step. Merge them in order, or merge the top of the stack alone.

How tests were run: with the server stopped, since a running server holds almost all VRAM and GPU tests fail spuriously. Benchmarks are streamed chat completions with 256 tokens generated with ignore_eos, one request at a time. Prompts are salted so the radix cache cannot hit.

  • Prefill = prompt tokens / TTFT.
  • Decode = (completion - 1) / time after the first token.
  • "94K recall": a 94,526-token prompt of repository source with a codeword planted in the first line.
  • "248K recall": a 248,029-token prompt with facts planted at token ~0, ~124K and ~240K.

Rebased 2026-09-17 onto upstream main cac247a (v0.1.3). The whole stack was rebuilt merge by merge on the new base (previous base e0886cc); the merge resolutions were replayed unchanged via git rerere, and the rebuilt tip differs from the old one by exactly the e0886cc..cac247a file set. This PR's head is now fb4f839.

Rebased 2026-09-19 onto upstream main cc1f5c2 (4 commits past cac247a: FlashML-org#471 greedy sampling in mixed batches, FlashML-org#518 WeightLoadError, FlashML-org#521 tvm-ffi jit arch, FlashML-org#524 install index). Same replay as before via git rerere; the replayed stack differs from the previous tip 8adde91 by exactly the cac247a..cc1f5c2 file set. This PR's head is now 4eaec8c.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Bu6LgoxLR4wETqb7RPR2vt

…s present

resolve_thinking_mode() forced mode='thinking' when tools were present,
ignoring an explicit enable_thinking=False from the caller. This wasted
generation budget on reasoning tokens for clients that explicitly
requested no thinking while using tool calling.

An explicit disable now takes precedence over the tools-presumed-thinking
heuristic.

Closes FlashML-org#474

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The remaining findings are minor style nits and do not block approval.

Pull request overview

Merges the upstream fix so explicit thinking disable flags override tool-triggered thinking mode.

Changes:

  • Prioritizes enable_thinking=False and thinking=False.
  • Adds regression tests for conflicting flags and tool presence.
File summaries
File Description Findings
tests/tokenizer/test_resolve_thinking_mode.py Adds resolver regression tests. Nit (2 votes): replace the Unicode em dash with an ASCII hyphen.
python/freetoken/tokenizer/tokenize.py Applies explicit disable precedence. Nit (2 votes): replace the Unicode em dash with an ASCII hyphen.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

when tools are offered (dsv4 only emits well-formed tool calls in thinking
mode) or when the caller requests it via ``chat_template_kwargs``.
An explicit ``enable_thinking=False`` (or ``thinking=False``) from the
caller always wins, even when tools are present — the caller knows their

def test_explicit_disable_overrides_tools():
"""An explicit enable_thinking=False (or thinking=False) must win even
when tools are present — the caller knows their intent better than the
@gdevenyi
gdevenyi force-pushed the 5080/03-developer-role-391 branch from f4b6ebe to 925a217 Compare September 18, 2026 03:06
@gdevenyi
gdevenyi force-pushed the 5080/04-thinking-tools-475 branch from 805e347 to fb4f839 Compare September 18, 2026 03:06
@gdevenyi
gdevenyi force-pushed the 5080/03-developer-role-391 branch from 925a217 to d4a2701 Compare September 19, 2026 21:31
@gdevenyi
gdevenyi force-pushed the 5080/04-thinking-tools-475 branch from fb4f839 to 4eaec8c Compare September 19, 2026 21:31
@gdevenyi
gdevenyi force-pushed the 5080/03-developer-role-391 branch from d4a2701 to 8ff853c Compare September 23, 2026 23:35
@gdevenyi
gdevenyi force-pushed the 5080/04-thinking-tools-475 branch from 4eaec8c to 9591b11 Compare September 23, 2026 23:36
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.

3 participants