Skip to content

Studio: use --reasoning where available and name the compressed-tensors refusal - #11072

Merged
danielhanchen merged 9 commits into
mainfrom
pr/studio-reasoning-probe-and-quant-matcher
Sep 17, 2026
Merged

danielhanchen merged 9 commits into
mainfrom
pr/studio-reasoning-probe-and-quant-matcher

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Sep 16, 2026 •

Copy link
Copy Markdown
Member

Summary

Two reports against the same Studio load path.

  1. Every Studio launch of a reasoning model makes llama-server print Setting 'enable_thinking' via --chat-template-kwargs is deprecated. Use --reasoning on / --reasoning off instead. We now emit --reasoning on|off on builds that have the flag, and keep --chat-template-kwargs for everything else.
  2. A compressed-tensors checkpoint (NVFP4 or FP8) failed on a CUDA, ROCm or CPU host with transformers' own pip install compressed-tensors, which is advice a Studio user cannot act on. It is now refused with a short message that says what to do instead.

Root cause

The deprecated kwarg. LlamaCppBackend.load_model has only ever had one channel for the launch-time thinking default, --chat-template-kwargs {"enable_thinking": ...}, and llama.cpp deprecated setting that one key that way. The deprecation is per key: enable_thinking is the only template variable with a flag of its own, and --chat-template-kwargs is still the only channel for an arbitrary one.

The refusal that only fired on MLX. _is_unsupported_nvfp4_inference_error matches the MLX loader's per-module metadata error, so it never fired anywhere else. On every other host the load dies inside transformers, and format_error_message passes that text through untouched, so the raw pip install compressed-tensors reached the user. Installing the library into the Studio environment does not make the checkpoint load either, which is what the reporter found.

Changes

studio/backend/core/inference/llama_cpp.py

  • probe_server_capabilities reports a new supports_reasoning_flag, read off the flag catalogue parsed from llama-server --help. Read off the catalogue and not the raw text, because --reasoning-format, --reasoning-budget and --reasoning-preserve all contain the string and none of them is this flag.
  • The gate fails closed, unlike --jinja. A build that predates the flag exits with error: invalid argument: --reasoning rather than starting without it, so an empty help, a failed probe or anything short of a positive answer keeps the argv main emits today, byte for byte.
  • _build_launch_reasoning_args moves only enable_thinking. preserve_thinking, a reasoning_effort ladder and any future template variable stay in --chat-template-kwargs.
  • The logger.info that --chat-template-kwargs is deprecated, use instead --reasoning #7526 was diagnosed from keeps naming the resolved defaults and now also names the flags they went out as.

studio/backend/core/inference/llama_server_args.py

  • --reasoning and its -rea alias join _TEMPLATE_FLAGS, for the reason --chat-template-kwargs is already in that group: applying a chat template override recomputes the reasoning default from the new template, and an inherited copy appended later would last-wins-override it. Without the entry, the outcome would depend on which spelling the user typed. It takes a value, so it is deliberately not in _BOOLEAN_SHADOWING_FLAGS.

studio/backend/routes/inference.py

  • _unsupported_quantization_detail is the one place the load route, the native-model load route and validate now ask, so those three cannot drift apart on which shapes they recognise. The NVFP4 MLX refusal keeps its own wording.
  • A compressed-tensors checkpoint is refused with This model is quantized with compressed-tensors (NVFP4 or FP8), which Unsloth cannot run yet. Installing compressed-tensors will not help. Try a GGUF or a 4-bit build of this model instead.
  • The two signatures match the part of transformers' message that survived its 5.10 rewording, not a whole sentence. Transformers changed both refusals in 5.10 to name a minimum version, so a matcher built from either wording alone recognises only half the range Studio supports.

Evidence

Two real llama-server binaries, a real Qwen3-0.6B GGUF, the real capability probe and the real launcher. b10909 is the bundled prebuilt, which has the flag; b6277 is the release tag, which does not.

Launch default versus what a request asks for, on b10909:

launch args plain request request enable_thinking=true request enable_thinking=false deprecation warning
(none) thinking thinking no thinking no
--chat-template-kwargs {"enable_thinking": true} thinking thinking no thinking yes
--reasoning on thinking thinking no thinking no
--chat-template-kwargs {"enable_thinking": false} no thinking thinking no thinking yes
--reasoning off no thinking thinking no thinking no
--reasoning off + {"preserve_thinking": false} no thinking thinking no thinking no

