quantprobe 1.10.4__tar.gz → 1.11.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 (34) hide show
  1. {quantprobe-1.10.4 → quantprobe-1.11.0}/LICENSE +21 -21
  2. {quantprobe-1.10.4 → quantprobe-1.11.0}/PKG-INFO +19 -2
  3. quantprobe-1.10.4/quantprobe.egg-info/PKG-INFO → quantprobe-1.11.0/README.md +168 -169
  4. {quantprobe-1.10.4 → quantprobe-1.11.0}/pyproject.toml +31 -31
  5. quantprobe-1.11.0/quantprobe/__init__.py +11 -0
  6. {quantprobe-1.10.4 → quantprobe-1.11.0}/quantprobe/__main__.py +9 -9
  7. {quantprobe-1.10.4 → quantprobe-1.11.0}/quantprobe/auto.py +272 -258
  8. {quantprobe-1.10.4 → quantprobe-1.11.0}/quantprobe/cli.py +163 -163
  9. {quantprobe-1.10.4 → quantprobe-1.11.0}/quantprobe/detect.py +167 -167
  10. {quantprobe-1.10.4 → quantprobe-1.11.0}/quantprobe/optimize.py +149 -136
  11. {quantprobe-1.10.4 → quantprobe-1.11.0}/quantprobe/plan.py +376 -294
  12. {quantprobe-1.10.4 → quantprobe-1.11.0}/quantprobe/probe.py +334 -334
  13. {quantprobe-1.10.4 → quantprobe-1.11.0}/quantprobe/recipes/mistral-7b.json +50 -50
  14. {quantprobe-1.10.4 → quantprobe-1.11.0}/quantprobe/recipes/qwen2.5-7b.json +50 -50
  15. {quantprobe-1.10.4 → quantprobe-1.11.0}/quantprobe/recipes/qwen3-30b.json +50 -50
  16. {quantprobe-1.10.4 → quantprobe-1.11.0}/quantprobe/recipes/qwen3.5-35b.json +50 -50
  17. {quantprobe-1.10.4 → quantprobe-1.11.0}/quantprobe/recipes.py +75 -75
  18. {quantprobe-1.10.4 → quantprobe-1.11.0}/quantprobe/runtime.py +213 -205
  19. {quantprobe-1.10.4 → quantprobe-1.11.0}/quantprobe/spec.py +141 -140
  20. {quantprobe-1.10.4 → quantprobe-1.11.0}/quantprobe/target.py +91 -91
  21. quantprobe-1.10.4/README.md → quantprobe-1.11.0/quantprobe.egg-info/PKG-INFO +36 -1
  22. {quantprobe-1.10.4 → quantprobe-1.11.0}/tests/test_engine.py +72 -72
  23. {quantprobe-1.10.4 → quantprobe-1.11.0}/tests/test_evaluator.py +65 -65
  24. {quantprobe-1.10.4 → quantprobe-1.11.0}/tests/test_pipeline.py +77 -77
  25. {quantprobe-1.10.4 → quantprobe-1.11.0}/tests/test_transforms.py +79 -79
  26. quantprobe-1.10.4/quantprobe/__init__.py +0 -11
  27. {quantprobe-1.10.4 → quantprobe-1.11.0}/quantprobe/dashboard.py +0 -0
  28. {quantprobe-1.10.4 → quantprobe-1.11.0}/quantprobe/fetch.py +0 -0
  29. {quantprobe-1.10.4 → quantprobe-1.11.0}/quantprobe.egg-info/SOURCES.txt +0 -0
  30. {quantprobe-1.10.4 → quantprobe-1.11.0}/quantprobe.egg-info/dependency_links.txt +0 -0
  31. {quantprobe-1.10.4 → quantprobe-1.11.0}/quantprobe.egg-info/entry_points.txt +0 -0
  32. {quantprobe-1.10.4 → quantprobe-1.11.0}/quantprobe.egg-info/requires.txt +0 -0
  33. {quantprobe-1.10.4 → quantprobe-1.11.0}/quantprobe.egg-info/top_level.txt +0 -0
  34. {quantprobe-1.10.4 → quantprobe-1.11.0}/setup.cfg +0 -0
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Federico Sciuca
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Federico Sciuca
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: quantprobe
3
- Version: 1.10.4
3
+ Version: 1.11.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
@@ -66,6 +66,23 @@ Most guides put *all* of a mixture-of-experts model's experts in system RAM and
66
66
 
