unsloth/studio/frontend/src/features
Daniel Han 76a2b9edf1
Studio: Auto disables MTP for MLA models (GLM-5.2 et al.); UNSLOTH_MLA_MTP_ENABLED to re-enable (#6468)
* Studio: Auto disables MTP for MLA models (GLM-5.2 et al.); UNSLOTH_MLA_MTP_ENABLED to re-enable

Studio's Auto speculative mode promotes any embedded-MTP model >=3B to
--spec-type draft-mtp. For MLA models (GLM-5.2/DeepSeek/Kimi) that is a
regression: llama.cpp's MLA/DSA MTP path keeps a duplicated full target-KV
context and recomputes the sparse-attention indexer every draft step, so it
runs ~2x slower than no speculation (GLM-5.2 UD-IQ1_S bench: 27 vs 45 tok/s,
flat across draft depth 1..6 and 96-100% acceptance, on both prose and code).
vLLM/SGLang get a speedup from the same model, so this is a llama.cpp
implementation gap, not a model property.

Auto now drops embedded MTP for MLA models and falls back to ngram-mod (or
spec-off when the binary lacks ngram-mod), mirroring the existing sub-3B
fallback. The metadata separator is kv_lora_rank: it is present on MLA models
and absent on non-MLA embedded-MTP models (Qwen3.x-MTP), whose MTP module is
structurally identical but fast, so a "full layer" heuristic cannot tell them
apart. Qwen MTP, separate drafters (Gemma, --model-draft), and non-MTP models
are unchanged.

Explicit overrides still engage the slower MTP route: choosing MTP / MTP+Ngram
in Settings, or passing --spec-type in extra args. UNSLOTH_MLA_MTP_ENABLED=1
re-enables Auto promotion for MLA once the upstream path is optimized.

A new spec_fallback_reason value "mla_mtp_disabled" surfaces this as an
Auto-mode policy downgrade (not a binary/update problem), with a settings
banner that points users at the MTP override. It is deliberately kept out of
the "Update llama.cpp" affordance since updating does not help.

Tests: resolver-matrix rows for MLA->ngram-mod / MLA-no-ngram->off /
non-MLA-Qwen->draft-mtp / MLA-separate-drafter->draft-mtp /
non-MTP-MLA->default / forced mtp|mtp+ngram on MLA->draft-mtp / env flag;
kv_lora_rank metadata fixtures; and reload-skip coverage (Auto ngram-mod is
idempotent, forced mtp bounces a reload).

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

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

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-06-19 05:40:16 -07:00
..
auth Studio: UI polish for sidebar, menus, hub and toasts (#6288) 2026-06-13 03:50:36 -07:00
chat Studio: Auto disables MTP for MLA models (GLM-5.2 et al.); UNSLOTH_MLA_MTP_ENABLED to re-enable (#6468) 2026-06-19 05:40:16 -07:00
data-recipes feat(hub): full-page redesign with trending feed, search, and persisted state (#6349) 2026-06-17 04:50:34 -07:00
export fix: clean up Studio warning log formatting (#6265) 2026-06-19 05:06:03 -07:00
hub Studio: add an Open button to reveal the models folder in the file manager (#6452) 2026-06-19 05:14:58 -07:00
native-intents Studio: add an Open button to reveal the models folder in the file manager (#6452) 2026-06-19 05:14:58 -07:00
onboarding Studio: mascot images degrade gracefully instead of showing alt text (#6146) 2026-06-10 08:22:17 -07:00
profile feat(hub): full-page redesign with trending feed, search, and persisted state (#6349) 2026-06-17 04:50:34 -07:00
rag Unify retrieval slider styling (#6436) 2026-06-19 12:07:10 +02:00
recipe-studio feat(studio): expose provider_type selector in model provider dialog (#4277) 2026-06-15 15:07:06 +02:00
security Harden model fetching (#6391) 2026-06-18 05:39:52 -07:00
settings Studio: add an Open button to reveal the models folder in the file manager (#6452) 2026-06-19 05:14:58 -07:00
studio feat(hub): full-page redesign with trending feed, search, and persisted state (#6349) 2026-06-17 04:50:34 -07:00
tour Studio: unify shadows, backgrounds and dark mode consistency in chat UI (#6116) 2026-06-10 03:09:37 -07:00
training Studio: free chat model VRAM at training start only when the GPU is tight (#6243) 2026-06-18 09:04:01 -07:00