The flag rows and the kwargs rows match row for row, so the substitution is exact and the launch value is still a per-key default a request overrides. The same table with LLAMA_ARG_REASONING exported as on, off and auto is also identical between the two channels.

On b6277, every --reasoning row is did not start, exit 1, which is why the gate fails closed. With the probe in charge, that build gets the same argv it gets on main.

End to end, the probe and the launcher together: on b10909 the branch emits --reasoning on --chat-template-kwargs {"preserve_thinking": false}, the server starts and the deprecation warning is gone; main emits the single kwargs argument and the warning is present. On b6277 the probe answers no and both sides produce the identical argv.

For the second issue, the matcher was checked against the refusal every transformers really raises, produced by calling the two upstream sites with the library reported absent:

transformers config site quantizer site
5.0.0, 5.4.0, 5.9.0 matched matched
5.10.4, 5.13.1, 5.17.0 matched matched

A matcher pinned to the pre-5.10 wording matches the first three rows and misses the last three.

Compatibility

corner result
llama-server without --reasoning (b6277) pass, argv byte-identical to main, flag never emitted
llama-server with --reasoning (b10909) pass, flag emitted, warning gone, behaviour unchanged
probe inconclusive (empty help, nonzero exit, missing binary) pass, falls back to the kwargs channel
a future llama.cpp that lists the flag as removed pass, treated as absent
reasoning_effort ladder models (gpt-oss style) pass, unchanged on both vintages, flag never emitted
preserve_thinking default from #9096 pass, stays in --chat-template-kwargs
Linux, Windows, WSL and macOS x NVIDIA, AMD and CPU pass, 12 corners, reasoning argv invariant
transformers 4.57.6 through 5.9 (pre-rewording refusal) pass
transformers 5.10 through 5.17 (post-rewording refusal) pass
every other quantization family transformers ships pass, 25 to 26 families, no message re-routed
MLX NVFP4 metadata refusal pass, unchanged wording

The capability cache is an in-process dict keyed on binary path, mtime and size and is never persisted, so the new key cannot be read stale from an older install, and every consumer uses .get().

Tests

studio/backend/tests/test_launch_reasoning_flag.py, 55 tests. The probe against help text copied verbatim out of both binaries, the per-key split, the closed gate on four inconclusive shapes, the real load_model on 12 host combinations, and both spellings of an inherited launch flag against a chat template override.

studio/backend/tests/test_compressed_tensors_load_error_message.py, 30 tests. All four wordings through the load route, the native-model load route and validate; the message surviving format_error_message; the untouched MLX refusal; an unrelated failure keeping its own message; the child-process diagnostics block still not being read.

Two of those are drift guards rather than fixtures. One re-derives the refusal from whichever transformers is installed by calling CompressedTensorsConfig.__init__ and CompressedTensorsHfQuantizer.validate_environment with the library reported absent, and fails naming the new sentence if transformers rewords again. The other parses every raise in every transformers/quantizers/quantizer_*.py and asserts the route still declines to claim any of them, which is how a widened matcher is kept inside compressed-tensors: 53 messages over 25 families on transformers 5.4.0, 57 over 26 on 5.17.0, and only the compressed-tensors quantizer's own answer changes.

studio/backend$ python -m pytest tests/test_launch_reasoning_flag.py
main:   collection error, _build_launch_reasoning_args does not exist
branch: 55 passed

studio/backend$ python -m pytest tests/test_compressed_tensors_load_error_message.py
main:   23 failed, 7 passed
branch: 30 passed

The 7 that pass on main are the ones asserting behaviour this change must preserve: the MLX refusal's own wording, an unrelated failure keeping its own message, and the child-process diagnostics block not being read.

Cross-platform staging, four owners in parallel, counts read out of the run logs rather than off
the tick:

OS verdict tests
ubuntu-latest (x64 Linux) success 85 passed
macos-15 (Apple Silicon) success 85 passed
windows-latest (x64) success 85 passed
macos-26 (Apple Silicon) success 85 passed
ubuntu-24.04-arm (ARM64 Linux) success 85 passed
windows-11-arm (ARM64 Windows) not run backend requirements pin sqlite-vec, which has no win-arm64 wheel

The last three are platforms this change does not touch in any specific way, so that "it broke
nothing" is a measurement. WSL is not a GitHub runner: it is covered as a code path, in the
12-host launch matrix and in the collapse table above, not on a real WSL machine.

