quantprobe 1.17.0__tar.gz → 1.18.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 (33) hide show
  1. {quantprobe-1.17.0/quantprobe.egg-info → quantprobe-1.18.0}/PKG-INFO +1 -1
  2. {quantprobe-1.17.0 → quantprobe-1.18.0}/pyproject.toml +1 -1
  3. {quantprobe-1.17.0 → quantprobe-1.18.0}/quantprobe/__init__.py +1 -1
  4. {quantprobe-1.17.0 → quantprobe-1.18.0}/quantprobe/plan.py +74 -7
  5. {quantprobe-1.17.0 → quantprobe-1.18.0/quantprobe.egg-info}/PKG-INFO +1 -1
  6. {quantprobe-1.17.0 → quantprobe-1.18.0}/LICENSE +0 -0
  7. {quantprobe-1.17.0 → quantprobe-1.18.0}/README.md +0 -0
  8. {quantprobe-1.17.0 → quantprobe-1.18.0}/quantprobe/__main__.py +0 -0
  9. {quantprobe-1.17.0 → quantprobe-1.18.0}/quantprobe/auto.py +0 -0
  10. {quantprobe-1.17.0 → quantprobe-1.18.0}/quantprobe/cli.py +0 -0
  11. {quantprobe-1.17.0 → quantprobe-1.18.0}/quantprobe/dashboard.py +0 -0
  12. {quantprobe-1.17.0 → quantprobe-1.18.0}/quantprobe/detect.py +0 -0
  13. {quantprobe-1.17.0 → quantprobe-1.18.0}/quantprobe/fetch.py +0 -0
  14. {quantprobe-1.17.0 → quantprobe-1.18.0}/quantprobe/optimize.py +0 -0
  15. {quantprobe-1.17.0 → quantprobe-1.18.0}/quantprobe/probe.py +0 -0
  16. {quantprobe-1.17.0 → quantprobe-1.18.0}/quantprobe/recipes/mistral-7b.json +0 -0
  17. {quantprobe-1.17.0 → quantprobe-1.18.0}/quantprobe/recipes/qwen2.5-7b.json +0 -0
  18. {quantprobe-1.17.0 → quantprobe-1.18.0}/quantprobe/recipes/qwen3-30b.json +0 -0
  19. {quantprobe-1.17.0 → quantprobe-1.18.0}/quantprobe/recipes/qwen3.5-35b.json +0 -0
  20. {quantprobe-1.17.0 → quantprobe-1.18.0}/quantprobe/recipes.py +0 -0
  21. {quantprobe-1.17.0 → quantprobe-1.18.0}/quantprobe/runtime.py +0 -0
  22. {quantprobe-1.17.0 → quantprobe-1.18.0}/quantprobe/spec.py +0 -0
  23. {quantprobe-1.17.0 → quantprobe-1.18.0}/quantprobe/target.py +0 -0
  24. {quantprobe-1.17.0 → quantprobe-1.18.0}/quantprobe.egg-info/SOURCES.txt +0 -0
  25. {quantprobe-1.17.0 → quantprobe-1.18.0}/quantprobe.egg-info/dependency_links.txt +0 -0
  26. {quantprobe-1.17.0 → quantprobe-1.18.0}/quantprobe.egg-info/entry_points.txt +0 -0
  27. {quantprobe-1.17.0 → quantprobe-1.18.0}/quantprobe.egg-info/requires.txt +0 -0
  28. {quantprobe-1.17.0 → quantprobe-1.18.0}/quantprobe.egg-info/top_level.txt +0 -0
  29. {quantprobe-1.17.0 → quantprobe-1.18.0}/setup.cfg +0 -0
  30. {quantprobe-1.17.0 → quantprobe-1.18.0}/tests/test_engine.py +0 -0
  31. {quantprobe-1.17.0 → quantprobe-1.18.0}/tests/test_evaluator.py +0 -0
  32. {quantprobe-1.17.0 → quantprobe-1.18.0}/tests/test_pipeline.py +0 -0
  33. {quantprobe-1.17.0 → quantprobe-1.18.0}/tests/test_transforms.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: quantprobe
