quantprobe 1.10.0__tar.gz → 1.10.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.
Files changed (33) hide show
  1. {quantprobe-1.10.0/quantprobe.egg-info → quantprobe-1.10.1}/PKG-INFO +1 -1
  2. {quantprobe-1.10.0 → quantprobe-1.10.1}/pyproject.toml +1 -1
  3. {quantprobe-1.10.0 → quantprobe-1.10.1}/quantprobe/__init__.py +1 -1
  4. {quantprobe-1.10.0 → quantprobe-1.10.1}/quantprobe/probe.py +18 -0
  5. {quantprobe-1.10.0 → quantprobe-1.10.1}/quantprobe/spec.py +41 -0
  6. {quantprobe-1.10.0 → quantprobe-1.10.1/quantprobe.egg-info}/PKG-INFO +1 -1
  7. {quantprobe-1.10.0 → quantprobe-1.10.1}/LICENSE +0 -0
  8. {quantprobe-1.10.0 → quantprobe-1.10.1}/README.md +0 -0
  9. {quantprobe-1.10.0 → quantprobe-1.10.1}/quantprobe/__main__.py +0 -0
  10. {quantprobe-1.10.0 → quantprobe-1.10.1}/quantprobe/auto.py +0 -0
  11. {quantprobe-1.10.0 → quantprobe-1.10.1}/quantprobe/cli.py +0 -0
  12. {quantprobe-1.10.0 → quantprobe-1.10.1}/quantprobe/dashboard.py +0 -0
  13. {quantprobe-1.10.0 → quantprobe-1.10.1}/quantprobe/detect.py +0 -0
  14. {quantprobe-1.10.0 → quantprobe-1.10.1}/quantprobe/fetch.py +0 -0
  15. {quantprobe-1.10.0 → quantprobe-1.10.1}/quantprobe/optimize.py +0 -0
  16. {quantprobe-1.10.0 → quantprobe-1.10.1}/quantprobe/plan.py +0 -0
  17. {quantprobe-1.10.0 → quantprobe-1.10.1}/quantprobe/recipes/mistral-7b.json +0 -0
  18. {quantprobe-1.10.0 → quantprobe-1.10.1}/quantprobe/recipes/qwen2.5-7b.json +0 -0
  19. {quantprobe-1.10.0 → quantprobe-1.10.1}/quantprobe/recipes/qwen3-30b.json +0 -0
  20. {quantprobe-1.10.0 → quantprobe-1.10.1}/quantprobe/recipes/qwen3.5-35b.json +0 -0
  21. {quantprobe-1.10.0 → quantprobe-1.10.1}/quantprobe/recipes.py +0 -0
  22. {quantprobe-1.10.0 → quantprobe-1.10.1}/quantprobe/runtime.py +0 -0
  23. {quantprobe-1.10.0 → quantprobe-1.10.1}/quantprobe/target.py +0 -0
  24. {quantprobe-1.10.0 → quantprobe-1.10.1}/quantprobe.egg-info/SOURCES.txt +0 -0
  25. {quantprobe-1.10.0 → quantprobe-1.10.1}/quantprobe.egg-info/dependency_links.txt +0 -0
  26. {quantprobe-1.10.0 → quantprobe-1.10.1}/quantprobe.egg-info/entry_points.txt +0 -0
  27. {quantprobe-1.10.0 → quantprobe-1.10.1}/quantprobe.egg-info/requires.txt +0 -0
  28. {quantprobe-1.10.0 → quantprobe-1.10.1}/quantprobe.egg-info/top_level.txt +0 -0
  29. {quantprobe-1.10.0 → quantprobe-1.10.1}/setup.cfg +0 -0
  30. {quantprobe-1.10.0 → quantprobe-1.10.1}/tests/test_engine.py +0 -0
  31. {quantprobe-1.10.0 → quantprobe-1.10.1}/tests/test_evaluator.py +0 -0
  32. {quantprobe-1.10.0 → quantprobe-1.10.1}/tests/test_pipeline.py +0 -0
  33. {quantprobe-1.10.0 → quantprobe-1.10.1}/tests/test_transforms.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: quantprobe