Whole backend suite, the Backend CI selection, Python 3.13:

main:   11 failed, 44314 passed, 297 skipped
branch: 14 failed, 44395 passed, 294 skipped

The 81 added passes are this PR's two files. Every failure is pre-existing and unrelated (account confinement, media index, offload planner, text-io encoding, a GPU arch gate). The three that separate the two totals are all in tests/test_account_tool_confinement.py, which is order and load sensitive under -n 4; run on its own it is 3 failed, 31 passed, 1 skipped on both sides, identically. tests/studio/load_freeze 23 passed, tests/studio/test_token_count_prompt_parity.py 15 passed, ruff clean.

Routing, enumerated rather than argued

Both changed predicates were run over their whole input space on both sides, and the three files
were parsed with ast on both sides so a change in reachability is a structural fact. One
function is added to llama_cpp.py, two to routes/inference.py, none is removed, and no bare
except is introduced or made newly reachable.

_build_launch_reasoning_args, over the product of the capability tri-state (advertised, refused,
None, key absent, probe-inconclusive), five enable_thinking shapes, preserve_thinking, a
reasoning_effort ladder and an unknown future key:

300 cells, 24 emit the flag, 276 byte-identical to main, 0 violations

The 24 that differ are exactly the cells where the probe positively advertised the flag and the
deprecated key is a bool, and in every one of them the default_template_kwargs llama-server
resolves is identical to what main resolves. This enumeration is what found the empty-kwargs
case fixed in the second commit: main appends --chat-template-kwargs {} for an empty dict and
the first version of this helper appended nothing. _reasoning_kwargs never returns an empty dict,
so the launcher could not produce it, but the untouched path should be identical to main by
construction rather than by an argument about reachability.

_unsupported_quantization_detail, over every raise literal parsed out of every
transformers/quantizers/quantizer_*.py and transformers/utils/quantization_config.py, plus the
MLX refusal, plus shapes that must stay generic failures, plus both recorded wordings:

transformers messages quantization families unmoved moved violations
5.4.0 179 28 174 5 0
5.17.0 193 30 189 4 0

Every moved message goes from the terminal Failed to load model to the new refusal, and every
one of them is a compressed-tensors message. Nothing moves out of the MLX NVFP4 branch, which is
also guaranteed structurally, since it is evaluated first and is unchanged. Unmoved messages are
checked for byte-identical text, not merely the same branch.

The one probe a predicate depends on can fail, time out or answer nothing. What that collapses to,
per OS:

OS help empty, exit 0 help empty, exit 1 usage only probe raises namesakes only advertised
Linux False False False False False True
WSL False False False False False True
Windows False False False False False True
macOS False False False False False True

Fail closed everywhere: "could not be asked" never becomes "the flag is present". It has to be
this way round, because a build without the flag exits on it rather than starting without it.

Release safety

Nothing here is read by the installer, the Desktop updater or the release workflow. The diff
touches no installer script, workflow, marker, version file or schema, adds no disk write, no
environment mutation, no pid or signal call, and no shell integration, session or credential code.
The new capability key lives in an in-process dict keyed on the binary's path, mtime and size,
never serialised and never written to disk, so no older marker can lack it and no strict parser
can meet it. That cache key is also what makes unsloth studio update work through this change:
replacing llama-server in place invalidates the entry, so a user who updates from a build without
the flag to one with it starts using it without restarting Studio. Update and marker suites:
750 passed.

A user on NVIDIA CUDA Linux, or CPU-only Windows, who never loads a compressed-tensors checkpoint
and whose llama-server predates the flag executes provably the same sequence, for every one of the
300 enumerated inputs.

Known limitations

  • An exported LLAMA_ARG_REASONING, which unsloth start writes, is left exactly where it already was: the command line beats the environment, so a launch overrides it here just as the kwargs channel overrides it on main today. Measured on b10909 across on, off and auto. What changes is only which warning llama-server prints about it, and the new one names the override it drops instead of saying nothing. Actually honouring that override is a separate behaviour change, worked out in fix(studio): use --reasoning for launch defaults #8521.
  • The compressed-tensors refusal is a message, not support. Running these checkpoints is still the open ask.

Fixes #7526
Fixes #8246


What this looks like in Studio

