quantprobe 1.26.2__tar.gz → 1.27.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. {quantprobe-1.26.2/quantprobe.egg-info → quantprobe-1.27.0}/PKG-INFO +20 -1
  2. {quantprobe-1.26.2 → quantprobe-1.27.0}/README.md +19 -0
  3. {quantprobe-1.26.2 → quantprobe-1.27.0}/pyproject.toml +1 -1
  4. {quantprobe-1.26.2 → quantprobe-1.27.0}/quantprobe/__init__.py +1 -1
  5. {quantprobe-1.26.2 → quantprobe-1.27.0}/quantprobe/calibrate.py +4 -2
  6. {quantprobe-1.26.2 → quantprobe-1.27.0}/quantprobe/detect.py +83 -2
  7. {quantprobe-1.26.2 → quantprobe-1.27.0}/quantprobe/plan.py +2 -1
  8. {quantprobe-1.26.2 → quantprobe-1.27.0}/quantprobe/probe.py +4 -2
  9. {quantprobe-1.26.2 → quantprobe-1.27.0}/quantprobe/runtime.py +17 -5
  10. {quantprobe-1.26.2 → quantprobe-1.27.0}/quantprobe/spec.py +45 -5
  11. {quantprobe-1.26.2 → quantprobe-1.27.0/quantprobe.egg-info}/PKG-INFO +20 -1
  12. {quantprobe-1.26.2 → quantprobe-1.27.0}/LICENSE +0 -0
  13. {quantprobe-1.26.2 → quantprobe-1.27.0}/quantprobe/__main__.py +0 -0
  14. {quantprobe-1.26.2 → quantprobe-1.27.0}/quantprobe/auto.py +0 -0
  15. {quantprobe-1.26.2 → quantprobe-1.27.0}/quantprobe/branding.py +0 -0
  16. {quantprobe-1.26.2 → quantprobe-1.27.0}/quantprobe/cli.py +0 -0
  17. {quantprobe-1.26.2 → quantprobe-1.27.0}/quantprobe/dashboard.py +0 -0
  18. {quantprobe-1.26.2 → quantprobe-1.27.0}/quantprobe/fetch.py +0 -0
  19. {quantprobe-1.26.2 → quantprobe-1.27.0}/quantprobe/ollama.py +0 -0
  20. {quantprobe-1.26.2 → quantprobe-1.27.0}/quantprobe/optimize.py +0 -0
  21. {quantprobe-1.26.2 → quantprobe-1.27.0}/quantprobe/recipes/mistral-7b.json +0 -0
  22. {quantprobe-1.26.2 → quantprobe-1.27.0}/quantprobe/recipes/qwen2.5-7b.json +0 -0
  23. {quantprobe-1.26.2 → quantprobe-1.27.0}/quantprobe/recipes/qwen3-30b.json +0 -0
  24. {quantprobe-1.26.2 → quantprobe-1.27.0}/quantprobe/recipes/qwen3.5-35b.json +0 -0
  25. {quantprobe-1.26.2 → quantprobe-1.27.0}/quantprobe/recipes.py +0 -0
  26. {quantprobe-1.26.2 → quantprobe-1.27.0}/quantprobe/target.py +0 -0
  27. {quantprobe-1.26.2 → quantprobe-1.27.0}/quantprobe.egg-info/SOURCES.txt +0 -0
  28. {quantprobe-1.26.2 → quantprobe-1.27.0}/quantprobe.egg-info/dependency_links.txt +0 -0
  29. {quantprobe-1.26.2 → quantprobe-1.27.0}/quantprobe.egg-info/entry_points.txt +0 -0
  30. {quantprobe-1.26.2 → quantprobe-1.27.0}/quantprobe.egg-info/requires.txt +0 -0
  31. {quantprobe-1.26.2 → quantprobe-1.27.0}/quantprobe.egg-info/top_level.txt +0 -0
  32. {quantprobe-1.26.2 → quantprobe-1.27.0}/setup.cfg +0 -0
  33. {quantprobe-1.26.2 → quantprobe-1.27.0}/tests/test_engine.py +0 -0
  34. {quantprobe-1.26.2 → quantprobe-1.27.0}/tests/test_evaluator.py +0 -0
  35. {quantprobe-1.26.2 → quantprobe-1.27.0}/tests/test_pipeline.py +0 -0
  36. {quantprobe-1.26.2 → quantprobe-1.27.0}/tests/test_transforms.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: quantprobe
3
- Version: 1.26.2
3
+ Version: 1.27.0
4
4
  Summary: Probe-then-quantize for LLMs: measure a model's fragility curve, plan bit/tier placement by the tiered decode law, and emit ready-to-run llama.cpp recipes.
5
5
  Author: Federico Sciuca
6
6
  License: MIT
@@ -97,6 +97,8 @@ The task set also carries a **difficulty ladder** for comparing models on identi
97
97
  | Qwen2.5-7B @ 2-bit (both quants, byte-equal) | 27/40 | 4/6 | 0/6 |
