quantprobe 1.30.0__tar.gz → 1.32.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 (39) hide show
  1. {quantprobe-1.30.0/quantprobe.egg-info → quantprobe-1.32.0}/PKG-INFO +6 -2
  2. {quantprobe-1.30.0 → quantprobe-1.32.0}/README.md +5 -1
  3. {quantprobe-1.30.0 → quantprobe-1.32.0}/pyproject.toml +1 -1
  4. {quantprobe-1.30.0 → quantprobe-1.32.0}/quantprobe/__init__.py +1 -1
  5. {quantprobe-1.30.0 → quantprobe-1.32.0}/quantprobe/cli.py +4 -0
  6. {quantprobe-1.30.0 → quantprobe-1.32.0}/quantprobe/detect.py +7 -1
  7. {quantprobe-1.30.0 → quantprobe-1.32.0}/quantprobe/ollama.py +2 -0
  8. {quantprobe-1.30.0 → quantprobe-1.32.0}/quantprobe/plan.py +23 -1
  9. {quantprobe-1.30.0 → quantprobe-1.32.0}/quantprobe/report.py +2 -0
  10. {quantprobe-1.30.0 → quantprobe-1.32.0}/quantprobe/runtime.py +5 -0
  11. {quantprobe-1.30.0 → quantprobe-1.32.0}/quantprobe/spec.py +37 -5
  12. {quantprobe-1.30.0 → quantprobe-1.32.0/quantprobe.egg-info}/PKG-INFO +6 -2
  13. {quantprobe-1.30.0 → quantprobe-1.32.0}/LICENSE +0 -0
  14. {quantprobe-1.30.0 → quantprobe-1.32.0}/quantprobe/__main__.py +0 -0
  15. {quantprobe-1.30.0 → quantprobe-1.32.0}/quantprobe/auto.py +0 -0
  16. {quantprobe-1.30.0 → quantprobe-1.32.0}/quantprobe/branding.py +0 -0
  17. {quantprobe-1.30.0 → quantprobe-1.32.0}/quantprobe/calibrate.py +0 -0
  18. {quantprobe-1.30.0 → quantprobe-1.32.0}/quantprobe/dashboard.py +0 -0
  19. {quantprobe-1.30.0 → quantprobe-1.32.0}/quantprobe/fetch.py +0 -0
  20. {quantprobe-1.30.0 → quantprobe-1.32.0}/quantprobe/optimize.py +0 -0
  21. {quantprobe-1.30.0 → quantprobe-1.32.0}/quantprobe/probe.py +0 -0
  22. {quantprobe-1.30.0 → quantprobe-1.32.0}/quantprobe/recipes/mistral-7b.json +0 -0
  23. {quantprobe-1.30.0 → quantprobe-1.32.0}/quantprobe/recipes/qwen2.5-7b.json +0 -0
  24. {quantprobe-1.30.0 → quantprobe-1.32.0}/quantprobe/recipes/qwen3-30b.json +0 -0
  25. {quantprobe-1.30.0 → quantprobe-1.32.0}/quantprobe/recipes/qwen3.5-35b.json +0 -0
  26. {quantprobe-1.30.0 → quantprobe-1.32.0}/quantprobe/recipes/qwen3.6-35b.json +0 -0
  27. {quantprobe-1.30.0 → quantprobe-1.32.0}/quantprobe/recipes/qwen3.8-27b.json +0 -0
  28. {quantprobe-1.30.0 → quantprobe-1.32.0}/quantprobe/recipes.py +0 -0
  29. {quantprobe-1.30.0 → quantprobe-1.32.0}/quantprobe/target.py +0 -0
  30. {quantprobe-1.30.0 → quantprobe-1.32.0}/quantprobe.egg-info/SOURCES.txt +0 -0
  31. {quantprobe-1.30.0 → quantprobe-1.32.0}/quantprobe.egg-info/dependency_links.txt +0 -0
  32. {quantprobe-1.30.0 → quantprobe-1.32.0}/quantprobe.egg-info/entry_points.txt +0 -0
  33. {quantprobe-1.30.0 → quantprobe-1.32.0}/quantprobe.egg-info/requires.txt +0 -0
  34. {quantprobe-1.30.0 → quantprobe-1.32.0}/quantprobe.egg-info/top_level.txt +0 -0
  35. {quantprobe-1.30.0 → quantprobe-1.32.0}/setup.cfg +0 -0
  36. {quantprobe-1.30.0 → quantprobe-1.32.0}/tests/test_engine.py +0 -0
  37. {quantprobe-1.30.0 → quantprobe-1.32.0}/tests/test_evaluator.py +0 -0
  38. {quantprobe-1.30.0 → quantprobe-1.32.0}/tests/test_pipeline.py +0 -0
  39. {quantprobe-1.30.0 → quantprobe-1.32.0}/tests/test_transforms.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: quantprobe