Two isolated Studio installs, built from this PR's merge base (2ab07c9c4) and from its head, driven by one scene. Both were pointed at the same seeded cache holding unsloth/gemma-4-E2B-it-NVFP4 config-only: transformers refuses at quantizer selection, before a weight is read, so this reaches the real refusal without the weights and without a GPU. The shot is the load-error chip in the chat header with its popover open, which is where the whole sentence is.

compressed-tensors load refusal, before and after

Read off the same server that was photographed, rather than off the picture:

BEFORE (merge base) AFTER (head)
chip text Failed to load model: compressed_tensors is not installed and is required for compressed-tensors quantization. Please install it with pip install compressed-tensors. This model is quantized with compressed-tensors, which Unsloth cannot run yet. Installing compressed-tensors will not help. Try a GGUF or a bitsandbytes 4-bit build of this model instead.
detail_tells_the_user_to_pip_install true false

The advice the reporter in #8246 could not act on is the pip install line: Studio runs from its own environment, so following it moves the failure rather than fixing it. The AFTER text also names no quantization scheme, because the two transformers errors this matches are raised before the compression config is read and so cannot identify one.

The composite is cropped to the chip and popover. Below that crop the two halves also differ in the greeting line, which is chosen at random per page load and is not something this PR touches.

…rs refusal

Two things reported against the same llama.cpp launch path.

llama-server now prints "Setting 'enable_thinking' via --chat-template-kwargs
is deprecated. Use --reasoning on / --reasoning off instead." on every Studio
launch of a reasoning model. The deprecation is per key, and only enable_thinking
has a flag of its own, so only that key moves; preserve_thinking, a
reasoning_effort ladder and any future template variable stay in
--chat-template-kwargs, which is still the only channel for an arbitrary
template key.

The gate is the flag catalogue read off llama-server --help, and it fails closed.
A build that predates the flag exits with "error: invalid argument: --reasoning"
rather than starting without it, measured on the b6277 release tag, so anything
short of a positive answer keeps the argv main emits today byte for byte.
Measured on two real binaries: on b10909 the two channels produce the same
thinking state for a plain request and for a request that sets its own
chat_template_kwargs either way, with and without LLAMA_ARG_REASONING exported,
and only the kwargs channel prints the warning.

--reasoning and its -rea alias join the template flag group in
llama_server_args, for the reason --chat-template-kwargs is already in it:
applying a chat template override recomputes the reasoning default from the new
template, and an inherited copy appended later would last-wins-override it.

Separately, a compressed-tensors checkpoint (NVFP4 or FP8) is now refused with
the same short message on every host. Studio only recognised the MLX loader's
per-module metadata error, so on a CUDA, ROCm or CPU host the load died inside
transformers and showed the user "pip install compressed-tensors", which is
advice that cannot succeed: Studio runs from its own environment, and installing
the library there does not make the checkpoint load either.

Both refusal sites are matched on the part that survived transformers' 5.10
rewording rather than on a whole sentence, because the wording carried a minimum
version from 5.10 on and a matcher built from either wording alone covers half
the supported range. The new test re-derives the pair from whichever transformers
is installed, and walks every quantizer transformers ships to confirm no other
quantization family is re-routed into this refusal.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-16T14:42:29.933888Z 5343e03 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 66621dbd26

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread studio/backend/routes/inference.py Outdated
Comment on lines +14327 to +14329
"This model is quantized with compressed-tensors (NVFP4 or FP8), which Unsloth "
"cannot run yet. Installing compressed-tensors will not help. Try a GGUF or a "
"4-bit build of this model instead."

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Make the compressed-tensors refusal format-neutral

When a compressed-tensors W4A16, W8A8, INT8, MXFP4, or other non-FP8/NVFP4 checkpoint encounters the missing-library error, _is_missing_compressed_tensors_error matches it solely by the generic quantization method and returns this message. The repository itself exports these formats in unsloth/save.py:202-218, so affected users are incorrectly told their model is “NVFP4 or FP8” and may even be advised to find a 4-bit build when they already selected W4A16. Either inspect the model's actual scheme before naming formats or make this refusal describe compressed-tensors generically.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in f272e68. Confirmed against transformers rather than from memory: both sites this matcher accepts raise before the compression config is read. CompressedTensorsHfQuantizer.validate_environment tests only is_compressed_tensors_available() and is_torch_available(), with no branch on quantization_config, and CompressedTensorsConfig.__init__ is the same shape. Scheme-dependent behaviour starts at _process_model_before_weight_loading, well after the raise. So a W4A16, W8A8, INT8 or MXFP4 checkpoint produced a byte-identical error to an NVFP4 one and there was nothing in it to tell them apart.

