quantprobe 1.29.0__tar.gz → 1.31.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.
- {quantprobe-1.29.0/quantprobe.egg-info → quantprobe-1.31.0}/PKG-INFO +1 -1
- {quantprobe-1.29.0 → quantprobe-1.31.0}/pyproject.toml +1 -1
- {quantprobe-1.29.0 → quantprobe-1.31.0}/quantprobe/__init__.py +1 -1
- {quantprobe-1.29.0 → quantprobe-1.31.0}/quantprobe/detect.py +7 -1
- {quantprobe-1.29.0 → quantprobe-1.31.0}/quantprobe/plan.py +10 -0
- {quantprobe-1.29.0 → quantprobe-1.31.0}/quantprobe/spec.py +90 -0
- {quantprobe-1.29.0 → quantprobe-1.31.0/quantprobe.egg-info}/PKG-INFO +1 -1
- {quantprobe-1.29.0 → quantprobe-1.31.0}/LICENSE +0 -0
- {quantprobe-1.29.0 → quantprobe-1.31.0}/README.md +0 -0
- {quantprobe-1.29.0 → quantprobe-1.31.0}/quantprobe/__main__.py +0 -0
- {quantprobe-1.29.0 → quantprobe-1.31.0}/quantprobe/auto.py +0 -0
- {quantprobe-1.29.0 → quantprobe-1.31.0}/quantprobe/branding.py +0 -0
- {quantprobe-1.29.0 → quantprobe-1.31.0}/quantprobe/calibrate.py +0 -0
- {quantprobe-1.29.0 → quantprobe-1.31.0}/quantprobe/cli.py +0 -0
- {quantprobe-1.29.0 → quantprobe-1.31.0}/quantprobe/dashboard.py +0 -0
- {quantprobe-1.29.0 → quantprobe-1.31.0}/quantprobe/fetch.py +0 -0
- {quantprobe-1.29.0 → quantprobe-1.31.0}/quantprobe/ollama.py +0 -0
- {quantprobe-1.29.0 → quantprobe-1.31.0}/quantprobe/optimize.py +0 -0
- {quantprobe-1.29.0 → quantprobe-1.31.0}/quantprobe/probe.py +0 -0
- {quantprobe-1.29.0 → quantprobe-1.31.0}/quantprobe/recipes/mistral-7b.json +0 -0
- {quantprobe-1.29.0 → quantprobe-1.31.0}/quantprobe/recipes/qwen2.5-7b.json +0 -0
- {quantprobe-1.29.0 → quantprobe-1.31.0}/quantprobe/recipes/qwen3-30b.json +0 -0
- {quantprobe-1.29.0 → quantprobe-1.31.0}/quantprobe/recipes/qwen3.5-35b.json +0 -0
- {quantprobe-1.29.0 → quantprobe-1.31.0}/quantprobe/recipes/qwen3.6-35b.json +0 -0
- {quantprobe-1.29.0 → quantprobe-1.31.0}/quantprobe/recipes/qwen3.8-27b.json +0 -0
- {quantprobe-1.29.0 → quantprobe-1.31.0}/quantprobe/recipes.py +0 -0
- {quantprobe-1.29.0 → quantprobe-1.31.0}/quantprobe/report.py +0 -0
- {quantprobe-1.29.0 → quantprobe-1.31.0}/quantprobe/runtime.py +0 -0
- {quantprobe-1.29.0 → quantprobe-1.31.0}/quantprobe/target.py +0 -0
- {quantprobe-1.29.0 → quantprobe-1.31.0}/quantprobe.egg-info/SOURCES.txt +0 -0
- {quantprobe-1.29.0 → quantprobe-1.31.0}/quantprobe.egg-info/dependency_links.txt +0 -0
- {quantprobe-1.29.0 → quantprobe-1.31.0}/quantprobe.egg-info/entry_points.txt +0 -0
- {quantprobe-1.29.0 → quantprobe-1.31.0}/quantprobe.egg-info/requires.txt +0 -0
- {quantprobe-1.29.0 → quantprobe-1.31.0}/quantprobe.egg-info/top_level.txt +0 -0
- {quantprobe-1.29.0 → quantprobe-1.31.0}/setup.cfg +0 -0
- {quantprobe-1.29.0 → quantprobe-1.31.0}/tests/test_engine.py +0 -0
- {quantprobe-1.29.0 → quantprobe-1.31.0}/tests/test_evaluator.py +0 -0
- {quantprobe-1.29.0 → quantprobe-1.31.0}/tests/test_pipeline.py +0 -0
- {quantprobe-1.29.0 → quantprobe-1.31.0}/tests/test_transforms.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: quantprobe
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.31.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
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "quantprobe"
|
|
7
|
-
version = "1.
|
|
7
|
+
version = "1.31.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.
|
|
11
|
+
__version__ = "1.31.0"
|
|
@@ -308,7 +308,13 @@ def residency(model_bytes, free_gb=None):
|
|
|
308
308
|
f"minute's\n"
|
|
309
309
|
f" machine state, not the file. Expect it to move when something else is "
|
|
310
310
|
f"running,\n"
|
|
311
|
-
f" and do not publish it without the free-RAM number beside it (C-32)
|
|
311
|
+
f" and do not publish it without the free-RAM number beside it (C-32).\n"
|
|
312
|
+
f" COMPARING CONFIGURATIONS? In this regime a run is contaminated by the one\n"
|
|
313
|
+
f" before it - the page cache carries the previous config's working set into\n"
|
|
314
|
+
f" the next process. Measured: identical arms spread 0.8-1.8% when the\n"
|
|
315
|
+
f" predecessor matched and 21-72% when it did not, a 6.3x span from run "
|
|
316
|
+
f"order\n"
|
|
317
|
+
f" alone (L-31). Interleave your arms and repeat them, or A/B here is noise.")
|
|
312
318
|
|
|
313
319
|
|
|
314
320
|
WIDE_CPU = ("threadripper", "epyc", "xeon w-3", "xeon(r) w9", "xeon(r) w7", "xeon gold",
|
|
@@ -2022,6 +2022,16 @@ def run(args):
|
|
|
2022
2022
|
print()
|
|
2023
2023
|
for line in rep:
|
|
2024
2024
|
print(" " + line)
|
|
2025
|
+
# L-30 / prereg #107: the expert-count dial is a bounded lever, and the bound is arithmetic
|
|
2026
|
+
# on THIS file. Printing the ceiling is the useful output; offering the dial is not, because
|
|
2027
|
+
# every measured point on the curve costs more quality than the speed is worth. Only shown
|
|
2028
|
+
# when a real GGUF was scanned - a preset has no expert byte split to read.
|
|
2029
|
+
_sp = getattr(args, "_spec", None)
|
|
2030
|
+
if isinstance(_sp, dict) and _sp.get("moe"):
|
|
2031
|
+
from . import spec as _specmod
|
|
2032
|
+
_note = _specmod.expert_ceiling_note(_sp)
|
|
2033
|
+
if _note:
|
|
2034
|
+
print(_note)
|
|
2025
2035
|
# Speculation reality, TOP-LINE (first external replication, u/MoneroApe: the buried version
|
|
2026
2036
|
# of this note cost him a debugging session - the drafter silently produced 0 drafts on a
|
|
2027
2037
|
# novel prompt, exactly as D-10 measured, and the warning was ten paragraphs down).
|
|
@@ -99,6 +99,7 @@ def from_gguf(path):
|
|
|
99
99
|
tier_exp = {'bytes': 0, 'wsum': 0.0, 'wb': 0, 'cb': 0} # prereg #79: per-tier format stats
|
|
100
100
|
tier_att = {'bytes': 0, 'wsum': 0.0, 'wb': 0, 'cb': 0}
|
|
101
101
|
embd_params = 0 # token_embd: a GATHER at decode, not a read (U-26 / prereg #76)
|
|
102
|
+
embd_bytes = 0 # the same exclusion in bytes, for L-30's routed share
|
|
102
103
|
has_output = False # a separate output/lm_head means embeddings are NOT tied
|
|
103
104
|
kv_blocks = set() # U-51: blocks that carry a K projection, i.e. FULL attention
|
|
104
105
|
tensors = list(r.tensors)
|
|
@@ -115,6 +116,7 @@ def from_gguf(path):
|
|
|
115
116
|
routed += n
|
|
116
117
|
if "token_embd" in t.name:
|
|
117
118
|
embd_params += n
|
|
119
|
+
embd_bytes += int(t.n_bytes) # L-30 needs the BYTE version of the same exclusion
|
|
118
120
|
if t.name.startswith("output.") or "lm_head" in t.name:
|
|
119
121
|
has_output = True
|
|
120
122
|
# bytes-weighted I-quant share. Measured (pre-registration #31): on the CPU tier the
|
|
@@ -214,7 +216,16 @@ def from_gguf(path):
|
|
|
214
216
|
ws += unpriced_cb * WORST_MEASURED_CODEBOOK
|
|
215
217
|
wb += unpriced_cb
|
|
216
218
|
fmt_bw = (ws / wb) if (all_bytes and wb / all_bytes >= 0.6) else None
|
|
219
|
+
# L-30 (prereg #107): the ceiling of the expert-count knob is decided by the routed share of
|
|
220
|
+
# ACTIVE BYTES, and that is readable here. Params are the wrong unit - experts are usually
|
|
221
|
+
# quantized harder than the always-active path, so their byte share is smaller than their
|
|
222
|
+
# param share, and predicting from params overstates the lever.
|
|
223
|
+
routed_active_b = tier_exp["bytes"] * (n_used / n_exp) if (moe and n_exp and n_used) else 0
|
|
224
|
+
always_b = all_bytes - tier_exp["bytes"] - (embd_bytes if has_output else 0)
|
|
217
225
|
return dict(t=total / 1e9, a=active / 1e9, ne=ne_params / 1e9, moe=moe,
|
|
226
|
+
routed_byte_share=(routed_active_b / (routed_active_b + always_b))
|
|
227
|
+
if (moe and (routed_active_b + always_b)) else 0.0,
|
|
228
|
+
n_expert=n_exp, n_expert_used=n_used,
|
|
218
229
|
bits=round(bits, 2), kvp=int(kvp), n_layer=n_layer, arch=arch,
|
|
219
230
|
kv_layers=kv_layers, # U-51: < n_layer marks a hybrid (linear-attn) model
|
|
220
231
|
iq_share=(iq_bytes / all_bytes) if all_bytes else 0.0,
|
|
@@ -226,6 +237,83 @@ def from_gguf(path):
|
|
|
226
237
|
fmt_bw=round(fmt_bw, 1) if fmt_bw else None)
|
|
227
238
|
|
|
228
239
|
|
|
240
|
+
def expert_ceiling(s):
|
|
241
|
+
"""L-30: the most the expert-count knob can ever buy on this file. -> (share, ceiling) or None.
|
|
242
|
+
|
|
243
|
+
`--override-kv <arch>.expert_used_count=int:K` is widely traded as a free speed dial for MoE
|
|
244
|
+
on small hardware. It is bounded, and the bound is arithmetic on the file: routed experts own
|
|
245
|
+
`routed_byte_share` of the active bytes AT THE DEFAULT k, so driving k to 1 removes all but
|
|
246
|
+
1/k_default of that share and Law 4 caps the speedup at
|
|
247
|
+
|
|
248
|
+
1 / (1 - share * (1 - 1/k_default))
|
|
249
|
+
|
|
250
|
+
The divisor is the DEFAULT k, not the expert count. Using n_expert instead reads as "drop from
|
|
251
|
+
all 256 experts to one" and inflates the ceiling - on the file below, 1.28x against the true
|
|
252
|
+
1.24x. Checked against prereg #107's staked byte table, which is why the slip was caught.
|
|
253
|
+
|
|
254
|
+
Measured against this prediction on Qwen3.6-35B-A3B (prereg #107, 4/4): k=4 1.146x against
|
|
255
|
+
1.125x predicted, k=2 1.175x against 1.200x. It is exact where the working set is unchanged.
|
|
256
|
+
At k=1 the measurement overshot by 17% - on a model larger than free RAM the touched-expert
|
|
257
|
+
set collapses and the page cache starts paying (L-29). So this is a CEILING for the regime the
|
|
258
|
+
law covers, and the honest word is "about", not a guarantee.
|
|
259
|
+
|
|
260
|
+
Returns None for dense models and for any MoE whose expert metadata is missing - a ceiling we
|
|
261
|
+
cannot compute is not a ceiling we should print."""
|
|
262
|
+
if not s.get("moe"):
|
|
263
|
+
return None
|
|
264
|
+
share, k_def = s.get("routed_byte_share") or 0.0, s.get("n_expert_used") or 0
|
|
265
|
+
if not share or k_def < 2:
|
|
266
|
+
return None # k=1 already: there is nothing left to turn down
|
|
267
|
+
return share, _ceil(share, k_def)
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
def _ceil(share, k_def):
|
|
271
|
+
return 1.0 / (1.0 - share * (1.0 - 1.0 / k_def))
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
def expert_ceiling_prefill(s):
|
|
275
|
+
"""The same ceiling for PREFILL -> (share, ceiling) or None.
|
|
276
|
+
|
|
277
|
+
L-30 prices decode, which is bandwidth-bound, so it divides BYTES. Prefill is compute-bound
|
|
278
|
+
and compute scales with PARAMETERS - quantization shrinks bytes, not FLOPs. The routed share
|
|
279
|
+
is therefore larger here, and so is the ceiling.
|
|
280
|
+
|
|
281
|
+
Measured (prereg #108, V-23): prefill moved 1.613x at k=4 and 3.766x at k=2, where decode
|
|
282
|
+
moved 1.146x and 1.175x. The direction and ordering are confirmed. The MAGNITUDE is not -
|
|
283
|
+
the param share predicted 1.206x at k=4 and the measurement came in 34% above it, so this
|
|
284
|
+
number is a FLOOR on what prefill does, not an estimate of it. Said that way in the note."""
|
|
285
|
+
a, ne, k_def = s.get("a") or 0.0, s.get("ne") or 0.0, s.get("n_expert_used") or 0
|
|
286
|
+
if not s.get("moe") or not a or a <= ne or k_def < 2:
|
|
287
|
+
return None
|
|
288
|
+
share = (a - ne) / a
|
|
289
|
+
return share, _ceil(share, k_def)
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
def expert_ceiling_note(s):
|
|
293
|
+
"""One line for `plan`/`report`, or None when there is nothing honest to say."""
|
|
294
|
+
r = expert_ceiling(s)
|
|
295
|
+
if not r:
|
|
296
|
+
return None
|
|
297
|
+
share, ceil = r
|
|
298
|
+
if ceil < 1.05: # below a 5% ceiling the knob is not worth a line
|
|
299
|
+
return (f" experts routed experts are only {share*100:.0f}% of the active bytes - "
|
|
300
|
+
f"cutting expert_used_count cannot help here (L-30)")
|
|
301
|
+
out = (f" experts routed experts are {share*100:.0f}% of the active bytes, so "
|
|
302
|
+
f"lowering expert_used_count\n"
|
|
303
|
+
f" buys at most ~{ceil:.2f}x DECODE even at k=1 - and quality falls "
|
|
304
|
+
f"long before that (L-30, prereg #107)")
|
|
305
|
+
pf = expert_ceiling_prefill(s)
|
|
306
|
+
if pf:
|
|
307
|
+
pshare, pceil = pf
|
|
308
|
+
out += (f"\n PREFILL is the better place for it: {pshare*100:.0f}% of "
|
|
309
|
+
f"active PARAMS are routed, and\n"
|
|
310
|
+
f" measured gains beat this {pceil:.2f}x floor (1.6x at k=4, "
|
|
311
|
+
f"3.8x at k=2 - V-23, prereg #108).\n"
|
|
312
|
+
f" Neither is free: halving the experts cost +1.51 perplexity "
|
|
313
|
+
f"on the measured model.")
|
|
314
|
+
return out
|
|
315
|
+
|
|
316
|
+
|
|
229
317
|
def apply(a, quiet=False):
|
|
230
318
|
"""Fill law-parameters from a.gguf for anything the user didn't set. Explicit flags win."""
|
|
231
319
|
g = getattr(a, "gguf", None)
|
|
@@ -260,6 +348,8 @@ def apply(a, quiet=False):
|
|
|
260
348
|
a.fmt_bw_exp = s.get("fmt_bw_exp")
|
|
261
349
|
a.codebook_share_exp = s.get("codebook_share_exp", 0.0)
|
|
262
350
|
a.fmt_bw = s.get("fmt_bw") # read-only: lets anchored predictions rescale by format (L-16)
|
|
351
|
+
a._spec = s # read-only: L-30's expert ceiling needs the byte split,
|
|
352
|
+
# and re-scanning the GGUF to recover it would be silly
|
|
263
353
|
if used and not quiet:
|
|
264
354
|
print(f"[quantprobe] read from GGUF: " + ", ".join(used))
|
|
265
355
|
return True
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: quantprobe
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.31.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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|