Dashboard: a reasoning chooser, offering only what the model accepts
Reasoning effort isn't a backend flag -- vLLM's --reasoning-parser only parses
the output. It's a chat-template kwarg read per request, and the models differ:
Qwen3.8 27B's template takes enable_thinking plus reasoning_effort in
('low','medium','xhigh') and raises on anything else, while Ornith 1.5 9B takes
only enable_thinking. Note 'xhigh', not OpenAI's 'high'.
So the chooser is built from what the loaded model's own template actually reads
(hfcache.template_controls), with the level names from the catalog, which is the
part that can't be inferred -- a level the template doesn't know would make it
raise, so an undeclared or unreadable one is never offered or sent.
The proxy injects the setting into chat completions, with a key the client set
itself always winning, the same precedence mlx_lm gives its own
--chat-template-kwargs. Reading it from config per request (mtime-cached) means
the dashboard changes it with no restart, so the model stays loaded -- the
startup flag would have cost a full reload per change.
vLLM gets no control: llm-host runs it without a proxy, so there is nothing in
the path to inject the kwarg. The panel hides itself rather than pretend.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
944eda06cc
commit
623d093b81
6 changed files with 395 additions and 44 deletions
|
|
@ -160,3 +160,39 @@ def mlx_args(entry, choice, port):
|
|||
args += ["--prompt-concurrency", "1", "--decode-concurrency", "4"]
|
||||
args += x.get("extra_args", [])
|
||||
return args
|
||||
|
||||
|
||||
# ---- reasoning effort -------------------------------------------------------------
|
||||
# Not a backend flag: it's a chat-template kwarg, read per request. "default" means send
|
||||
# nothing and let the template decide; "off" suppresses thinking; anything else is an
|
||||
# effort level the template defines. Levels come from the catalog (they're model-specific
|
||||
# and a wrong one makes the template raise), gated by what the template really reads.
|
||||
|
||||
OFF = "off"
|
||||
DEFAULT = "default"
|
||||
|
||||
|
||||
def reasoning_options(entry, choice, controls):
|
||||
"""The settings a model can be given, as (value, label) pairs, most effort first."""
|
||||
if not entry.get("reasoning"):
|
||||
return []
|
||||
opts = [(DEFAULT, "Model default")]
|
||||
levels = (entry.get("effort") or {}).get("levels") or []
|
||||
if controls.get("effort") and levels:
|
||||
pretty = {"xhigh": "Extra high", "high": "High", "medium": "Medium", "low": "Low"}
|
||||
opts += [(l, pretty.get(l, l.title())) for l in reversed(levels)]
|
||||
if controls.get("thinking"):
|
||||
opts.append((OFF, "Thinking off"))
|
||||
return opts if len(opts) > 1 else []
|
||||
|
||||
|
||||
def reasoning_kwargs(value, entry, controls):
|
||||
"""chat_template_kwargs for a setting, or {} for "default"/anything unsupported."""
|
||||
if not value or value == DEFAULT or not entry.get("reasoning"):
|
||||
return {}
|
||||
if value == OFF:
|
||||
return {"enable_thinking": False} if controls.get("thinking") else {}
|
||||
levels = (entry.get("effort") or {}).get("levels") or []
|
||||
if controls.get("effort") and value in levels:
|
||||
return {"reasoning_effort": value}
|
||||
return {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue