Merge f-ling32-fast (20f1700ac7): Windows Intel Qwen IQ2_XS / IQ3_S default to fast mode (DFlash2, --spec 6); Ling expert skip Medium, optional and off by default

This commit is contained in:
Niko1221 committed 2026-12-03 09:22:19 +01:00
commit 05361524ea
13 files changed
+293 -43

No files matched your search

+5 -2
View File
@@ -10,7 +10,7 @@ debugging and are kept in `terminal/data/settings-register.json`.
A number or a word is set like any environment variable, for example `STRATA_KVA=1`. In the Terminal, `strata launch --set NAME=value`
puts it in the model's run configuration.
## Switches you can turn on (471)
## Switches you can turn on (472)
Off unless you set them. The last column says where each one is described.
@@ -279,6 +279,7 @@ Off unless you set them. The last column says where each one is described.
| `STRATA_L32_KDA_SEQ` | number | Intel Arc | - |
| `STRATA_L32_MTP_ONLINE` | on / off | NVIDIA and AMD | - |
| `STRATA_L32_SEGMENTED` | on / off | NVIDIA and AMD | - |
| `STRATA_L32_SKIP_TAU` | number | NVIDIA and AMD | - |
| `STRATA_L3_PF` | on / off | NVIDIA and AMD | [DETAILS.md](DETAILS.md) |
| `STRATA_L3_PF_TOP` | number | NVIDIA and AMD | [DETAILS.md](DETAILS.md) |
| `STRATA_LEND_MIRROR` | text | Intel Arc | [INTEL.md](INTEL.md), [INTEL_ARC.md](INTEL_ARC.md) |
@@ -683,7 +684,7 @@ version made it the default.
| `STRATA_WDDM_SHARED_RESERVE_MIB` | number | NVIDIA and AMD | v0.2.17 | - |
| `STRATA_XN_F16` | on / off | NVIDIA and AMD | v0.2.16 | [DETAILS.md](DETAILS.md) |
## Ling-3.2-Air options (27)
## Ling-3.2-Air options (29)
These are command-line options and variables of `strata launch` and setup, not engine variables. Nothing here is on unless you ask,
except the thinking default (off) and the memory tier (chosen for your computer when you say `auto`).
@@ -696,6 +697,8 @@ except the thinking default (off) and the memory tier (chosen for your computer
| `--ram-budget-gib N` | let the engine hold at most N GiB of RAM (default: the available RAM less 6 GiB) | launcher-flag | opt-in |
| `--turbo-ssd` | faster, may change answers: in tier C the engine skips a cold expert read from the SSD once memory covers enough of the routing weight; off unless asked | launcher-flag | opt-in |
| `--cpu-coexec N` | N CPU threads work on the experts that are not on the card; answers stay identical; off unless asked | launcher-flag | opt-in |
| `--expert-skip LEVEL` | Ling-3.2-Air expert skip: medium = the engine's --skip-tau 0.05, faster (about +9 to 10 % on a 3090) and slightly less exact (about 1 word in 60 differs); offered only for an NVIDIA card of the 24 GB class (3090, 4090) on Linux when the plan streams experts (tier B or C); off unless asked; written into the saved run config as `--skip-tau 0.05` only when on | launcher-flag | opt-in |
| `--expert-skip LEVEL (setup)` | Ling-3.2-Air expert skip: medium = the engine's --skip-tau 0.05, faster (about +9 to 10 % on a 3090) and slightly less exact (about 1 word in 60 differs); offered only for an NVIDIA card of the 24 GB class (3090, 4090) on Linux when the plan streams experts (tier B or C); off unless asked; written into the saved run config as `--skip-tau 0.05` only when on | setup-flag | opt-in |
| `--tier / --vram-budget-gib / --ram-budget-gib / --turbo-ssd / --cpu-coexec / --thinking` | the same options for setup.py (the first install writes them into the run config) | setup-flag | opt-in |
| `--tier vram/hybrid/nvme` | the engine's own words for tiers A / B / C (strata-ling32 --tier); passed only when the person chose one | engine-flag | default |
| `--vram-budget-gib / --ram-budget-gib / --turbo-ssd / --cpu-coexec` | passed to strata-ling32 only when given | engine-flag | opt-in |
+25 -2
View File
@@ -36497,9 +36497,9 @@
"since": null,
"last_commit": "e1b809c30e",
"last_date": "2026-12-03",
"status": "research",
"status": "opt-in",
"owner": "L32",
"note": "experiment, NOT exact: drop a decode / verify token's routed experts whose share of its routing weight is below this value (the top expert is kept, weights renormalized, the tier store fetches nothing for them); default 0 (off)",
"note": "experiment, NOT exact: drop a decode / verify token's routed experts whose share of its routing weight is below this value (the top expert is kept, weights renormalized); default 0 (off). The launcher's optional `--expert-skip medium` writes --skip-tau 0.05 (24 GB NVIDIA class, Linux, tier B / C)",
"retire_after": "",
"retired_in": ""
},
@@ -70134,6 +70134,29 @@
"terminal/strata_cli/launch/cmd.py": "\"--cpu-coexec\""
}
},
{
"name": "--expert-skip LEVEL",
"kind": "launcher-flag",
"family": "ling-3.2-air",
"status": "opt-in",
"default": "",
"note": "Ling-3.2-Air expert skip: medium = the engine's --skip-tau 0.05, faster (about +9 to 10 % on a 3090) and slightly less exact (about 1 word in 60 differs); offered only for an NVIDIA card of the 24 GB class (3090, 4090) on Linux when the plan streams experts (tier B or C); off unless asked; written into the saved run config as `--skip-tau 0.05` only when on",
"where": {
"terminal/strata_cli/launch/cmd.py": "\"--expert-skip\"",
"terminal/strata_control/ling32_fit.py": "Faster, slightly less exact"
}
},
{
"name": "--expert-skip LEVEL (setup)",
"kind": "setup-flag",
"family": "ling-3.2-air",
"status": "opt-in",
"default": "",
"note": "Ling-3.2-Air expert skip: medium = the engine's --skip-tau 0.05, faster (about +9 to 10 % on a 3090) and slightly less exact (about 1 word in 60 differs); offered only for an NVIDIA card of the 24 GB class (3090, 4090) on Linux when the plan streams experts (tier B or C); off unless asked; written into the saved run config as `--skip-tau 0.05` only when on",
"where": {
"terminal/setup.py": "\"--expert-skip\""
}
},
{
"name": "--tier / --vram-budget-gib / --ram-budget-gib / --turbo-ssd / --cpu-coexec / --thinking",
"kind": "setup-flag",
+9
View File
@@ -9597,6 +9597,7 @@ def _select_sycl_cards(a, cards: list[dict]) -> list[dict]:
return list(cards[:1])
INTEL_FAST_MIN_RAM_GB = 32 # IQ2_XS / IQ3_S with the DFlash2 drafter on an Intel Arc (the default since 2026-12-03): QFN-B70's B70 box with 32 GB: free RAM down to 10.6 GiB (IQ2_XS) and 6.2 GiB (IQ3_S, commit 44 GiB): said, not refused
INTEL_GGUF_MIN_RAM_GB = 24 # an Arc run of a Qwen size keeps about 20 GB of the PC's RAM busy (QFN-B70, the B70 box with 32 GB: 20 GB free at the lowest with IQ3_S): said, not refused
@@ -9674,6 +9675,11 @@ def intel_control_setup(a) -> int:
sel_cards = _select_sycl_cards(a, cards) if cards else []
vram = max((float(c.get("vram_gb") or 0) for c in (sel_cards or cards)), default=0.0)
ok("graphics card: " + (", ".join(f"{c['name']} ({c['vram_gb']:g} GB)" for c in cards) or "an Intel Arc"))
from strata_control import drafting as _drafting
_ram = ram_gb()
if model in ("IQ2_XS", "IQ3_S") and family in ("qwen", "coder") and not _drafting.INTEL_PLAIN_BY_DEFAULT and _ram and _ram < INTEL_FAST_MIN_RAM_GB:
warn(f"this computer has {_ram:.0f} GB of RAM: {model} with the fast drafter (DFlash2) on an Intel Arc needs about {INTEL_FAST_MIN_RAM_GB} GB; with less it may run slowly or not start. "
"Choose drafting Off for the plain mode, which needs less.")
if a.check:
return 0
SHAPE_ENGINE.clear()
@@ -10885,6 +10891,7 @@ def ling32_engine_args(a, vram_gib, ram_gib, unified, ctx, vision: bool = False,
args = ["--ctx", str(ctx), "--chunk", str(adv["plan"]["chunk"]), *ling32_family.ENGINE_FLAGS.get(backend, ling32_family.ENGINE_FLAGS["cuda"])]
if backend == "metal": # no tiers on a Mac: the whole model is in memory
return args, adv
args += ling32_fit.skip_tau_args(getattr(a, "expert_skip", None), backend, card_gib or vram_gib, adv["tier"]) # the expert skip: only when asked (--expert-skip medium) and offered here
args += ling32_fit.tier_args(tier=getattr(a, "tier", None) or "auto", vram_budget_gib=getattr(a, "vram_budget_gib", None) or 0.0,
ram_budget_gib=getattr(a, "ram_budget_gib", None) or 0.0, turbo_ssd=bool(getattr(a, "turbo_ssd", False)),
cpu_coexec=getattr(a, "cpu_coexec", None) or 0,
@@ -12721,6 +12728,8 @@ def main() -> int:
"B = hot ones in video memory and the rest in RAM, C = the rest read from the SSD (slow)")
ap.add_argument("--vram-budget-gib", type=float, metavar="N", help="Ling-3.2-Air only: use at most N GiB of the card (default: what is free)")
ap.add_argument("--ram-budget-gib", type=float, metavar="N", help="Ling-3.2-Air only: let the engine hold at most N GiB of RAM (default: the available RAM less 6 GiB)")
ap.add_argument("--expert-skip", choices=("off", "medium"), default=None,
help="Ling-3.2-Air only: medium = faster, slightly less exact (about 1 word in 60 differs); offered for an NVIDIA card of the 24 GB class on Linux when the plan streams experts. Off unless asked")
ap.add_argument("--turbo-ssd", action="store_true",
help="Ling-3.2-Air only: faster, may change answers. In tier C the engine skips a cold expert read from the SSD once the experts in memory cover enough of the "
"routing weight. Off unless you ask")
+3 -2
View File
@@ -317,8 +317,9 @@ def plan(*, family: str, model: str, model_dir: Path, data_dir: Path, src: Path,
return None, [f"the expert profile {prof} is missing"]
from strata_control import intel_app
args += ["--expert-profile", str(prof), "--expert-cache", "auto", "--prefill", "4096", "--spec", "2"]
if not intel_app.QWEN_SYCL_WINDOWS_PACKS.get(str(model), True): # IQ2_XS / IQ3_S: plain decode (a 2-token window with the suffix drafter off; the engine needs T >= 2 for a native pack)
args += ["--suffix-draft", "0"]
from strata_control import drafting as _drafting
if not intel_app.QWEN_SYCL_WINDOWS_PACKS.get(str(model), True) and (_drafting.INTEL_PLAIN_BY_DEFAULT or _drafting.normalize(drafting) == "off"):
args += ["--suffix-draft", "0"] # IQ2_XS / IQ3_S: plain decode (a 2-token window with the suffix drafter off; the engine needs T >= 2 for a native pack), when it is the default or Off was chosen
else:
args += ["--expert-profile", str(profile), "--expert-cache", "auto", "--prefill", "auto", "--spec", "4", "--spec-min-p", "0.5"]
if mtp.exists() and not feed and not win_sycl: # the Flash-Next draft layer is not a feed model's own (a feed entry carries no MTP head yet)
+1 -1
View File
@@ -401,7 +401,7 @@ class Ctx:
from serve.server import engine_args
import contextlib
import io
d = derive_config(apply_choices(cfg, s), s, bool_flags=tune_knobs.BOOL_FLAGS, gpus=cards_for_launch(s, self.catalog, base=cfg))
d = derive_config(apply_choices(cfg, s), s, bool_flags=tune_knobs.BOOL_FLAGS, gpus=cards_for_launch(s, self.catalog, base=cfg), expert_skip_ok=S.expert_skip_applies(s, self.catalog.computer()))
if s.parallel:
d["parallel"] = s.parallel
with contextlib.redirect_stdout(io.StringIO()):
+5
View File
@@ -163,6 +163,9 @@ def add_parsers(sp: argparse._SubParsersAction) -> list[argparse.ArgumentParser]
g.add_argument("--turbo-ssd", action="store_true",
help="Ling-3.2-Air tier C only: faster, may change answers. The engine skips a cold expert read from the SSD once the experts in memory cover enough of the "
"routing weight. Off unless you ask")
g.add_argument("--expert-skip", choices=("off", "medium"), metavar="LEVEL",
help="Ling-3.2-Air only: medium = faster, slightly less exact (about 1 word in 60 differs): the engine leaves out an expert that carries little of a token's routing weight. "
"Offered for an NVIDIA card of the 24 GB class (3090, 4090) on Linux when the plan streams experts (tier B or C). Off unless you ask")
g.add_argument("--cpu-coexec", type=_parallel, metavar="N", help="Ling-3.2-Air only: N CPU threads work on the experts that are not on the card (answers stay identical; off unless you ask)")
g.add_argument("--speed", metavar="WORD", help=argparse.SUPPRESS) # DeepSeek (no longer run): accepted, answered in plain words
g.add_argument("--full-quality", action="store_true", help=argparse.SUPPRESS) # DeepSeek (no longer run): accepted, answered in plain words
@@ -371,6 +374,8 @@ def settings_from_args(a: argparse.Namespace, catalog=None) -> tuple[S.LaunchSet
s.ram_budget = a.ram_budget_gib
if getattr(a, "turbo_ssd", False):
s.turbo_ssd = True
if getattr(a, "expert_skip", None):
s.expert_skip = a.expert_skip
if getattr(a, "cpu_coexec", None):
s.extra = {**s.extra, "--cpu-coexec": str(a.cpu_coexec)}
if a.gpu and getattr(a, "gpu_roles", None):
+10 -2
View File
@@ -769,7 +769,7 @@ def _pairs(argv: list[str]) -> dict[str, str]:
def derive_config(base: dict, s: S.LaunchSettings, *, bool_flags: frozenset[str], log: str | None = None, gpus: "list[int] | dict | None" = None,
prev: dict | None = None, defaults: dict | None = None) -> dict:
prev: dict | None = None, defaults: dict | None = None, expert_skip_ok: bool = False) -> dict:
"""The private run config of this launch: the installed one plus the choices that are not setup's (host, port, key, cards, advanced).
`prev` is the config this launch wrote last time: its calibrated values, hand edits and the values the Settings view
saved (serve/runconfig.py, carry_settings) are kept (strata_control/arg_layers.py: explicit launch values, then
@@ -857,6 +857,14 @@ def derive_config(base: dict, s: S.LaunchSettings, *, bool_flags: frozenset[str]
cfg["thinking"] = s.thinking
mine = ling32_fit.tier_args(tier=s.tier or "auto", vram_budget_gib=s.vram_budget or 0.0, ram_budget_gib=s.ram_budget or 0.0, turbo_ssd=bool(s.turbo_ssd))
extra = {**extra, **{k: (v if v else "on") for k, v in _pairs(mine).items() if k not in extra}}
if s.expert_skip == "medium" and expert_skip_ok and "--skip-tau" not in extra: # the expert skip: only where it is offered (ling32_fit.expert_skip_applies), written only when the person asked
extra["--skip-tau"] = f"{ling32_fit.SKIP_TAU_MEDIUM:g}"
elif s.expert_skip == "off" and isinstance(cfg.get("args"), list): # turned off: nothing is written, an earlier value goes
cargs0 = [str(a) for a in cfg["args"]]
while "--skip-tau" in cargs0:
at = cargs0.index("--skip-tau")
del cargs0[at:at + (2 if at + 1 < len(cargs0) and not cargs0[at + 1].startswith("--") else 1)]
cfg["args"] = cargs0
cfg.pop("mtp", None)
from strata_control import ling32_family
if s.mtp == "off": # the MTP sidecar (strata_control/ling32_family.py): off drops the config keys serve makes the engine flags from
@@ -2436,7 +2444,7 @@ class Runner:
self.emit("config", note, None, level="warn")
cfg = derive_config(base, self.s, bool_flags=tune_knobs.BOOL_FLAGS,
log=str(launch_dir() / f"{self.name}.engine.log"), gpus=cards_for_launch(self.s, self.catalog, base=base),
prev=previous, defaults=defaults)
prev=previous, defaults=defaults, expert_skip_ok=S.expert_skip_applies(self.s, self.catalog.computer()))
if self.is_inkling(): # a --kv the Inkling engine does not take is said, never dropped quietly
kv_note = S.inkling_kv_note(self.s.kv, cfg.get("backend"))
if kv_note:
+22
View File
@@ -179,6 +179,7 @@ class LaunchSettings:
tier: str | None = None # Ling-3.2-Air: auto | A | B | C (None = auto: Strata chooses from video memory, RAM and disk)
vram_budget: float | None = None # Ling-3.2-Air: GiB of the card the engine may use (None = what is free)
ram_budget: float | None = None # Ling-3.2-Air: GiB of RAM the engine may hold (None = the available RAM less 6 GiB)
expert_skip: str | None = None # Ling-3.2-Air expert skip: None = as installed (off), "off", "medium" (--skip-tau 0.05: faster, slightly less exact; the NVIDIA 24 GB class in tier B / C on Linux only)
turbo_ssd: bool = False # Ling-3.2-Air tier C: skip cold experts once memory covers enough of the routing weight: faster, may change answers (off unless asked)
mtp: str | None = None # None = as installed (draft layer on); "off" starts without it (less graphics memory and RAM, slower); "on" overrides an installed "off"
tune: str = "skip" # quick | thorough | skip
@@ -418,6 +419,22 @@ def old_nvidia_cards(cards) -> list[dict]:
return out
def expert_skip_applies(s: LaunchSettings, comp) -> bool:
"""Is the Ling expert skip offered on this computer for these settings (ling32_fit.expert_skip_applies: NVIDIA, Linux, the 24 GB class, a plan in tier B or C). Never raises."""
try:
if s.family != "ling-3.2-air" or str(getattr(comp, "engine_vendor", "") or "").lower() != "nvidia":
return False
from strata_control import ling32_family, ling32_fit
vram_gb = getattr(comp, "main_vram_gb", None) or None
mtp_mode = ling32_fit.mtp_mode(s.mtp, default_on=ling32_family.DEFAULT_MTP, vram_gib=vram_gb, unified=False)
adv = ling32_fit.advise(vram_gb, float(getattr(comp, "ram_gb", 0.0) or 0.0), unified=False, tier=s.tier or "auto", vram_budget_gib=s.vram_budget or 0.0, ram_budget_gib=s.ram_budget or 0.0,
turbo_ssd=bool(s.turbo_ssd), ctx=s.context, vision=s.vision not in ("off", "no"), vision_device=s.vision if s.vision in ("gpu", "cpu") else "auto",
mtp="auto" if mtp_mode == "auto" else mtp_mode == "on", backend="cuda", card_gib=vram_gb)
return ling32_fit.expert_skip_applies("cuda", vram_gb, adv.get("tier"))
except Exception: # noqa: BLE001
return False
def check_ling32(s: LaunchSettings, *, vram_gb: float | None, ram_gb: float | None, disk_free_gb: float | None = None, unified: bool = False, vendor: str | None = None,
cards=None) -> list[Notice]:
"""Ling-3.2-Air: what the memory tier will be on this computer and what the person chose for it (strata_control/ling32_fit.py, the engine's planner): the tier and its
@@ -474,6 +491,9 @@ def check_ling32(s: LaunchSettings, *, vram_gb: float | None, ram_gb: float | No
out.append(Notice("warn", ling32_fit.MTP_SMALL_CARD_NOTE, ""))
from strata_control import ling32_family
out.append(Notice("warn", f"MTP sidecar licence: {ling32_family.MTP_LICENSE['spdx']}. {ling32_family.MTP_LICENSE['attribution']}", ""))
if s.expert_skip == "medium":
out.append(Notice("warn", ling32_fit.EXPERT_SKIP_NOTE if ling32_fit.expert_skip_applies(engine_backend, vram_gb, adv["tier"]) else
"--expert-skip changes nothing here: it is offered for an NVIDIA card of the 24 GB class (3090, 4090) on Linux when the plan streams experts (tier B or C).", ""))
if s.turbo_ssd:
out.append(Notice("warn", ling32_fit.TURBO_SSD_NOTE if adv["tier"] == "C" else "--turbo-ssd changes nothing here: it only acts in tier C and this computer plans another tier.",
"Take the flag away to get exact answers again."))
@@ -608,6 +628,8 @@ def flags_text(s: LaunchSettings, *, preset: str | None = None) -> str:
parts.append(f"--ram-budget-gib {s.ram_budget:g}")
if s.turbo_ssd:
parts.append("--turbo-ssd")
if s.expert_skip:
parts.append(f"--expert-skip {s.expert_skip}")
parts.append(f"--tune {s.tune}")
if s.tune_allow_small:
parts.append("--tune-allow-small")
+5 -3
View File
@@ -1547,10 +1547,12 @@ def canonical_pack(args: list[Any] | None = None) -> bool:
return False
#: Intel Arc (the SYCL engine), Qwen3.8-Flash-Next IQ2_XS and IQ3_S: Auto is NO drafter, the plain decode QFN-B70 gated on the B70. With DFlash2 (Auto's pick wherever the engine has it) the Windows run starts with
#: Owner decision 2026-12-03 09:05: Qwen IQ2_XS and IQ3_S on an Intel Arc on Windows default to FAST mode (DFlash2, --spec 6), the same as Linux Arc, so this is False; plain decode stays available (below).
#: Intel Arc (the SYCL engine), Qwen3.8-Flash-Next IQ2_XS and IQ3_S: True = Auto is NO drafter, the plain decode QFN-B70 gated on the B70. With DFlash2 (Auto's pick wherever the engine has it) the Windows run starts with
#: `--spec 6` and the drafter (decode 77-114 tok/s, about twice plain, acceptance 90 %), which was not gated: speculation with this pack is not bit-equal to plain decode (near-tie flips from token 56 to 185 with spec 2).
#: ONE switch: set False and Auto is DFlash2 on Intel again if the owner chooses speed over exact answers (the person can name a drafter in Settings either way).
INTEL_PLAIN_BY_DEFAULT = True
#: ONE switch: False (now) = Auto is DFlash2 on Intel (speed); True = plain decode by default (exact). The person can name a drafter or Off in Settings either way: with Off a Windows Intel IQ2_XS / IQ3_S install is written
#: with `--suffix-draft 0` (strata_cli/launch/adopt.py), which is the plain decode (a 2-token window, no draft proposed).
INTEL_PLAIN_BY_DEFAULT = False
#: The platforms it applies to (sys.platform prefixes). Windows only for now: that is where the B70 gate measured it and where the app's Load put DFlash2 on without a gate. Linux Arc keeps its tuned
#: DFlash2 default for IQ3_S (CLASS_DEFAULTS, tests/terminal/test_drafting_tuned.py); add "linux" here, and update those tests, if the owner wants the plain decode there too.
INTEL_PLAIN_PLATFORMS = ("win",)
+24
View File
@@ -521,6 +521,30 @@ def plan(vram_gib: float | None, ram_gib: float, *, unified: bool = False, tier:
return got
#: Expert skip (the engine's `--skip-tau T`, f-ling32-int c966eccc17; env STRATA_L32_SKIP_TAU): at decode and speculative-verify rows only, a token's routed experts whose routing-weight share is below T are dropped (the top expert
#: is always kept, the weights are rescaled). NOT exact. One level, "medium" = 0.05 (L32-CUDA, an RTX 3090 24 GB, PCIe 4.0, tier B, ctx 131072, plain decode: 0 / 0.03 / 0.05 / 0.08 = 53.0 / 53.5 / 58.0 / 70.8 tok/s;
#: top-1 agreement with the unpruned run 100 / 98-100 / 97.5-98 %, mean KL 1e-4 / 1e-3 / 1.6e-2: medium is +9 to 10 % for about 1 word in 60 different on code). Off by default; the person turns it on.
SKIP_TAU_MEDIUM = 0.05
EXPERT_SKIP_WORDS = ("off", "medium")
EXPERT_SKIP_PLATFORMS = ("linux",) # measured on Linux only; Windows, HIP, SYCL and Metal are not offered until they are measured
EXPERT_SKIP_NOTE = "Faster, slightly less exact (about 1 word in 60 differs)."
def expert_skip_applies(backend: str | None, card_gib: float | None, tier: str | None, platform: str | None = None) -> bool:
"""Is the expert skip offered here: the NVIDIA CUDA engine on Linux, a card of the 24 GB class (CLASS_24_GIB up to CLASS_32_GIB: the 3090 and 4090), and a plan that streams experts (tier B or C; tier A gains nothing)."""
import sys as _sys
if str(backend or "cuda").lower() != "cuda" or not str(platform or _sys.platform).startswith(EXPERT_SKIP_PLATFORMS):
return False
return bool(card_gib and CLASS_24_GIB <= float(card_gib) < CLASS_32_GIB and tier in ("B", "C"))
def skip_tau_args(word: str | None, backend: str | None, card_gib: float | None, tier: str | None, platform: str | None = None) -> list[str]:
"""`--skip-tau 0.05` when the person chose "medium" and the expert skip is offered here, else nothing."""
if str(word or "").lower() == "medium" and expert_skip_applies(backend, card_gib, tier, platform):
return ["--skip-tau", f"{SKIP_TAU_MEDIUM:g}"]
return []
def tier_args(*, tier: str = "auto", vram_budget_gib: float = 0.0, ram_budget_gib: float = 0.0, turbo_ssd: bool = False, cpu_coexec: int = 0,
map_experts: bool = False) -> list[str]:
"""The engine flags for the person's choices, and nothing for the defaults (the engine plans by itself, with the rules above)."""
+15 -1
View File
@@ -141,7 +141,8 @@ class ArcInstall(unittest.TestCase):
self.assertEqual(self.packed, str(data / "packs" / "iq2_xs"))
cfg = json.loads((home / "strata-iq2_xs.json").read_text(encoding="utf-8"))
a = cfg["args"]
self.assertEqual((cfg["backend"], a[a.index("--spec") + 1], a[a.index("--suffix-draft") + 1]), ("sycl", "2", "0")) # IQ2_XS on Windows: plain decode
self.assertEqual((cfg["backend"], a[a.index("--spec") + 1]), ("sycl", "2"))
self.assertNotIn("--suffix-draft", a) # IQ2_XS on Windows: fast mode by default (owner, 2026-12-03): the drafting rule adds DFlash2 at Load, nothing forces plain
def test_a_pack_that_is_not_gated_on_windows_keeps_the_block_with_its_words(self):
with tempfile.TemporaryDirectory() as t:
@@ -176,6 +177,19 @@ class ArcInstall(unittest.TestCase):
self.run_setup(self.args(), data, home, ram=16.0)
self.assertTrue(any(m.startswith("WARN") and "16 GB of RAM" in m for m in self.said), self.said)
def test_the_fast_drafter_ram_note(self):
with tempfile.TemporaryDirectory() as t:
t = Path(t)
data, home = t / "Strata-data", t / "install"
data.mkdir()
home.mkdir()
self.run_setup(self.args(model="IQ3_S"), data, home, ram=16.0)
self.assertTrue(any(m.startswith("WARN") and "32 GB" in m and "DFlash2" in m for m in self.said), self.said)
self.run_setup(self.args(model="IQ3_S"), data, home, ram=64.0)
self.assertFalse(any("DFlash2" in m for m in self.said), self.said)
self.run_setup(self.args(model="IQ2_XS", family="qwen"), data, home, ram=64.0)
self.assertFalse(any("32 GB" in m for m in self.said), self.said)
def test_files_that_are_there_download_nothing(self):
with tempfile.TemporaryDirectory() as t:
t = Path(t)
@@ -0,0 +1,139 @@
"""Ling-3.2-Air expert skip, "Medium" (0.2.25, owner decision 2026-12-03): the engine's `--skip-tau 0.05` (f-ling32-int c966eccc17: at decode and speculative-verify rows, a token's experts with a routing-weight
share below 0.05 are dropped, the top expert kept; NOT exact; +9 to 10 % on a 3090, about 1 word in 60 different). An optional setting, off by default, offered only where it was measured: the NVIDIA CUDA engine on
Linux, a card of the 24 GB class, a plan that streams experts (tier B or C). What these tests pin:
* the rule (ling32_fit.expert_skip_applies / skip_tau_args) for every class of card, tier, backend and platform;
* the Terminal: `--expert-skip medium` reaches the saved run config as `--skip-tau 0.05` only where it is offered; off, unset or not offered write nothing; "off" removes an earlier pair; the default rows are unchanged;
* setup writes the same pair for the same rows; the notice says what it costs, or that it changes nothing here;
* the saved representation is the one the app reads: the two entries in the engine args, no other key.
Offline: nothing runs but Python."""
from __future__ import annotations
import argparse
import sys
import types
import unittest
from pathlib import Path
from unittest import mock
ROOT = Path(__file__).resolve().parents[2]
sys.path.insert(0, str(ROOT))
sys.path.insert(0, str(ROOT / "tools"))
from strata_cli.launch import cmd as C # noqa: E402
from strata_cli.launch import runner as R # noqa: E402
from strata_cli.launch import settings as S # noqa: E402
from strata_control import ling32_fit, tune_knobs # noqa: E402
BASE = {"exe": "component:strata-ling32", "arch": "ling32", "model_name": "ling-3.2-air-sq-96", "port": 8095, "drafting": "off", "thinking": "off",
"args": ["--model", "C:/m/Ling-3.2-Air-SQ-96.strata", "--ctx", "32768", "--chunk", "2048", "--tc", "16", "--tc-moe", "128", "--graph", "--mla-kernel", "simt"]}
def derive(base=BASE, ok=True, **kw):
return R.derive_config(base, S.LaunchSettings(family="ling-3.2-air", port=8123, **kw), bool_flags=tune_knobs.BOOL_FLAGS, log="x.log", expert_skip_ok=ok)
def computer(vendor="nvidia", vram=23.5, ram=64.0):
return types.SimpleNamespace(engine_vendor=vendor, main_vram_gb=vram, ram_gb=ram)
class Rule(unittest.TestCase):
def test_where_it_is_offered(self):
F = ling32_fit
for card in (23.5, 24.0, 20.0, 26.9): # the 24 GB class: 3090, 4090 (23.x GiB), the edges of CLASS_24_GIB .. CLASS_32_GIB
for tier in ("B", "C"):
self.assertTrue(F.expert_skip_applies("cuda", card, tier, "linux"), (card, tier))
self.assertFalse(F.expert_skip_applies("cuda", 23.5, "A", "linux")) # tier A gains nothing
for card in (8.0, 11.95, 15.9, 19.9, 27.0, 31.4, 47.5, 96.0, None, 0):
self.assertFalse(F.expert_skip_applies("cuda", card, "B", "linux"), card)
for backend in ("hip", "sycl", "metal"):
self.assertFalse(F.expert_skip_applies(backend, 23.5, "B", "linux"), backend)
for platform in ("win32", "darwin"):
self.assertFalse(F.expert_skip_applies("cuda", 23.5, "B", platform), platform) # measured on Linux only
def test_the_flag_and_its_level(self):
F = ling32_fit
self.assertEqual(F.SKIP_TAU_MEDIUM, 0.05)
self.assertEqual(F.EXPERT_SKIP_WORDS, ("off", "medium")) # one level: no light, no strong
self.assertEqual(F.skip_tau_args("medium", "cuda", 23.5, "B", "linux"), ["--skip-tau", "0.05"])
for word in (None, "", "off", "light", "strong"):
self.assertEqual(F.skip_tau_args(word, "cuda", 23.5, "B", "linux"), [], word)
self.assertEqual(F.skip_tau_args("medium", "cuda", 15.9, "B", "linux"), [])
self.assertIn("1 word in 60", F.EXPERT_SKIP_NOTE)
def test_the_helper_the_launcher_uses(self):
with mock.patch.object(ling32_fit, "EXPERT_SKIP_PLATFORMS", ("",)): # any platform: the tests run on Linux and Windows
s = S.LaunchSettings(family="ling-3.2-air")
self.assertTrue(S.expert_skip_applies(s, computer("nvidia", 23.5, 64.0))) # a 3090 with 64 GB: the experts stream (tier B or C)
self.assertFalse(S.expert_skip_applies(s, computer("nvidia", 15.9, 64.0)))
self.assertFalse(S.expert_skip_applies(s, computer("nvidia", 47.5, 128.0)))
self.assertFalse(S.expert_skip_applies(s, computer("amd", 23.5, 64.0)))
self.assertFalse(S.expert_skip_applies(s, computer("intel", 23.5, 64.0)))
self.assertFalse(S.expert_skip_applies(s, computer(None, 23.5, 64.0)))
self.assertFalse(S.expert_skip_applies(S.LaunchSettings(family="qwen"), computer()))
self.assertFalse(S.expert_skip_applies(s, object())) # a computer record without the fields: no crash
with mock.patch.object(ling32_fit, "EXPERT_SKIP_PLATFORMS", ("linux",)), mock.patch.object(sys, "platform", "win32"):
self.assertFalse(S.expert_skip_applies(S.LaunchSettings(family="ling-3.2-air"), computer()))
class Terminal(unittest.TestCase):
def test_default_rows_are_unchanged(self):
for kw in ({}, {"expert_skip": None}):
self.assertNotIn("--skip-tau", derive(**kw)["args"])
self.assertEqual(derive()["args"][:len(BASE["args"])], BASE["args"])
self.assertIsNone(S.LaunchSettings().expert_skip)
def test_medium_writes_the_pair_only_where_it_is_offered(self):
a = derive(expert_skip="medium")["args"]
self.assertEqual(a[a.index("--skip-tau"):a.index("--skip-tau") + 2], ["--skip-tau", "0.05"])
self.assertEqual(a.count("--skip-tau"), 1)
self.assertNotIn("--skip-tau", derive(ok=False, expert_skip="medium")["args"]) # not the 24 GB class / not tier B or C / not Linux CUDA: nothing
self.assertNotIn("--skip-tau", derive(expert_skip="off")["args"])
def test_off_removes_an_earlier_pair_and_unset_leaves_it(self):
base = {**BASE, "args": [*BASE["args"], "--skip-tau", "0.05"]}
self.assertNotIn("--skip-tau", derive(base, expert_skip="off")["args"])
self.assertNotIn("0.05", derive(base, expert_skip="off")["args"])
self.assertIn("--skip-tau", derive(base)["args"]) # as installed: kept (the app writes the same pair)
def test_other_families_never_get_it(self):
cfg = R.derive_config({"exe": "component:strata-engine", "args": []}, S.LaunchSettings(family="qwen", port=8123, expert_skip="medium"), bool_flags=tune_knobs.BOOL_FLAGS, log="x.log", expert_skip_ok=True)
self.assertNotIn("--skip-tau", cfg["args"])
def test_the_command_line_flag_and_the_summary(self):
ap = argparse.ArgumentParser()
C.add_parsers(ap.add_subparsers(dest="cmd"))
a = ap.parse_args(["launch", "--family", "ling-3.2-air", "--expert-skip", "medium"])
self.assertEqual(a.expert_skip, "medium")
self.assertIsNone(ap.parse_args(["launch", "--family", "ling-3.2-air"]).expert_skip)
with self.assertRaises(SystemExit), mock.patch("sys.stderr"):
ap.parse_args(["launch", "--family", "ling-3.2-air", "--expert-skip", "strong"])
self.assertIn("--expert-skip medium", S.flags_text(S.LaunchSettings(family="ling-3.2-air", expert_skip="medium")))
self.assertNotIn("--expert-skip", S.flags_text(S.LaunchSettings(family="ling-3.2-air")))
def test_the_notice(self):
s = S.LaunchSettings(family="ling-3.2-air", expert_skip="medium")
with mock.patch.object(ling32_fit, "EXPERT_SKIP_PLATFORMS", ("",)):
on = S.check_ling32(s, vram_gb=23.5, ram_gb=64.0, vendor="nvidia")
off_card = S.check_ling32(s, vram_gb=15.9, ram_gb=64.0, vendor="nvidia")
self.assertTrue(any("1 word in 60" in n.line() for n in on))
self.assertTrue(any("--expert-skip changes nothing here" in n.line() for n in off_card))
self.assertFalse(any("expert-skip" in n.line() for n in S.check_ling32(S.LaunchSettings(family="ling-3.2-air"), vram_gb=23.5, ram_gb=64.0, vendor="nvidia")))
class Setup(unittest.TestCase):
def test_setup_writes_the_same_pair(self):
import setup
a = argparse.Namespace(tier=None, vram_budget_gib=None, ram_budget_gib=None, turbo_ssd=False, cpu_coexec=None, expert_skip="medium")
with mock.patch.object(ling32_fit, "EXPERT_SKIP_PLATFORMS", ("",)):
args, adv = setup.ling32_engine_args(a, 23.0, 64.0, False, 32768, backend="cuda", card_gib=23.5)
self.assertEqual(args[args.index("--skip-tau") + 1], "0.05")
self.assertIn(adv["tier"], ("B", "C"))
a.expert_skip = None
self.assertNotIn("--skip-tau", setup.ling32_engine_args(a, 23.0, 64.0, False, 32768, backend="cuda", card_gib=23.5)[0])
a.expert_skip = "medium"
self.assertNotIn("--skip-tau", setup.ling32_engine_args(a, 15.0, 64.0, False, 32768, backend="cuda", card_gib=15.9)[0]) # not the 24 GB class
self.assertNotIn("--skip-tau", setup.ling32_engine_args(a, 23.0, 64.0, False, 32768, backend="hip", card_gib=23.5)[0]) # not CUDA
if __name__ == "__main__":
unittest.main()
@@ -40,11 +40,11 @@ class Tree:
for i in (1, 2):
(self.models / f"Qwen3.8-Flash-Next-GSQ-RCO-{pack_name.split('-')[-1].upper()}-0000{i}-of-00002.gguf").write_bytes(b"x")
def plan(self, model: str, platform: str, context: int = 32768, vram_gb: float = 32.0):
def plan(self, model: str, platform: str, context: int = 32768, vram_gb: float = 32.0, drafting=None):
fam = setup.FAMILIES[self.family]
return adopt.plan(family=self.family, model=model, model_dir=self.models, data_dir=self.data, src=self.src, context=context, kv="int8",
model_name=f"{fam.get('name', self.family)}-{model.lower()}", family_def=fam, log=self.root / "x.log", backend="sycl",
pack_name=self.pack.name, vram_gb=vram_gb, platform=platform)
pack_name=self.pack.name, vram_gb=vram_gb, platform=platform, drafting=drafting)
def value(args, flag):
@@ -81,7 +81,14 @@ class WindowsFlags(unittest.TestCase):
a = cfg["args"]
self.assertEqual(value(a, "--vram-reserve-mib"), "2048")
self.assertEqual(value(a, "--expert-profile"), str(t.src / "data" / "expert-profile-sycl.bin"))
self.assertEqual((value(a, "--spec"), value(a, "--prefill"), value(a, "--suffix-draft")), ("2", "4096", "0")) # IQ2_XS: plain decode (a 2-token window, the suffix drafter off: spec 2 with it is not bit-equal to plain decode here)
self.assertEqual((value(a, "--spec"), value(a, "--prefill")), ("2", "4096"))
self.assertNotIn("--suffix-draft", a) # IQ2_XS: fast mode by default (DFlash2 at Load, owner 2026-12-03); plain decode is the Off choice or the constant
cfg2, _p = t.plan("IQ2_XS", "win32", context=65536, drafting="off")
self.assertEqual(value(cfg2["args"], "--suffix-draft"), "0") # Off: the plain decode (a 2-token window, no draft proposed)
from strata_control import drafting
with mock.patch.object(drafting, "INTEL_PLAIN_BY_DEFAULT", True):
cfg3, _p = t.plan("IQ2_XS", "win32", context=65536)
self.assertEqual(value(cfg3["args"], "--suffix-draft"), "0") # the constant: plain by default again
self.assertNotIn("--spec-min-p", a)
def test_linux_keeps_its_flags(self):
@@ -113,8 +120,8 @@ class WindowsRoute(unittest.TestCase):
class PlainDecodeOnIntel(unittest.TestCase):
"""IQ2_XS and IQ3_S on the SYCL engine on Windows: Auto drafting is NO drafter (the plain decode QFN-B70 gated), in the app's Load and in the Terminal; one constant (drafting.INTEL_PLAIN_BY_DEFAULT) turns
DFlash2 back on, another (INTEL_PLAIN_PLATFORMS) adds Linux."""
"""IQ2_XS and IQ3_S on the SYCL engine on Windows: fast mode (DFlash2) by default since the owner's decision of 2026-12-03 (drafting.INTEL_PLAIN_BY_DEFAULT = False), like Linux Arc. The plain-decode machinery stays behind
the constant (Auto = no drafter on a platform of INTEL_PLAIN_PLATFORMS), and Off is the plain decode in the install's flags."""
NAMES = ("qwen3.8-flash-next-iq2_xs", "qwen3.8-flash-next-iq3_s")
@@ -124,43 +131,36 @@ class PlainDecodeOnIntel(unittest.TestCase):
p.start()
self.addCleanup(p.stop)
def test_auto_means_no_drafter_for_the_two_packs_on_sycl_only(self):
def test_the_default_is_fast_mode_on_windows_intel(self):
from strata_control import drafting
self.assertFalse(drafting.INTEL_PLAIN_BY_DEFAULT)
for name in self.NAMES:
self.assertTrue(drafting.intel_plain("sycl", name), name)
self.assertEqual(drafting.choice_of("auto", model_name=name, backend="sycl"), "off")
self.assertFalse(drafting.intel_plain("sycl", name), name)
d = drafting.decide("auto", model_name=name, backend="sycl", data_dir=None, mtp_here=False)
self.assertEqual((d.drafter, d.note, d.flags), ("off", "", ())) # no drafter, nothing to say, no --spec 6
self.assertFalse(drafting.wants_one_request("auto", model_name=name, backend="sycl")) # no "one request at a time"
self.assertFalse(drafting.needs_pack("auto", model_name=name, backend="sycl", data_dir="x")) # nothing is fetched for it
self.assertFalse(drafting.needs_mtp("auto", model_name=name, backend="sycl", mtp_here=False))
for backend in ("cuda", "hip", "metal", None):
self.assertFalse(drafting.intel_plain(backend, name), (backend, name)) # NVIDIA, AMD and Apple are untouched
for name in ("qwen3.8-flash-next-q2_0", "qwen3.8-flash-next-iq3_xxs", "qwen3.8-flash-next-coder-iq1_m", "qwen3.8-flash-next-unsloth-iq3_s", "swift-iq3_s", None):
self.assertFalse(drafting.intel_plain("sycl", name), name) # the other packs and families keep their rule
self.assertEqual(d.drafter, drafting.decide("auto", model_name=name, backend="sycl", data_dir=None, mtp_here=False).drafter)
self.assertNotEqual(drafting.choice_of("auto", model_name=name, backend="sycl"), "off") # the engine's own Auto rule: DFlash2 where it runs, else the MTP
def test_linux_keeps_its_rule_until_the_owner_says_otherwise(self):
def test_the_constant_brings_plain_back_and_leaves_the_other_cards_alone(self):
from strata_control import drafting
with mock.patch.object(drafting, "_host_platform", lambda: "linux"):
with mock.patch.object(drafting, "INTEL_PLAIN_BY_DEFAULT", True):
for name in self.NAMES:
self.assertFalse(drafting.intel_plain("sycl", name))
self.assertNotEqual(drafting.choice_of("auto", model_name=name, backend="sycl"), "off")
with mock.patch.object(drafting, "INTEL_PLAIN_PLATFORMS", ("win", "linux")), mock.patch.object(drafting, "_host_platform", lambda: "linux"):
self.assertTrue(drafting.intel_plain("sycl", self.NAMES[0])) # one word adds it
self.assertTrue(drafting.intel_plain("sycl", name), name)
self.assertEqual(drafting.choice_of("auto", model_name=name, backend="sycl"), "off")
d = drafting.decide("auto", model_name=name, backend="sycl", data_dir=None, mtp_here=False)
self.assertEqual((d.drafter, d.note, d.flags), ("off", "", ()))
for backend in ("cuda", "hip", "metal", None):
self.assertFalse(drafting.intel_plain(backend, name), (backend, name))
for name in ("qwen3.8-flash-next-q2_0", "qwen3.8-flash-next-coder-iq1_m", "swift-iq3_s", None):
self.assertFalse(drafting.intel_plain("sycl", name), name)
with mock.patch.object(drafting, "_host_platform", lambda: "linux"):
self.assertFalse(drafting.intel_plain("sycl", self.NAMES[0])) # platforms: Windows only
def test_a_named_drafter_and_off_are_the_persons_own(self):
from strata_control import drafting
name = self.NAMES[0]
self.assertEqual(drafting.choice_of("mtp", model_name=name, backend="sycl"), "mtp")
self.assertEqual(drafting.choice_of("off", model_name=name, backend="sycl"), "off")
self.assertEqual(drafting.choice_of("dflash2", model_name=name, backend="sycl"), "dflash2") # asked for by name: the person's choice (the engine may still refuse it)
def test_one_constant_turns_dflash2_back_on(self):
from strata_control import drafting
with mock.patch.object(drafting, "INTEL_PLAIN_BY_DEFAULT", False):
for name in self.NAMES:
self.assertFalse(drafting.intel_plain("sycl", name))
self.assertNotEqual(drafting.choice_of("auto", model_name=name, backend="sycl"), "off") # back to the engine's own Auto rule (DFlash2 where it runs, else the MTP)
self.assertEqual(drafting.choice_of("dflash2", model_name=name, backend="sycl"), "dflash2")
if __name__ == "__main__":