98
98
  | Qwen3-0.6B @ Q8 | 22/38* | 3/5* | 1/3* |
99
99
 
100
+ <p align="center"><img src="weights/data/chart_kpi_model_ladder.svg" width="760" alt="Four models scored on 52 executable predicates across four difficulty tiers: the 30B clears T1 and T2 completely, the 0.6B fires the suite's kill rule, and T4 is designed so today's models fail"></p>
101
+
100
102
  \* thinking-model truncations quarantined and disclosed, never counted as failures. The 0.6B
101
103
  fires the suite's own kill rule (57.9% < 60%) — the instrument correctly refuses to call it
102
104
  business-usable. And one honest anomaly the ladder itself exposed: **the only T4 task anyone
@@ -117,6 +119,17 @@ Law 4 is `tok/s = η·BW ÷ bytes-per-token`, and it prices other people's machi
117
119
 
118
120
  Same arithmetic the planner runs — you just feed it someone else's bandwidth and bytes.
119
121
 
122
+ ## One box, two right answers — it depends how many people are using it
123
+
124
+ <p align="center"><img src="weights/data/chart_kpi_batching_inversion.svg" width="760" alt="Aggregate throughput vs concurrent streams on a GTX 1060: the dense 7B in VRAM climbs to 219 tok/s at 32 streams while the 30B MoE with experts in RAM caps near 40, the two curves crossing early"></p>
125
+
126
+ At **one user** the 30B MoE is the better model — smarter, and 19.7 tok/s. At **32 users** the
127
+ dense 7B wins by 5.5× on aggregate throughput, because routed-expert reads from system RAM do
128
+ not amortise across streams while dense weights read once serve everyone. The jump at width
129
+ 8→9 is a kernel switch, not a smooth curve — which also makes batch widths 2–8 strictly
130
+ dominated on this card class. `plan` prints the right advice for whichever placement it
131
+ recommends (U-38 overturned our own prior "2× ceiling"; U-39 confirmed the MoE cap as staked).
132
+
120
133
  ## Fast vs Custom
121
134
 
122
135
  | | **Fast** — `quantprobe auto qwen3-30b` | **Custom** — `quantprobe auto qwen3-30b --custom` |
@@ -144,6 +157,12 @@ Most guides put *all* of a mixture-of-experts model's experts in system RAM and
144
157
 
145
158
  `--spec-type ngram-simple` drafts tokens by finding repeated spans in your own context, then verifies them — output is **identical**, it's one flag, nothing is downloaded.
146
159
 
160
+ <p align="center"><img src="weights/data/chart_kpi_draft_cliff.svg" width="760" alt="Decode speed against speculation draft length: drafts of 4 to 7 sit near 50 tok/s in the slow kernel, then jump to 88.5 at draft 8 and climb to 132 at draft 24"></p>
161
+
162
+ **Draft length is the lever, and it is a kernel decision.** Drafts of 4–7 verify in llama.cpp's
163
+ slow mat-vec path; m≥8 crosses into the fast one. Measured on the same model, same prompt,
164
+ byte-identical output: 48.2 → **88.5** in one step, up to **132.1 tok/s (5.8×)** at m=24.
165
+
147
166
  | workload | off | ngram on | effect |
148
167
  |---|---|---|---|
149
168
  | **code** (edit a file, answer restates its input) | 17.72 | **37.17** | **2.10× — decode doubles** |
@@ -79,6 +79,8 @@ The task set also carries a **difficulty ladder** for comparing models on identi
79
79
  | Qwen2.5-7B @ 2-bit (both quants, byte-equal) | 27/40 | 4/6 | 0/6 |
80
80
  | Qwen3-0.6B @ Q8 | 22/38* | 3/5* | 1/3* |
81
81
 
82
+ <p align="center"><img src="weights/data/chart_kpi_model_ladder.svg" width="760" alt="Four models scored on 52 executable predicates across four difficulty tiers: the 30B clears T1 and T2 completely, the 0.6B fires the suite's kill rule, and T4 is designed so today's models fail"></p>
83
+
82
84
  \* thinking-model truncations quarantined and disclosed, never counted as failures. The 0.6B
83
85
  fires the suite's own kill rule (57.9% < 60%) — the instrument correctly refuses to call it
84
86
  business-usable. And one honest anomaly the ladder itself exposed: **the only T4 task anyone
@@ -99,6 +101,17 @@ Law 4 is `tok/s = η·BW ÷ bytes-per-token`, and it prices other people's machi
99
101
 
100
102
  Same arithmetic the planner runs — you just feed it someone else's bandwidth and bytes.
101
103
 