3
- Version: 1.30.0
3
+ Version: 1.32.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
@@ -186,7 +186,11 @@ Most guides put *all* of a mixture-of-experts model's experts in system RAM and
186
186
 
187
187
  ## Free speed, part two: if you write code
188
188
 
189
- `--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.
189
+ llama.cpp's `--spec-type ngram-simple` drafts tokens by finding repeated spans in your own context, then verifies them — output is **identical** and nothing is downloaded. It is a **llama.cpp** flag, so `quantprobe run` forwards it (and picks the placement for you):
190
+
191
+ ```bash
192
+ quantprobe run --gguf model.gguf --extra "--spec-type ngram-simple --spec-ngram-simple-size-m 384 --spec-ngram-simple-size-n 4"
193
+ ```
190
194
 
191
195
  <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>
192
196
 
@@ -168,7 +168,11 @@ Most guides put *all* of a mixture-of-experts model's experts in system RAM and
168
168
 
169
169
  ## Free speed, part two: if you write code
170
170
 
171
- `--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.
171
+ llama.cpp's `--spec-type ngram-simple` drafts tokens by finding repeated spans in your own context, then verifies them — output is **identical** and nothing is downloaded. It is a **llama.cpp** flag, so `quantprobe run` forwards it (and picks the placement for you):
172
+
173
+ ```bash
174
+ quantprobe run --gguf model.gguf --extra "--spec-type ngram-simple --spec-ngram-simple-size-m 384 --spec-ngram-simple-size-n 4"
175
+ ```
172
176
 
173
177
  <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>
174
178
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "quantprobe"
7
- version = "1.30.0"
7
+ version = "1.32.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.30.0"
11
+ __version__ = "1.32.0"
@@ -11,10 +11,14 @@ def main():
11
11
  sys.stdout.reconfigure(errors="replace")
12
12
  except Exception:
13
13
  pass
14
+ from . import __version__
14
15
  ap = argparse.ArgumentParser(
15
16
  prog="quantprobe",
16
17
  description="Probe-then-quantize for LLMs: fragility curves, placement plans, recipes. "
17
18
  "Laws + evidence: github.com/FedericoTs/quantprobe")
19
+ # Packagers and bug reports expect `--version`; before this it errored with
20
+ # `unrecognized arguments` and the number was only visible in the no-args banner.
21
+ ap.add_argument("--version", action="version", version=f"quantprobe {__version__}")
18
22
  sub = ap.add_subparsers(dest="cmd") # not required: bare `quantprobe` shows the banner + help
19
23
 
20
24
  p = sub.add_parser("probe", help="measure a GGUF's depth-fragility curve, emit the recipe (Law 3)")
@@ -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",
@@ -235,6 +235,8 @@ def unload(name, need_free_mib=4500, tries=20):
235
235
 
236
236
  def run(a):
237
237
  from . import plan as planmod, spec as specmod
238
+ planmod.check_presets(a) # audit-ollama prices every stored model against --machine; a typo'd
239
+ # preset must refuse, not silently price them for the auto box
238
240
  root = store_root(getattr(a, "store", None))
239
241
  models = installed(root)
240
242
  print(f"quantprobe audit-ollama - store: {root}")
@@ -1405,7 +1405,14 @@ def qual_of(moe, bits):
1405
1405
 
1406
1406
 
1407
1407
  def check_presets(args):
1408
- """Refuse unknown preset names LOUDLY instead of silently falling back to defaults."""
1408
+ """Refuse unknown preset names LOUDLY, and never predict from a silently-fabricated model.
1409
+
1410
+ The whole product is a trustworthy number, so every prediction entry point calls this -
1411
+ plan/optimize/target AND run/bench/report/dashboard/audit-ollama. It refuses a typo'd
1412
+ --machine/--model that used to quietly predict for the WRONG box or model (e.g.
1413
+ `--machine rtx4090` for `rtx-4090` fell through to auto-detect and nobody said so). The
1414
+ companion warn_if_no_model() labels the separate generic-13B fallback for the commands that
1415
+ actually reach it."""
1409
1416
  mdl = getattr(args, "model", None)
1410
1417
  if mdl and mdl not in MODELS and not getattr(args, "total", None):
1411
1418
  raise SystemExit(
@@ -1421,6 +1428,20 @@ def check_presets(args):
1421
1428
  " or pass flags: --vram/--vram-bw/--ram/--ram-bw/--disk-bw (no flags = auto-detect this box)" % (mac, ", ".join(sorted(MACHINES))))
1422
1429
 
1423
1430
 
1431
+ def warn_if_no_model(args):
1432
+ """Label the generic-13B assumption, unmissably, when the user described no model at all.
1433
+
1434
+ Separate from check_presets because only the commands that actually FALL BACK to 13B should
1435
+ say so: `plan` can (no required --gguf), but audit-ollama prices real stored models and
1436
+ run/bench/dashboard require --gguf, so none of them assume 13B and none should print this."""
1437
+ if not (getattr(args, "model", None) or getattr(args, "total", None)
1438
+ or getattr(args, "gguf", None)):
1439
+ print("[quantprobe] NO MODEL GIVEN - assuming a generic 13B DENSE model. This number is "
1440
+ "illustrative, not about your model.\n"
1441
+ " Pass --gguf model.gguf (exact, read from the file), --model <preset>, "
1442
+ "or --total <B> for yours.")
1443
+
1444
+
1424
1445
  CAL_COMPONENTS = (("RAM stream", "ram_bw_measured"), ("disk", "disk_bw_measured"),
1425
1446
  ("decode anchors", "anchors"))
1426
1447
 
@@ -1931,6 +1952,7 @@ def build_rows(args):
1931
1952
  from . import spec as specmod
1932
1953
  specmod.apply(args)
1933
1954
  check_presets(args)
1955
+ warn_if_no_model(args)
1934
1956
  if getattr(args, "bits", None) is None:
1935
1957
  args.bits = 2.5
1936
1958
  m = dict(MODELS[args.model]) if args.model in MODELS else {}
@@ -870,6 +870,8 @@ def run(args):
870
870
  raise SystemExit(f"report needs the file it is about: --gguf {g or '<missing>'} "
871
871
  f"not found.\nA preset-only report is a v2 item "
872
872
  f"(docs/DESIGN_REPORT_CMD.md section 6).")
873
+ planmod.check_presets(args) # a typo'd --machine must refuse here too, not report a number
874
+ # for the wrong box (the report is the forwardable artifact)
873
875
  # Snapshot what the USER passed before build_rows lets autospec fill the gaps in place -
874
876
  # the Reproduce section echoes the invocation, not the resolved state.
875
877
  snap = {attr: getattr(args, attr, None) for _f, attr in _RECON_FLAGS}
@@ -30,6 +30,11 @@ def best_flags(a):
30
30
  """Run the planner, return (best_config, flags_list) for the winning placement."""
31
31
  from . import spec as specmod
32
32
  from_file = specmod.apply(a) # True when the spec came from the GGUF itself
33
+ # A typo'd --machine used to fall through to auto-detect here (line ~40) and quietly predict
34
+ # for the wrong box. run / bench / dashboard all route through best_flags, so one guard here
35
+ # gives them the same loud refusal plan/optimize/target already have. Runs AFTER apply so a
36
+ # --gguf has already filled the spec.
37
+ planmod.check_presets(a)
33
38
  if getattr(a, "bits", None) is None:
34
39
  a.bits = 2.5
35
40
  m = dict(planmod.MODELS[a.model]) if getattr(a, "model", None) in planmod.MODELS else {}
@@ -264,7 +264,29 @@ def expert_ceiling(s):
264
264
  share, k_def = s.get("routed_byte_share") or 0.0, s.get("n_expert_used") or 0
265
265
  if not share or k_def < 2:
266
266
  return None # k=1 already: there is nothing left to turn down
267
- return share, 1.0 / (1.0 - share * (1.0 - 1.0 / k_def))
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)
268
290
 
269
291
 
270
292
  def expert_ceiling_note(s):
@@ -276,10 +298,20 @@ def expert_ceiling_note(s):
276
298
  if ceil < 1.05: # below a 5% ceiling the knob is not worth a line
277
299
  return (f" experts routed experts are only {share*100:.0f}% of the active bytes - "
278
300
  f"cutting expert_used_count cannot help here (L-30)")
279
- return (f" experts routed experts are {share*100:.0f}% of the active bytes, so "
280
- f"lowering expert_used_count\n"
281
- f" buys at most ~{ceil:.2f}x even at k=1 - and quality falls long "
282
- f"before that (L-30, prereg #107)")
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
283
315
 
284
316
 
285
317
  def apply(a, quiet=False):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: quantprobe
3
- Version: 1.30.0
3
+ Version: 1.32.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
@@ -186,7 +186,11 @@ Most guides put *all* of a mixture-of-experts model's experts in system RAM and
186
186
 
187
187
  ## Free speed, part two: if you write code
188
188
 
189
- `--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.
189
+ llama.cpp's `--spec-type ngram-simple` drafts tokens by finding repeated spans in your own context, then verifies them — output is **identical** and nothing is downloaded. It is a **llama.cpp** flag, so `quantprobe run` forwards it (and picks the placement for you):
190
+
191
+ ```bash
192
+ quantprobe run --gguf model.gguf --extra "--spec-type ngram-simple --spec-ngram-simple-size-m 384 --spec-ngram-simple-size-n 4"
193
+ ```
190
194
 
191
195
  <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>
192
196
 
File without changes
File without changes