67
67
  *This number was first published as +34.7% and is now corrected downward: that baseline was measured without `--no-mmap`, a flag the tool already recommended, so the control was worse than what a user would actually run. The [correction is published in full](preregistrations/2026-07-26-moe-partial-expert-offload.md#correction-2026-07-26-the-baseline-above-was-mis-configured-and-347-is-overstated) beneath the original — a community report about llama.cpp's `-fit` is what led us to check.*
68
68
 
69
+ ## The other free win: speculation, if you write code
70
+
71
+ `--spec-type ngram-simple` drafts tokens by finding repeated spans in your own context, then
72
+ verifies them — so output is **identical**, it is one flag, and nothing is downloaded. Measured
73
+ on the same model and box, three runs per cell:
74
+
75
+ | workload | off | ngram on | effect |
76
+ |---|---|---|---|
77
+ | **code** (edit a file, answer restates its input) | 17.72 | **37.17** | **2.10× — decode doubles** |
78
+ | prose (open-ended continuation) | 18.46 | 18.56 | 1.01× — nothing |
79
+ | code, but **MoE with experts in RAM** | 18.18 | 18.81 | 1.03× — the union tax eats it |
80
+
81
+ Copyability is the whole mechanism: code answers repeat their input, prose invents. So turn it on
82
+ for coding work on a **dense** model; skip it for prose, and skip it for MoE with offloaded
83
+ experts. ([staked before measuring](preregistrations/2026-07-24-law6-speculation-economics.md) —
84
+ the code result came in *above* my staked ceiling, which still scores as a miss.)
85
+
69
86
  ## Measured results
70
87
 
71
88
  | result | number |
@@ -154,7 +171,7 @@ quantprobe dashboard --gguf 2bit.gguf # the law live, every r
154
171
  - Perplexity and KL divergence are my metrics; I haven't run task-level evals (MMLU/HellaSwag) yet.
155
172
  - The fragility atlas covers four model families — enough to *disprove* universality, not to chart every architecture.
156
173
  - 0.19 tok/s for a 110B is a **capacity demonstration, not usable inference.**
157
- - **We do not model multi-token prediction (MTP) or speculative decoding.** If your runtime uses either, expect roughly **1.5–2.5× above** our estimate — a user measured 29–30 tok/s where we predicted ~16. That is a missing term, not a wrong one: the placement arithmetic still holds, MTP just emits several tokens per weight read. Being measured and modelled during launch week ([staked here](preregistrations/2026-07-24-law6-speculation-economics.md)).
174
+ - **Multi-token prediction (MTP) is not the 2x everyone quotes — measured.** Toggled on the same file and server: **dense GPU-resident +17%, dense on CPU +4.6%, MoE with experts in RAM −24%.** Turn it on if your model is GPU-resident; turn it **off** for MoE with offloaded experts. The one large number we found (1.94x) came from a model that was *spilling VRAM* — MTP rescuing it from paging, not a general property. We do not model it in the planner because there is no single multiplier to apply. ([full 2x2, and all four of my magnitude predictions missed high](preregistrations/2026-07-24-law6-speculation-economics.md))
158
175
  - Speed numbers are single-stream decode on one machine (±25% across environments); the η values are fitted, not derived.
159
176
  - No custom runtime: everything rides stock llama.cpp.
160
177
 
@@ -1,169 +1,168 @@
1
- Metadata-Version: 2.4
2
- Name: quantprobe
3
- Version: 1.10.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
- Author: Federico Sciuca
6
- License: MIT
7
- Project-URL: Homepage, https://github.com/FedericoTs/quantprobe
8
- Keywords: llm,quantization,llama.cpp,gguf,inference,moe
9
- Classifier: License :: OSI Approved :: MIT License
10
- Classifier: Programming Language :: Python :: 3
11
- Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
12
- Requires-Python: >=3.9
13
- Description-Content-Type: text/markdown
14
- License-File: LICENSE
15
- Requires-Dist: gguf>=0.9
16
- Requires-Dist: requests>=2.28
17
- Dynamic: license-file
18
-
19
- # quantprobe
20
-
21
- ### How fast will this model run on *my* machine — and how do I make it faster?
22
-
23
- **Answers both before you download anything. Then hands you the exact command.** Every number measured on one 2016 desktop (GTX 1060 6 GB · 16 GB DDR4 · SATA SSD), and every claim published as a prediction *made before the measurement*.
24
-
25
- ![smoke](https://github.com/FedericoTs/quantprobe/actions/workflows/smoke.yml/badge.svg) ![license](https://img.shields.io/badge/license-MIT-0f766e) ![hardware](https://img.shields.io/badge/measured_on-2016_GTX_1060_6GB-d73027) ![models](https://img.shields.io/badge/validated-7B_→_744B-378add) [![x](https://img.shields.io/badge/author-@federico__sciuca-14181f)](https://x.com/federico_sciuca)
26
-
27
- <p align="center"><img src="weights/data/hero_placement.png" width="880" alt="Placement across memory tiers: disk 2-bit cold experts, RAM 2-bit experts + probed fragile band at 4-bit, VRAM 4-bit attention — one law ties them"></p>
28
-
29
- ---
30
-
31
- ## Start here
32
-
33
- ```bash
34
- pip install quantprobe
35
- quantprobe auto
36
- ```
37
-
38
- That's it — it detects your machine, asks which model you want, and gets you running. No flags to learn.
39
-
40
- **Just want the number first?** `quantprobe plan --gguf model.gguf` prints your predicted tok/s, whether it fits, and the launch command. Downloads nothing, takes a second. There's also a [browser version](https://federicots.github.io/quantprobe/) with nothing to install.
41
-
42
- ## The two ways to run a model
43
-
44
- | | **Fast** — `quantprobe auto qwen3-30b` | **Custom** — `quantprobe auto qwen3-30b --custom` |
45
- |---|---|---|
46
- | what it does | picks the best existing quant for *your* machine, downloads it | measures which layers of *your* model break under compression, then builds a version tailored to it |
47
- | time | minutes (mostly download) | **~50 min for a 7B, ~10 h for a 35B** — it tells you before starting |
48
- | disk | one file | source + working files, 3–4× bigger |
49
- | **speed** | full | **identical** — speed comes from placement, not from the build |
50
- | **quality** | whatever the community published | **−9% perplexity at the same file size** ([measured](preregistrations/2026-07-25-recipe-upgrade-shexp-imatrix.md)) |
51
-
52
- **Most people want Fast.** Above ~3 bits per weight, community quants are already near-lossless — so `--custom` *refuses to run* on machines that don't need it and explains why. The tool declines to sell you its own product.
53
-
54
- **Use Custom when** you're squeezing a model that barely fits (under ~3 bits, where ordinary compression falls off a cliff), you have your own fine-tune nobody has published, or you need maximum quality at a fixed size.
55
-
56
- ## The free speed you probably already have
57
-
58
- Most guides put *all* of a mixture-of-experts model's experts in system RAM and leave your graphics card half empty. Keeping the first N expert layers on the GPU instead — same file, different flags — measured on the reference box:
59
-
60
- | | all experts → RAM | **partial offload** |
61
- |---|---|---|
62
- | generation | 18.35 tok/s | **20.62 tok/s** (+12.4%) |
63
- | prompt reading | 88 tok/s | **~238 tok/s** (2–3×) |
64
-
65
- `plan` and `run` compute the cutoff from your *free* VRAM and emit the exact flags. It costs nothing and needs no new download.
66
-
67
- *This number was first published as +34.7% and is now corrected downward: that baseline was measured without `--no-mmap`, a flag the tool already recommended, so the control was worse than what a user would actually run. The [correction is published in full](preregistrations/2026-07-26-moe-partial-expert-offload.md#correction-2026-07-26-the-baseline-above-was-mis-configured-and-347-is-overstated) beneath the original — a community report about llama.cpp's `-fit` is what led us to check.*
68
-
69
- ## Measured results
70
-
71
- | result | number |
72
- |---|---|
73
- | Qwen3-30B-A3B on the 2016 desktop | **19.3 tok/s** — *predicted 19 before measuring* |
74
- | Same model, partial expert offload | **20.62 tok/s**, +12.4% for free (corrected from a first-published +34.7%) |
75
- | Same bytes, different layers (Gemma 4 12B) | **byte-identical files, 2.25 ppl apart** |
76
- | Gemma 4 12B depth-aware 2-bit | 1.91× → **1.45×** quality cost, ~4.5 GB resident |
77
- | GLM-4.5-Air **110B** from a SATA drive, 16 GB RAM | 0.19 tok/s — inside the pre-registered 0.2–0.3 band |
78
- | RAM overclock (XMP, 2133→3000) | dense **+52%**, pre-registered ×1.41+ |
79
-
80
- <p align="center"><img src="weights/data/validation_19tok/live_run_20tps.png" width="880" alt="One frame: Task Manager showing 16 GB DDR4-3000 and the GTX 1060 6GB beside llama.cpp chatting Qwen3-30B-A3B live at 20.4 tok/s generation"></p>
81
- <p align="center"><em>One frame, no cuts: Task Manager beside llama.cpp chatting Qwen3-30B-A3B at <b>20.4 tok/s</b> — above the pre-registered 19. Raw logs + GGUF SHA256: <a href="weights/data/validation_19tok/EVIDENCE.txt">EVIDENCE.txt</a>.</em></p>
82
-
83
- ## Why you can trust the numbers
84
-
85
- Most benchmark posts report what happened. **I write the prediction down first, publish it, then run the hardware** — and publish the misses just as loudly.
86
-
87
- | predicted (first) | measured (after) |
88
- |---|---|
89
- | 110B streamed from SATA: **0.2–0.3 tok/s** | **0.19** |
90
- | RAM overclock scales decode **×1.41+** | **×1.52** |
91
- | 30B hybrid placement: **~19 tok/s** | **19.30 ± 0.88** |
92
- | a day-old 118B streamed from SATA: **0.2–0.4** | **0.38 ± 0.17** |
93
-
94
- **The misses are the point.** A few that are published in full:
95
-
96
- - **I benchmarked my recipe against a competitor's and lost** ([#11](preregistrations/2026-07-25-apex-vs-probe-depthaware.md), +8.9% worse). It exposed two real bugs in mine. Fixed them ([#12](preregistrations/2026-07-25-recipe-upgrade-shexp-imatrix.md)), then ran a *fair* rematch on data neither side calibrated for — [predicting I'd lose again](preregistrations/2026-07-26-apex-rematch-ood-kl.md). I won: 26% better KL divergence. Two of four stakes missed **in my favour**, still recorded as misses.
97
- - **I retracted a headline finding within the hour** when my own audit showed it was a measurement artifact — then reproduced the artifact deliberately to prove the cause ([Law 5 ledger](weights/LAW5_PROTOCOL.md)).
98
- - **This tool told users a probe takes "30–60 minutes."** It takes 5h40m on a 35 GB model. That was my unmeasured claim, and [v1.9.0](CHANGELOG.md) replaced it with a derived estimate, a live ETA, and a confirmation prompt.
99
-
100
- Plus a **byte-identical control** (two same-size files, 2.25 ppl apart — only placement differs), a full claim → script → log manifest, and **documented dead ends** (dynamic top-k, semantic paging, self-speculation — all measured-dead, because a law you only confirm is a law you haven't tested).
101
-
102
- ## The four laws, in one line each
103
-
104
- Full statements with measurements and falsifiable predictions in **[LAWS.md](LAWS.md)**.
105
-
106
- 1. **Rotation is rank-conditional.** The standard trick behind modern quantization helps full-rank tensors and destroys low-rank bottlenecks — a ~270,000× swing.
107
- 2. **Trained networks are dense everywhere.** No free lunch left in the weights: **2-bit is the data-free floor.**
108
- 3. **Fragility is measurable, not predictable.** Gemma breaks late, Mistral breaks early — architectural near-twins pointing opposite ways. Only a functional probe decides.
109
- 4. **The tiered decode law.** `tok/s = η(tier) × bandwidth ÷ active-bytes-per-token`. This is the equation that predicts your speed before you download.
110
-
111
- <p align="center"><img src="weights/data/x_chart_E_scalinglaw.png" width="700" alt="One scaling law, 7B to 744B, predicted vs measured"></p>
112
-
113
- ## All eleven commands
114
-
115
- ```bash
116
- quantprobe auto # interactive: detects, asks, decides, runs
117
- quantprobe auto qwen3-30b --custom --run # the full custom pipeline, end to end
118
- quantprobe hw # what the law sees on THIS machine
119
- quantprobe plan --gguf model.gguf # predicted tok/s + placement + launch command
120
- quantprobe optimize --tps 20 # cheapest path to a speed target, Pareto-ranked
121
- quantprobe target --tps 5 --ladder # inverse: target -> smartest model that fits
122
- quantprobe fetch qwen3-30b ./models # robust, resumable download
123
- quantprobe quantize --gguf f16.gguf --out 2bit.gguf # build a depth-aware quant
124
- quantprobe probe --gguf f16.gguf --eval wiki.test.raw # measure YOUR model's fragile band
125
- quantprobe run --gguf 2bit.gguf # plan the placement, then launch chat
126
- quantprobe bench --gguf 2bit.gguf --contribute # predicted vs measured; opt-in datapoint
127
- quantprobe dashboard --gguf 2bit.gguf # the law live, every reply scored vs prediction
128
- ```
129
-
130
- `hw`/`plan`/`target`/`optimize` need nothing but Python. The weight-touching commands drive stock [llama.cpp](https://github.com/ggml-org/llama.cpp/releases) — point at it with `--llama-dir`, `QUANTPROBE_LLAMA_DIR`, or `PATH`, and preview anything with `--dry`. 16 machine presets ship in (`--machine`); multi-GPU and RAID aggregate with comma lists (`--vram 24,24`).
131
-
132
- > **Windows: `'quantprobe' is not recognized`?** pip put it in a folder that isn't on your PATH. Use `python -m quantprobe ...` — identical, always works.
133
-
134
- ## Help grow the law
135
-
136
- `quantprobe bench --contribute` prints exactly what would be shared plus a pre-filled issue link — **you review and submit; nothing is ever sent automatically.** Points that land *outside* the predicted bands are the most valuable ones. Open predictions anyone can settle: [preregistrations/](preregistrations/) — including [Law 6, staked before launch](preregistrations/2026-07-24-law6-speculation-economics.md) and scored in public during launch week.
137
-
138
- ## Deep dives
139
-
140
- | | |
141
- |---|---|
142
- | [QUICKSTART.md](QUICKSTART.md) | get running, three levels; recipes for fine-tunes, coding agents, hardware buying |
143
- | [LAWS.md](LAWS.md) | the four laws — statements, measurements, falsifiable predictions |
144
- | [docs/EXAMPLES.md](docs/EXAMPLES.md) | worked examples with real output, including the ×5.4 optimizer A/B |
145
- | [docs/HARDWARE.md](docs/HARDWARE.md) | the 2016 box: exact specs, measured bandwidths, what the next euro buys |
146
- | [docs/DEEP-DIVE.md](docs/DEEP-DIVE.md) | what's new vs. built-on, parity tables, and the **repository map** (this repo also holds the earlier research spike that led here) |
147
- | [papers/arxiv/](papers/arxiv/) | the paper (submission-ready LaTeX) |
148
- | [preregistrations/](preregistrations/) | every staked prediction with its verdict — hits **and** misses |
149
- | [weights/LAW5_PROTOCOL.md](weights/LAW5_PROTOCOL.md) | the live Law-5 research ledger, including the retraction |
150
- | [CHANGELOG.md](CHANGELOG.md) | every release |
151
-
152
- ## Honest limitations
153
-
154
- - Perplexity and KL divergence are my metrics; I haven't run task-level evals (MMLU/HellaSwag) yet.
155
- - The fragility atlas covers four model families — enough to *disprove* universality, not to chart every architecture.
156
- - 0.19 tok/s for a 110B is a **capacity demonstration, not usable inference.**
157
- - **We do not model multi-token prediction (MTP) or speculative decoding.** If your runtime uses either, expect roughly **1.5–2.5× above** our estimate — a user measured 29–30 tok/s where we predicted ~16. That is a missing term, not a wrong one: the placement arithmetic still holds, MTP just emits several tokens per weight read. Being measured and modelled during launch week ([staked here](preregistrations/2026-07-24-law6-speculation-economics.md)).
158
- - Speed numbers are single-stream decode on one machine (±25% across environments); the η values are fitted, not derived.
159
- - No custom runtime: everything rides stock llama.cpp.
160
-
161
- ## Credits
162
-
163
- [colibri](https://github.com/JustVugg/colibri) (744B on 25 GB, pure C) inspired the tier-streaming exploration. The quantization stack builds on [llama.cpp](https://github.com/ggml-org/llama.cpp) and the QTIP/QuIP# incoherence codecs — whose central tool our first law bounds. Independent research by Federico Sciuca, AI-supported, on one desktop.
164
-
165
- Two community contributions changed the tool measurably: **u/RogerAI--fyi** (Reddit) observed that the Law 4 formulation omitted per-token KV reads — measured, confirmed, shipped within a day. **u/MoneroApe** pointed me at [apex-quant](https://github.com/localai-org/apex-quant) and TurboQuant, and testing against **mudler's APEX** exposed two real gaps in my recipe: unprotected always-active tensors (their kurtosis argument, adopted here) and no importance-matrix calibration at all. The head-to-head and its scope limits are published in full, loss first.
166
-
167
- ## License
168
-
169
- MIT — see [LICENSE](LICENSE). © 2026 Federico Sciuca.
1
+ # quantprobe
2
+
3
+ ### How fast will this model run on *my* machine — and how do I make it faster?
4
+
5
+ **Answers both before you download anything. Then hands you the exact command.** Every number measured on one 2016 desktop (GTX 1060 6 GB · 16 GB DDR4 · SATA SSD), and every claim published as a prediction *made before the measurement*.
6
+
7
+ ![smoke](https://github.com/FedericoTs/quantprobe/actions/workflows/smoke.yml/badge.svg) ![license](https://img.shields.io/badge/license-MIT-0f766e) ![hardware](https://img.shields.io/badge/measured_on-2016_GTX_1060_6GB-d73027) ![models](https://img.shields.io/badge/validated-7B_→_744B-378add) [![x](https://img.shields.io/badge/author-@federico__sciuca-14181f)](https://x.com/federico_sciuca)
8
+
9
+ <p align="center"><img src="weights/data/hero_placement.png" width="880" alt="Placement across memory tiers: disk 2-bit cold experts, RAM 2-bit experts + probed fragile band at 4-bit, VRAM 4-bit attention — one law ties them"></p>
10
+
11
+ ---
12
+
13
+ ## Start here
14
+
15
+ ```bash
16
+ pip install quantprobe
17
+ quantprobe auto
18
+ ```
19
+
20
+ That's it — it detects your machine, asks which model you want, and gets you running. No flags to learn.
21
+
22
+ **Just want the number first?** `quantprobe plan --gguf model.gguf` prints your predicted tok/s, whether it fits, and the launch command. Downloads nothing, takes a second. There's also a [browser version](https://federicots.github.io/quantprobe/) with nothing to install.
23
+
24
+ ## The two ways to run a model
25
+
26
+ | | **Fast** — `quantprobe auto qwen3-30b` | **Custom** — `quantprobe auto qwen3-30b --custom` |
27
+ |---|---|---|
28
+ | what it does | picks the best existing quant for *your* machine, downloads it | measures which layers of *your* model break under compression, then builds a version tailored to it |
29
+ | time | minutes (mostly download) | **~50 min for a 7B, ~10 h for a 35B** — it tells you before starting |
30
+ | disk | one file | source + working files, 3–4× bigger |
31
+ | **speed** | full | **identical** — speed comes from placement, not from the build |
32
+ | **quality** | whatever the community published | **−9% perplexity at the same file size** ([measured](preregistrations/2026-07-25-recipe-upgrade-shexp-imatrix.md)) |
33
+
34
+ **Most people want Fast.** Above ~3 bits per weight, community quants are already near-lossless — so `--custom` *refuses to run* on machines that don't need it and explains why. The tool declines to sell you its own product.
35
+
36
+ **Use Custom when** you're squeezing a model that barely fits (under ~3 bits, where ordinary compression falls off a cliff), you have your own fine-tune nobody has published, or you need maximum quality at a fixed size.
37
+
38
+ ## The free speed you probably already have
39
+
40
+ Most guides put *all* of a mixture-of-experts model's experts in system RAM and leave your graphics card half empty. Keeping the first N expert layers on the GPU instead — same file, different flags — measured on the reference box:
41
+
42
+ | | all experts → RAM | **partial offload** |
43
+ |---|---|---|
44
+ | generation | 18.35 tok/s | **20.62 tok/s** (+12.4%) |
45
+ | prompt reading | 88 tok/s | **~238 tok/s** (2–3×) |
46
+
47
+ `plan` and `run` compute the cutoff from your *free* VRAM and emit the exact flags. It costs nothing and needs no new download.
48
+
49
+ *This number was first published as +34.7% and is now corrected downward: that baseline was measured without `--no-mmap`, a flag the tool already recommended, so the control was worse than what a user would actually run. The [correction is published in full](preregistrations/2026-07-26-moe-partial-expert-offload.md#correction-2026-07-26-the-baseline-above-was-mis-configured-and-347-is-overstated) beneath the original — a community report about llama.cpp's `-fit` is what led us to check.*
50
+
51
+ ## The other free win: speculation, if you write code
52
+
53
+ `--spec-type ngram-simple` drafts tokens by finding repeated spans in your own context, then
54
+ verifies them — so output is **identical**, it is one flag, and nothing is downloaded. Measured
55
+ on the same model and box, three runs per cell:
56
+
57
+ | workload | off | ngram on | effect |
58
+ |---|---|---|---|
59
+ | **code** (edit a file, answer restates its input) | 17.72 | **37.17** | **2.10× — decode doubles** |
60
+ | prose (open-ended continuation) | 18.46 | 18.56 | 1.01× — nothing |
61
+ | code, but **MoE with experts in RAM** | 18.18 | 18.81 | 1.03× — the union tax eats it |
62
+
63
+ Copyability is the whole mechanism: code answers repeat their input, prose invents. So turn it on
64
+ for coding work on a **dense** model; skip it for prose, and skip it for MoE with offloaded
65
+ experts. ([staked before measuring](preregistrations/2026-07-24-law6-speculation-economics.md) —
66
+ the code result came in *above* my staked ceiling, which still scores as a miss.)
67
+
68
+ ## Measured results
69
+
70
+ | result | number |
71
+ |---|---|
72
+ | Qwen3-30B-A3B on the 2016 desktop | **19.3 tok/s** — *predicted 19 before measuring* |
73
+ | Same model, partial expert offload | **20.62 tok/s**, +12.4% for free (corrected from a first-published +34.7%) |
74
+ | Same bytes, different layers (Gemma 4 12B) | **byte-identical files, 2.25 ppl apart** |
75
+ | Gemma 4 12B depth-aware 2-bit | 1.91× → **1.45×** quality cost, ~4.5 GB resident |
76
+ | GLM-4.5-Air **110B** from a SATA drive, 16 GB RAM | 0.19 tok/s — inside the pre-registered 0.2–0.3 band |
77
+ | RAM overclock (XMP, 2133→3000) | dense **+52%**, pre-registered ×1.41+ |
78
+
79
+ <p align="center"><img src="weights/data/validation_19tok/live_run_20tps.png" width="880" alt="One frame: Task Manager showing 16 GB DDR4-3000 and the GTX 1060 6GB beside llama.cpp chatting Qwen3-30B-A3B live at 20.4 tok/s generation"></p>
80
+ <p align="center"><em>One frame, no cuts: Task Manager beside llama.cpp chatting Qwen3-30B-A3B at <b>20.4 tok/s</b> — above the pre-registered 19. Raw logs + GGUF SHA256: <a href="weights/data/validation_19tok/EVIDENCE.txt">EVIDENCE.txt</a>.</em></p>
81
+
82
+ ## Why you can trust the numbers
83
+
84
+ Most benchmark posts report what happened. **I write the prediction down first, publish it, then run the hardware** — and publish the misses just as loudly.
85
+
86
+ | predicted (first) | measured (after) |
87
+ |---|---|
88
+ | 110B streamed from SATA: **0.2–0.3 tok/s** | **0.19** |
89
+ | RAM overclock scales decode **×1.41+** | **×1.52** |
90
+ | 30B hybrid placement: **~19 tok/s** | **19.30 ± 0.88** |
91
+ | a day-old 118B streamed from SATA: **0.2–0.4** | **0.38 ± 0.17** |
92
+
93
+ **The misses are the point.** A few that are published in full:
94
+
95
+ - **I benchmarked my recipe against a competitor's and lost** ([#11](preregistrations/2026-07-25-apex-vs-probe-depthaware.md), +8.9% worse). It exposed two real bugs in mine. Fixed them ([#12](preregistrations/2026-07-25-recipe-upgrade-shexp-imatrix.md)), then ran a *fair* rematch on data neither side calibrated for — [predicting I'd lose again](preregistrations/2026-07-26-apex-rematch-ood-kl.md). I won: 26% better KL divergence. Two of four stakes missed **in my favour**, still recorded as misses.
96
+ - **I retracted a headline finding within the hour** when my own audit showed it was a measurement artifact — then reproduced the artifact deliberately to prove the cause ([Law 5 ledger](weights/LAW5_PROTOCOL.md)).
97
+ - **This tool told users a probe takes "30–60 minutes."** It takes 5h40m on a 35 GB model. That was my unmeasured claim, and [v1.9.0](CHANGELOG.md) replaced it with a derived estimate, a live ETA, and a confirmation prompt.
98
+
99
+ Plus a **byte-identical control** (two same-size files, 2.25 ppl apart — only placement differs), a full claim → script → log manifest, and **documented dead ends** (dynamic top-k, semantic paging, self-speculation — all measured-dead, because a law you only confirm is a law you haven't tested).
100
+
101
+ ## The four laws, in one line each
102
+
103
+ Full statements with measurements and falsifiable predictions in **[LAWS.md](LAWS.md)**.
104
+
105
+ 1. **Rotation is rank-conditional.** The standard trick behind modern quantization helps full-rank tensors and destroys low-rank bottlenecks — a ~270,000× swing.
106
+ 2. **Trained networks are dense everywhere.** No free lunch left in the weights: **2-bit is the data-free floor.**
107
+ 3. **Fragility is measurable, not predictable.** Gemma breaks late, Mistral breaks early — architectural near-twins pointing opposite ways. Only a functional probe decides.
108
+ 4. **The tiered decode law.** `tok/s = η(tier) × bandwidth ÷ active-bytes-per-token`. This is the equation that predicts your speed before you download.
109
+
110
+ <p align="center"><img src="weights/data/x_chart_E_scalinglaw.png" width="700" alt="One scaling law, 7B to 744B, predicted vs measured"></p>
111
+
112
+ ## All eleven commands
113
+
114
+ ```bash
115
+ quantprobe auto # interactive: detects, asks, decides, runs
116
+ quantprobe auto qwen3-30b --custom --run # the full custom pipeline, end to end
117
+ quantprobe hw # what the law sees on THIS machine
118
+ quantprobe plan --gguf model.gguf # predicted tok/s + placement + launch command
119
+ quantprobe optimize --tps 20 # cheapest path to a speed target, Pareto-ranked
120
+ quantprobe target --tps 5 --ladder # inverse: target -> smartest model that fits
121
+ quantprobe fetch qwen3-30b ./models # robust, resumable download
122
+ quantprobe quantize --gguf f16.gguf --out 2bit.gguf # build a depth-aware quant
123
+ quantprobe probe --gguf f16.gguf --eval wiki.test.raw # measure YOUR model's fragile band
124
+ quantprobe run --gguf 2bit.gguf # plan the placement, then launch chat
125
+ quantprobe bench --gguf 2bit.gguf --contribute # predicted vs measured; opt-in datapoint
126
+ quantprobe dashboard --gguf 2bit.gguf # the law live, every reply scored vs prediction
127
+ ```
128
+
129
+ `hw`/`plan`/`target`/`optimize` need nothing but Python. The weight-touching commands drive stock [llama.cpp](https://github.com/ggml-org/llama.cpp/releases) — point at it with `--llama-dir`, `QUANTPROBE_LLAMA_DIR`, or `PATH`, and preview anything with `--dry`. 16 machine presets ship in (`--machine`); multi-GPU and RAID aggregate with comma lists (`--vram 24,24`).
130
+
131
+ > **Windows: `'quantprobe' is not recognized`?** pip put it in a folder that isn't on your PATH. Use `python -m quantprobe ...` — identical, always works.
132
+
133
+ ## Help grow the law
134
+
135
+ `quantprobe bench --contribute` prints exactly what would be shared plus a pre-filled issue link — **you review and submit; nothing is ever sent automatically.** Points that land *outside* the predicted bands are the most valuable ones. Open predictions anyone can settle: [preregistrations/](preregistrations/) — including [Law 6, staked before launch](preregistrations/2026-07-24-law6-speculation-economics.md) and scored in public during launch week.
136
+
137
+ ## Deep dives
138
+
139
+ | | |
140
+ |---|---|
141
+ | [QUICKSTART.md](QUICKSTART.md) | get running, three levels; recipes for fine-tunes, coding agents, hardware buying |
142
+ | [LAWS.md](LAWS.md) | the four laws — statements, measurements, falsifiable predictions |
143
+ | [docs/EXAMPLES.md](docs/EXAMPLES.md) | worked examples with real output, including the ×5.4 optimizer A/B |
144
+ | [docs/HARDWARE.md](docs/HARDWARE.md) | the 2016 box: exact specs, measured bandwidths, what the next euro buys |
145
+ | [docs/DEEP-DIVE.md](docs/DEEP-DIVE.md) | what's new vs. built-on, parity tables, and the **repository map** (this repo also holds the earlier research spike that led here) |
146
+ | [papers/arxiv/](papers/arxiv/) | the paper (submission-ready LaTeX) |
147
+ | [preregistrations/](preregistrations/) | every staked prediction with its verdict — hits **and** misses |
148
+ | [weights/LAW5_PROTOCOL.md](weights/LAW5_PROTOCOL.md) | the live Law-5 research ledger, including the retraction |
149
+ | [CHANGELOG.md](CHANGELOG.md) | every release |
150
+
151
+ ## Honest limitations
152
+
153
+ - Perplexity and KL divergence are my metrics; I haven't run task-level evals (MMLU/HellaSwag) yet.
154
+ - The fragility atlas covers four model families — enough to *disprove* universality, not to chart every architecture.
155
+ - 0.19 tok/s for a 110B is a **capacity demonstration, not usable inference.**
156
+ - **Multi-token prediction (MTP) is not the 2x everyone quotes — measured.** Toggled on the same file and server: **dense GPU-resident +17%, dense on CPU +4.6%, MoE with experts in RAM −24%.** Turn it on if your model is GPU-resident; turn it **off** for MoE with offloaded experts. The one large number we found (1.94x) came from a model that was *spilling VRAM* — MTP rescuing it from paging, not a general property. We do not model it in the planner because there is no single multiplier to apply. ([full 2x2, and all four of my magnitude predictions missed high](preregistrations/2026-07-24-law6-speculation-economics.md))
157
+ - Speed numbers are single-stream decode on one machine (±25% across environments); the η values are fitted, not derived.
158
+ - No custom runtime: everything rides stock llama.cpp.
159
+
160
+ ## Credits
161
+
162
+ [colibri](https://github.com/JustVugg/colibri) (744B on 25 GB, pure C) inspired the tier-streaming exploration. The quantization stack builds on [llama.cpp](https://github.com/ggml-org/llama.cpp) and the QTIP/QuIP# incoherence codecs — whose central tool our first law bounds. Independent research by Federico Sciuca, AI-supported, on one desktop.
163
+
164
+ Two community contributions changed the tool measurably: **u/RogerAI--fyi** (Reddit) observed that the Law 4 formulation omitted per-token KV reads — measured, confirmed, shipped within a day. **u/MoneroApe** pointed me at [apex-quant](https://github.com/localai-org/apex-quant) and TurboQuant, and testing against **mudler's APEX** exposed two real gaps in my recipe: unprotected always-active tensors (their kurtosis argument, adopted here) and no importance-matrix calibration at all. The head-to-head and its scope limits are published in full, loss first.
165
+
166
+ ## License
167
+
168
+ MIT — see [LICENSE](LICENSE). © 2026 Federico Sciuca.
@@ -1,31 +1,31 @@
1
- [build-system]
2
- requires = ["setuptools>=68"]
3
- build-backend = "setuptools.build_meta"
4
-
5
- [project]
6
- name = "quantprobe"
7
- version = "1.10.4"
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
- readme = "README.md"
10
- license = { text = "MIT" }
11
- authors = [{ name = "Federico Sciuca" }]
12
- requires-python = ">=3.9"
13
- dependencies = ["gguf>=0.9", "requests>=2.28"]
14
- keywords = ["llm", "quantization", "llama.cpp", "gguf", "inference", "moe"]
15
- classifiers = [
16
- "License :: OSI Approved :: MIT License",
17
- "Programming Language :: Python :: 3",
18
- "Topic :: Scientific/Engineering :: Artificial Intelligence",
19
- ]
20
-
21
- [project.urls]
22
- Homepage = "https://github.com/FedericoTs/quantprobe"
23
-
24
- [project.scripts]
25
- quantprobe = "quantprobe.cli:main"
26
-
27
- [tool.setuptools]
28
- packages = ["quantprobe"]
29
-
30
- [tool.setuptools.package-data]
31
- quantprobe = ["recipes/*.json"]
1
+ [build-system]
2
+ requires = ["setuptools>=68"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "quantprobe"
7
+ version = "1.11.0"
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
+ readme = "README.md"
10
+ license = { text = "MIT" }
11
+ authors = [{ name = "Federico Sciuca" }]
12
+ requires-python = ">=3.9"
13
+ dependencies = ["gguf>=0.9", "requests>=2.28"]
14
+ keywords = ["llm", "quantization", "llama.cpp", "gguf", "inference", "moe"]
15
+ classifiers = [
16
+ "License :: OSI Approved :: MIT License",
17
+ "Programming Language :: Python :: 3",
18
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
19
+ ]
20
+
21
+ [project.urls]
22
+ Homepage = "https://github.com/FedericoTs/quantprobe"
23
+
24
+ [project.scripts]
25
+ quantprobe = "quantprobe.cli:main"
26
+
27
+ [tool.setuptools]
28
+ packages = ["quantprobe"]
29
+
30
+ [tool.setuptools.package-data]
31
+ quantprobe = ["recipes/*.json"]
@@ -0,0 +1,11 @@
1
+ """quantprobe - probe-then-quantize for LLMs on commodity hardware.
2
+
3
+ Three commands, all grounded in measured laws (see LAWS.md in the repo):
4
+ quantprobe probe - measure a GGUF's depth-fragility curve, emit the depth-aware recipe (Law 3)
5
+ quantprobe plan - evaluate every bit/tier placement for a model on your machine, predict tok/s (Law 4)
6
+ quantprobe fetch - robust HuggingFace downloader (Range-resume, retry)
7
+
8
+ Every constant in `plan` is fitted from measurements published in the repo, including two
9
+ pre-registered hardware predictions confirmed within 8%.
10
+ """
11
+ __version__ = "1.11.0"
@@ -1,9 +1,9 @@
1
- """`python -m quantprobe` — identical to the `quantprobe` console script.
2
-
3
- The PATH-proof entry point: on Windows, `pip install` often lands the .exe in a
4
- user-site Scripts folder that is not on PATH; this always works regardless.
5
- """
6
- from .cli import main
7
-
8
- if __name__ == "__main__":
9
- main()
1
+ """`python -m quantprobe` - identical to the `quantprobe` console script.
2
+
3
+ The PATH-proof entry point: on Windows, `pip install` often lands the .exe in a
4
+ user-site Scripts folder that is not on PATH; this always works regardless.
5
+ """
6
+ from .cli import main
7
+
8
+ if __name__ == "__main__":
9
+ main()