Skip to content

Kyojin: open-source engine that runs 100 GB-class open models (GLM-5.3, Qwen3.8, DeepSeek V4.1) on one desktop machine. AMD Strix Halo, NVIDIA RTX and Apple Mac. OpenAI API, built on ExLlamaV3.

qualify: per-stage input keys, engine checkout as PYTHONPATH, eval suite lookup, design findings

YanissAmzb1dfbc1f390f
diff --git a/tools/qualify/DESIGN.md b/tools/qualify/DESIGN.md
index 23399f5..7b64f61 100644
--- a/tools/qualify/DESIGN.md
+++ b/tools/qualify/DESIGN.md
@@ -45,3 +45,14 @@ sha self-equal, smoke >= 80 % of the tasks, no OOM. Verdict is advisory; numbers
## Not in v1 (explicit)
GDN/MoE/MLA reference adapters (only dense Llama), MLX profile, Strix real run, day-0 autotune (q2 will write into the pack cache; `serve` has a hook
`--tuning-cache DIR` reserved), automatic HF fetch of gated repos.
+
+## Findings while building it (feed the converter / serve owners)
+- `serve.py` loads the MTP drafter for every `--draft-policy` but `off`: a head-less pack (Nanbeige) must be served `off`; `pack.draft_policy` derives it from
+ `mtp_num_hidden_layers`. n-gram lookup without an MTP head needs a server flag (drill-0 gap 8 stays open).
+- The per-layer SQNR is only in the converter log, not in the pack: the converter should write `convert.log` into the pack (`parity` reads `<pack>/convert.log`
+ or `--conv-log`).
+- Servers run with `PYTHONPATH=<engine checkout>` (the built extension lives there): `--repo` is that checkout, not the qualify tree.
+- `standard_cal_data` is also the quantizer's calibration source: the domain docs use late offsets (held-out in practice, not by construction). A truly
+ held-out set is a v2 item.
+- The hermes_opt/eval copy under duel_src lacks `lib/taskdefs.py`; the duel's copy (pr_bundles/duel/harness/eval) is complete and is found automatically
+ (`QUALIFY_EVAL_DIR` overrides).
diff --git a/tools/qualify/plan.py b/tools/qualify/plan.py
index a330b3c..436b362 100644
--- a/tools/qualify/plan.py
+++ b/tools/qualify/plan.py
@@ -36,9 +36,13 @@ class Stage:
cmd: list = field(default_factory=list)
+RELEVANT = {"fetch": ("ref",), "meta": (), "parity": ("ref",), "kv": ("ref", "kv_kl_max", "kv_bits"), "maxctx": ("sessions", "ctx_cap"),
+ "serve": ("sessions", "ctx_cap"), "smoke": ("smoke_tasks",), "report": ()}
+
+
def fingerprint(stage: str, meta: dict, args: dict) -> str:
- """Input key of a stage: pack index sha + the arguments that change its result. A done-file with another key is stale."""
- rel = {k: args.get(k) for k in ("backend", "sessions", "kv_kl_max", "ref", "smoke_tasks", "seq", "ctx_cap")}
+ """Input key of a stage: pack index sha, backend + the arguments that change THIS stage's result. A done-file with another key is stale."""
+ rel = {k: args.get(k) for k in ("backend",) + RELEVANT[stage]}
return hashlib.sha1(json.dumps([stage, meta.get("index_sha"), rel], sort_keys=True, default=str).encode()).hexdigest()[:12]
diff --git a/tools/qualify/qualify.py b/tools/qualify/qualify.py
index ecdff84..5ce8082 100644
--- a/tools/qualify/qualify.py
+++ b/tools/qualify/qualify.py
@@ -113,7 +113,7 @@ def main(argv=None) -> int:
c.data[name] = d
results[name] = dict(status="done", wall_s=round(wall, 1), data=d)
log(f"stage {s.name} done in {wall:.0f} s")
- if "report" in {x.name for x in plan if x.status in ("todo",)} or not only:
+ if True: # the report is cheap: always rebuilt from the stage files
results = planmod.load_state(out)
j = report.assemble(meta, a, results, Path(a["repo"]))
report.write(out, j)
diff --git a/tools/qualify/smoke.py b/tools/qualify/smoke.py
index fa4c712..cf32cbf 100644
--- a/tools/qualify/smoke.py
+++ b/tools/qualify/smoke.py
@@ -13,7 +13,9 @@ import time
import urllib.request
from pathlib import Path
-EVAL_DIRS = [Path.home() / "hermes-work/hermes_opt/eval", Path.home() / "hermes-work/duel_src/hermes_opt/eval"]
+EVAL_DIRS = ([Path(os.environ["QUALIFY_EVAL_DIR"])] if os.environ.get("QUALIFY_EVAL_DIR") else []) + [
+ Path.home() / "hermes-work/hermes_opt/eval", Path.home() / "hermes-work/duel_src/hermes_opt/eval",
+ Path.home() / "hermes-work/leadk/fleet/pr_bundles/duel/harness/eval"] # the duel's copy is the complete one (44 tasks, lib/taskdefs.py)
DEFAULT_TASKS = "" # filled by pick_tasks from the suite's own task list
diff --git a/tools/qualify/tests/test_plan.py b/tools/qualify/tests/test_plan.py
index 89366a3..0e2a2e8 100644
--- a/tools/qualify/tests/test_plan.py
+++ b/tools/qualify/tests/test_plan.py
@@ -33,7 +33,7 @@ def fake_pack(d: Path, arch="LlamaForCausalLM", mtp=0, template=True, quant="exl
def args(**kw):
- a = dict(backend="cuda", sessions=[1, 4], ref=None, kv_kl_max=0.02, smoke_tasks="", ctx_cap=None, out="/tmp/x", seq=None)
+ a = dict(backend="cuda", sessions=[1, 4], ref=None, kv_kl_max=0.02, kv_bits=[8, 6, 4], smoke_tasks="", ctx_cap=None, out="/tmp/x", seq=None)
a.update(kw)
return a
@@ -108,6 +108,8 @@ class PlanTests(unittest.TestCase):
st = {"maxctx": dict(status="done", key=key, wall_s=12.0, data={})}
self.assertEqual(self.names(planmod.build_plan(m, args(), st), "done"), ["maxctx"])
self.assertEqual(self.names(planmod.build_plan(m, args(sessions=[1]), st), "done"), []) # changed input -> stale
+ km = dict(status="done", key=planmod.fingerprint("meta", m, args()), wall_s=0, data={})
+ self.assertEqual(self.names(planmod.build_plan(m, args(sessions=[1]), {"meta": km}), "done"), ["meta"]) # unrelated arg keeps meta
self.assertEqual(self.names(planmod.build_plan(m, args(), st, redo=["maxctx"]), "done"), [])
def test_stage_selector_blocks_missing_dependency(self):