The refusal is now format-neutral. The "4-bit build" advice is qualified as "a bitsandbytes 4-bit build" for the reason you gave: unqualified it reads as a no-op to someone who already selected W4A16. _NVFP4_INFERENCE_UNSUPPORTED_MESSAGE keeps naming the scheme, since the MLX loader error it fires on does identify it.

A new test asserts the refusal contains none of NVFP4, FP8, W4A16, W8A8, INT8 or MXFP4, and that the MLX one still names NVFP4, so the two cannot drift back together.

_build_launch_reasoning_args dropped main's --chat-template-kwargs {} when the
reasoning kwargs were empty, on every build including the ones the probe answers
no for. _reasoning_kwargs returns a non-empty dict today, so that input does not
arrive from the launcher, but the untouched path should be identical to main
because of how the code is written and not because the one input that separates
the two spellings is unreachable.

Found by enumerating the predicate's whole input space rather than by reading the
diff: 300 cells over the capability tri-state, five enable_thinking shapes, and
preserve_thinking, a reasoning_effort ladder and an unknown future key. Before
this commit 5 of the 300 differed from main on a path that emits no flag; after
it, 276 are byte-identical and the remaining 24 are exactly the cells where the
probe advertised the flag and the deprecated key is a bool.
danielhanchen added a commit to Imagineer99/unsloth that referenced this pull request Sep 16, 2026
danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Sep 16, 2026
danielhanchen added a commit to shimmyshimmer/unsloth-staging-4 that referenced this pull request Sep 16, 2026
danielhanchen added a commit to Datta0/unsloth-staging-3 that referenced this pull request Sep 16, 2026
danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Sep 16, 2026
danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Sep 16, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 16, 2026
Both transformers errors this matches are raised before the compression config is
read, so W4A16, W8A8, INT8 and MXFP4 checkpoints reached a message that told them
they were NVFP4 or FP8 and advised finding a 4-bit build they had already picked.
The MLX path does identify the scheme and keeps its specific wording.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: f272e68422

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

danielhanchen and others added 2 commits September 16, 2026 08:21
The guard re-derives transformers' own refusals and matches them, which is the
right check, and it can only run where the whole Studio backend is importable:
it imports fastapi and models.inference at module scope and execs
routes/inference.py. studio-backend-ci.yml pins that environment to
transformers>=4.51,<5.5 at lines 275 and 568. The rewording the matcher exists
to survive landed in 5.10, outside that window, so the guard as installed never
sees the wording it was built for. It is green on the half of the range that was
never in danger, which is the shape of the defect the matcher fixes, one level
up.

Add a second guard that needs only transformers. The signatures and
_diagnosis_text are lifted out of routes/inference.py with ast, so there is no
fastapi, no PyJWT, no route import and no event loop, and it runs anywhere
transformers is installed, including a plain pip install -U transformers. One of
its four tests asserts that property directly, so the file cannot quietly grow a
backend import and go back to covering only the pinned window.

Measured on transformers 4.57.6, 5.0.0, 5.4.0, 5.5.4, 5.9.0, 5.10.4, 5.13.1 and
5.17.0: both refusal sites matched at every one, spanning both wordings, and 20
to 24 quantizer modules were scanned for over-acceptance at each with none
found.

Also correct what _build_launch_reasoning_args claims about the substitution. It
said exact rather than merely equivalent. Reading common/arg.cpp, --reasoning
writes the same default_template_kwargs["enable_thinking"] entry the kwargs
channel writes AND sets params.enable_reasoning, which the kwargs channel leaves
at -1. That field has one consumer, server-context.cpp, where it lowers the
per-server enable_thinking default. The outcome is unchanged because
server-common.cpp re-reads the merged kwarg and overrides from it, and both
spellings put the same value there, but the claim as written would tell a future
reader there is nothing on the llama.cpp side to re-check. The comment now names
both halves and what would have to move for this to stop being a substitution.
danielhanchen pushed a commit to shimmyshimmer/unsloth-staging-4 that referenced this pull request Sep 16, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 16, 2026
@danielhanchen danielhanchen self-assigned this Sep 16, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d3996992a9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +20 to +24
This file closes it by needing only `transformers`. The signatures and `_diagnosis_text`
are read out of `routes/inference.py` with `ast`, so no fastapi, no PyJWT, no route
import, no event loop. It therefore runs in any environment that has transformers at all,
including the 4.57.6 and >=5,<6 legs of `consolidated-tests-ci.yml`, and can be pointed at
a newer transformers with a bare `pip install -U transformers` and nothing else.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Run the drift guard in the modern Transformers matrix

