unsloth/studio/frontend
Daniel Han 9e8b63c826 studio: spec-draft-p-min knob + ngram-map-k/k4v power-user wire values
Builds on the 5-mode Speculative Decoding dropdown (PR #5582) by adding
two upstream-driven knobs that landed in llama.cpp #23269 (MTP
clean-up):

1. spec_draft_p_min: minimum draft probability threshold for MTP
   speculative decoding (--spec-draft-p-min). Drafts below this
   probability are rejected. Was non-functional pre-#23269; now
   defaults to 0.0 upstream. Studio exposes it as a "Draft p-min"
   numeric input below "Draft Tokens", visible only when the dropdown
   is MTP or MTP+Ngram (the only modes where MTP actually engages and
   the knob has effect).

2. ngram-map-k / ngram-map-k4v: new spec types added alongside
   ngram-mod. Each carries its own knob triplet
   (--spec-{variant}-size-n/m/min-hits). They are NOT in the
   dropdown -- power-user-only -- but the load API accepts them and
   the resolver emits the correct flag set when probed support is
   present.

Backend
- _canonicalize_spec_mode recognises ngram-map-k / ngram-map-k4v.
- New helper _build_ngram_map_k_flags(caps, variant=...) emits the
  knob triplet only when the binary advertises the knobs as real
  flags (not removal stubs).
- _build_speculative_flags grows two branches and an inline
  _maybe_emit_p_min helper that flows p_min through the MTP path
  only. Auto on an MTP GGUF still gets p_min applied because the
  resolved emission is MTP.
- LoadRequest.spec_draft_p_min (Optional[float], 0..1). Threaded
  through routes/inference.py at the four wire sites and the
  _request_matches_loaded_settings comparator.
- _already_in_target_state takes spec_draft_p_min so a changed p_min
  bounces a reload even on the Auto-promoted path.
- probe_server_capabilities now reports spec_draft_p_min_flag,
  supports_ngram_map_k, and supports_ngram_map_k4v.

Frontend
- chat-runtime-store: specDraftPMin / loadedSpecDraftPMin / setter.
- use-chat-model-runtime: hydrate p_min from /api/inference/status
  and the load response. Reset p_min alongside spec mode and n_max
  when the user switches to a different model.
- chat-settings-sheet: new "Draft p-min" number input
  (min 0, max 1, step 0.05), visible when speculativeType is mtp
  or mtp+ngram. Wired into the Reset and dirty-state machinery.

Tests
- 12 new assertions in test_llama_cpp_mtp_detection.py: p_min emission
  matrix (MTP modes only; never for auto/ngram/off; auto-promoted
  draft-mtp still gets p_min; graceful degrade when binary lacks
  --spec-draft-p-min), ngram-map-k / ngram-map-k4v emission with the
  right knob triplet, no-emit-when-unsupported, canonicalize
  recognition. 373 total backend tests pass (was 361 before).
2026-05-22 01:10:37 +00:00
..
public Polish/cloud to providers (#5450) 2026-05-15 19:29:21 +04:00
src studio: spec-draft-p-min knob + ngram-map-k/k4v power-user wire values 2026-05-22 01:10:37 +00:00
.gitignore perf(studio): upgrade to Vite 8 + auto-install bun for faster frontend builds (#4522) 2026-03-25 04:27:41 -07:00
.gitkeep add studio root folder 2026-02-02 09:14:35 +00:00
.npmrc security: NOT affected by Mini Shai-Hulud (May-12 wave) -- forward-looking hardening only (#5397) 2026-05-13 04:58:12 -07:00
biome.json feat: add seed dataset support with configuration, preview, and builder utilities 2026-02-14 18:44:38 +01:00
components.json add studio root folder 2026-02-02 09:14:35 +00:00
data-designer.openapi (1).yaml save and import, and fixes 2026-02-04 14:32:49 +01:00
eslint.config.js Final cleanup 2026-03-12 18:28:04 +00:00
index.html Final cleanup 2026-03-12 18:28:04 +00:00
package-lock.json Add OpenDocument chat attachments (#5510) 2026-05-18 03:41:24 -07:00
package.json Add OpenDocument chat attachments (#5510) 2026-05-18 03:41:24 -07:00
tsconfig.app.json Relax frontend unused local check (#4388) 2026-03-17 16:04:11 -07:00
tsconfig.json cleanup 2026-02-04 13:28:39 +01:00
tsconfig.node.json cleanup 2026-02-04 13:28:39 +01:00
vite.config.ts Fix Install commands for Windows + 1 line installs (#4447) 2026-03-19 02:09:09 -07:00