104
+ ## One box, two right answers — it depends how many people are using it
105
+
106
+ <p align="center"><img src="weights/data/chart_kpi_batching_inversion.svg" width="760" alt="Aggregate throughput vs concurrent streams on a GTX 1060: the dense 7B in VRAM climbs to 219 tok/s at 32 streams while the 30B MoE with experts in RAM caps near 40, the two curves crossing early"></p>
107
+
108
+ At **one user** the 30B MoE is the better model — smarter, and 19.7 tok/s. At **32 users** the
109
+ dense 7B wins by 5.5× on aggregate throughput, because routed-expert reads from system RAM do
110
+ not amortise across streams while dense weights read once serve everyone. The jump at width
111
+ 8→9 is a kernel switch, not a smooth curve — which also makes batch widths 2–8 strictly
112
+ dominated on this card class. `plan` prints the right advice for whichever placement it
113
+ recommends (U-38 overturned our own prior "2× ceiling"; U-39 confirmed the MoE cap as staked).
114
+
102
115
  ## Fast vs Custom
103
116
 
104
117
  | | **Fast** — `quantprobe auto qwen3-30b` | **Custom** — `quantprobe auto qwen3-30b --custom` |
@@ -126,6 +139,12 @@ Most guides put *all* of a mixture-of-experts model's experts in system RAM and
126
139
 
127
140
  `--spec-type ngram-simple` drafts tokens by finding repeated spans in your own context, then verifies them — output is **identical**, it's one flag, nothing is downloaded.
128
141
 
142
+ <p align="center"><img src="weights/data/chart_kpi_draft_cliff.svg" width="760" alt="Decode speed against speculation draft length: drafts of 4 to 7 sit near 50 tok/s in the slow kernel, then jump to 88.5 at draft 8 and climb to 132 at draft 24"></p>
143
+
144
+ **Draft length is the lever, and it is a kernel decision.** Drafts of 4–7 verify in llama.cpp's
145
+ slow mat-vec path; m≥8 crosses into the fast one. Measured on the same model, same prompt,
146
+ byte-identical output: 48.2 → **88.5** in one step, up to **132.1 tok/s (5.8×)** at m=24.
147
+
129
148
  | workload | off | ngram on | effect |
130
149
  |---|---|---|---|
131
150
  | **code** (edit a file, answer restates its input) | 17.72 | **37.17** | **2.10× — decode doubles** |
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "quantprobe"
7
- version = "1.26.2"
7
+ version = "1.27.0"
8
8
  description = "Probe-then-quantize for LLMs: measure a model's fragility curve, plan bit/tier placement by the tiered decode law, and emit ready-to-run llama.cpp recipes."
9
9
  readme = "README.md"
10
10
  license = { text = "MIT" }
@@ -8,4 +8,4 @@ Three commands, all grounded in measured laws (see LAWS.md in the repo):
8
8
  Every constant in `plan` is fitted from measurements published in the repo, including two
9
9
  pre-registered hardware predictions confirmed within 8%.
10
10
  """
11
- __version__ = "1.26.2"
11
+ __version__ = "1.27.0"
@@ -24,6 +24,8 @@ measured RAM/disk numbers automatically whenever it would otherwise auto-detect,
24
24
  from __future__ import annotations
25
25
  import json, os, platform, subprocess, threading, time
26
26
 
27
+ from .spec import gguf_size as _gguf_size # split-GGUF-aware size (issue #1)
28
+
27
29
  CAL_DIR = os.path.join(os.path.expanduser("~"), ".quantprobe")
28
30
  CAL_PATH = os.path.join(CAL_DIR, "calibration.json")
29
31
  STALE_DAYS = 60 # hardware does not drift, but drivers and RAM configs do
@@ -149,7 +151,7 @@ def _bench_anchor(model_path, ngl, metric_tokens, llama_dir=None):
149
151
  anchor = dict(placement=("pure CPU (-ngl 0)" if ngl == 0 else "all-in-VRAM (-ngl 99)"),
150
152
  metric=tag, tok_s=toks,
151
153
  model=os.path.basename(model_path),
152
- model_gb=round(os.path.getsize(model_path) / 1e9, 3),
154
+ model_gb=round(_gguf_size(model_path) / 1e9, 3),
153
155
  sustained_sm=clk.sustained())
154
156
  # the anchor's own spec, so plan can price this arm with the SAME formula it uses
155
157
  # for every row (active bytes with the 1.08 overhead), and rescale the ratio by
@@ -181,7 +183,7 @@ def gpu_anchor(model_path, vram_gb, llama_dir=None):
181
183
  clearly fits (80% of detected VRAM), because an OOM teaches nothing and wastes minutes.
182
184
  tg128 rather than tg64: the run must outlast the model-load phase by enough for the clock
183
185
  sampler to collect real loaded samples (see ClockSampler.sustained)."""
184
- gb = os.path.getsize(model_path) / 1e9
186
+ gb = _gguf_size(model_path) / 1e9
185
187
  if not vram_gb or gb > 0.8 * vram_gb:
186
188
  return None, f"model {gb:.1f} GB does not clearly fit {vram_gb or 0:.0f} GB VRAM - GPU anchor skipped"
187
189
  return _bench_anchor(model_path, 99, 128, llama_dir)
@@ -29,6 +29,25 @@ GPU_TABLE = [
29
29
  ("2080", 448, 0.45, 0.25), ("2070", 448, 0.45, 0.25), ("2060", 336, 0.42, 0.22),
30
30
  ("1080", 320, 0.38, 0.06), ("1070", 256, 0.36, 0.05), ("1060", 192, 0.35, 0.04),
31
31
  ("a100", 1935, 0.7, 0.55), ("h100", 3350, 0.75, 0.6), ("rtx 6000", 960, 0.62, 0.42),
32
+ # AMD / Intel, added for issue #1 (an RX 5700 XT owner got "GPU: none detected" and had to
33
+ # hand-pass the exact 448 this table now carries). Spec-sheet peaks, same [table] convention
34
+ # as above; the geta/gl hints are the generic-unknown values because NO eta has been
35
+ # measured on RDNA/Arc backends here - resolve_gpu_eta's size-classed floor and the user's
36
+ # own `calibrate` anchors do the honest work, exactly as they did for E-13's +0.1%.
37
+ ("rx 9070 xt", 640, 0.45, 0.27), ("rx 9070", 640, 0.45, 0.27),
38
+ ("rx 7900 xtx", 960, 0.45, 0.27), ("rx 7900 xt", 800, 0.45, 0.27),
39
+ ("rx 7900 gre", 576, 0.45, 0.27), ("rx 7800 xt", 624, 0.45, 0.27),
40
+ ("rx 7700 xt", 432, 0.45, 0.27), ("rx 7600 xt", 288, 0.45, 0.27),
41
+ ("rx 7600", 288, 0.45, 0.27), ("rx 6950 xt", 576, 0.45, 0.27),
42
+ ("rx 6900 xt", 512, 0.45, 0.27), ("rx 6800 xt", 512, 0.45, 0.27),
43
+ ("rx 6800", 512, 0.45, 0.27), ("rx 6750 xt", 432, 0.45, 0.27),
44
+ ("rx 6700 xt", 384, 0.45, 0.27), ("rx 6700", 320, 0.45, 0.27),
45
+ ("rx 6650 xt", 280, 0.45, 0.27), ("rx 6600 xt", 256, 0.45, 0.27),
46
+ ("rx 6600", 224, 0.45, 0.27), ("rx 5700 xt", 448, 0.45, 0.27),
47
+ ("rx 5700", 448, 0.45, 0.27), ("rx 5600 xt", 288, 0.45, 0.27),
48
+ ("radeon vii", 1024, 0.45, 0.27), ("vega 64", 484, 0.45, 0.27), ("vega 56", 410, 0.45, 0.27),
49
+ ("arc a770", 560, 0.45, 0.27), ("arc a750", 512, 0.45, 0.27),
50
+ ("arc b580", 456, 0.45, 0.27), ("arc b570", 380, 0.45, 0.27),
32
51
  ]