This file is not actually collected by either transformers>=5,<6 leg in consolidated-tests-ci.yml: those jobs only invoke selected paths under the root tests/ directory (plus the explicit studio/backend/tests/test_dataset_map_num_proc.py at lines 407-412). The only workflow that auto-discovers this new file is studio-backend-ci.yml, whose dependency setup pins transformers>=4.51,<5.5 at line 275. Consequently the guard still never sees the >=5.10 wording it was added to protect, and a future matcher regression against modern Transformers can remain green; explicitly add this file to the consolidated matrix.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 5343e03. You are right, and the file's own docstring claimed the opposite, which made it worse: it was written to need nothing but transformers precisely so it could run in that matrix, and then nothing listed it. Those jobs collect selected paths rather than a tree, so it is named now in the same step that already names studio/backend/tests/test_dataset_map_num_proc.py, which puts it in both the 4.57.6 and the >=5,<6 legs.

test_a_workflow_that_installs_a_modern_transformers_actually_collects_this_file gates that, since a guard nobody runs is the same defect one level up. It fails without the workflow change.

…s is installed

The file was written to need nothing but transformers so it could run in the consolidated
matrix, and its own docstring claimed it did. It does not: those jobs collect selected
paths rather than a tree, and every job that auto-discovers it pins transformers>=4.51,<5.5
while the rewording it exists to survive landed in 5.10. Name it in the step that already
names the other studio backend file, and gate that with a test, since a guard nobody runs
is the same defect one level up.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 5343e03502

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen

Copy link
Copy Markdown
Member Author

Confirmed against main that neither the probe-gated --reasoning path nor the compressed-tensors refusal exists today, so this covers #7526 and the unactionable pip advice in #8246. Will get this reviewed.

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

Confirmed against main that neither the probe-gated --reasoning path nor the compressed-tensors refusal exists today, so this covers #7526 and the unactionable pip advice in #8246. Will get this reviewed.

