quantprobe 1.20.0__tar.gz → 1.20.1__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.20.0/quantprobe.egg-info → quantprobe-1.20.1}/PKG-INFO +1 -1
- {quantprobe-1.20.0 → quantprobe-1.20.1}/pyproject.toml +1 -1
- {quantprobe-1.20.0 → quantprobe-1.20.1}/quantprobe/__init__.py +1 -1
- {quantprobe-1.20.0 → quantprobe-1.20.1}/quantprobe/calibrate.py +16 -5
- {quantprobe-1.20.0 → quantprobe-1.20.1}/quantprobe/plan.py +66 -8
- {quantprobe-1.20.0 → quantprobe-1.20.1}/quantprobe/runtime.py +2 -0
- {quantprobe-1.20.0 → quantprobe-1.20.1}/quantprobe/spec.py +23 -1
- {quantprobe-1.20.0 → quantprobe-1.20.1/quantprobe.egg-info}/PKG-INFO +1 -1
- {quantprobe-1.20.0 → quantprobe-1.20.1}/LICENSE +0 -0
- {quantprobe-1.20.0 → quantprobe-1.20.1}/README.md +0 -0
- {quantprobe-1.20.0 → quantprobe-1.20.1}/quantprobe/__main__.py +0 -0
- {quantprobe-1.20.0 → quantprobe-1.20.1}/quantprobe/auto.py +0 -0
- {quantprobe-1.20.0 → quantprobe-1.20.1}/quantprobe/cli.py +0 -0
- {quantprobe-1.20.0 → quantprobe-1.20.1}/quantprobe/dashboard.py +0 -0
- {quantprobe-1.20.0 → quantprobe-1.20.1}/quantprobe/detect.py +0 -0
- {quantprobe-1.20.0 → quantprobe-1.20.1}/quantprobe/fetch.py +0 -0
- {quantprobe-1.20.0 → quantprobe-1.20.1}/quantprobe/optimize.py +0 -0
- {quantprobe-1.20.0 → quantprobe-1.20.1}/quantprobe/probe.py +0 -0
- {quantprobe-1.20.0 → quantprobe-1.20.1}/quantprobe/recipes/mistral-7b.json +0 -0
- {quantprobe-1.20.0 → quantprobe-1.20.1}/quantprobe/recipes/qwen2.5-7b.json +0 -0
- {quantprobe-1.20.0 → quantprobe-1.20.1}/quantprobe/recipes/qwen3-30b.json +0 -0
- {quantprobe-1.20.0 → quantprobe-1.20.1}/quantprobe/recipes/qwen3.5-35b.json +0 -0
- {quantprobe-1.20.0 → quantprobe-1.20.1}/quantprobe/recipes.py +0 -0
- {quantprobe-1.20.0 → quantprobe-1.20.1}/quantprobe/target.py +0 -0
- {quantprobe-1.20.0 → quantprobe-1.20.1}/quantprobe.egg-info/SOURCES.txt +0 -0
- {quantprobe-1.20.0 → quantprobe-1.20.1}/quantprobe.egg-info/dependency_links.txt +0 -0
- {quantprobe-1.20.0 → quantprobe-1.20.1}/quantprobe.egg-info/entry_points.txt +0 -0
- {quantprobe-1.20.0 → quantprobe-1.20.1}/quantprobe.egg-info/requires.txt +0 -0
- {quantprobe-1.20.0 → quantprobe-1.20.1}/quantprobe.egg-info/top_level.txt +0 -0
- {quantprobe-1.20.0 → quantprobe-1.20.1}/setup.cfg +0 -0
- {quantprobe-1.20.0 → quantprobe-1.20.1}/tests/test_engine.py +0 -0
- {quantprobe-1.20.0 → quantprobe-1.20.1}/tests/test_evaluator.py +0 -0
- {quantprobe-1.20.0 → quantprobe-1.20.1}/tests/test_pipeline.py +0 -0
- {quantprobe-1.20.0 → quantprobe-1.20.1}/tests/test_transforms.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: quantprobe
|
|
3
|
-
Version: 1.20.
|
|
3
|
+
Version: 1.20.1
|
|
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
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "quantprobe"
|
|
7
|
-
version = "1.20.
|
|
7
|
+
version = "1.20.1"
|
|
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.20.
|
|
11
|
+
__version__ = "1.20.1"
|
|
@@ -146,11 +146,22 @@ def _bench_anchor(model_path, ngl, metric_tokens, llama_dir=None):
|
|
|
146
146
|
if tag in line and "|" in line:
|
|
147
147
|
try:
|
|
148
148
|
toks = float(line.split("|")[-2].strip().split()[0])
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
149
|
+
anchor = dict(placement=("pure CPU (-ngl 0)" if ngl == 0 else "all-in-VRAM (-ngl 99)"),
|
|
150
|
+
metric=tag, tok_s=toks,
|
|
151
|
+
model=os.path.basename(model_path),
|
|
152
|
+
model_gb=round(os.path.getsize(model_path) / 1e9, 3),
|
|
153
|
+
sustained_sm=clk.sustained())
|
|
154
|
+
# the anchor's own spec, so plan can price this arm with the SAME formula it uses
|
|
155
|
+
# for every row (active bytes with the 1.08 overhead), and rescale the ratio by
|
|
156
|
+
# format (L-16) when the target's format mix differs from the anchor's
|
|
157
|
+
try:
|
|
158
|
+
from . import spec as specmod
|
|
159
|
+
s = specmod.from_gguf(model_path)
|
|
160
|
+
anchor["act_gb"] = round(s["a"] * s["bits"] / 8 * 1.08, 4)
|
|
161
|
+
anchor["fmt_bw"] = s.get("fmt_bw")
|
|
162
|
+
except Exception:
|
|
163
|
+
pass
|
|
164
|
+
return anchor, None
|
|
154
165
|
except (ValueError, IndexError):
|
|
155
166
|
break
|
|
156
167
|
return None, "could not parse llama-bench output - anchor skipped"
|
|
@@ -698,6 +698,7 @@ def apply_calibration_overrides(hw, args):
|
|
|
698
698
|
cal, age = calmod.load()
|
|
699
699
|
if not cal:
|
|
700
700
|
return hw
|
|
701
|
+
hw["_cal_active"] = True
|
|
701
702
|
applied = []
|
|
702
703
|
if cal.get("ram_bw_measured"):
|
|
703
704
|
hw["rb"] = round(cal["ram_bw_measured"] / 0.544)
|
|
@@ -711,32 +712,88 @@ def apply_calibration_overrides(hw, args):
|
|
|
711
712
|
if cal.get("boost_verdict") and "healthy" not in cal["boost_verdict"]:
|
|
712
713
|
print(f"[quantprobe] GPU health at last calibration: {cal['boost_verdict']}")
|
|
713
714
|
if not getattr(args, "no_anchors", False):
|
|
714
|
-
ratios = {}
|
|
715
|
+
ratios, notes = {}, []
|
|
715
716
|
for an in (cal.get("anchors") or []):
|
|
716
717
|
try:
|
|
717
|
-
|
|
718
|
-
|
|
718
|
+
ts = float(an["tok_s"])
|
|
719
|
+
# act_gb prices the anchor with the SAME active-byte convention every row uses
|
|
720
|
+
# (params x bits/8 x 1.08). Old calibrations without it fall back to file size -
|
|
721
|
+
# a known ~8% low bias, which the clamp bounds and a re-calibrate removes.
|
|
722
|
+
act_a = float(an.get("act_gb") or an["model_gb"])
|
|
723
|
+
if act_a <= 0 or ts <= 0:
|
|
719
724
|
continue
|
|
720
725
|
if "pure CPU" in an.get("placement", ""):
|
|
721
|
-
pred = 0.62 * hw["rb"] /
|
|
726
|
+
pred = 0.62 * hw["rb"] / act_a # dense CPU eta, same as evaluate()
|
|
722
727
|
ratios["cpu"] = max(0.70, min(1.40, ts / pred))
|
|
723
728
|
elif "all-in-VRAM" in an.get("placement", "") and hw.get("vb"):
|
|
724
|
-
pred = hw.get("geta", 0.45) * hw["vb"] /
|
|
729
|
+
pred = hw.get("geta", 0.45) * hw["vb"] / act_a
|
|
725
730
|
ratios["gpu"] = max(0.70, min(1.40, ts / pred))
|
|
731
|
+
hw["_anchor_gpu_act"] = act_a # for the size-class dispatcher below
|
|
732
|
+
# FORMAT RESCALING (L-16): the anchor measured ONE format's eta; the target
|
|
733
|
+
# may decode another. Both sides priced from the measured per-format ladder
|
|
734
|
+
# (spec.FORMAT_EBW); missing data -> no rescale.
|
|
735
|
+
tgt_bw = getattr(args, "fmt_bw", None)
|
|
736
|
+
anc_bw = an.get("fmt_bw")
|
|
737
|
+
if tgt_bw and anc_bw:
|
|
738
|
+
f = tgt_bw / anc_bw
|
|
739
|
+
ratios["gpu"] = max(0.60, min(1.50, ratios["gpu"] * f))
|
|
740
|
+
if abs(f - 1.0) > 0.03:
|
|
741
|
+
notes.append(f"format x{f:.2f}")
|
|
726
742
|
except (KeyError, TypeError, ValueError, ZeroDivisionError):
|
|
727
743
|
continue
|
|
728
744
|
if ratios:
|
|
729
745
|
if "cpu" in ratios:
|
|
730
746
|
hw["rb"] = hw["rb"] * ratios["cpu"]
|
|
731
747
|
if "gpu" in ratios:
|
|
732
|
-
|
|
748
|
+
# NOT applied to vb here: whether the GPU ratio is valid depends on the TARGET's
|
|
749
|
+
# size class (resolve_gpu_eta below), which is not known yet. Stored instead.
|
|
750
|
+
hw["_gpu_ratio"] = ratios["gpu"]
|
|
751
|
+
extra = ("; " + ", ".join(notes)) if notes else ""
|
|
733
752
|
print("[quantprobe] anchored: "
|
|
734
753
|
+ ", ".join(f"{k.upper()} x{v:.2f}" for k, v in sorted(ratios.items()))
|
|
735
|
-
+ " from your calibrate anchor runs [tier ratios
|
|
736
|
-
" --no-anchors disables]")
|
|
754
|
+
+ f" from your calibrate anchor runs [tier ratios{extra}; --no-anchors disables]")
|
|
737
755
|
return hw
|
|
738
756
|
|
|
739
757
|
|
|
758
|
+
def resolve_gpu_eta(hw, args, active_b, bits, vb, geta):
|
|
759
|
+
"""The size-classed GPU dispatcher - ONE function, used by plan AND runtime.best_flags.
|
|
760
|
+
|
|
761
|
+
The #65 ladder measured the failure this prevents the same day anchors shipped: a 0.5B
|
|
762
|
+
anchor priced a 7B GPU arm 34% low, because small models pay a size floor (#59) that big
|
|
763
|
+
models do not - the anchor conflates format eta with that floor. Rules, each measured:
|
|
764
|
+
- target active >= 1.5 GB and format known: eta comes from the per-format ladder
|
|
765
|
+
(spec.FORMAT_EBW / 192.2 ref) - the reference box's own big-model GPU calibration,
|
|
766
|
+
format-resolved (L-16). The anchor's machine ratio applies ONLY if the anchor sits
|
|
767
|
+
within 4x of the target's active bytes (same size class).
|
|
768
|
+
- smaller targets, or unknown format: the anchor ratio applies as before (a same-class
|
|
769
|
+
small anchor measured -8%/+10%).
|
|
770
|
+
Returns (vb, geta) with the choice printed.
|
|
771
|
+
"""
|
|
772
|
+
ratio = hw.get("_gpu_ratio")
|
|
773
|
+
# the format-ladder eta is a CALIBRATION-class refinement: it applies only on the
|
|
774
|
+
# calibrated auto-detect path. Preset machines keep their fitted geta and the one-sided
|
|
775
|
+
# floor semantics - the ratchet test caught exactly this scope creep (+47% on gemma's
|
|
776
|
+
# custom mixed-quant file when the ladder eta overrode a preset).
|
|
777
|
+
fmt_bw = getattr(args, "fmt_bw", None) if hw.get("_cal_active") else None
|
|
778
|
+
act_est = (active_b or 0) * (bits or 4.5) / 8 * 1.08
|
|
779
|
+
anchor_act = hw.get("_anchor_gpu_act")
|
|
780
|
+
same_class = bool(anchor_act and act_est and act_est / 4 <= anchor_act <= act_est * 4)
|
|
781
|
+
big = act_est >= 1.5
|
|
782
|
+
# The size-class guard holds with OR without format knowledge: an out-of-class anchor ratio
|
|
783
|
+
# never touches a big target (that misapplication is what the ratchet test caught).
|
|
784
|
+
use_ratio = bool(ratio) and (same_class or not big)
|
|
785
|
+
if fmt_bw and big:
|
|
786
|
+
eta_fmt = fmt_bw / 192.2
|
|
787
|
+
if not use_ratio and ratio:
|
|
788
|
+
print(f"[quantprobe] GPU eta from the measured format ladder: {eta_fmt:.2f} "
|
|
789
|
+
f"(fmt {fmt_bw:.0f} GB/s ref; anchor outside this size class, machine ratio not applied)")
|
|
790
|
+
return (vb * ratio, eta_fmt) if use_ratio else (vb, eta_fmt)
|
|
791
|
+
if ratio and not use_ratio:
|
|
792
|
+
print("[quantprobe] GPU anchor is outside this model's size class - machine ratio not "
|
|
793
|
+
"applied (small anchors under-price big models; #65). CPU anchor still applies.")
|
|
794
|
+
return (vb * ratio, geta) if use_ratio else (vb, geta)
|
|
795
|
+
|
|
796
|
+
|
|
740
797
|
def run(args):
|
|
741
798
|
from . import spec as specmod
|
|
742
799
|
specmod.apply(args)
|
|
@@ -778,6 +835,7 @@ def run(args):
|
|
|
778
835
|
import os as _os
|
|
779
836
|
_g = getattr(args, 'gguf', None)
|
|
780
837
|
true_size = _os.path.getsize(_g) / 1e9 if _g and _os.path.isfile(_g) else None
|
|
838
|
+
vb, geta = resolve_gpu_eta(hw, args, a, args.bits, vb, geta)
|
|
781
839
|
size, act, cfgs = evaluate(t, a, ne, moe, args.bits, vc, vb, rc, rb, db, geta, gl=gl, ctx=ctx,
|
|
782
840
|
kvp=kvp, n_layer=nlay, true_size_gb=true_size)
|
|
783
841
|
q = qual_of(moe, args.bits)
|
|
@@ -74,6 +74,8 @@ def best_flags(a):
|
|
|
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
76
|
_true = os.path.getsize(gguf) / 1e9 if gguf and os.path.isfile(gguf) else None
|
|
77
|
+
# same size-classed GPU-eta dispatch as plan (ONE shared function; layer 3 enforces parity)
|
|
78
|
+
vb, geta = planmod.resolve_gpu_eta(hw, a, ac, a.bits, vb, geta)
|
|
77
79
|
_, _, cfgs = planmod.evaluate(t, ac, ne, moe, a.bits, vc, vb, rc, rb, db, geta, act_scale, gl,
|
|
78
80
|
ctx=ctx, kvp=kvp, true_size_gb=_true,
|
|
79
81
|
n_layer=planmod.effective_n_layer(a, m))
|
|
@@ -22,6 +22,20 @@ def _field(r, *names):
|
|
|
22
22
|
return None
|
|
23
23
|
|
|
24
24
|
|
|
25
|
+
# Effective decode bandwidth BY FORMAT on the reference box, e2e (GB/s). This is L-16 made
|
|
26
|
+
# actionable: eta is a property of the format, so an anchor measured on one format must be
|
|
27
|
+
# rescaled before it prices another (prereg #65 measured the cost of NOT doing this: -34% on
|
|
28
|
+
# Q4_K_M from a Q8_0 anchor). 'measured' = e2e on a real 7B (#52/#53) or in-situ per-op (#58);
|
|
29
|
+
# 'derived' = scaled from the kernelprobe ladder. Formats not listed (IQ*, exotic) are excluded
|
|
30
|
+
# from the weighting; if coverage falls below 60% of bytes the factor is withheld entirely -
|
|
31
|
+
# no number beats a wrong number.
|
|
32
|
+
FORMAT_EBW = {
|
|
33
|
+
"Q4_0": 119.1, "Q4_K": 106.4, "Q2_K": 65.4, "Q3_K": 57.3, "Q6_K": 100.0, # measured
|
|
34
|
+
"Q8_0": 115.0, "Q5_K": 103.0, "Q5_0": 117.0, "Q5_1": 115.0, # derived
|
|
35
|
+
"F16": 150.0, "F32": 150.0, "BF16": 150.0, # derived
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
|
|
25
39
|
def from_gguf(path):
|
|
26
40
|
from gguf import GGUFReader
|
|
27
41
|
r = GGUFReader(path)
|
|
@@ -29,6 +43,7 @@ def from_gguf(path):
|
|
|
29
43
|
total = 0
|
|
30
44
|
routed = 0
|
|
31
45
|
iq_bytes = all_bytes = 0
|
|
46
|
+
fmt_wsum = fmt_bytes = 0.0
|
|
32
47
|
for t in r.tensors:
|
|
33
48
|
n = 1
|
|
34
49
|
for d in t.shape:
|
|
@@ -45,6 +60,10 @@ def from_gguf(path):
|
|
|
45
60
|
all_bytes += nb
|
|
46
61
|
if t.tensor_type.name.startswith("IQ"):
|
|
47
62
|
iq_bytes += nb
|
|
63
|
+
tn = t.tensor_type.name
|
|
64
|
+
if tn in FORMAT_EBW:
|
|
65
|
+
fmt_wsum += nb * FORMAT_EBW[tn]
|
|
66
|
+
fmt_bytes += nb
|
|
48
67
|
ne_params = total - routed
|
|
49
68
|
|
|
50
69
|
n_exp = _field(r, ".expert_count")
|
|
@@ -79,9 +98,11 @@ def from_gguf(path):
|
|
|
79
98
|
except Exception:
|
|
80
99
|
arch = None
|
|
81
100
|
break
|
|
101
|
+
fmt_bw = (fmt_wsum / fmt_bytes) if (all_bytes and fmt_bytes / all_bytes >= 0.6) else None
|
|
82
102
|
return dict(t=total / 1e9, a=active / 1e9, ne=ne_params / 1e9, moe=moe,
|
|
83
103
|
bits=round(bits, 2), kvp=int(kvp), n_layer=n_layer, arch=arch,
|
|
84
|
-
iq_share=(iq_bytes / all_bytes) if all_bytes else 0.0
|
|
104
|
+
iq_share=(iq_bytes / all_bytes) if all_bytes else 0.0,
|
|
105
|
+
fmt_bw=round(fmt_bw, 1) if fmt_bw else None)
|
|
85
106
|
|
|
86
107
|
|
|
87
108
|
def apply(a, quiet=False):
|
|
@@ -106,6 +127,7 @@ def apply(a, quiet=False):
|
|
|
106
127
|
if getattr(a, "n_layer", None) is None:
|
|
107
128
|
a.n_layer = s["n_layer"] # enables the MoE partial-offload -ot regex (needs real layer indices)
|
|
108
129
|
a.iq_share = s.get("iq_share", 0.0) # read-only: lets plan warn when IQ weights land on a CPU tier
|
|
130
|
+
a.fmt_bw = s.get("fmt_bw") # read-only: lets anchored predictions rescale by format (L-16)
|
|
109
131
|
if used and not quiet:
|
|
110
132
|
print(f"[quantprobe] read from GGUF: " + ", ".join(used))
|
|
111
133
|
return True
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: quantprobe
|
|
3
|
-
Version: 1.20.
|
|
3
|
+
Version: 1.20.1
|
|
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
|
|
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
|