quantprobe 1.26.1__tar.gz → 1.26.3__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.
- {quantprobe-1.26.1/quantprobe.egg-info → quantprobe-1.26.3}/PKG-INFO +21 -1
- {quantprobe-1.26.1 → quantprobe-1.26.3}/README.md +20 -0
- {quantprobe-1.26.1 → quantprobe-1.26.3}/pyproject.toml +1 -1
- {quantprobe-1.26.1 → quantprobe-1.26.3}/quantprobe/__init__.py +1 -1
- {quantprobe-1.26.1 → quantprobe-1.26.3}/quantprobe/calibrate.py +4 -2
- {quantprobe-1.26.1 → quantprobe-1.26.3}/quantprobe/plan.py +2 -1
- {quantprobe-1.26.1 → quantprobe-1.26.3}/quantprobe/probe.py +4 -2
- {quantprobe-1.26.1 → quantprobe-1.26.3}/quantprobe/runtime.py +29 -7
- {quantprobe-1.26.1 → quantprobe-1.26.3}/quantprobe/spec.py +45 -5
- {quantprobe-1.26.1 → quantprobe-1.26.3/quantprobe.egg-info}/PKG-INFO +21 -1
- {quantprobe-1.26.1 → quantprobe-1.26.3}/LICENSE +0 -0
- {quantprobe-1.26.1 → quantprobe-1.26.3}/quantprobe/__main__.py +0 -0
- {quantprobe-1.26.1 → quantprobe-1.26.3}/quantprobe/auto.py +0 -0
- {quantprobe-1.26.1 → quantprobe-1.26.3}/quantprobe/branding.py +0 -0
- {quantprobe-1.26.1 → quantprobe-1.26.3}/quantprobe/cli.py +0 -0
- {quantprobe-1.26.1 → quantprobe-1.26.3}/quantprobe/dashboard.py +0 -0
- {quantprobe-1.26.1 → quantprobe-1.26.3}/quantprobe/detect.py +0 -0
- {quantprobe-1.26.1 → quantprobe-1.26.3}/quantprobe/fetch.py +0 -0
- {quantprobe-1.26.1 → quantprobe-1.26.3}/quantprobe/ollama.py +0 -0
- {quantprobe-1.26.1 → quantprobe-1.26.3}/quantprobe/optimize.py +0 -0
- {quantprobe-1.26.1 → quantprobe-1.26.3}/quantprobe/recipes/mistral-7b.json +0 -0
- {quantprobe-1.26.1 → quantprobe-1.26.3}/quantprobe/recipes/qwen2.5-7b.json +0 -0
- {quantprobe-1.26.1 → quantprobe-1.26.3}/quantprobe/recipes/qwen3-30b.json +0 -0
- {quantprobe-1.26.1 → quantprobe-1.26.3}/quantprobe/recipes/qwen3.5-35b.json +0 -0
- {quantprobe-1.26.1 → quantprobe-1.26.3}/quantprobe/recipes.py +0 -0
- {quantprobe-1.26.1 → quantprobe-1.26.3}/quantprobe/target.py +0 -0
- {quantprobe-1.26.1 → quantprobe-1.26.3}/quantprobe.egg-info/SOURCES.txt +0 -0
- {quantprobe-1.26.1 → quantprobe-1.26.3}/quantprobe.egg-info/dependency_links.txt +0 -0
- {quantprobe-1.26.1 → quantprobe-1.26.3}/quantprobe.egg-info/entry_points.txt +0 -0
- {quantprobe-1.26.1 → quantprobe-1.26.3}/quantprobe.egg-info/requires.txt +0 -0
- {quantprobe-1.26.1 → quantprobe-1.26.3}/quantprobe.egg-info/top_level.txt +0 -0
- {quantprobe-1.26.1 → quantprobe-1.26.3}/setup.cfg +0 -0
- {quantprobe-1.26.1 → quantprobe-1.26.3}/tests/test_engine.py +0 -0
- {quantprobe-1.26.1 → quantprobe-1.26.3}/tests/test_evaluator.py +0 -0
- {quantprobe-1.26.1 → quantprobe-1.26.3}/tests/test_pipeline.py +0 -0
- {quantprobe-1.26.1 → quantprobe-1.26.3}/tests/test_transforms.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: quantprobe
|
|
3
|
-
Version: 1.26.
|
|
3
|
+
Version: 1.26.3
|
|
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** |
|
|
@@ -251,6 +270,7 @@ quantprobe dashboard --gguf 2bit.gguf # the law live, every r
|
|
|
251
270
|
| [QUICKSTART.md](QUICKSTART.md) | get running, three levels; recipes for fine-tunes, coding agents, hardware buying |
|
|
252
271
|
| [LAWS.md](LAWS.md) | the four laws — statements, measurements, falsifiable predictions |
|
|
253
272
|
| [docs/MATRIX.md](docs/MATRIX.md) | **what to run on what** — 11 machines × 11 models, every cell priced by the shipped engine, scored against third-party reports |
|
|
273
|
+
| [docs/ATLAS.md](docs/ATLAS.md) | **every machine the law has been scored on** — and the one command that adds yours |
|
|
254
274
|
| [docs/EXAMPLES.md](docs/EXAMPLES.md) | worked examples with real output, including the ×5.4 optimizer A/B |
|
|
255
275
|
| [docs/HARDWARE.md](docs/HARDWARE.md) | the 2016 box: exact specs, measured bandwidths, what the next euro buys |
|
|
256
276
|
| [preregistrations/](preregistrations/) | every staked prediction with its verdict — hits **and** misses |
|
|
@@ -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** |
|
|
@@ -233,6 +252,7 @@ quantprobe dashboard --gguf 2bit.gguf # the law live, every r
|
|
|
233
252
|
| [QUICKSTART.md](QUICKSTART.md) | get running, three levels; recipes for fine-tunes, coding agents, hardware buying |
|
|
234
253
|
| [LAWS.md](LAWS.md) | the four laws — statements, measurements, falsifiable predictions |
|
|
235
254
|
| [docs/MATRIX.md](docs/MATRIX.md) | **what to run on what** — 11 machines × 11 models, every cell priced by the shipped engine, scored against third-party reports |
|
|
255
|
+
| [docs/ATLAS.md](docs/ATLAS.md) | **every machine the law has been scored on** — and the one command that adds yours |
|
|
236
256
|
| [docs/EXAMPLES.md](docs/EXAMPLES.md) | worked examples with real output, including the ×5.4 optimizer A/B |
|
|
237
257
|
| [docs/HARDWARE.md](docs/HARDWARE.md) | the 2016 box: exact specs, measured bandwidths, what the next euro buys |
|
|
238
258
|
| [preregistrations/](preregistrations/) | every staked prediction with its verdict — hits **and** misses |
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "quantprobe"
|
|
7
|
-
version = "1.26.
|
|
7
|
+
version = "1.26.3"
|
|
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.
|
|
11
|
+
__version__ = "1.26.3"
|
|
@@ -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(
|
|
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 =
|
|
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)
|
|
@@ -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 =
|
|
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
|
-
|
|
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
|
-
|
|
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 =
|
|
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 =
|
|
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
|
-
|
|
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)]
|
|
@@ -234,9 +240,25 @@ def tier_view(a, best):
|
|
|
234
240
|
def _emit_contribution(a, best, meas, err, delta):
|
|
235
241
|
import urllib.parse
|
|
236
242
|
from . import __version__
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
243
|
+
# THE HARDWARE MUST BE THE RESOLVED HARDWARE, not the raw args. Under auto-detect (the
|
|
244
|
+
# default path, i.e. nearly every contributor) the args are all None, and this function
|
|
245
|
+
# shipped printing "vram=None vram_bw=None ram=None..." - a datapoint whose entire purpose
|
|
246
|
+
# is the machine, arriving without one. Caught by the pre-launch gauntlet on v1.26.1;
|
|
247
|
+
# re-resolve here exactly as the prediction did.
|
|
248
|
+
hw = dict(planmod.MACHINES.get(getattr(a, "machine", "") or "", {})).get("hint")
|
|
249
|
+
if not hw:
|
|
250
|
+
try:
|
|
251
|
+
vc, vb, rc, rb, db, _geta, _gl, _hw = planmod.resolve_hw(a, announce=False)
|
|
252
|
+
hw = f"vram={vc:g} vram_bw={vb:g} ram={rc:g} ram_bw={rb:g} disk_bw={db:g}"
|
|
253
|
+
except Exception:
|
|
254
|
+
hw = f"vram={a.vram} vram_bw={a.vram_bw} ram={a.ram} ram_bw={a.ram_bw} disk_bw={a.disk_bw}"
|
|
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)
|
|
240
262
|
lines = [
|
|
241
263
|
f"hardware: {hw}",
|
|
242
264
|
f"model: {model} @ {a.bits:g}-bit",
|
|
@@ -248,7 +270,7 @@ def _emit_contribution(a, best, meas, err, delta):
|
|
|
248
270
|
"Notes (optional): ",
|
|
249
271
|
]
|
|
250
272
|
body = "\n".join(lines)
|
|
251
|
-
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]}"
|
|
252
274
|
url = ("https://github.com/FedericoTs/quantprobe/issues/new?labels=eta-datapoint"
|
|
253
275
|
f"&title={urllib.parse.quote(title)}&body={urllib.parse.quote(body)}")
|
|
254
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
|
-
|
|
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
|
-
|
|
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(
|
|
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
|
-
|
|
272
|
+
tensors = []
|
|
273
|
+
for p in split_siblings(path):
|
|
274
|
+
tensors.extend(GGUFReader(p).tensors)
|
|
235
275
|
roles, unknown = {}, {}
|
|
236
|
-
for t in
|
|
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.
|
|
3
|
+
Version: 1.26.3
|
|
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** |
|
|
@@ -251,6 +270,7 @@ quantprobe dashboard --gguf 2bit.gguf # the law live, every r
|
|
|
251
270
|
| [QUICKSTART.md](QUICKSTART.md) | get running, three levels; recipes for fine-tunes, coding agents, hardware buying |
|
|
252
271
|
| [LAWS.md](LAWS.md) | the four laws — statements, measurements, falsifiable predictions |
|
|
253
272
|
| [docs/MATRIX.md](docs/MATRIX.md) | **what to run on what** — 11 machines × 11 models, every cell priced by the shipped engine, scored against third-party reports |
|
|
273
|
+
| [docs/ATLAS.md](docs/ATLAS.md) | **every machine the law has been scored on** — and the one command that adds yours |
|
|
254
274
|
| [docs/EXAMPLES.md](docs/EXAMPLES.md) | worked examples with real output, including the ×5.4 optimizer A/B |
|
|
255
275
|
| [docs/HARDWARE.md](docs/HARDWARE.md) | the 2016 box: exact specs, measured bandwidths, what the next euro buys |
|
|
256
276
|
| [preregistrations/](preregistrations/) | every staked prediction with its verdict — hits **and** misses |
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|