Comments only, no executable change. Cuts restatement and narration and keeps
the facts the code cannot state: the --reasoning gate fails closed, the flag is
read off the catalogue rather than the help text, both transformers wordings are
matched on the part that survived the 5.10 rewording, and why the drift guard is
listed by name in the CI job.
@danielhanchen
danielhanchen merged commit e7becaf into main Sep 17, 2026
47 of 51 checks passed
@danielhanchen
danielhanchen deleted the pr/studio-reasoning-probe-and-quant-matcher branch September 17, 2026 09:47
shaojun pushed a commit to shaojun/unsloth that referenced this pull request Sep 29, 2026
…rs refusal (unslothai#11072)

* Studio: use --reasoning where available and name the compressed-tensors refusal

Two things reported against the same llama.cpp launch path.

llama-server now prints "Setting 'enable_thinking' via --chat-template-kwargs
is deprecated. Use --reasoning on / --reasoning off instead." on every Studio
launch of a reasoning model. The deprecation is per key, and only enable_thinking
has a flag of its own, so only that key moves; preserve_thinking, a
reasoning_effort ladder and any future template variable stay in
--chat-template-kwargs, which is still the only channel for an arbitrary
template key.

The gate is the flag catalogue read off llama-server --help, and it fails closed.
A build that predates the flag exits with "error: invalid argument: --reasoning"
rather than starting without it, measured on the b6277 release tag, so anything
short of a positive answer keeps the argv main emits today byte for byte.
Measured on two real binaries: on b10909 the two channels produce the same
thinking state for a plain request and for a request that sets its own
chat_template_kwargs either way, with and without LLAMA_ARG_REASONING exported,
and only the kwargs channel prints the warning.

--reasoning and its -rea alias join the template flag group in
llama_server_args, for the reason --chat-template-kwargs is already in it:
applying a chat template override recomputes the reasoning default from the new
template, and an inherited copy appended later would last-wins-override it.

Separately, a compressed-tensors checkpoint (NVFP4 or FP8) is now refused with
the same short message on every host. Studio only recognised the MLX loader's
per-module metadata error, so on a CUDA, ROCm or CPU host the load died inside
transformers and showed the user "pip install compressed-tensors", which is
advice that cannot succeed: Studio runs from its own environment, and installing
the library there does not make the checkpoint load either.

Both refusal sites are matched on the part that survived transformers' 5.10
rewording rather than on a whole sentence, because the wording carried a minimum
version from 5.10 on and a matcher built from either wording alone covers half
the supported range. The new test re-derives the pair from whichever transformers
is installed, and walks every quantizer transformers ships to confirm no other
quantization family is re-routed into this refusal.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Studio: keep the untouched reasoning argv byte-identical by construction

_build_launch_reasoning_args dropped main's --chat-template-kwargs {} when the
reasoning kwargs were empty, on every build including the ones the probe answers
no for. _reasoning_kwargs returns a non-empty dict today, so that input does not
arrive from the launcher, but the untouched path should be identical to main
because of how the code is written and not because the one input that separates
the two spellings is unreachable.

Found by enumerating the predicate's whole input space rather than by reading the
diff: 300 cells over the capability tri-state, five enable_thinking shapes, and
preserve_thinking, a reasoning_effort ladder and an unknown future key. Before
this commit 5 of the 300 differed from main on a path that emits no flag; after
it, 276 are byte-identical and the remaining 24 are exactly the cells where the
probe advertised the flag and the deprecated key is a bool.

* Make the compressed-tensors refusal name no quantization scheme

Both transformers errors this matches are raised before the compression config is
read, so W4A16, W8A8, INT8 and MXFP4 checkpoints reached a message that told them
they were NVFP4 or FP8 and advised finding a 4-bit build they had already picked.
The MLX path does identify the scheme and keeps its specific wording.

* Run the compressed-tensors drift guard outside the backend CI pin

The guard re-derives transformers' own refusals and matches them, which is the
right check, and it can only run where the whole Studio backend is importable:
it imports fastapi and models.inference at module scope and execs
routes/inference.py. studio-backend-ci.yml pins that environment to
transformers>=4.51,<5.5 at lines 275 and 568. The rewording the matcher exists
to survive landed in 5.10, outside that window, so the guard as installed never
sees the wording it was built for. It is green on the half of the range that was
never in danger, which is the shape of the defect the matcher fixes, one level
up.

Add a second guard that needs only transformers. The signatures and
_diagnosis_text are lifted out of routes/inference.py with ast, so there is no
fastapi, no PyJWT, no route import and no event loop, and it runs anywhere
transformers is installed, including a plain pip install -U transformers. One of
its four tests asserts that property directly, so the file cannot quietly grow a
backend import and go back to covering only the pinned window.

Measured on transformers 4.57.6, 5.0.0, 5.4.0, 5.5.4, 5.9.0, 5.10.4, 5.13.1 and
5.17.0: both refusal sites matched at every one, spanning both wordings, and 20
to 24 quantizer modules were scanned for over-acceptance at each with none
found.

Also correct what _build_launch_reasoning_args claims about the substitution. It
said exact rather than merely equivalent. Reading common/arg.cpp, --reasoning
writes the same default_template_kwargs["enable_thinking"] entry the kwargs
channel writes AND sets params.enable_reasoning, which the kwargs channel leaves
at -1. That field has one consumer, server-context.cpp, where it lowers the
per-server enable_thinking default. The outcome is unchanged because
server-common.cpp re-reads the merged kwarg and overrides from it, and both
spellings put the same value there, but the claim as written would tell a future
reader there is nothing on the llama.cpp side to re-check. The comment now names
both halves and what would have to move for this to stop being a substitution.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Collect the compressed-tensors drift guard where a modern Transformers is installed

The file was written to need nothing but transformers so it could run in the consolidated
matrix, and its own docstring claimed it did. It does not: those jobs collect selected
paths rather than a tree, and every job that auto-discovers it pins transformers>=4.51,<5.5
while the rewording it exists to survive landed in 5.10. Name it in the step that already
names the other studio backend file, and gate that with a test, since a guard nobody runs
is the same defect one level up.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Trim comments on the reasoning flag and compressed-tensors paths

Comments only, no executable change. Cuts restatement and narration and keeps
the facts the code cannot state: the --reasoning gate fails closed, the flag is
read off the catalogue rather than the help text, both transformers wordings are
matched on the part that survived the 5.10 rewording, and why the drift guard is
listed by name in the CI job.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't load NVFP4 on 5060TI 16 GB --chat-template-kwargs is deprecated, use instead --reasoning

1 participant