Add native Qwen MTP speculation

This commit is contained in:
Georg Bauer
2026-09-03 22:38:52 +02:00
parent 714b39f7f3
commit bf82df77cb
14 changed files with 1302 additions and 78 deletions

View File

@@ -17,12 +17,12 @@ impl App {
let glm_mtp_toggle: Option<fn(bool) -> Message> = self
.preference_draft
.acceleration_model
.supports_glm_mtp()
.supports_integrated_mtp()
.then_some(Message::PreferenceGlmMtpChanged);
let glm_mtp_timing_toggle: Option<fn(bool) -> Message> = self
.preference_draft
.acceleration_model
.supports_glm_mtp()
.supports_integrated_mtp()
.then_some(Message::PreferenceGlmMtpTimingChanged);
let keep_vision_loaded_toggle: Option<fn(bool) -> Message> =
(self.preference_draft.acceleration_model == ModelChoice::Glm53Flash)
@@ -608,13 +608,13 @@ impl App {
text("SPECULATIVE DECODING").size(11).color(muted_text()),
hint(
toggle(self.preference_draft.glm_mtp)
.label("Enable integrated GLM MTP")
.label("Enable integrated MTP")
.on_toggle_maybe(glm_mtp_toggle),
"Uses the prediction head built into GLM for speculative decoding, so no separate draft model is loaded.",
"Uses the selected model's managed prediction head for speculative decoding. Qwen loads its pinned MTP sidecar; GLM uses its embedded head.",
),
hint(
toggle(self.preference_draft.glm_mtp_timing)
.label("Log GLM MTP timing counters")
.label("Log MTP timing counters")
.on_toggle_maybe(glm_mtp_timing_toggle),
"Records per-stage timings of the speculative path to the log, to show where the acceleration actually goes. A diagnostic aid that costs a little throughput.",
),
@@ -644,8 +644,8 @@ impl App {
),
text(if self.preference_draft.acceleration_model.supports_dspark() {
"DeepSeek V4 Flash 0731 uses its managed DSpark support artifact."
} else if self.preference_draft.acceleration_model.supports_glm_mtp() {
"GLM MTP is integrated; DSpark is unavailable for this model."
} else if self.preference_draft.acceleration_model.supports_integrated_mtp() {
"Integrated MTP is available; DSpark is unavailable for this model."
} else {
"No speculative-decoding support is available for this model."
})
@@ -656,7 +656,7 @@ impl App {
|engine| {
let settings = engine.speculative;
format!(
"Engine: GLM MTP {} • timing {} • DSpark {} • confidence {}{} • target-only {} • exact sampling {}",
"Engine: integrated MTP {} • timing {} • DSpark {} • confidence {}{} • target-only {} • exact sampling {}",
if settings.glm_mtp { "on" } else { "off" },
if settings.glm_mtp_timing { "on" } else { "off" },
if settings.dspark { "on" } else { "off" },