33
52
  MAC_BW = {"m1 ultra": 800, "m1 max": 400, "m1 pro": 200, "m1": 68,
34
53
  "m2 ultra": 800, "m2 max": 400, "m2 pro": 200, "m2": 100,
@@ -58,6 +77,45 @@ def gpu_lookup(name):
58
77
  return 300, 0.45, 0.27, "[default: unknown GPU, pass --vram-bw]"
59
78
 
60
79
 
80
+ def _parse_win_adapters(text):
81
+ """'DriverDesc|bytes' lines -> [(name, vram_gb)], virtual adapters filtered, dedup by max.
82
+ Pure parser so the smoke suite can test it without the registry."""
83
+ VIRTUAL = ("basic display", "basic render", "remote", "virtual", "vnc", "dameware",
84
+ "parsec", "spacedesk", "idd", "usb", "mirage", "citrix")
85
+ out = {}
86
+ for line in (text or "").strip().splitlines():
87
+ if "|" not in line:
88
+ continue
89
+ name, _, raw = line.rpartition("|")
90
+ name = name.strip()
91
+ if not name or any(v in name.lower() for v in VIRTUAL):
92
+ continue
93
+ try:
94
+ gb = int(raw.strip()) / 2**30
95
+ except ValueError:
96
+ gb = 0.0
97
+ out[name] = max(gb, out.get(name, 0.0))
98
+ return sorted(out.items())
99
+
100
+
101
+ def gpus_other():
102
+ """Non-NVIDIA adapters, Windows: driver registry first - qwMemorySize is the reliable VRAM
103
+ field; Win32_VideoController.AdapterRAM is a uint32 that CAPS AT 4 GB and under-reports
104
+ every modern card - CIM only as fallback. Issue #1's contributor ran an RX 5700 XT and this
105
+ tool printed 'GPU: none detected'; this function is the fix."""
106
+ if os.name != "nt":
107
+ return []
108
+ ps = ("$k='HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Class\\"
109
+ "{4d36e968-e325-11ce-bfc1-08002be10318}\\0*';"
110
+ "$r=Get-ItemProperty $k -ErrorAction SilentlyContinue | "
111
+ "Where-Object { $_.DriverDesc } | "
112
+ "ForEach-Object { $_.DriverDesc + '|' + $_.'HardwareInformation.qwMemorySize' };"
113
+ "if (-not $r) { $r = Get-CimInstance Win32_VideoController | "
114
+ "ForEach-Object { $_.Name + '|' + $_.AdapterRAM } };"
115
+ "$r")
116
+ return _parse_win_adapters(_run(["powershell", "-NoProfile", "-c", ps]))
117
+
118
+
61
119
  def ram_windows():
62
120
  """(total_gb[os], mts[os], channels[os]) via CIM (wmic fallback)."""
63
121
  ps = _run(["powershell", "-NoProfile", "-c",
@@ -150,8 +208,31 @@ def detect():
150
208
  + (f" (x{len(gs)} per-card sum, 0.85 TP efficiency [est]; slower card gates its share)" if len(gs) > 1 else ""))
151
209
  hw.update(vram=vram, vram_bw=round(vram_bw), geta=geta, gl=gl)
152
210
  else:
153
- hw.update(vram=0, vram_bw=0)
154
- notes.append("GPU: none detected (nvidia-smi absent/empty; AMD/Intel: pass --vram/--vram-bw) [os]")
211
+ # nvidia-smi saw nothing - check the Windows driver registry for AMD/Intel (or an
212
+ # NVIDIA card with no driver tools). Field case: issue #1, RX 5700 XT, "none detected".
213
+ others = gpus_other()
214
+ priced = [(n, gb) + gpu_lookup(n) for n, gb in others]
215
+ known = [p for p in priced if "table" in p[5]]
216
+ unknown = [p for p in priced if "table" not in p[5]]
217
+ if known:
218
+ vram = sum(p[1] for p in known)
219
+ vram_bw = sum(p[2] for p in known) * (1.0 if len(known) == 1 else 0.85)
220
+ names = " + ".join(p[0] for p in known)
221
+ hw.update(vram=round(vram, 1), vram_bw=round(vram_bw),
222
+ geta=known[0][3], gl=known[0][4])
223
+ notes.append(f"GPU: {names}, {vram:.0f} GB [os], {vram_bw:.0f} GB/s [table] - "
224
+ f"non-NVIDIA path: VRAM from the driver registry, bandwidth from spec; "
225
+ f"eta on this backend is UNVALIDATED here, so run `quantprobe "
226
+ f"calibrate` with your llama.cpp build to anchor it")
227
+ elif unknown:
228
+ names = ", ".join(f"{p[0]} ({p[1]:.0f} GB)" for p in unknown)
229
+ hw.update(vram=0, vram_bw=0)
230
+ notes.append(f"GPU: {names} detected [os] but not in the bandwidth table - pass "
231
+ f"--vram <GB> --vram-bw <GB/s> (spec sheet) to include the GPU tier; "
232
+ f"planning CPU-only until then")
233
+ else:
234
+ hw.update(vram=0, vram_bw=0)
235
+ notes.append("GPU: none detected (nvidia-smi absent/empty; AMD/Intel: pass --vram/--vram-bw) [os]")
155
236
 
156
237
  # disk: class default; a real measured number needs `quantprobe hw --measure` (reads a large file)
157
238
  hw.update(ram=round(total), ram_bw=ram_bw, disk_bw=0.5)
@@ -1874,8 +1874,9 @@ def run(args):
1874
1874
 
1875
1875
  nlay = effective_n_layer(args, m)
1876
1876
  import os as _os
1877
+ from . import spec as _specmod
1877
1878
  _g = getattr(args, 'gguf', None)
1878
- true_size = _os.path.getsize(_g) / 1e9 if _g and _os.path.isfile(_g) else None
1879
+ true_size = _specmod.gguf_size(_g) / 1e9 if _g and _os.path.isfile(_g) else None
1879
1880
  vb, geta = resolve_gpu_eta(hw, args, a, args.bits, vb, geta)
1880
1881
  rb = resolve_cpu_bw(hw, args, a, args.bits, rb)
1881
1882
  # ONE argument dict for the baseline AND every counterfactual (upgrades, capacity probes,
@@ -196,7 +196,8 @@ def run(a):
196
196
 
197
197
  # Up-front honesty about cost. A 35 GB source took 5h40m on the reference box - telling
198
198
  # people "30-60 min" (as this tool used to) is wrong by an order of magnitude on big models.
199
- src_gb = os.path.getsize(a.gguf) / 1e9
199
+ from .spec import gguf_size as _gguf_size
200
+ src_gb = _gguf_size(a.gguf) / 1e9
200
201
  ram_gb, vram_gb = 16.0, 0.0
201
202
  try:
202
203
  from . import detect as detmod
@@ -346,7 +347,8 @@ def make_imatrix(llama_dir, src, eval_file, out=None, chunks=100, ngl=99, dry=Fa
346
347
  return out
347
348
  im = exe("llama-imatrix") if dry else os.path.join(find_llama(llama_dir), exe("llama-imatrix"))
348
349
  cmd = [im, "-m", src, "-f", eval_file, "-o", out, "--chunks", str(chunks), "-ngl", str(ngl), "-c", "512"]
349
- src_gb = os.path.getsize(src) / 1e9 if os.path.isfile(src) else 0
350
+ from .spec import gguf_size as _gguf_size
351
+ src_gb = _gguf_size(src) / 1e9 if os.path.isfile(src) else 0
350
352
  im_est = src_gb * IMATRIX_MIN_PER_GB * (chunks / 100.0)
351
353
  print(f"[quantprobe] building importance matrix over {chunks} chunks on a {src_gb:.0f} GB source")
352
354
  print(f" ESTIMATED TIME: ~{fmt_dur(im_est)} (measured 4.5 h for a 35 GB source at 100 chunks).")
@@ -65,7 +65,7 @@ def best_flags(a):
65
65
  if gguf and os.path.isfile(gguf) and not from_file:
66
66
  ab = max(a.bits, 4.5)
67
67
  size_pred = (ne * ab / 8 + (t - ne) * a.bits / 8) * 1.08
68
- size_real = os.path.getsize(gguf) / 1e9
68
+ size_real = specmod.gguf_size(gguf) / 1e9
69
69
  if size_pred > 0:
70
70
  act_scale = size_real / size_pred
71
71
  print(f"[quantprobe] calibrated to file: {size_real:.2f} GB on disk "
@@ -73,7 +73,12 @@ def best_flags(a):
73
73
  ctx = getattr(a, "ctx", 0) or 0
74
74
  kvp = (a.kv_per_pos * 1024 if getattr(a, "kv_per_pos", None)
75
75
  else m.get("kvp", planmod.DEFAULT_KVP))
76
- _true = os.path.getsize(gguf) / 1e9 if gguf and os.path.isfile(gguf) else None
76
+ _true = specmod.gguf_size(gguf) / 1e9 if gguf and os.path.isfile(gguf) else None
77
+ # The contribution payload must carry the spec THE PREDICTION USED, not the raw args - under
78
+ # autospec-failure or preset paths a.total/a.active are None, and issue #1 (the tool's first
79
+ # external datapoint) arrived titled "total=None active=None". Same bug class as the
80
+ # v1.26.1 hardware fix, other operand; stashed here because this is the resolution moment.
81
+ a._resolved_spec = (t, ac)
77
82
  # same size-classed GPU-eta dispatch as plan (ONE shared function; layer 3 enforces parity)
78
83
  vb, geta = planmod.resolve_gpu_eta(hw, a, ac, a.bits, vb, geta)
79
84
  rb = planmod.resolve_cpu_bw(hw, a, ac, a.bits, rb)
@@ -217,7 +222,8 @@ def tier_view(a, best):
217
222
  planmod.apply_calibration_overrides(hw, a)
218
223
  vc = planmod.agg_cap(a.vram) if a.vram is not None else hw.get("vc", 0)
219
224
  rc = a.ram if a.ram is not None else hw.get("rc", 16)
220
- size = os.path.getsize(a.gguf) / 1e9 if a.gguf and os.path.isfile(a.gguf) else 0
225
+ from . import spec as specmod
226
+ size = specmod.gguf_size(a.gguf) / 1e9 if a.gguf and os.path.isfile(a.gguf) else 0
221
227
  name = best[0]
222
228
  if name == "all in VRAM":
223
229
  return [("VRAM", vc, size), ("RAM", rc, 1.0)]
@@ -246,7 +252,13 @@ def _emit_contribution(a, best, meas, err, delta):
246
252
  hw = f"vram={vc:g} vram_bw={vb:g} ram={rc:g} ram_bw={rb:g} disk_bw={db:g}"
247
253
  except Exception:
248
254
  hw = f"vram={a.vram} vram_bw={a.vram_bw} ram={a.ram} ram_bw={a.ram_bw} disk_bw={a.disk_bw}"
249
- model = getattr(a, "model", None) or f"total={a.total} active={a.active}"
255
+ # Model identity, best available first: preset name > GGUF filename > resolved spec. The raw
256
+ # a.total/a.active fallback stays last - it is what shipped None/None in issue #1.
257
+ rs = getattr(a, "_resolved_spec", None)
258
+ spec_s = (f"total={rs[0]:g} active={rs[1]:g}" if rs
259
+ else f"total={a.total} active={a.active}")
260
+ gguf_name = os.path.basename(a.gguf) if getattr(a, "gguf", None) else None
261
+ model = getattr(a, "model", None) or (f"{gguf_name} ({spec_s})" if gguf_name else spec_s)
250
262
  lines = [
251
263
  f"hardware: {hw}",
252
264
  f"model: {model} @ {a.bits:g}-bit",
@@ -258,7 +270,7 @@ def _emit_contribution(a, best, meas, err, delta):
258
270
  "Notes (optional): ",
259
271
  ]
260
272
  body = "\n".join(lines)
261
- title = f"[eta] {model} {a.bits:g}-bit on {str(hw)[:40]}"
273
+ title = f"[eta] {str(model)[:60]} {a.bits:g}-bit on {str(hw)[:40]}"
262
274
  url = ("https://github.com/FedericoTs/quantprobe/issues/new?labels=eta-datapoint"
263
275
  f"&title={urllib.parse.quote(title)}&body={urllib.parse.quote(body)}")
264
276
  print("\n[quantprobe] Contribute this data point (OPT-IN). It contains ONLY what you see below --")
@@ -9,6 +9,38 @@ So `--gguf model.gguf` alone fully specifies the model; flags remain as override
9
9
  """
10
10
  from __future__ import annotations
11
11
  import os
12
+ import re
13
+
14
+
15
+ # Multi-part GGUFs (llama.cpp gguf-split naming: model-00001-of-00002.gguf). The first external
16
+ # contribution the tool ever received (issue #1, RX 5700 XT) arrived as "total=None active=None
17
+ # @ 2.5-bit" for a Q4_0 7.6B - because the file was a 2-part split, from_gguf saw one part,
18
+ # and every downstream consumer fell back to defaults. A split part is a fully valid GGUF, so
19
+ # the fix is enumeration, not parsing: spec from ALL parts, size from ALL parts.
20
+ _SPLIT_RE = re.compile(r"^(.*)-(\d{5})-of-(\d{5})\.gguf$", re.IGNORECASE)
21
+
22
+
23
+ def split_siblings(path):
24
+ """All parts of a split GGUF (sorted), or [path] for a normal file. Missing parts raise:
25
+ a spec computed from a subset of the model is wrong, not approximate."""
26
+ m = _SPLIT_RE.match(os.path.basename(path))
27
+ if not m:
28
+ return [path]
29
+ stem, _no, cnt = m.group(1), int(m.group(2)), int(m.group(3))
30
+ d = os.path.dirname(path) or "."
31
+ parts = [os.path.join(d, f"{stem}-{i:05d}-of-{cnt:05d}.gguf") for i in range(1, cnt + 1)]
32
+ missing = [p for p in parts if not os.path.isfile(p)]
33
+ if missing:
34
+ raise FileNotFoundError(
35
+ f"split GGUF: {len(parts) - len(missing)} of {cnt} parts present "
36
+ f"(first missing: {os.path.basename(missing[0])})")
37
+ return parts
38
+
39
+
40
+ def gguf_size(path):
41
+ """Bytes on disk for the WHOLE model - sums split parts. os.path.getsize on part 1 of a
42
+ 2-part file halves every size-derived quantity (bits, act_scale, tier placement)."""
43
+ return sum(os.path.getsize(p) for p in split_siblings(path))
12
44
 
13
45
 
14
46
  def _field(r, *names):
@@ -55,7 +87,10 @@ CODEBOOK_FALLBACK_MIN_SHARE = 0.25
55
87
 
56
88
  def from_gguf(path):
57
89
  from gguf import GGUFReader
58
- r = GGUFReader(path)
90
+ paths = split_siblings(path)
91
+ # Part 1 carries the full metadata (gguf-split copies the KV store there; later parts hold
92
+ # only split bookkeeping). Tensors, however, live where they live: every part contributes.
93
+ r = GGUFReader(paths[0])
59
94
  n_layer = _field(r, ".block_count") or 32
60
95
  total = 0
61
96
  routed = 0
@@ -65,7 +100,10 @@ def from_gguf(path):
65
100
  tier_att = {'bytes': 0, 'wsum': 0.0, 'wb': 0, 'cb': 0}
66
101
  embd_params = 0 # token_embd: a GATHER at decode, not a read (U-26 / prereg #76)
67
102
  has_output = False # a separate output/lm_head means embeddings are NOT tied
68
- for t in r.tensors:
103
+ tensors = list(r.tensors)
104
+ for extra in paths[1:]:
105
+ tensors.extend(GGUFReader(extra).tensors)
106
+ for t in tensors:
69
107
  n = 1
70
108
  for d in t.shape:
71
109
  n *= int(d)
@@ -141,7 +179,7 @@ def from_gguf(path):
141
179
  k_dim = v_dim = emb // heads
142
180
  kvp = n_layer * kv_heads * ((k_dim or 128) + (v_dim or k_dim or 128)) * 2
143
181
 
144
- bits = os.path.getsize(path) * 8 / total
182
+ bits = sum(os.path.getsize(p) for p in paths) * 8 / total
145
183
  arch = None
146
184
  for field in r.fields.values(): # recipe matching needs (arch, n_layer), not layers alone
147
185
  if field.name == "general.architecture":
@@ -231,9 +269,11 @@ def tensor_roles(path):
231
269
  builder can warn about weight classes it has no protection rule for."""
232
270
  import re
233
271
  from gguf import GGUFReader
234
- r = GGUFReader(path)
272
+ tensors = []
273
+ for p in split_siblings(path):
274
+ tensors.extend(GGUFReader(p).tensors)
235
275
  roles, unknown = {}, {}
236
- for t in r.tensors:
276
+ for t in tensors:
237
277
  nbytes = int(t.n_bytes) if hasattr(t, "n_bytes") else 0
238
278
  for name, pat, _ in TENSOR_ROLES:
239
279
  if re.search(pat, t.name):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: quantprobe
3
- Version: 1.26.2
3
+ Version: 1.27.0
4
4
  Summary: Probe-then-quantize for LLMs: measure a model's fragility curve, plan bit/tier placement by the tiered decode law, and emit ready-to-run llama.cpp recipes.
5
5
  Author: Federico Sciuca
6
6
  License: MIT
@@ -97,6 +97,8 @@ The task set also carries a **difficulty ladder** for comparing models on identi
97
97
  | Qwen2.5-7B @ 2-bit (both quants, byte-equal) | 27/40 | 4/6 | 0/6 |
98
98
  | Qwen3-0.6B @ Q8 | 22/38* | 3/5* | 1/3* |
99
99
 
100
+ <p align="center"><img src="weights/data/chart_kpi_model_ladder.svg" width="760" alt="Four models scored on 52 executable predicates across four difficulty tiers: the 30B clears T1 and T2 completely, the 0.6B fires the suite's kill rule, and T4 is designed so today's models fail"></p>
101
+
100
102
  \* thinking-model truncations quarantined and disclosed, never counted as failures. The 0.6B
101
103
  fires the suite's own kill rule (57.9% < 60%) — the instrument correctly refuses to call it
102
104
  business-usable. And one honest anomaly the ladder itself exposed: **the only T4 task anyone
@@ -117,6 +119,17 @@ Law 4 is `tok/s = η·BW ÷ bytes-per-token`, and it prices other people's machi
117
119
 
118
120
  Same arithmetic the planner runs — you just feed it someone else's bandwidth and bytes.
119
121
 
122
+ ## One box, two right answers — it depends how many people are using it
123
+
124
+ <p align="center"><img src="weights/data/chart_kpi_batching_inversion.svg" width="760" alt="Aggregate throughput vs concurrent streams on a GTX 1060: the dense 7B in VRAM climbs to 219 tok/s at 32 streams while the 30B MoE with experts in RAM caps near 40, the two curves crossing early"></p>
125
+
126
+ At **one user** the 30B MoE is the better model — smarter, and 19.7 tok/s. At **32 users** the
127
+ dense 7B wins by 5.5× on aggregate throughput, because routed-expert reads from system RAM do
128
+ not amortise across streams while dense weights read once serve everyone. The jump at width
129
+ 8→9 is a kernel switch, not a smooth curve — which also makes batch widths 2–8 strictly
130
+ dominated on this card class. `plan` prints the right advice for whichever placement it
131
+ recommends (U-38 overturned our own prior "2× ceiling"; U-39 confirmed the MoE cap as staked).
132
+
120
133
  ## Fast vs Custom
121
134
 
122
135
  | | **Fast** — `quantprobe auto qwen3-30b` | **Custom** — `quantprobe auto qwen3-30b --custom` |
@@ -144,6 +157,12 @@ Most guides put *all* of a mixture-of-experts model's experts in system RAM and
144
157
 
145
158
  `--spec-type ngram-simple` drafts tokens by finding repeated spans in your own context, then verifies them — output is **identical**, it's one flag, nothing is downloaded.
146
159
 
160
+ <p align="center"><img src="weights/data/chart_kpi_draft_cliff.svg" width="760" alt="Decode speed against speculation draft length: drafts of 4 to 7 sit near 50 tok/s in the slow kernel, then jump to 88.5 at draft 8 and climb to 132 at draft 24"></p>
161
+
162
+ **Draft length is the lever, and it is a kernel decision.** Drafts of 4–7 verify in llama.cpp's
163
+ slow mat-vec path; m≥8 crosses into the fast one. Measured on the same model, same prompt,
164
+ byte-identical output: 48.2 → **88.5** in one step, up to **132.1 tok/s (5.8×)** at m=24.
165
+
147
166
  | workload | off | ngram on | effect |
148
167
  |---|---|---|---|
149
168
  | **code** (edit a file, answer restates its input) | 17.72 | **37.17** | **2.10× — decode doubles** |
File without changes
File without changes