3
- Version: 1.10.0
3
+ Version: 1.10.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.10.0"
7
+ version = "1.10.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.10.0"
11
+ __version__ = "1.10.1"
@@ -217,6 +217,24 @@ def build_depthaware(llama_dir, src, out, protect_lo, protect_hi, n_lay,
217
217
  # 2026-07-25), so this must precede the band rules or it silently does nothing. The shared
218
218
  # expert fires on EVERY token (routed experts fire ~8/256) and is heavy-tailed: measured
219
219
  # -3.2% ppl when protected at q8_0, for ~0.65% more bytes (pre-registration #12).
220
+ # Pre-flight: does this model contain weight classes we have no protection rule for?
221
+ # We shipped exactly that bug once (SSM tensors, v1.6.4). Reporting beats silently
222
+ # compressing something always-active.
223
+ if not dry and os.path.isfile(src):
224
+ try:
225
+ from .spec import tensor_roles
226
+ roles, unknown = tensor_roles(src)
227
+ big = {k: v for k, v in unknown.items() if v > 5e7} # ignore trivia
228
+ if big:
229
+ tot = sum(big.values()) / 1e9
230
+ print(f"[quantprobe] NOTE: {tot:.2f} GB of tensors have no known role and will "
231
+ f"take the base quantization level:")
232
+ for k, v in sorted(big.items(), key=lambda x: -x[1])[:5]:
233
+ print(f" {k} ({v/1e9:.2f} GB)")
234
+ print(" If any of those are always-active, they should be protected - please "
235
+ "open an issue with the model name so the registry can be extended.")
236
+ except Exception:
237
+ pass
220
238
  cmd += ["--tensor-type", "ffn_.*_shexp.*=q8_0"]
221
239
  if protect_lo > 0:
222
240
  cmd += ["--tensor-type", f"{_band_re(0, protect_lo - 1)}=q2_k"]
@@ -97,3 +97,44 @@ def apply(a, quiet=False):
97
97
  if used and not quiet:
98
98
  print(f"[quantprobe] read from GGUF: " + ", ".join(used))
99
99
  return True
100
+
101
+
102
+ # --- tensor-role registry -----------------------------------------------------------------
103
+ # WHAT TRANSFERS between models is structure, not fragility. Which tensor classes exist and
104
+ # which are always-active is a property of the ARCHITECTURE, so it is knowable for a model
105
+ # nobody has ever probed. Which LAYERS are fragile is not (Law 3; Mistral is early-fragile
106
+ # where its near-twin Qwen is late, a 25x error if you guess).
107
+ #
108
+ # This registry exists because we shipped that bug: hybrid SSM architectures name their
109
+ # recurrent-state tensors ssm_*, our protection pattern only matched attn_*, and every SSM
110
+ # tensor silently landed at the aggressive base level (fixed in v1.6.4, cost -24% ppl).
111
+ # Anything unrecognised is now REPORTED rather than silently compressed.
112
+ TENSOR_ROLES = [
113
+ ("routed-expert", r"ffn_(gate|up|down)_exps", "compressible: ~8 of N experts fire per token"),
114
+ ("shared-expert", r"ffn_.*_shexp", "ALWAYS ACTIVE on every token - protect"),
115
+ ("attention", r"attn_", "ALWAYS ACTIVE - protect"),
116
+ ("recurrent/SSM", r"ssm_", "ALWAYS ACTIVE - protect"),
117
+ ("embedding", r"(token_embd|output\.)", "ALWAYS ACTIVE - protect"),
118
+ ("router", r"ffn_gate_inp", "tiny, kept at full precision"),
119
+ ("norm", r"(_norm|norm\.)", "tiny, kept at full precision"),
120
+ ("dense-ffn", r"ffn_(gate|up|down)\.", "dense FFN - the depth-aware band applies here"),
121
+ ]
122
+
123
+
124
+ def tensor_roles(path):
125
+ """Classify a GGUF's tensors by role. Returns (roles, unknown) with byte totals, so the
126
+ builder can warn about weight classes it has no protection rule for."""
127
+ import re
128
+ from gguf import GGUFReader
129
+ r = GGUFReader(path)
130
+ roles, unknown = {}, {}
131
+ for t in r.tensors:
132
+ nbytes = int(t.n_bytes) if hasattr(t, "n_bytes") else 0
133
+ for name, pat, _ in TENSOR_ROLES:
134
+ if re.search(pat, t.name):
135
+ roles[name] = roles.get(name, 0) + nbytes
136
+ break
137
+ else:
138
+ key = re.sub(r"blk\.\d+\.", "", t.name)
139
+ unknown[key] = unknown.get(key, 0) + nbytes
140
+ return roles, unknown
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: quantprobe
3
- Version: 1.10.0
3
+ Version: 1.10.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