From bc049a5aea3db2dffaf2688e46fc67b83e96f4b3 Mon Sep 17 00:00:00 2001 From: Niko1221 Date: Fri, 4 Dec 2026 09:09:18 +0100 Subject: [PATCH] qwen4: KV cache choice, the BF16-route MTP drafter for the GGUF build, MTP Auto on the app side, and the real fit facts - KV: per-format bytes from Q4-KV (fp16 20480, int8 and fp8 10560, k8v4 8160, q4_0 5760 per token); GGUF default int8, .strata builds fp16; KV_CHOICES, KV_DEFAULT, KV_READY (fp8 not ready), KV_BACKENDS; setup, launcher, catalog and the app panel ("Context memory" select, strings q427 to q430). - MTP: the GGUF build builds the 923 MiB BF16-route drafter at install (mtp_fetch at the pinned Qwen revision, mtp_pack q8_0, mtp_rt); any failed step is MTP off with one warning; Unsloth's 1.95 GB sidecar is out of the download set; --spec 3 --spec-min-p 0.5 on every card (Q4-SMALL measurements), qwen4_mtp_spec; MTP Auto on for 6 GB and up with an empty per-card fallback table; app Auto help lines (q431, q432). - fit facts: .strata floors (Compact 13, Balanced 22, Ultra 29 GiB: below it the build shows as short until the engine's memory tiering lands), the GGUF build needs about 64 GB of RAM, informational expert slot counts per card size. - the model host name stays in setup.py only. --- app/host/scripts/add-qwen4-strings.mjs | 14 ++ app/host/server/native-settings.mjs | 2 +- app/host/server/qwen4.mjs | 9 ++ app/host/src/components/NativeModels.tsx | 16 ++- app/host/src/lib/native.ts | 2 +- app/host/src/lib/qwen4.ts | 14 ++ app/host/src/locales/gtui-de.json | 8 +- app/host/src/locales/gtui-en.json | 8 +- app/host/src/locales/gtui-es.json | 8 +- app/host/src/locales/gtui-fr.json | 8 +- app/host/src/locales/gtui-he.json | 8 +- app/host/src/locales/gtui-ja.json | 8 +- app/host/src/locales/gtui-ko.json | 8 +- app/host/src/locales/gtui-pt.json | 8 +- app/host/src/locales/gtui-ru.json | 8 +- app/host/src/locales/gtui-zh.json | 8 +- app/host/tests/qwen4-family.test.mjs | 52 +++++++- terminal/serve/qwen4_kind.py | 3 +- terminal/serve/test_qwen4_kind.py | 6 +- terminal/setup.py | 78 +++++++---- terminal/strata_cli/launch/catalog.py | 2 +- terminal/strata_cli/launch/modelstate.py | 2 +- terminal/strata_cli/launch/runner.py | 14 +- terminal/strata_cli/launch/settings.py | 4 + terminal/strata_control/qwen4_family.py | 72 +++++++++-- terminal/strata_control/qwen4_fit.py | 83 ++++++++++-- terminal/tests/terminal/test_qwen4_fit.py | 129 ++++++++++++++++++- terminal/tests/terminal/test_qwen4_launch.py | 7 +- terminal/tools/strata_mcp.py | 16 ++- terminal/tools/test_setup_qwen4.py | 128 ++++++++++++++++-- 30 files changed, 633 insertions(+), 100 deletions(-) diff --git a/app/host/scripts/add-qwen4-strings.mjs b/app/host/scripts/add-qwen4-strings.mjs index aaabfb0226..3a11cf559c 100644 --- a/app/host/scripts/add-qwen4-strings.mjs +++ b/app/host/scripts/add-qwen4-strings.mjs @@ -293,11 +293,25 @@ const strataComing = { ko: ['엔진과 함께 제공 예정', '엔진과 함께 제공 예정: 이 빌드의 엔진은 초안 레이어(MTP)과 이미지 읽기를 아직 지원하지 않습니다. 당분간 꺼진 상태로 유지됩니다.'], he: ['יגיע עם המנוע', 'יגיע עם המנוע: שכבת הטיוטה (MTP) וקריאת תמונות עדיין אינן במנוע עבור הגרסה הזו. בינתיים הן נשארות כבויות.'], }; +// the K/V format lines (q427 to q430) and the Auto help of the draft layer (q431 on, q432 off): qwen4_family.KV_WORDS, qwen4_fit.AUTO_HELP. +const kvAuto = { + en: ['int8: same quality as fp16, faster prompt reading.', 'k8v4 and q4_0: less memory for long context.', 'fp16: the reference, most memory.', 'fp8: like int8, new, NVIDIA first.', 'Auto turns the draft layer on for graphics cards of 6 GB or more.', 'Auto keeps the draft layer off on this card: it is under 6 GB or it measured slower here.'], + de: ['int8: gleiche Qualität wie fp16, schnelleres Lesen des Prompts.', 'k8v4 und q4_0: weniger Speicher bei langem Kontext.', 'fp16: die Referenz, am meisten Speicher.', 'fp8: wie int8, neu, zuerst für NVIDIA.', 'Auto schaltet die Entwurfsschicht für Grafikkarten ab 6 GB ein.', 'Auto lässt die Entwurfsschicht auf dieser Karte aus: sie hat unter 6 GB oder war hier langsamer.'], + es: ['int8: la misma calidad que fp16, lectura del prompt más rápida.', 'k8v4 y q4_0: menos memoria con contexto largo.', 'fp16: la referencia, la que más memoria usa.', 'fp8: como int8, nuevo, primero para NVIDIA.', 'Auto activa la capa de borrador en tarjetas gráficas de 6 GB o más.', 'Auto deja la capa de borrador desactivada en esta tarjeta: tiene menos de 6 GB o aquí resultó más lenta.'], + fr: ['int8 : même qualité que fp16, lecture de l’invite plus rapide.', 'k8v4 et q4_0 : moins de mémoire pour un long contexte.', 'fp16 : la référence, la plus gourmande en mémoire.', 'fp8 : comme int8, nouveau, d’abord pour NVIDIA.', 'Auto active la couche de brouillon sur les cartes graphiques de 6 Go ou plus.', 'Auto laisse la couche de brouillon désactivée sur cette carte : elle a moins de 6 Go ou y était plus lente.'], + pt: ['int8: a mesma qualidade do fp16, leitura do prompt mais rápida.', 'k8v4 e q4_0: menos memória com contexto longo.', 'fp16: a referência, a que mais usa memória.', 'fp8: como o int8, novo, primeiro para NVIDIA.', 'Auto liga a camada de rascunho em placas de vídeo de 6 GB ou mais.', 'Auto mantém a camada de rascunho desligada nesta placa: ela tem menos de 6 GB ou aqui foi mais lenta.'], + ru: ['int8: то же качество, что у fp16, быстрее чтение запроса.', 'k8v4 и q4_0: меньше памяти при длинном контексте.', 'fp16: эталон, больше всего памяти.', 'fp8: как int8, новинка, сначала для NVIDIA.', 'Авто включает черновой слой на видеокартах от 6 ГБ.', 'Авто оставляет черновой слой выключенным на этой карте: у неё меньше 6 ГБ или здесь он работал медленнее.'], + zh: ['int8:质量与 fp16 相同,读取提示更快。', 'k8v4 和 q4_0:长上下文占用更少内存。', 'fp16:基准格式,占用内存最多。', 'fp8:类似 int8,较新,优先支持 NVIDIA。', '自动:6 GB 及以上的显卡会开启草稿层。', '自动:此显卡上草稿层保持关闭:显存不足 6 GB,或实测更慢。'], + ja: ['int8:fp16 と同じ品質で、プロンプトの読み込みが速くなります。', 'k8v4 と q4_0:長いコンテキストでメモリを節約します。', 'fp16:基準の形式で、メモリを最も使います。', 'fp8:int8 に近く、新しい形式で、まず NVIDIA 向けです。', '自動:6 GB 以上のグラフィックスカードでドラフトレイヤーをオンにします。', '自動:このカードではドラフトレイヤーをオフのままにします(6 GB 未満、または実測で遅いため)。'], + ko: ['int8: fp16과 같은 품질에 프롬프트 읽기가 더 빠릅니다.', 'k8v4와 q4_0: 긴 컨텍스트에서 메모리를 덜 씁니다.', 'fp16: 기준 형식으로 메모리를 가장 많이 씁니다.', 'fp8: int8과 비슷한 새 형식으로, NVIDIA가 먼저입니다.', '자동: 6GB 이상의 그래픽 카드에서 초안 레이어를 켭니다.', '자동: 이 카드에서는 초안 레이어를 끈 채로 둡니다(6GB 미만이거나 실측에서 더 느렸습니다).'], + he: ['int8: אותה איכות כמו fp16, קריאת ההנחיה מהירה יותר.', 'k8v4 ו-q4_0: פחות זיכרון בהקשר ארוך.', 'fp16: המדד, הכי הרבה זיכרון.', 'fp8: כמו int8, חדש, קודם כל ל-NVIDIA.', 'אוטומטי: שכבת הטיוטה מופעלת בכרטיסים גרפיים של 6 GB ומעלה.', 'אוטומטי: בכרטיס הזה שכבת הטיוטה נשארת כבויה: יש בו פחות מ-6 GB או שהיא התגלתה כאן איטית יותר.'], +}; for (const [lang, strings] of Object.entries(add)) { const file = join(dir, `gtui-${lang}.json`); const data = JSON.parse(readFileSync(file, 'utf8')); // French: a no-break space before ; : ? ! (tests/french-typography-all.test.mjs) for (const [k, v] of Object.entries(strings)) if (!(k in data)) data[k] = lang === 'fr' ? v.replace(/(?<=\S) ([;:?!])/g, '\u00a0$1') : v; + kvAuto[lang].forEach((text, i) => { const k = `q${427 + i}`; if (!(k in data)) data[k] = lang === 'fr' ? text.replace(/(?<=\S) ([;:?!])/g, '\u00a0$1') : text; }); const [suffix, sentence] = strataComing[lang]; const guicEn = JSON.parse(readFileSync(join(dir, 'guic-en.json'), 'utf8')); // the language's own "Draft layer (MTP)" is in the guic catalog const guic = JSON.parse(readFileSync(join(dir, `guic-${lang}.json`), 'utf8')); diff --git a/app/host/server/native-settings.mjs b/app/host/server/native-settings.mjs index 33455fffeb..28128ac754 100644 --- a/app/host/server/native-settings.mjs +++ b/app/host/server/native-settings.mjs @@ -14,7 +14,7 @@ export const NATIVE_FIELDS=[ {id:'mtp',label:'Draft layer (MTP)',group:'Serving',type:'boolean',hint:'The draft layer guesses several words ahead, which makes answers faster, and costs about 1 GB of graphics memory and some RAM. Turn it off if the model stops while it starts, or the card is small: the expert cache gets that memory back and answers are slower. Default is on.'}, {id:'ling_mtp',label:'Draft layer (MTP)',group:'Serving',type:'enum',choices:['auto','on','off'],hint:'Auto: the engine loads the MTP draft layer only where it speeds answers up on this card (it measures the link when it starts). On forces it, Off never loads it. The file is 1 GB.'}, {id:'effort',label:'Effort by default',group:'Responses',type:'enum',choices:['off','low','high','xhigh'],hint:'How hard Qwen4-35B-A3B thinks when a request says nothing (the Reasoning menu of a chat does). Off answers straight away; Low, High and X-High think first, longer each step: slower, better on hard questions.'}, - {id:'q4_mtp',label:'Draft layer (MTP)',group:'Serving',type:'enum',choices:['auto','on','off'],hint:'Auto: the engine loads the MTP draft layer only where it speeds answers up on this PC (it checks when it starts). On forces it, Off never loads it. The file is 0.4 GB.'}, + {id:'q4_mtp',label:'Draft layer (MTP)',group:'Serving',type:'enum',choices:['auto','on','off'],hint:'Auto turns the draft layer on for graphics cards of 6 GB or more. On forces it, Off never loads it. The file is 0.4 GB.'}, {id:'q4_loop',label:'Loop (2 steps)',group:'Serving',type:'enum',choices:['off','on'],hint:'Loop (2 steps): thinks each word twice. Slower (about 40% fewer words per second while writing, prompt reading about half as fast), a little closer to the original model. Off by default. Needs a 147 MB file that the Download step fetches when Loop is on. It has no effect while Effort is Off.'}, {id:'ling_skip',label:'Expert skip',group:'Serving',type:'enum',choices:['off','medium','custom'],hint:'Faster answers with a small cost in accuracy. Off (the default) gives the exact answers. Medium lets the engine skip the experts that matter least for each word it writes: about 1 word in 60 differs. Applies the next time the model loads.'}, {id:'thinking',label:'Thinking by default',group:'Responses',type:'enum',choices:['off','on'],hint:'Ling-3.2-Air thinks only when a request asks for it (the Thinking menu of a chat does). On makes every request that says nothing think first: slower, better on hard questions.'}, diff --git a/app/host/server/qwen4.mjs b/app/host/server/qwen4.mjs index 5803b714cd..6d13a846d8 100644 --- a/app/host/server/qwen4.mjs +++ b/app/host/server/qwen4.mjs @@ -55,6 +55,15 @@ export const qwen4MtpReady = (build, table = QWEN4_STRATA_READY) => String(build export const qwen4VisionReady = (build, table = QWEN4_STRATA_READY) => String(build ?? '').toLowerCase() === 'ud-q4_k_xl' ? true : ['compact', 'balanced', 'ultra'].includes(String(build ?? '').toLowerCase()) && table.vision === true; export const QWEN4_STRATA_COMING_LABEL = 'Draft layer (MTP) - coming with the engine'; export const QWEN4_STRATA_COMING_NOTE = 'Coming with the engine: the draft layer (MTP) and picture reading are not in the engine for this build yet. They stay off for now.'; +/** The K/V cache format (mirrors qwen4_family.py KV_CHOICES / KV_DEFAULT / KV_READY / KV_BACKENDS and src/lib/qwen4.ts; the host test pins the three): which formats a build takes and which it starts with. */ +export const QWEN4_KV_CHOICES = Object.freeze({ gguf: Object.freeze(['int8', 'fp16', 'k8v4', 'fp8', 'q4_0']), strata: Object.freeze(['fp16']) }); +export const QWEN4_KV_DEFAULT = Object.freeze({ gguf: 'int8', strata: 'fp16' }); +export const QWEN4_KV_READY = Object.freeze({ 'gguf/fp8': false }); +export const QWEN4_KV_BACKENDS = Object.freeze({ fp8: Object.freeze(['cuda']) }); +const kvSource = build => String(build ?? '').toLowerCase() === 'ud-q4_k_xl' ? 'gguf' : 'strata'; +export const qwen4KvChoices = (build, backend) => { const src = kvSource(build), be = String(backend || 'cuda').toLowerCase(); return QWEN4_KV_CHOICES[src].filter(k => QWEN4_KV_READY[`${src}/${k}`] !== false && (QWEN4_KV_BACKENDS[k] ?? [be]).includes(be)); }; +export const qwen4KvDefault = build => QWEN4_KV_DEFAULT[kvSource(build)]; +export const qwen4KvPick = (build, backend, kv) => kv && qwen4KvChoices(build, backend).includes(kv) ? kv : qwen4KvDefault(build); /** The Loop table's source of a build name: gguf for UD-Q4_K_XL, strata for the others. */ export const qwen4LoopSource = build => String(build ?? '').toLowerCase() === 'ud-q4_k_xl' ? 'gguf' : 'strata'; /** Does the engine support Loop for this build on this backend (no backend means cuda; an unknown build or backend is false)? */ diff --git a/app/host/src/components/NativeModels.tsx b/app/host/src/components/NativeModels.tsx index 43b64b3a98..3d3db2b5a5 100644 --- a/app/host/src/components/NativeModels.tsx +++ b/app/host/src/components/NativeModels.tsx @@ -35,7 +35,7 @@ import { NativeTune } from './NativeTune'; import { NativeTuneBadge } from './NativeTuneBadge'; import { commitWarning } from '../lib/commit-warning'; import { nativeCatalogModels, catalogVersionLabel, type CatalogVersion, fetchesPictures, hasKvChoice, HY4_FAMILY, LING_FAMILY, isNativeStrataFamily } from '../lib/native-catalog'; -import { QWEN4_FAMILY, qwen4LoopReady, qwen4MtpReady, isQwen4GgufBuild } from '../lib/qwen4'; +import { QWEN4_FAMILY, qwen4LoopReady, qwen4MtpReady, qwen4KvPick, qwen4KvChoices, QWEN4_KV_LABELS, isQwen4GgufBuild } from '../lib/qwen4'; export function NativeModels({ onOtherModels, onReady, onImport, onConnectEngine }: { onOtherModels: () => void; onImport?: () => void; @@ -57,7 +57,7 @@ export function NativeModels({ onOtherModels, onReady, onImport, onConnectEngine const selectedFamily = families.find(f => f.family === family || f.sizes.some(size => size.sourceFamily === family)) ?? families[0], selectedSize = selectedFamily?.sizes.find(s => s.id === size) ?? selectedFamily?.sizes[0]; const isHy4Selected = isNativeStrataFamily(selectedFamily?.family); // Hy4-Flash, Inkling-2-Mini or Ling-3.2-Air: a native program, none of the Flash-Next options const isLingSelected = selectedFamily?.family === LING_FAMILY, ling = isLingSelected ? selectedSize?.ling32 ?? null : null; - const isQ4Selected = selectedFamily?.family === QWEN4_FAMILY, q4 = isQ4Selected ? selectedSize?.qwen4 ?? null : null, q4Own = isQ4Selected && !selectedSize?.custom, q4LoopReady = q4Own && qwen4LoopReady(selectedSize?.model, q4?.backend); // Qwen4-35B-A3B: Loop (2 steps) is for Strata's own quantization only + const isQ4Selected = selectedFamily?.family === QWEN4_FAMILY, q4 = isQ4Selected ? selectedSize?.qwen4 ?? null : null, q4Own = isQ4Selected && !selectedSize?.custom, q4LoopReady = q4Own && qwen4LoopReady(selectedSize?.model, q4?.backend), q4Kv = isQ4Selected ? qwen4KvPick(selectedSize?.model, q4?.backend, kv, q4?.kv_choices) : kv; // Qwen4-35B-A3B: Loop (2 steps) is for Strata's own quantization only const q4NoEngine = !!q4 && q4.engine_exists === false; const lingNoEngine = !!ling && ling.engine_exists === false; // this make of card has no Ling engine yet (Intel until SYCL exists): the download would be for nothing const isGgufSelected = selectedFamily?.family === HY4_FAMILY && selectedSize?.format === 'gguf'; // AngelSlim's Hy4-Flash GGUF build (NVIDIA): its own Context-memory choice (INT8 or FP16) @@ -146,7 +146,7 @@ export function NativeModels({ onOtherModels, onReady, onImport, onConnectEngine // DFlash2 with the converted pack (the selector as Q4_0 rows) takes 175 MiB less graphics memory: the fit says the true number (Control's `selq4`, strata_control/drafting.py vram_gb). const fitDrafter = nowDrafter === 'dflash2' && native?.capabilities?.dflash2Selq4 === true ? 'dflash2_selq4' : nowDrafter; const draftingWords: Record = { auto: 'Auto (recommended)', mtp: 'MTP', dflash2: 'DFlash2', off: 'Off' }; - const values = useMemo(() => ({ family: selectedSize?.sourceFamily, model: selectedSize?.model, context, vision: selectedSize?.images ? vision : 'no', kv, low_ram: lowRam, resourceProfile, ...(cardsGpus.length > 1 ? { gpus: cardsGpus.join(',') } : cardsGpus.length === 1 ? { gpu: cardsGpus[0] } : {}), ...(roleCards.length > 1 && roles && (customRoles || savedDiffers) ? { gpuRoles: effectiveRoles } : {}), loadAfter: true, multiple: expert && multiple }), [selectedSize?.sourceFamily, selectedSize?.model, context, vision, kv, lowRam, resourceProfile, cardsGpus.join(','), roles, customRoles, savedDiffers, expert, multiple]); + const values = useMemo(() => ({ family: selectedSize?.sourceFamily, model: selectedSize?.model, context, vision: selectedSize?.images ? vision : 'no', kv: q4Kv, low_ram: lowRam, resourceProfile, ...(cardsGpus.length > 1 ? { gpus: cardsGpus.join(',') } : cardsGpus.length === 1 ? { gpu: cardsGpus[0] } : {}), ...(roleCards.length > 1 && roles && (customRoles || savedDiffers) ? { gpuRoles: effectiveRoles } : {}), loadAfter: true, multiple: expert && multiple }), [selectedSize?.sourceFamily, selectedSize?.model, context, vision, kv, lowRam, resourceProfile, cardsGpus.join(','), roles, customRoles, savedDiffers, expert, multiple]); const downloadValues = { ...values, ...(draftingChoices ? { drafting } : {}), ...((isLingSelected || (isQ4Selected && qwen4MtpReady(selectedSize?.model))) && lingMtp !== 'auto' ? { mtp: lingMtp } : {}), ...(q4LoopReady && q4Loop === 'on' ? { loop: 'on' } : {}), ...(isLingSelected && lingSkip === 'medium' ? { ling_skip: lingSkip } : {}), vision: selectedSize?.images && vision !== 'no' ? 'yes' : 'no', loadVision: selectedSize?.images ? vision : 'no', ...(noReader ? { visionUnavailable: true } : {}), ...(contextPicked ? { contextChosen: true } : {}) }; useEffect(() => { if (!native?.catalog || family) return; const current = native.instances.find(i => i.id === native.defaultId); const rec = native.catalog.recommendation ?? { family: null, model: null }; const loadedFamily = families.find(f => f.sizes.some(s => s.id === current?.model)); const have = new Set((native.installed?.models ?? []).filter(m => m.ready).map(m => m.model)); const installedFamily = families.find(f => f.sizes.some(s => have.has(s.id))); const diskFamily = families.find(f => f.sizes.some(s => s.files_on_disk)); const f = loadedFamily ?? installedFamily ?? diskFamily ?? families.find(f => f.family === rec.family || f.sizes.some(s => s.sourceFamily === rec.family)) ?? families[0]; if (f) { @@ -261,7 +261,7 @@ export function NativeModels({ onOtherModels, onReady, onImport, onConnectEngine return; presetPending.current = true; setFamily(f.family); setSize(f.sizes.find(s => s.model === v.model && (s.sourceFamily === v.family || f.family === v.family))?.id ?? ''); setContext(v.context ?? 32768); setVision(v.vision ?? 'no'); setKv(v.kv ?? 'int8'); setLowRam(v.low_ram ?? 'auto'); }}/> : null} setManage(true)}>{tr("Manage models")}
{ const f = families.find(f => f.sizes.some(s => s.id === id)); if (f) { setFamily(f.family); setSize(id); setError(''); setLoadedError(''); } }} onOwnGguf={() => (onImport ?? onOtherModels)()}/>
{tr(fitState === 'ssd' ?

{tr("may run slower")}

: null)} - {tr(q4 ? : null)} + {tr(q4 ? void} loop={q4Loop} onLoop={setQ4Loop} loopOffered={q4Own} installedLoop={installed?.q4Loop} installedMtp={installed?.draftLayer} disabled={!!active}/> : null)} {tr(ling ? : null)} {tr(isGgufSelected && selectedSize?.hy4?.fit?.level === 'tight' ?

{tr("This build wants about {0} GB of RAM and this PC has {1} GB: the experts that do not fit are read from the SSD, which is much slower.", [selectedSize.hy4.ram_need_gb, Math.round(pcRam ?? 0)])}{tr(selectedSize.hy4.fit.suggest ? <> {tr("The less-RAM build needs about {0} GB.", [selectedFamily?.sizes.find(s => s.model === selectedSize.hy4!.fit!.suggest)?.ram_needed_gb])} : null)}

: null)}
@@ -379,8 +379,8 @@ export function NativeProgress({ job, label }: { } /** Qwen Qwen4-35B-A3B on this PC (terminal/strata_control/qwen4_fit.py through the catalog): the build and PLE table this PC gets and where the model lives, what is different about this make of card, * the draft layer (MTP) and Loop (2 steps). Written here, never the planner's own sentences. Loop is offered for Strata's own quantization only and is off unless chosen. */ -function Qwen4Plan({ selectedModel, q4, mtp, onMtp, loop, onLoop, loopOffered, installedLoop, installedMtp, disabled }: { q4: NonNullable; mtp: string; onMtp: (v: string) => void; loop: string; onLoop: (v: string) => void; loopOffered: boolean; selectedModel?: string; installedLoop?: 'off' | 'on'; installedMtp?: boolean; disabled: boolean }) { - const notes = q4.notes ?? [], loopReady = qwen4LoopReady(selectedModel, q4.backend), mtpReady = qwen4MtpReady(selectedModel); // Loop (2 steps) per build and backend: qwen4_family.LOOP_READY, mirrored in lib/qwen4.ts +function Qwen4Plan({ selectedModel, q4, mtp, onMtp, kv, onKv, loop, onLoop, loopOffered, installedLoop, installedMtp, disabled }: { q4: NonNullable; mtp: string; onMtp: (v: string) => void; kv: string; onKv: (v: string) => void; loop: string; onLoop: (v: string) => void; loopOffered: boolean; selectedModel?: string; installedLoop?: 'off' | 'on'; installedMtp?: boolean; disabled: boolean }) { + const notes = q4.notes ?? [], loopReady = qwen4LoopReady(selectedModel, q4.backend), mtpReady = qwen4MtpReady(selectedModel), kvList = q4.kv_choices?.length ? q4.kv_choices : qwen4KvChoices(selectedModel, q4.backend); // Loop (2 steps) per build and backend: qwen4_family.LOOP_READY, mirrored in lib/qwen4.ts const has = (code: string) => notes.find(n => n.code === code); const mtpWords: Record = { auto: 'Auto (on when it pays)', on: 'On', off: 'Off' }; const old = has('old_nvidia'), amd = has('amd_compiled') ?? has('amd_unsupported'); @@ -392,7 +392,9 @@ function Qwen4Plan({ selectedModel, q4, mtp, onMtp, loop, onLoop, loopOffered, i {old ?

{tr("This NVIDIA card has no tensor cores for this engine, so Qwen4-35B-A3B runs on plain kernels, slower than on an RTX 20 series or newer.")}

: null} {has('no_card') ?

{tr("No graphics card was found. Qwen4-35B-A3B needs one.")}

: null} {q4.engine_exists !== false ?
{tr(mtpReady ? "Draft layer (MTP)" : "Draft layer (MTP) - coming with the engine")} ({ value: v, label: QWEN4_KV_LABELS[v] ?? v }))} onChange={v => onKv(String(v))}/> + {tr(kv === 'int8' ? "int8: same quality as fp16, faster prompt reading." : kv === 'k8v4' || kv === 'q4_0' ? "k8v4 and q4_0: less memory for long context." : kv === 'fp8' ? "fp8: like int8, new, NVIDIA first." : "fp16: the reference, most memory.")}
: null} {loopOffered && q4.engine_exists !== false ?
{tr(loopReady ? "Loop (2 steps)" : "Loop (2 steps) - coming soon")}