The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
feat(local-runtime): remove the quant ladder — one Q4-class build per catalog entry
emozillab8a82c975698
diff --git a/hermes_cli/local_runtime/catalog.json b/hermes_cli/local_runtime/catalog.jsonindex 587da75d7ad..65bc4a38806 100644--- a/hermes_cli/local_runtime/catalog.json+++ b/hermes_cli/local_runtime/catalog.json@@ -7,33 +7,6 @@"description": "Best all-round agent model; sees images; long context stays fast","repo": "unsloth/Qwen3.8-27B-GGUF","variants": [- {- "quant": "UD-Q8_K_XL",- "files": [- {- "path": "Qwen3.8-27B-UD-Q8_K_XL.gguf",- "size_bytes": 31457991680- }- ]- },- {- "quant": "UD-Q6_K_XL",- "files": [- {- "path": "Qwen3.8-27B-UD-Q6_K_XL.gguf",- "size_bytes": 25299061664- }- ]- },- {- "quant": "UD-Q5_K_XL",- "files": [- {- "path": "Qwen3.8-27B-UD-Q5_K_XL.gguf",- "size_bytes": 20876938144- }- ]- },{"quant": "UD-Q4_K_M","files": [@@ -68,33 +41,6 @@"description": "Bigger mixture-of-experts with multi-token prediction; sees images","repo": "unsloth/Qwen3.6-35B-A3B-MTP-GGUF","variants": [- {- "quant": "UD-Q8_K_XL",- "files": [- {- "path": "Qwen3.6-35B-A3B-UD-Q8_K_XL.gguf",- "size_bytes": 39099447584- }- ]- },- {- "quant": "UD-Q6_K_XL",- "files": [- {- "path": "Qwen3.6-35B-A3B-UD-Q6_K_XL.gguf",- "size_bytes": 32611711264- }- ]- },- {- "quant": "UD-Q5_K_XL",- "files": [- {- "path": "Qwen3.6-35B-A3B-UD-Q5_K_XL.gguf",- "size_bytes": 27159116064- }- ]- },{"quant": "UD-Q4_K_M","files": [@@ -132,33 +78,6 @@"description": "NVIDIA's fast tool-calling model; 1M-token context","repo": "unsloth/NVIDIA-Nemotron-3.5-Lightning-30B-A3B-GGUF","variants": [- {- "quant": "UD-Q8_K_XL",- "files": [- {- "path": "NVIDIA-Nemotron-3.5-Lightning-30B-A3B-UD-Q8_K_XL.gguf",- "size_bytes": 38615380032- }- ]- },- {- "quant": "UD-Q6_K_XL",- "files": [- {- "path": "NVIDIA-Nemotron-3.5-Lightning-30B-A3B-UD-Q6_K_XL.gguf",- "size_bytes": 35004643392- }- ]- },- {- "quant": "UD-Q5_K_XL",- "files": [- {- "path": "NVIDIA-Nemotron-3.5-Lightning-30B-A3B-UD-Q5_K_XL.gguf",- "size_bytes": 30414829632- }- ]- },{"quant": "UD-Q4_K_M","files": [@@ -188,33 +107,6 @@"description": "Meta's open vision model for coding and agent work","repo": "unsloth/Muse-Glimmer-30B-GGUF","variants": [- {- "quant": "UD-Q8_K_XL",- "files": [- {- "path": "Muse-Glimmer-30B-UD-Q8_K_XL.gguf",- "size_bytes": 32300651040- }- ]- },- {- "quant": "UD-Q6_K_XL",- "files": [- {- "path": "Muse-Glimmer-30B-UD-Q6_K_XL.gguf",- "size_bytes": 26265362976- }- ]- },- {- "quant": "UD-Q5_K_XL",- "files": [- {- "path": "Muse-Glimmer-30B-UD-Q5_K_XL.gguf",- "size_bytes": 21789618976- }- ]- },{"quant": "UD-Q4_K_XL","files": [@@ -246,31 +138,6 @@"description": "Frontier-class model for machines with 128GB+ memory","repo": "unsloth/DeepSeek-V4-Flash-0731-GGUF","variants": [- {- "quant": "UD-Q8_K_XL",- "files": [- {- "path": "UD-Q8_K_XL/DeepSeek-V4-Flash-0731-UD-Q8_K_XL-00001-of-00005.gguf",- "size_bytes": 5257408- },- {- "path": "UD-Q8_K_XL/DeepSeek-V4-Flash-0731-UD-Q8_K_XL-00002-of-00005.gguf",- "size_bytes": 49215492960- },- {- "path": "UD-Q8_K_XL/DeepSeek-V4-Flash-0731-UD-Q8_K_XL-00003-of-00005.gguf",- "size_bytes": 49700372160- },- {- "path": "UD-Q8_K_XL/DeepSeek-V4-Flash-0731-UD-Q8_K_XL-00004-of-00005.gguf",- "size_bytes": 49466495968- },- {- "path": "UD-Q8_K_XL/DeepSeek-V4-Flash-0731-UD-Q8_K_XL-00005-of-00005.gguf",- "size_bytes": 13481997024- }- ]- },{"quant": "UD-Q4_K_XL","files": [diff --git a/hermes_cli/local_runtime/catalog.py b/hermes_cli/local_runtime/catalog.pyindex 09747502706..9b98b07f052 100644--- a/hermes_cli/local_runtime/catalog.py+++ b/hermes_cli/local_runtime/catalog.py@@ -7,18 +7,19 @@ and the catalog numbers are only used for the download decision. Entrieswhose base config is gated upstream carry a same-family conservativeprior (commented) — the GGUF header corrects it at load time.-Each model ships a QUANT LADDER (variants, best quality first). The ladder-floors at UD-Q4_K_XL — below Q4 the quality loss is too severe to ship as-someone's first local-AI experience. Selection is hardware-aware: pick the-highest-quality variant that zero-spills at the 64K floor on this machine;-else Q4 spilled (priced honestly by the fit policy); refuse only when even-Q4 fails the physics check.--Validation lifecycle: rungs proven end-to-end on real hardware are marked-validated. Day-0 entries ship before that proof under the "day-0" tag —-ensure_model_ready's touch generation still gates every first load at-runtime. The contract test requires every ladder floor to be Q4 AND-(validated OR day-0).+Each model ships ONE build, Q4-class (UD-Q4_K_M where the repo has it,+per NVIDIA's recommended catalog — their llama.cpp optimizations target+Q4-class quants; UD-Q4_K_XL elsewhere). No quant ladder: headroom buys a+bigger context window, never a bigger quant, so every machine runs the+same build the vendor recipes were measured on. Below Q4 the quality+loss is too severe to ship as someone's first local-AI experience; the+fit policy prices the build honestly (zero-spill, spilled, or refused by+the physics check).++Validation lifecycle: builds proven end-to-end on real hardware are+marked validated. Day-0 entries ship before that proof under the+"day-0" tag — ensure_model_ready's touch generation still gates every+first load at runtime.Multi-file models: variants may carry split-GGUF parts (llama-server loadsfrom the first part; all parts download together, each sha-verified).@@ -187,50 +188,36 @@ class VariantChoice:def select_variant(entry: CatalogEntry, budget: HardwareBudget) -> VariantChoice | None:- """Best build for this hardware, per the ladder policy.-- Ranked rules (each a guarantee the ones below may not break):- 1. Never below Q4 — the ladder's quality floor.- 2. Never below a 64K window — every session must be viable.- 3. Prefer reaching TARGET_WINDOW — compression should be the- exception, not the routine.- 4. Then maximize quality — free once the above hold.-- Concretely: highest-quality variant that zero-spills at the target- window; else highest-quality at the 64K floor (small cards keep the- old behavior); else the smallest build spilled; else refusal. One- quality step is worth multiple context rungs (dynamic-quant deltas- between adjacent rungs are small; 64K vs 216K changes what a session- can do), but nothing outranks full residency.+ """Fit the entry's one build (Q4-class) to this machine.++ The quant ladder is gone (NVIDIA guidance, 2026-08: their llama.cpp+ optimizations target Q4-class builds, so Q4 is the best+ speed-per-quality everywhere and the build the vendor recipes were+ measured on). Every entry ships exactly one variant; headroom buys a+ bigger window, never a bigger quant. Spill logic is unchanged:++ - "best-large-window": zero-spills at TARGET_WINDOW+ - "best-fits": zero-spills at the 64K floor+ - "smallest-fits-spilled": weights spill to host RAM, priced honestly+ - None: even spilled, physics refuses (the machine can't run it)"""overhead = (RUNTIME_OVERHEAD_BYTES+ (entry.mmproj.size_bytes if entry.mmproj else 0)+ ub_logits_bytes(entry.n_vocab, mtp_capable=entry.mtp))native = entry.n_ctx_train or FLOOR- floor_kv = None- target_kv = None- floor_pick: QuantVariant | None = None- for variant in entry.variants:- profile = entry.profile(variant)- if floor_kv is None:- floor_kv = ctx_bytes(profile, min(FLOOR, native))- target_kv = ctx_bytes(profile, min(TARGET_WINDOW, native))- if (variant.weights_bytes + target_kv + overhead- <= budget.usable_vram_bytes):- return VariantChoice(variant=variant, zero_spill=True,- reason_key="best-large-window")- if floor_pick is None and (variant.weights_bytes + floor_kv + overhead- <= budget.usable_vram_bytes):- floor_pick = variant-- if floor_pick is not None:- return VariantChoice(variant=floor_pick, zero_spill=True,+ variant = entry.variants[-1]+ profile = entry.profile(variant)+ need = variant.weights_bytes + overhead+ if (need + ctx_bytes(profile, min(TARGET_WINDOW, native))+ <= budget.usable_vram_bytes):+ return VariantChoice(variant=variant, zero_spill=True,+ reason_key="best-large-window")+ floor_kv = ctx_bytes(profile, min(FLOOR, native))+ if need + floor_kv <= budget.usable_vram_bytes:+ return VariantChoice(variant=variant, zero_spill=True,reason_key="best-fits")-- smallest = min(entry.variants, key=lambda v: v.size_bytes)- needed = smallest.weights_bytes + (floor_kv or 0) + overhead- if needed <= budget.usable_vram_bytes + budget.ram_available_bytes:- return VariantChoice(variant=smallest, zero_spill=False,+ if need + floor_kv <= budget.usable_vram_bytes + budget.ram_available_bytes:+ return VariantChoice(variant=variant, zero_spill=False,reason_key="smallest-fits-spilled")return Nonediff --git a/hermes_cli/web_routers/local_models.py b/hermes_cli/web_routers/local_models.pyindex 731721e446c..b4a1b44de66 100644--- a/hermes_cli/web_routers/local_models.py+++ b/hermes_cli/web_routers/local_models.py@@ -556,18 +556,14 @@ async def local_models_catalog():"variant_count": len(entry.variants),})if choice.reason_key == "best-large-window":- best = entry.variants[0]row["quant_reason"] = (- "Best quality build — runs fully on your GPU with a large context window"- if variant.quant == best.quant- else (f"Best balance for your GPU ({variant.quant}) — a larger "- "build would shrink the context window"))+ f"Recommended build ({variant.quant}) — the quant class this "+ "engine is optimized for; runs fully on your GPU with a "+ "large context window")elif choice.reason_key == "best-fits":- best = entry.variants[0]row["quant_reason"] = (- "Best quality build — runs fully on your GPU"- if variant.quant == best.quant- else f"Highest quality that runs fully on your GPU ({variant.quant})")+ f"Recommended build ({variant.quant}) — the quant class this "+ "engine is optimized for; runs fully on your GPU")else:row["quant_reason"] = (f"Compact build sized for this machine ({variant.quant}) — "diff --git a/tests/hermes_cli/test_catalog_variants.py b/tests/hermes_cli/test_catalog_variants.pyindex 02a8b60f023..38a26c397ba 100644--- a/tests/hermes_cli/test_catalog_variants.py+++ b/tests/hermes_cli/test_catalog_variants.py@@ -24,22 +24,21 @@ def budget(vram_gib: float, ram_gib: float = 64) -> HardwareBudget:ram_available_bytes=int(ram_gib * GIB))-def test_variants_ordered_best_first_and_floor_is_q4():+def test_every_entry_ships_exactly_one_q4_build():+ """No quant ladder: one Q4-class build per entry (NVIDIA guidance —+ their llama.cpp optimizations target Q4-class quants; K_M where the+ repo ships it, XL elsewhere). No Q3/Q2 ever ships (product decision,+ 2026-08-09). Validation status is explicit per variant in+ catalog.json; unvalidated builds are permitted (day-0 entries) and+ surface as unbadged rows in the pane."""for entry in CATALOG:- sizes = [v.size_bytes for v in entry.variants]- assert sizes == sorted(sizes, reverse=True), f"{entry.id}: variants not best-first"- for v in entry.variants:- for asset in entry.download_files(v):- assert asset.size_bytes > 0, f"{entry.id}/{v.quant}: no size on {asset.path}"- # The quality floor: the ladder ends at Q4 — no Q3/Q2 builds ship- # (product decision, 2026-08-09). The exact Q4 build follows- # NVIDIA's recommended catalog (Q4_K_M where their llama.cpp- # optimizations land; XL elsewhere). Validation status is explicit- # per variant in catalog.json; unvalidated floors are permitted- # (day-0 entries) and surface as unbadged rows in the pane.- floor = entry.variants[-1]- assert floor.quant.startswith(("UD-Q4", "Q4")), (- f"{entry.id}: ladder floor is {floor.quant}, not a Q4 build")+ assert len(entry.variants) == 1, (+ f"{entry.id}: {len(entry.variants)} variants — the ladder is gone")+ build = entry.variants[0]+ assert build.quant.startswith(("UD-Q4", "Q4")), (+ f"{entry.id}: ships {build.quant}, not a Q4-class build")+ for asset in entry.download_files(build):+ assert asset.size_bytes > 0, f"{entry.id}: no size on {asset.path}"def test_split_variants_have_coherent_parts():@@ -53,27 +52,33 @@ def test_split_variants_have_coherent_parts():assert entry.draft is not None, "DSpark draft rides along"-def test_big_card_gets_best_quality():- """A card with real headroom takes the top rung — quality is free when- it fits AT THE TARGET WINDOW. Muse is dense (target KV ~18 GiB), so- 'real headroom' for its Q8 means ~56+ GiB usable."""+def test_selection_is_the_q4_build_even_with_headroom():+ """NVIDIA guidance (2026-08): llama.cpp optimizations target Q4-class+ builds, so the selector picks the Q4 rung even when bigger quants fit+ with room to spare — headroom buys window, not quant. Larger builds+ stay one tile click away in the pane."""entry = catalog_by_id()["muse-glimmer-30b"]choice = select_variant(entry, budget(60))assert choice is not Noneassert choice.zero_spill- assert choice.variant.quant == entry.variants[0].quant # UD-Q8_K_XL+ assert choice.variant.quant == entry.variants[-1].quant # the Q4 rungassert choice.reason_key == "best-large-window"-def test_quality_monotone_in_vram():- """More VRAM never selects a smaller build."""+def test_selected_build_constant_and_fit_shape_monotone_in_vram():+ """More VRAM never changes the selected build (always the Q4 rung);+ what improves is the fit shape: spilled -> floor -> target window."""entry = catalog_by_id()["qwen3.8-27b"]- sizes = []+ quants = set()+ shapes = []+ rank = {"smallest-fits-spilled": 0, "best-fits": 1, "best-large-window": 2}for vram in (8, 12, 16, 24, 32, 48):choice = select_variant(entry, budget(vram))assert choice is not None- sizes.append(choice.variant.size_bytes)- assert sizes == sorted(sizes), f"quality not monotone in VRAM: {sizes}"+ quants.add(choice.variant.quant)+ shapes.append(rank[choice.reason_key])+ assert quants == {entry.variants[-1].quant}, f"selection not constant: {quants}"+ assert shapes == sorted(shapes), f"fit shape not monotone in VRAM: {shapes}"def test_small_card_gets_q4_spilled_never_below():@@ -99,34 +104,20 @@ def test_frontier_model_refused_on_consumer_card_offered_on_big_ram():def test_selection_accounts_for_kv_not_just_weights():"""The zero-spill check prices weights + KV, not weights alone: give a- machine exactly enough VRAM for the Q8 weights of a dense model and it- must step down a rung."""+ machine exactly enough VRAM for the build's weights and the fit must+ come back spilled, not zero-spill."""entry = catalog_by_id()["muse-glimmer-30b"]- q8 = entry.variants[0]+ build = entry.variants[0]exactly_weights = HardwareBudget(- usable_vram_bytes=q8.size_bytes + (100 << 20),- total_device_bytes=q8.size_bytes + (100 << 20),+ usable_vram_bytes=build.size_bytes + (100 << 20),+ total_device_bytes=build.size_bytes + (100 << 20),ram_available_bytes=64 * GIB)choice = select_variant(entry, exactly_weights)assert choice is not None- assert choice.variant.quant != q8.quant, "KV cost ignored — Q8 can't fit with floor KV"+ assert not choice.zero_spill, "KV cost ignored — weights alone can't zero-spill"-def test_target_window_beats_one_quality_step():- """The usability rule: a quant that only clears the 64K floor loses to- the next rung down when that rung clears the target window. A real- 32 GiB card is ~29.6 GiB usable after margin: Qwen3.8-27B Q6 (needs- ~31.5 with target KV + overhead) misses, Q5 (~26.2) clears — the- selector must pick Q5 and say why."""- entry = catalog_by_id()["qwen3.8-27b"]- choice = select_variant(entry, budget(29.6))- assert choice is not None and choice.zero_spill- assert choice.variant.quant == "UD-Q5_K_XL", (- f"expected the target-window pick, got {choice.variant.quant}")- assert choice.reason_key == "best-large-window"---def test_floor_fallback_when_no_variant_reaches_target():+def test_floor_fallback_when_target_window_does_not_fit():"""Cards where nothing clears the target keep the old rule: highestquality that zero-spills at the 64K floor (reason 'best-fits'), nevera needless step down."""