3
- Version: 1.17.0
3
+ Version: 1.18.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.17.0"
7
+ version = "1.18.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.17.0"
11
+ __version__ = "1.18.0"
@@ -384,6 +384,9 @@ def fits_in_vram_advice(placement, bits):
384
384
  note += (" It also already fits, and going lower-bit buys almost nothing: the same 7B at "
385
385
  "Q2_K vs Q4_K_M is 36% smaller and 4% SLOWER (19.17 vs 20.03 tok/s). Quantize "
386
386
  "to make a model FIT - once it fits, take the highest bits that still fit.")
387
+ fmt = format_advice(placement, bits)
388
+ if fmt:
389
+ note += "\n " + fmt
387
390
  note += ("\n We only have one GPU, and one GPU cannot fix this. If you run this model, "
388
391
  "`quantprobe bench --contribute` turns your machine into the datapoint that does - "
389
392
  "it prints exactly what would be shared and you submit it yourself. Results that "
@@ -391,6 +394,45 @@ def fits_in_vram_advice(placement, bits):
391
394
  return note
392
395
 
393
396
 
397
+ def format_advice(placement, bits):
398
+ """The format lever: on an ALU-weak GPU, the quantization FORMAT sets decode speed, not just
399
+ the byte count. Measured (preregs #52/#53/#54, kernelprobe controls, 2026-07-28):
400
+
401
+ Qwen2.5-7B, all-in-VRAM, same card, same session, interleaved:
402
+ Q4_K_M 4.36 GB 22.72 tok/s eta 0.553
403
+ Q4_0 4.12 GB 26.87 tok/s eta 0.619 <- +19% where bytes explain +5.7%
404
+ Q2_K 2.80 GB 21.67 tok/s eta 0.340 <- SLOWER than Q4_0 while 32% smaller
405
+
406
+ Mechanism, isolated at the metal (own CUDA, zero llama.cpp): a matvec with NO unpacking runs
407
+ at 95% of the streaming ceiling; the same bytes unpacked naively run at 42%. The cost is the
408
+ per-block metadata decode - K-quants unpack a 6-bit scale AND a 6-bit min before any dot
409
+ product, Q4_0 reads one fp16 scale. So eta is a property of (format x kernel), not the tier.
410
+
411
+ Scope, stated rather than implied: measured on ONE Pascal-class card (GTX 1060, cc 6.1),
412
+ where ALU is scarce relative to bandwidth. On Ampere+ the unpack has headroom to hide and
413
+ the ranking may invert - we say so and ask for the datapoint. SPEED-only claim: Q4_0 is
414
+ lower-quality per byte than Q4_K_M; at equal fit take K-quants on a modern card, Q4_0 on an
415
+ old one, and never Q2_K when a 4-bit file also fits (it is smaller, slower AND lower quality
416
+ there - strictly dominated).
417
+ """
418
+ if placement != "all in VRAM":
419
+ return None
420
+ if bits <= 3.0:
421
+ return ("FORMAT LEVER (pre-Ampere cards): this bit-width is in the regime where unpack "
422
+ "cost has REVERSED the byte ordering - measured Q2_K decodes 19% slower than Q4_0 "
423
+ "on the same model while being 32% smaller. If a ~4.5-bit file fits in VRAM, use "
424
+ "it instead; prefer Q4_0 over Q4_K_M on pre-Ampere (+19% measured, bytes explain "
425
+ "only 5.7%). On Ampere+ this is unverified and may invert.")
426
+ if bits <= 5.0:
427
+ return ("FORMAT LEVER (pre-Ampere cards): at this bit-width the FORMAT is worth more than "
428
+ "the bytes - Q4_0 measured +19% over Q4_K_M on the same model (26.87 vs 22.72 "
429
+ "tok/s). Mechanism (measured, preregs #56/#57): metadata application DENSITY - "
430
+ "K-quants apply fine-grained scale+min chains far more often per byte, and that "
431
+ "cost is intrinsic to the format definition, not a kernel bug. Speed-only: "
432
+ "Q4_K_M is higher quality per byte. On Ampere+ this is unverified and may invert.")
433
+ return None
434
+
435
+
394
436
  def speculation_advice(moe, placement):
395
437
  """What speculative decoding is worth for THIS model and placement.
396
438
 
@@ -412,13 +454,28 @@ def speculation_advice(moe, placement):
412
454
  # that reproduces context spans (edits, refactors, quoting) - most of what coding agents
413
455
  # emit, and none of what fresh generation emits.
414
456
  return ("if your output REUSES its context - edits, refactors, RAG quoting - add "
415
- "`--spec-type ngram-simple` to llama-server: measured **2.41x decode** on THIS "
416
- "model and placement (20.7 -> 50.0 tok/s, 89% draft acceptance), one flag, no "
417
- "download, identical output. That is 22% ABOVE this box's raw-decode wall - the "
418
- "one lever that can pass it. Novel generation gains nothing (0% acceptance), and "
419
- "a separate 0.6B DRAFT MODEL is measured NET NEGATIVE here (0.72x): its own "
420
- "forward passes cost more than verification saves. Note llama-cli ignores "
421
- "--spec-type silently; the flag only works on llama-server.")
457
+ "`--spec-type ngram-simple --spec-ngram-simple-size-m 384 "
458
+ "--spec-ngram-simple-size-n 4` to llama-server: measured **4.7x decode at ~3-bit** "
459
+ "(21.3 -> 98.8 tok/s), no download. REQUIRES A LONG PROMPT: with these values the drafter "
460
+ "cannot fire until the context exceeds size_m+size_n+1 = 389 tokens, so on short "
461
+ "prompts it does NOTHING and llama.cpp's default m=48 (61-token floor) is better. "
462
+ "Output was byte-identical in every copy-regime test we ran, but that is evidence, "
463
+ "not a guarantee - a verify pass batches several positions and batched reductions "
464
+ "are not bit-identical to single-token decode, which at temp 0 can flip an argmax "
465
+ "(measured: a rejected-draft case diverged reproducibly). The multiplier SHRINKS "
466
+ "with bit-width - the SAME model at Q3_K_M gives 3.4x (17.5 -> 59.2) - because a "
467
+ "verify round is compute-bound, so extra bits cost dequantisation on every drafted "
468
+ "token, not just extra bytes moved. Speculation and quantization are NOT "
469
+ "independent levers. "
470
+ "BOTH tunables matter and llama.cpp's defaults (m=48, n=12) capture only 2.3x of "
471
+ "it: the cost unit is the VERIFY ROUND (one full weight read), not the token, so "
472
+ "what pays is delivering the same accepted tokens in fewer, longer runs. 108 tok/s "
473
+ "is 2.6x this box's raw-decode wall, which no runtime, fork or rewrite can pass. "
474
+ "Two traps, both measured: do NOT tune on acceptance rate (it falls 89%->68% while "
475
+ "throughput doubles), and do NOT over-shorten n (n=2 drafts 36% MORE and runs 25% "
476
+ "SLOWER). Novel generation gains nothing (0% acceptance), a 0.6B DRAFT MODEL is net "
477
+ "negative here (0.72x), and stacking a second drafter costs 10%. Note llama-cli "
478
+ "ignores --spec-type silently; the flag only works on llama-server.")
422
479
  if moe and experts_offloaded:
423
480
  return ("speculation will NOT pay here: measured +3% (ngram) and -24% (MTP) with experts "
424
481
  "offloaded - a verify batch unions experts, and every extra one is a slow read.")
@@ -677,6 +734,16 @@ def run(args):
677
734
  "dominated,")
678
735
  print(" so there is nothing to choose. One fewer knob, and the honest number.")
679
736
  print()
737
+ print(" honesty on GENERATION speed (preregs #43/#60/#61): a plain fixed -ngl split measures")
738
+ print(" EQUAL tg to this -ot placement - three times, at degraded AND full clocks. The -ot")
739
+ print(" advice earns its keep on PROMPT PROCESSING (2.2x measured), on keeping KV in VRAM,")
740
+ print(" and on enabling the speculation numbers below - not on raw generation.")
741
+ print(" IF YOUR NUMBERS SAG 25-30% after hours of GPU churn: the cause on our box was a")
742
+ print(" STUCK BOOST STATE (SM 1506 vs 1835+ MHz at cool temps - diagnosed and confirmed by")
743
+ print(" cold-boot A/B, preregs #60/#61). Check `nvidia-smi --query-gpu=clocks.sm` under")
744
+ print(" load; consumer cards cannot reset it - reboot restores full speed. Not thermal,")
745
+ print(" not your config.")
746
+ print()
680
747
  print(" long prompts, same document: send cache_prompt=true to llama-server. Measured")
681
748
  print(" here (pre-registration #29): the second question against a 2k-token document")
682
749
  print(" pays 183 ms of prompt time instead of 5381 - 29x - because the document KV is")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: quantprobe
3
- Version: 1.17.0
3
+ Version: 1.18.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