quantprobe 1.29.0__tar.gz → 1.30.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.29.0/quantprobe.egg-info → quantprobe-1.30.0}/PKG-INFO +1 -1
  2. {quantprobe-1.29.0 → quantprobe-1.30.0}/pyproject.toml +1 -1
  3. {quantprobe-1.29.0 → quantprobe-1.30.0}/quantprobe/__init__.py +1 -1
  4. {quantprobe-1.29.0 → quantprobe-1.30.0}/quantprobe/plan.py +10 -0
  5. {quantprobe-1.29.0 → quantprobe-1.30.0}/quantprobe/spec.py +58 -0
  6. {quantprobe-1.29.0 → quantprobe-1.30.0/quantprobe.egg-info}/PKG-INFO +1 -1
  7. {quantprobe-1.29.0 → quantprobe-1.30.0}/LICENSE +0 -0
  8. {quantprobe-1.29.0 → quantprobe-1.30.0}/README.md +0 -0
  9. {quantprobe-1.29.0 → quantprobe-1.30.0}/quantprobe/__main__.py +0 -0
  10. {quantprobe-1.29.0 → quantprobe-1.30.0}/quantprobe/auto.py +0 -0
  11. {quantprobe-1.29.0 → quantprobe-1.30.0}/quantprobe/branding.py +0 -0
  12. {quantprobe-1.29.0 → quantprobe-1.30.0}/quantprobe/calibrate.py +0 -0
  13. {quantprobe-1.29.0 → quantprobe-1.30.0}/quantprobe/cli.py +0 -0
  14. {quantprobe-1.29.0 → quantprobe-1.30.0}/quantprobe/dashboard.py +0 -0
  15. {quantprobe-1.29.0 → quantprobe-1.30.0}/quantprobe/detect.py +0 -0
  16. {quantprobe-1.29.0 → quantprobe-1.30.0}/quantprobe/fetch.py +0 -0
  17. {quantprobe-1.29.0 → quantprobe-1.30.0}/quantprobe/ollama.py +0 -0
  18. {quantprobe-1.29.0 → quantprobe-1.30.0}/quantprobe/optimize.py +0 -0
  19. {quantprobe-1.29.0 → quantprobe-1.30.0}/quantprobe/probe.py +0 -0
  20. {quantprobe-1.29.0 → quantprobe-1.30.0}/quantprobe/recipes/mistral-7b.json +0 -0
  21. {quantprobe-1.29.0 → quantprobe-1.30.0}/quantprobe/recipes/qwen2.5-7b.json +0 -0
  22. {quantprobe-1.29.0 → quantprobe-1.30.0}/quantprobe/recipes/qwen3-30b.json +0 -0
  23. {quantprobe-1.29.0 → quantprobe-1.30.0}/quantprobe/recipes/qwen3.5-35b.json +0 -0
  24. {quantprobe-1.29.0 → quantprobe-1.30.0}/quantprobe/recipes/qwen3.6-35b.json +0 -0
  25. {quantprobe-1.29.0 → quantprobe-1.30.0}/quantprobe/recipes/qwen3.8-27b.json +0 -0
  26. {quantprobe-1.29.0 → quantprobe-1.30.0}/quantprobe/recipes.py +0 -0
  27. {quantprobe-1.29.0 → quantprobe-1.30.0}/quantprobe/report.py +0 -0
  28. {quantprobe-1.29.0 → quantprobe-1.30.0}/quantprobe/runtime.py +0 -0
  29. {quantprobe-1.29.0 → quantprobe-1.30.0}/quantprobe/target.py +0 -0
  30. {quantprobe-1.29.0 → quantprobe-1.30.0}/quantprobe.egg-info/SOURCES.txt +0 -0
  31. {quantprobe-1.29.0 → quantprobe-1.30.0}/quantprobe.egg-info/dependency_links.txt +0 -0
  32. {quantprobe-1.29.0 → quantprobe-1.30.0}/quantprobe.egg-info/entry_points.txt +0 -0
  33. {quantprobe-1.29.0 → quantprobe-1.30.0}/quantprobe.egg-info/requires.txt +0 -0
  34. {quantprobe-1.29.0 → quantprobe-1.30.0}/quantprobe.egg-info/top_level.txt +0 -0
  35. {quantprobe-1.29.0 → quantprobe-1.30.0}/setup.cfg +0 -0
  36. {quantprobe-1.29.0 → quantprobe-1.30.0}/tests/test_engine.py +0 -0
  37. {quantprobe-1.29.0 → quantprobe-1.30.0}/tests/test_evaluator.py +0 -0
  38. {quantprobe-1.29.0 → quantprobe-1.30.0}/tests/test_pipeline.py +0 -0
  39. {quantprobe-1.29.0 → quantprobe-1.30.0}/tests/test_transforms.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: quantprobe
3
- Version: 1.29.0
3
+ Version: 1.30.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.29.0"
7
+ version = "1.30.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.29.0"
11
+ __version__ = "1.30.0"
@@ -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,51 @@ 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, 1.0 / (1.0 - share * (1.0 - 1.0 / k_def))
268
+
269
+
270
+ def expert_ceiling_note(s):
271
+ """One line for `plan`/`report`, or None when there is nothing honest to say."""
272
+ r = expert_ceiling(s)
273
+ if not r:
274
+ return None
275
+ share, ceil = r
276
+ if ceil < 1.05: # below a 5% ceiling the knob is not worth a line
277
+ return (f" experts routed experts are only {share*100:.0f}% of the active bytes - "
278
+ 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)")
283
+
284
+
229
285
  def apply(a, quiet=False):
230
286
  """Fill law-parameters from a.gguf for anything the user didn't set. Explicit flags win."""
231
287
  g = getattr(a, "gguf", None)
@@ -260,6 +316,8 @@ def apply(a, quiet=False):
260
316
  a.fmt_bw_exp = s.get("fmt_bw_exp")
261
317
  a.codebook_share_exp = s.get("codebook_share_exp", 0.0)
262
318
  a.fmt_bw = s.get("fmt_bw") # read-only: lets anchored predictions rescale by format (L-16)
319
+ a._spec = s # read-only: L-30's expert ceiling needs the byte split,
320
+ # and re-scanning the GGUF to recover it would be silly
263
321
  if used and not quiet:
264
322
  print(f"[quantprobe] read from GGUF: " + ", ".join(used))
265
323
  return True
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: quantprobe
3
- Version: 1.29.0
3
+ Version: 1.30.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