quantprobe 1.11.0__tar.gz → 1.11.2__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.
- quantprobe-1.11.2/PKG-INFO +181 -0
- quantprobe-1.11.2/README.md +163 -0
- {quantprobe-1.11.0 → quantprobe-1.11.2}/pyproject.toml +1 -1
- {quantprobe-1.11.0 → quantprobe-1.11.2}/quantprobe/__init__.py +1 -1
- {quantprobe-1.11.0 → quantprobe-1.11.2}/quantprobe/auto.py +10 -1
- {quantprobe-1.11.0 → quantprobe-1.11.2}/quantprobe/optimize.py +12 -7
- {quantprobe-1.11.0 → quantprobe-1.11.2}/quantprobe/plan.py +63 -18
- {quantprobe-1.11.0 → quantprobe-1.11.2}/quantprobe/runtime.py +213 -213
- quantprobe-1.11.2/quantprobe.egg-info/PKG-INFO +181 -0
- quantprobe-1.11.0/PKG-INFO +0 -186
- quantprobe-1.11.0/README.md +0 -168
- quantprobe-1.11.0/quantprobe.egg-info/PKG-INFO +0 -186
- {quantprobe-1.11.0 → quantprobe-1.11.2}/LICENSE +0 -0
- {quantprobe-1.11.0 → quantprobe-1.11.2}/quantprobe/__main__.py +0 -0
- {quantprobe-1.11.0 → quantprobe-1.11.2}/quantprobe/cli.py +0 -0
- {quantprobe-1.11.0 → quantprobe-1.11.2}/quantprobe/dashboard.py +0 -0
- {quantprobe-1.11.0 → quantprobe-1.11.2}/quantprobe/detect.py +0 -0
- {quantprobe-1.11.0 → quantprobe-1.11.2}/quantprobe/fetch.py +0 -0
- {quantprobe-1.11.0 → quantprobe-1.11.2}/quantprobe/probe.py +0 -0
- {quantprobe-1.11.0 → quantprobe-1.11.2}/quantprobe/recipes/mistral-7b.json +0 -0
- {quantprobe-1.11.0 → quantprobe-1.11.2}/quantprobe/recipes/qwen2.5-7b.json +0 -0
- {quantprobe-1.11.0 → quantprobe-1.11.2}/quantprobe/recipes/qwen3-30b.json +0 -0
- {quantprobe-1.11.0 → quantprobe-1.11.2}/quantprobe/recipes/qwen3.5-35b.json +0 -0
- {quantprobe-1.11.0 → quantprobe-1.11.2}/quantprobe/recipes.py +0 -0
- {quantprobe-1.11.0 → quantprobe-1.11.2}/quantprobe/spec.py +0 -0
- {quantprobe-1.11.0 → quantprobe-1.11.2}/quantprobe/target.py +0 -0
- {quantprobe-1.11.0 → quantprobe-1.11.2}/quantprobe.egg-info/SOURCES.txt +0 -0
- {quantprobe-1.11.0 → quantprobe-1.11.2}/quantprobe.egg-info/dependency_links.txt +0 -0
- {quantprobe-1.11.0 → quantprobe-1.11.2}/quantprobe.egg-info/entry_points.txt +0 -0
- {quantprobe-1.11.0 → quantprobe-1.11.2}/quantprobe.egg-info/requires.txt +0 -0
- {quantprobe-1.11.0 → quantprobe-1.11.2}/quantprobe.egg-info/top_level.txt +0 -0
- {quantprobe-1.11.0 → quantprobe-1.11.2}/setup.cfg +0 -0
- {quantprobe-1.11.0 → quantprobe-1.11.2}/tests/test_engine.py +0 -0
- {quantprobe-1.11.0 → quantprobe-1.11.2}/tests/test_evaluator.py +0 -0
- {quantprobe-1.11.0 → quantprobe-1.11.2}/tests/test_pipeline.py +0 -0
- {quantprobe-1.11.0 → quantprobe-1.11.2}/tests/test_transforms.py +0 -0
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: quantprobe
|
|
3
|
+
Version: 1.11.2
|
|
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
|
+
Predicts how fast an LLM will run on your machine — **before you download it** — then hands you the exact llama.cpp command. If nothing fits well enough, it builds a quantization tuned to your specific model and hardware.
|
|
22
|
+
|
|
23
|
+
[**Quickstart**](#quickstart) · [**Browser version**](https://federicots.github.io/quantprobe/) · [**Commands**](#commands) · [**The laws**](LAWS.md) · [**When it won't help**](#when-quantprobe-wont-help-you)
|
|
24
|
+
|
|
25
|
+
    [](https://x.com/federico_sciuca)
|
|
26
|
+
|
|
27
|
+
## Quickstart
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pip install quantprobe
|
|
31
|
+
quantprobe plan --model qwen3-30b --bits 2.95
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
[quantprobe] no hardware flags: auto-detected this machine (vram 6GB@192 | ram 16GB@48 | disk 0.5 GB/s).
|
|
36
|
+
|
|
37
|
+
quantprobe plan - Qwen3-30B-A3B @ 2.95-bit on THIS machine [auto-detected]
|
|
38
|
+
model 12.4 GB | active 1.67 GB/token | est. quality cost x1.05 (depth-aware recipe)
|
|
39
|
+
|
|
40
|
+
* 18.9 tok/s split experts: 21%->VRAM, rest->RAM
|
|
41
|
+
18.4 tok/s stream from disk (VRAM+RAM expert cache) [needs an expert-caching runtime]
|
|
42
|
+
16.6 tok/s hybrid: attention->VRAM, experts->RAM [RAM boundary - needs --no-mmap]
|
|
43
|
+
3.0 tok/s stream from disk (cold experts) [exceeds RAM - capacity demo]
|
|
44
|
+
|
|
45
|
+
run it: llama-server -m model.gguf -ngl 99 -ot "blk\.(10|11|…|47)\.ffn_.*_exps\.=CPU" --no-mmap
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**Downloads nothing. Takes a second.** No hardware flags needed — it reads your machine. `--model` and `--bits` just say what you're considering; point it at a file you already have with `--gguf model.gguf` instead.
|
|
49
|
+
|
|
50
|
+
Want it to do the whole thing for you?
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
quantprobe auto
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Detects your machine, asks which model you want, picks the best quant for it, downloads it, and launches. No flags to learn.
|
|
57
|
+
|
|
58
|
+
## What it does
|
|
59
|
+
|
|
60
|
+
- **Predicts tok/s before you download** — across every placement (all-VRAM, hybrid, expert-split, CPU, disk-stream) and picks the winner.
|
|
61
|
+
- **Emits the exact command**, including the `-ot` regex most guides get wrong.
|
|
62
|
+
- **Finds free speed in what you already have** — [partial expert offload](#free-speed-you-probably-already-have) and [prompt-lookup speculation](#free-speed-part-two-if-you-write-code) need no new download.
|
|
63
|
+
- **Measures which layers of *your* model break** under compression, then builds a quant that protects them.
|
|
64
|
+
- **Tells you when to stop** — it declines the expensive path on machines that don't need it.
|
|
65
|
+
- Runs on stock [llama.cpp](https://github.com/ggml-org/llama.cpp). No custom runtime, nothing to build.
|
|
66
|
+
|
|
67
|
+
## Fast vs Custom
|
|
68
|
+
|
|
69
|
+
| | **Fast** — `quantprobe auto qwen3-30b` | **Custom** — `quantprobe auto qwen3-30b --custom` |
|
|
70
|
+
|---|---|---|
|
|
71
|
+
| 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 |
|
|
72
|
+
| time | minutes (mostly download) | **~50 min for a 7B, ~10 h for a 35B** — it tells you before starting |
|
|
73
|
+
| disk | one file | source + working files, 3–4× bigger |
|
|
74
|
+
| **speed** | full | **identical** — speed comes from placement, not from the build |
|
|
75
|
+
| **quality** | whatever the community published | **−9% perplexity at the same file size** |
|
|
76
|
+
|
|
77
|
+
**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 says why. Reach for Custom when you're squeezing a model that barely fits (under ~3 bits, where ordinary compression falls off a cliff), when you have a fine-tune nobody has published, or when you need maximum quality at a fixed size.
|
|
78
|
+
|
|
79
|
+
## Free speed you probably already have
|
|
80
|
+
|
|
81
|
+
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:
|
|
82
|
+
|
|
83
|
+
| | all experts → RAM | **partial offload** |
|
|
84
|
+
|---|---|---|
|
|
85
|
+
| generation | 18.35 tok/s | **20.62 tok/s** (+12.4%) |
|
|
86
|
+
| prompt reading | 88 tok/s | **~238 tok/s** (2–3×) |
|
|
87
|
+
|
|
88
|
+
`plan` and `run` compute the cutoff from your *free* VRAM and emit the flags.
|
|
89
|
+
|
|
90
|
+
## Free speed, part two: if you write code
|
|
91
|
+
|
|
92
|
+
`--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.
|
|
93
|
+
|
|
94
|
+
| workload | off | ngram on | effect |
|
|
95
|
+
|---|---|---|---|
|
|
96
|
+
| **code** (edit a file, answer restates its input) | 17.72 | **37.17** | **2.10× — decode doubles** |
|
|
97
|
+
| prose (open-ended continuation) | 18.46 | 18.56 | 1.01× — nothing |
|
|
98
|
+
| code, but **MoE with experts in RAM** | 18.18 | 18.81 | 1.03× — the union tax eats it |
|
|
99
|
+
|
|
100
|
+
Copyability is the whole mechanism: code answers repeat their input, prose invents. Turn it on for coding work on a **dense** model; skip it otherwise.
|
|
101
|
+
|
|
102
|
+
## Measured results
|
|
103
|
+
|
|
104
|
+
| result | number |
|
|
105
|
+
|---|---|
|
|
106
|
+
| Qwen3-30B-A3B on a 2016 desktop | **19.3 tok/s** |
|
|
107
|
+
| Same model, partial expert offload | **20.62 tok/s** (+12.4%, free) |
|
|
108
|
+
| Same bytes, different layers protected (Gemma 4 12B) | **byte-identical files, 2.25 ppl apart** |
|
|
109
|
+
| Gemma 4 12B depth-aware 2-bit | 1.91× → **1.45×** quality cost, ~4.5 GB resident |
|
|
110
|
+
| GLM-4.5-Air **110B** from a SATA drive, 16 GB RAM | **0.19 tok/s** (capacity demo, not usable inference) |
|
|
111
|
+
| RAM overclock (XMP, 2133→3000) | dense **+52%** |
|
|
112
|
+
|
|
113
|
+
<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>
|
|
114
|
+
<p align="center"><em>One frame, no cuts: Qwen3-30B-A3B at <b>20.4 tok/s</b> on a 2016 desktop — GTX 1060 6 GB · 16 GB DDR4 · SATA SSD. Raw logs + GGUF SHA256: <a href="weights/data/validation_19tok/EVIDENCE.txt">EVIDENCE.txt</a>.</em></p>
|
|
115
|
+
|
|
116
|
+
**Every number above was written down as a prediction, published, and only then measured** — including the ones that missed. [All predictions and their verdicts →](preregistrations/) · [the four laws behind them →](LAWS.md)
|
|
117
|
+
|
|
118
|
+
## When quantprobe won't help you
|
|
119
|
+
|
|
120
|
+
- **Your model already fits comfortably in VRAM at 4 bits or more.** Community quants are near-lossless there, and — measured — quantizing further buys almost no speed once a model is resident: the same 7B at Q2_K vs Q4_K_M is 36% smaller and **4% slower**. Quantize to make a model *fit*; once it fits, stop.
|
|
121
|
+
- **You want a tight number for a model that fits entirely in VRAM.** This is the placement the law knows least well: across all seven models measured there, the real speed came in **faster than predicted every time — by 2% to 67%.** Read that row as a floor, not a ceiling. Seven points on one GPU don't identify a better formula, and we'd rather say so than move a constant on thin evidence. **This is the single most useful thing you can send us:** `quantprobe bench --contribute` on a GPU-resident model turns your machine into the datapoint that fixes it.
|
|
122
|
+
- **You need task-level eval scores** (MMLU, HellaSwag). quantprobe measures perplexity and KL divergence only.
|
|
123
|
+
- **Your architecture isn't in the fragility atlas** (four families so far). The probe still works on your model; the published priors just won't apply. *Open an issue with your result — those are the most valuable datapoints.*
|
|
124
|
+
- **You want multi-token prediction modeled in the planner.** It isn't. Measured, the effect runs from **+17% (dense, GPU-resident) to −24% (MoE, experts in RAM)** — there's no single multiplier to apply. [Full 2×2 →](preregistrations/2026-07-24-law6-speculation-economics.md)
|
|
125
|
+
- **You're on a Mac or a 50-series card.** Those presets are extrapolated, not measured. `quantprobe bench --contribute` turns one into a datapoint.
|
|
126
|
+
- **You need throughput numbers.** Everything here is single-stream decode on one machine; expect ±25% across environments.
|
|
127
|
+
|
|
128
|
+
## Commands
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
quantprobe auto # interactive: detects, asks, decides, runs
|
|
132
|
+
quantprobe plan --gguf model.gguf # predicted tok/s + placement + launch command
|
|
133
|
+
quantprobe hw # what the law sees on THIS machine
|
|
134
|
+
quantprobe run --gguf model.gguf # plan the placement, then launch chat
|
|
135
|
+
quantprobe bench --gguf model.gguf --contribute # predicted vs measured; opt-in datapoint
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
<details>
|
|
139
|
+
<summary>Six more: optimize, target, fetch, quantize, probe, dashboard</summary>
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
quantprobe optimize --tps 20 # cheapest path to a speed target, Pareto-ranked
|
|
143
|
+
quantprobe target --tps 5 --ladder # inverse: target -> smartest model that fits
|
|
144
|
+
quantprobe fetch qwen3-30b ./models # robust, resumable download
|
|
145
|
+
quantprobe quantize --gguf f16.gguf --out 2bit.gguf # build a depth-aware quant
|
|
146
|
+
quantprobe probe --gguf f16.gguf --eval wiki.test.raw # measure YOUR model's fragile band
|
|
147
|
+
quantprobe dashboard --gguf 2bit.gguf # the law live, every reply scored vs prediction
|
|
148
|
+
```
|
|
149
|
+
</details>
|
|
150
|
+
|
|
151
|
+
`hw`/`plan`/`target`/`optimize` need nothing but Python. The weight-touching commands drive stock llama.cpp — point at it with `--llama-dir`, `QUANTPROBE_LLAMA_DIR`, or `PATH`, and preview anything with `--dry`. 17 machine presets ship in (`--machine`); multi-GPU and RAID aggregate with comma lists (`--vram 24,24`).
|
|
152
|
+
|
|
153
|
+
> **Windows: `'quantprobe' is not recognized`?** pip put it in a folder that isn't on your PATH. Use `python -m quantprobe ...` — identical, always works.
|
|
154
|
+
|
|
155
|
+
## Contributing
|
|
156
|
+
|
|
157
|
+
`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, and there are [open predictions](preregistrations/) anyone can settle.
|
|
158
|
+
|
|
159
|
+
## Docs
|
|
160
|
+
|
|
161
|
+
| | |
|
|
162
|
+
|---|---|
|
|
163
|
+
| [QUICKSTART.md](QUICKSTART.md) | get running, three levels; recipes for fine-tunes, coding agents, hardware buying |
|
|
164
|
+
| [LAWS.md](LAWS.md) | the four laws — statements, measurements, falsifiable predictions |
|
|
165
|
+
| [docs/EXAMPLES.md](docs/EXAMPLES.md) | worked examples with real output, including the ×5.4 optimizer A/B |
|
|
166
|
+
| [docs/HARDWARE.md](docs/HARDWARE.md) | the 2016 box: exact specs, measured bandwidths, what the next euro buys |
|
|
167
|
+
| [preregistrations/](preregistrations/) | every staked prediction with its verdict — hits **and** misses |
|
|
168
|
+
| [CONTRIBUTING.md](CONTRIBUTING.md) | the method: stake, measure, score *and wire*, audit |
|
|
169
|
+
| [docs/DEEP-DIVE.md](docs/DEEP-DIVE.md) | what's new vs. built-on, parity tables, and the repository map |
|
|
170
|
+
| [papers/arxiv/](papers/arxiv/) | the paper (submission-ready LaTeX) |
|
|
171
|
+
| [CHANGELOG.md](CHANGELOG.md) | every release, including corrections to numbers published here |
|
|
172
|
+
|
|
173
|
+
## Credits
|
|
174
|
+
|
|
175
|
+
[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.
|
|
176
|
+
|
|
177
|
+
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.
|
|
178
|
+
|
|
179
|
+
## License
|
|
180
|
+
|
|
181
|
+
MIT — see [LICENSE](LICENSE). © 2026 Federico Sciuca.
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# quantprobe
|
|
2
|
+
|
|
3
|
+
Predicts how fast an LLM will run on your machine — **before you download it** — then hands you the exact llama.cpp command. If nothing fits well enough, it builds a quantization tuned to your specific model and hardware.
|
|
4
|
+
|
|
5
|
+
[**Quickstart**](#quickstart) · [**Browser version**](https://federicots.github.io/quantprobe/) · [**Commands**](#commands) · [**The laws**](LAWS.md) · [**When it won't help**](#when-quantprobe-wont-help-you)
|
|
6
|
+
|
|
7
|
+
    [](https://x.com/federico_sciuca)
|
|
8
|
+
|
|
9
|
+
## Quickstart
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pip install quantprobe
|
|
13
|
+
quantprobe plan --model qwen3-30b --bits 2.95
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
[quantprobe] no hardware flags: auto-detected this machine (vram 6GB@192 | ram 16GB@48 | disk 0.5 GB/s).
|
|
18
|
+
|
|
19
|
+
quantprobe plan - Qwen3-30B-A3B @ 2.95-bit on THIS machine [auto-detected]
|
|
20
|
+
model 12.4 GB | active 1.67 GB/token | est. quality cost x1.05 (depth-aware recipe)
|
|
21
|
+
|
|
22
|
+
* 18.9 tok/s split experts: 21%->VRAM, rest->RAM
|
|
23
|
+
18.4 tok/s stream from disk (VRAM+RAM expert cache) [needs an expert-caching runtime]
|
|
24
|
+
16.6 tok/s hybrid: attention->VRAM, experts->RAM [RAM boundary - needs --no-mmap]
|
|
25
|
+
3.0 tok/s stream from disk (cold experts) [exceeds RAM - capacity demo]
|
|
26
|
+
|
|
27
|
+
run it: llama-server -m model.gguf -ngl 99 -ot "blk\.(10|11|…|47)\.ffn_.*_exps\.=CPU" --no-mmap
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**Downloads nothing. Takes a second.** No hardware flags needed — it reads your machine. `--model` and `--bits` just say what you're considering; point it at a file you already have with `--gguf model.gguf` instead.
|
|
31
|
+
|
|
32
|
+
Want it to do the whole thing for you?
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
quantprobe auto
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Detects your machine, asks which model you want, picks the best quant for it, downloads it, and launches. No flags to learn.
|
|
39
|
+
|
|
40
|
+
## What it does
|
|
41
|
+
|
|
42
|
+
- **Predicts tok/s before you download** — across every placement (all-VRAM, hybrid, expert-split, CPU, disk-stream) and picks the winner.
|
|
43
|
+
- **Emits the exact command**, including the `-ot` regex most guides get wrong.
|
|
44
|
+
- **Finds free speed in what you already have** — [partial expert offload](#free-speed-you-probably-already-have) and [prompt-lookup speculation](#free-speed-part-two-if-you-write-code) need no new download.
|
|
45
|
+
- **Measures which layers of *your* model break** under compression, then builds a quant that protects them.
|
|
46
|
+
- **Tells you when to stop** — it declines the expensive path on machines that don't need it.
|
|
47
|
+
- Runs on stock [llama.cpp](https://github.com/ggml-org/llama.cpp). No custom runtime, nothing to build.
|
|
48
|
+
|
|
49
|
+
## Fast vs Custom
|
|
50
|
+
|
|
51
|
+
| | **Fast** — `quantprobe auto qwen3-30b` | **Custom** — `quantprobe auto qwen3-30b --custom` |
|
|
52
|
+
|---|---|---|
|
|
53
|
+
| 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 |
|
|
54
|
+
| time | minutes (mostly download) | **~50 min for a 7B, ~10 h for a 35B** — it tells you before starting |
|
|
55
|
+
| disk | one file | source + working files, 3–4× bigger |
|
|
56
|
+
| **speed** | full | **identical** — speed comes from placement, not from the build |
|
|
57
|
+
| **quality** | whatever the community published | **−9% perplexity at the same file size** |
|
|
58
|
+
|
|
59
|
+
**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 says why. Reach for Custom when you're squeezing a model that barely fits (under ~3 bits, where ordinary compression falls off a cliff), when you have a fine-tune nobody has published, or when you need maximum quality at a fixed size.
|
|
60
|
+
|
|
61
|
+
## Free speed you probably already have
|
|
62
|
+
|
|
63
|
+
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:
|
|
64
|
+
|
|
65
|
+
| | all experts → RAM | **partial offload** |
|
|
66
|
+
|---|---|---|
|
|
67
|
+
| generation | 18.35 tok/s | **20.62 tok/s** (+12.4%) |
|
|
68
|
+
| prompt reading | 88 tok/s | **~238 tok/s** (2–3×) |
|
|
69
|
+
|
|
70
|
+
`plan` and `run` compute the cutoff from your *free* VRAM and emit the flags.
|
|
71
|
+
|
|
72
|
+
## Free speed, part two: if you write code
|
|
73
|
+
|
|
74
|
+
`--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.
|
|
75
|
+
|
|
76
|
+
| workload | off | ngram on | effect |
|
|
77
|
+
|---|---|---|---|
|
|
78
|
+
| **code** (edit a file, answer restates its input) | 17.72 | **37.17** | **2.10× — decode doubles** |
|
|
79
|
+
| prose (open-ended continuation) | 18.46 | 18.56 | 1.01× — nothing |
|
|
80
|
+
| code, but **MoE with experts in RAM** | 18.18 | 18.81 | 1.03× — the union tax eats it |
|
|
81
|
+
|
|
82
|
+
Copyability is the whole mechanism: code answers repeat their input, prose invents. Turn it on for coding work on a **dense** model; skip it otherwise.
|
|
83
|
+
|
|
84
|
+
## Measured results
|
|
85
|
+
|
|
86
|
+
| result | number |
|
|
87
|
+
|---|---|
|
|
88
|
+
| Qwen3-30B-A3B on a 2016 desktop | **19.3 tok/s** |
|
|
89
|
+
| Same model, partial expert offload | **20.62 tok/s** (+12.4%, free) |
|
|
90
|
+
| Same bytes, different layers protected (Gemma 4 12B) | **byte-identical files, 2.25 ppl apart** |
|
|
91
|
+
| Gemma 4 12B depth-aware 2-bit | 1.91× → **1.45×** quality cost, ~4.5 GB resident |
|
|
92
|
+
| GLM-4.5-Air **110B** from a SATA drive, 16 GB RAM | **0.19 tok/s** (capacity demo, not usable inference) |
|
|
93
|
+
| RAM overclock (XMP, 2133→3000) | dense **+52%** |
|
|
94
|
+
|
|
95
|
+
<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>
|
|
96
|
+
<p align="center"><em>One frame, no cuts: Qwen3-30B-A3B at <b>20.4 tok/s</b> on a 2016 desktop — GTX 1060 6 GB · 16 GB DDR4 · SATA SSD. Raw logs + GGUF SHA256: <a href="weights/data/validation_19tok/EVIDENCE.txt">EVIDENCE.txt</a>.</em></p>
|
|
97
|
+
|
|
98
|
+
**Every number above was written down as a prediction, published, and only then measured** — including the ones that missed. [All predictions and their verdicts →](preregistrations/) · [the four laws behind them →](LAWS.md)
|
|
99
|
+
|
|
100
|
+
## When quantprobe won't help you
|
|
101
|
+
|
|
102
|
+
- **Your model already fits comfortably in VRAM at 4 bits or more.** Community quants are near-lossless there, and — measured — quantizing further buys almost no speed once a model is resident: the same 7B at Q2_K vs Q4_K_M is 36% smaller and **4% slower**. Quantize to make a model *fit*; once it fits, stop.
|
|
103
|
+
- **You want a tight number for a model that fits entirely in VRAM.** This is the placement the law knows least well: across all seven models measured there, the real speed came in **faster than predicted every time — by 2% to 67%.** Read that row as a floor, not a ceiling. Seven points on one GPU don't identify a better formula, and we'd rather say so than move a constant on thin evidence. **This is the single most useful thing you can send us:** `quantprobe bench --contribute` on a GPU-resident model turns your machine into the datapoint that fixes it.
|
|
104
|
+
- **You need task-level eval scores** (MMLU, HellaSwag). quantprobe measures perplexity and KL divergence only.
|
|
105
|
+
- **Your architecture isn't in the fragility atlas** (four families so far). The probe still works on your model; the published priors just won't apply. *Open an issue with your result — those are the most valuable datapoints.*
|
|
106
|
+
- **You want multi-token prediction modeled in the planner.** It isn't. Measured, the effect runs from **+17% (dense, GPU-resident) to −24% (MoE, experts in RAM)** — there's no single multiplier to apply. [Full 2×2 →](preregistrations/2026-07-24-law6-speculation-economics.md)
|
|
107
|
+
- **You're on a Mac or a 50-series card.** Those presets are extrapolated, not measured. `quantprobe bench --contribute` turns one into a datapoint.
|
|
108
|
+
- **You need throughput numbers.** Everything here is single-stream decode on one machine; expect ±25% across environments.
|
|
109
|
+
|
|
110
|
+
## Commands
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
quantprobe auto # interactive: detects, asks, decides, runs
|
|
114
|
+
quantprobe plan --gguf model.gguf # predicted tok/s + placement + launch command
|
|
115
|
+
quantprobe hw # what the law sees on THIS machine
|
|
116
|
+
quantprobe run --gguf model.gguf # plan the placement, then launch chat
|
|
117
|
+
quantprobe bench --gguf model.gguf --contribute # predicted vs measured; opt-in datapoint
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
<details>
|
|
121
|
+
<summary>Six more: optimize, target, fetch, quantize, probe, dashboard</summary>
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
quantprobe optimize --tps 20 # cheapest path to a speed target, Pareto-ranked
|
|
125
|
+
quantprobe target --tps 5 --ladder # inverse: target -> smartest model that fits
|
|
126
|
+
quantprobe fetch qwen3-30b ./models # robust, resumable download
|
|
127
|
+
quantprobe quantize --gguf f16.gguf --out 2bit.gguf # build a depth-aware quant
|
|
128
|
+
quantprobe probe --gguf f16.gguf --eval wiki.test.raw # measure YOUR model's fragile band
|
|
129
|
+
quantprobe dashboard --gguf 2bit.gguf # the law live, every reply scored vs prediction
|
|
130
|
+
```
|
|
131
|
+
</details>
|
|
132
|
+
|
|
133
|
+
`hw`/`plan`/`target`/`optimize` need nothing but Python. The weight-touching commands drive stock llama.cpp — point at it with `--llama-dir`, `QUANTPROBE_LLAMA_DIR`, or `PATH`, and preview anything with `--dry`. 17 machine presets ship in (`--machine`); multi-GPU and RAID aggregate with comma lists (`--vram 24,24`).
|
|
134
|
+
|
|
135
|
+
> **Windows: `'quantprobe' is not recognized`?** pip put it in a folder that isn't on your PATH. Use `python -m quantprobe ...` — identical, always works.
|
|
136
|
+
|
|
137
|
+
## Contributing
|
|
138
|
+
|
|
139
|
+
`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, and there are [open predictions](preregistrations/) anyone can settle.
|
|
140
|
+
|
|
141
|
+
## Docs
|
|
142
|
+
|
|
143
|
+
| | |
|
|
144
|
+
|---|---|
|
|
145
|
+
| [QUICKSTART.md](QUICKSTART.md) | get running, three levels; recipes for fine-tunes, coding agents, hardware buying |
|
|
146
|
+
| [LAWS.md](LAWS.md) | the four laws — statements, measurements, falsifiable predictions |
|
|
147
|
+
| [docs/EXAMPLES.md](docs/EXAMPLES.md) | worked examples with real output, including the ×5.4 optimizer A/B |
|
|
148
|
+
| [docs/HARDWARE.md](docs/HARDWARE.md) | the 2016 box: exact specs, measured bandwidths, what the next euro buys |
|
|
149
|
+
| [preregistrations/](preregistrations/) | every staked prediction with its verdict — hits **and** misses |
|
|
150
|
+
| [CONTRIBUTING.md](CONTRIBUTING.md) | the method: stake, measure, score *and wire*, audit |
|
|
151
|
+
| [docs/DEEP-DIVE.md](docs/DEEP-DIVE.md) | what's new vs. built-on, parity tables, and the repository map |
|
|
152
|
+
| [papers/arxiv/](papers/arxiv/) | the paper (submission-ready LaTeX) |
|
|
153
|
+
| [CHANGELOG.md](CHANGELOG.md) | every release, including corrections to numbers published here |
|
|
154
|
+
|
|
155
|
+
## Credits
|
|
156
|
+
|
|
157
|
+
[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.
|
|
158
|
+
|
|
159
|
+
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.
|
|
160
|
+
|
|
161
|
+
## License
|
|
162
|
+
|
|
163
|
+
MIT — see [LICENSE](LICENSE). © 2026 Federico Sciuca.
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "quantprobe"
|
|
7
|
-
version = "1.11.
|
|
7
|
+
version = "1.11.2"
|
|
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.11.
|
|
11
|
+
__version__ = "1.11.2"
|
|
@@ -144,6 +144,14 @@ def run(a):
|
|
|
144
144
|
ne = a.always_active or (ac if ac >= t * 0.9 else ac * 0.35)
|
|
145
145
|
moe = ac < t * 0.9
|
|
146
146
|
a.total, a.active, a.always_active, a.model = t, ac, ne, None
|
|
147
|
+
# Setting a.model = None hands the law explicit params instead of a preset name, which also
|
|
148
|
+
# discards the preset's verified layer count - so every downstream reader (optimize's whole
|
|
149
|
+
# frontier included) silently lost the MoE split placement and recommended the slower hybrid.
|
|
150
|
+
# Carry the count forward on `a` at the one point where the preset is still in hand, rather
|
|
151
|
+
# than re-deriving it at each call site. That re-derivation is the bug shape effective_n_layer
|
|
152
|
+
# exists to end.
|
|
153
|
+
if not getattr(a, "n_layer", None):
|
|
154
|
+
a.n_layer = planmod.effective_n_layer(None, target)
|
|
147
155
|
|
|
148
156
|
# 1. what does the optimizer want on THIS machine?
|
|
149
157
|
a.gguf = None
|
|
@@ -164,7 +172,8 @@ def run(a):
|
|
|
164
172
|
if bits < 1.0 or bits > 9:
|
|
165
173
|
continue
|
|
166
174
|
_, _, cfgs = planmod.evaluate(t, ac, ne, moe, bits, vc, vb, rc, rb, db, geta, 1.0, gl,
|
|
167
|
-
ctx=ctx, kvp=kvp,
|
|
175
|
+
ctx=ctx, kvp=kvp,
|
|
176
|
+
n_layer=planmod.effective_n_layer(a, target))
|
|
168
177
|
cfgs = [c for c in cfgs if "expert cache" not in c[0]]
|
|
169
178
|
if not cfgs:
|
|
170
179
|
continue
|
|
@@ -86,7 +86,7 @@ def run(a):
|
|
|
86
86
|
continue
|
|
87
87
|
_, _, cfgs = planmod.evaluate(t * pf, ac, ne, moe, bits, vc, vb, rc2, rb, db2,
|
|
88
88
|
geta, 1.0, gl, ctx=ctx, kvp=kvp * kf,
|
|
89
|
-
n_layer=
|
|
89
|
+
n_layer=planmod.effective_n_layer(a, m))
|
|
90
90
|
if not cfgs:
|
|
91
91
|
continue
|
|
92
92
|
if not getattr(a, "any_runtime", False):
|
|
@@ -135,12 +135,17 @@ def run(a):
|
|
|
135
135
|
# actually does the ranking, so it has to say so too - a warning only one of two commands
|
|
136
136
|
# gives is the inconsistency class that cost us the plan-vs-bench correction.
|
|
137
137
|
roomier = next((r for r in ranked if r["bits"] >= 4.5 and "all in VRAM" in r["desc"]), None)
|
|
138
|
-
if
|
|
139
|
-
print(f"\n note:
|
|
140
|
-
print(f"
|
|
141
|
-
print(f"
|
|
142
|
-
|
|
143
|
-
|
|
138
|
+
if "all in VRAM" in best["desc"]:
|
|
139
|
+
print(f"\n note: all-in-VRAM is the placement our law knows least well. Every model we have")
|
|
140
|
+
print(f" measured there ran FASTER than predicted - by 2% to 67% - so read the speeds above")
|
|
141
|
+
print(f" as a floor, not a ceiling.")
|
|
142
|
+
if roomier and best["bits"] < 4.5:
|
|
143
|
+
print(f" It also already fits, and a lower quant buys almost nothing once it does: the same")
|
|
144
|
+
print(f" 7B at Q2_K vs Q4_K_M is 36% smaller and 4% SLOWER. The honest pick here is")
|
|
145
|
+
print(f" {roomier['bits']:g}-bit (quality x{roomier['q']:.2f}) - same speed in practice, better answers.")
|
|
146
|
+
print(f" We only have one GPU, and one GPU cannot fix this. `quantprobe bench --contribute`")
|
|
147
|
+
print(f" turns your machine into the datapoint that would - you review it before sending, and")
|
|
148
|
+
print(f" results OUTSIDE our predicted band are the most valuable ones we can receive.")
|
|
144
149
|
print(f"\n realize the pick:")
|
|
145
150
|
print(f" quantprobe {REALIZE.get(best['bits'], 'quantize')}")
|
|
146
151
|
print(f" quantprobe run --gguf <the file> ... # launches with: {best['flags']}")
|
|
@@ -81,6 +81,30 @@ QUAL = {True: {2.0: 1.10, 2.5: 1.07, 3.0: 1.05, 4.5: 1.02, 6.5: 1.01, 8.5: 1.00
|
|
|
81
81
|
False: {2.0: 1.45, 2.5: 1.30, 3.0: 1.12, 4.5: 1.03, 6.5: 1.01, 8.5: 1.00}}
|
|
82
82
|
|
|
83
83
|
|
|
84
|
+
def effective_n_layer(args=None, model=None):
|
|
85
|
+
"""THE resolver for "how many layers does this model have". Do not hand-write this again.
|
|
86
|
+
|
|
87
|
+
Precedence: an explicit --n-layer, then a preset's `nl` (verified against a real GGUF).
|
|
88
|
+
Callers that read a GGUF thread the file's own count onto args before calling.
|
|
89
|
+
|
|
90
|
+
This function exists because the fallback was hand-written at each call site and was wrong
|
|
91
|
+
FOUR times: v1.9.0 (target.py), v1.10.5 (runtime.py), and twice more found by auditing for
|
|
92
|
+
the shape - plan's layer-count note, and auto.py, which omitted the preset step entirely and
|
|
93
|
+
so could never offer the MoE split placement for a preset model. Each was fixed where it was
|
|
94
|
+
found; the shape was never fixed. One resolver, one behaviour, one place to be wrong.
|
|
95
|
+
|
|
96
|
+
`model` accepts a MODELS dict or a preset name, so callers can pass whichever they hold.
|
|
97
|
+
"""
|
|
98
|
+
n = getattr(args, "n_layer", None)
|
|
99
|
+
if n:
|
|
100
|
+
return int(n)
|
|
101
|
+
if isinstance(model, str):
|
|
102
|
+
model = MODELS.get(model)
|
|
103
|
+
if isinstance(model, dict) and model.get("nl"):
|
|
104
|
+
return int(model["nl"])
|
|
105
|
+
return None
|
|
106
|
+
|
|
107
|
+
|
|
84
108
|
def moe_split_flags(frac, n_layer):
|
|
85
109
|
"""-ot regex placing the FIRST ceil(frac*L) layers' experts on GPU, the rest on CPU.
|
|
86
110
|
Measured 2026-07-26 (pre-registration #13, corrected): +12.4% decode and ~2-3x prefill
|
|
@@ -97,27 +121,43 @@ def moe_split_flags(frac, n_layer):
|
|
|
97
121
|
|
|
98
122
|
|
|
99
123
|
def fits_in_vram_advice(placement, bits):
|
|
100
|
-
"""
|
|
124
|
+
"""What we know, and admit we don't know, about the all-in-VRAM row.
|
|
125
|
+
|
|
126
|
+
This is the most common configuration for anyone with adequate VRAM, and it is where the law
|
|
127
|
+
is least trustworthy. Two separate facts, both measured, both worth telling the user:
|
|
101
128
|
|
|
102
|
-
The
|
|
103
|
-
|
|
104
|
-
|
|
129
|
+
1. The prediction is CONSERVATIVE here. Across all seven models measured all-in-VRAM on the
|
|
130
|
+
reference box the real speed came in FASTER than predicted every single time, by 2% to
|
|
131
|
+
67%. That is the opposite of the usual failure direction and it is not noise - it is a
|
|
132
|
+
one-directional bias (pre-registration #15, unresolved).
|
|
105
133
|
|
|
106
|
-
|
|
107
|
-
|
|
134
|
+
2. Below 4.5 bits, quantizing further buys almost nothing. Same 7B, same card, only the
|
|
135
|
+
quantization changed (pre-registration #16, r=3):
|
|
136
|
+
Q4_K_M 4.5 bits 4.68 GB 20.03 +/- 0.04 tok/s
|
|
137
|
+
Q2_K 2.8 bits 3.01 GB 19.17 +/- 0.03 tok/s 36% smaller, 4% SLOWER
|
|
138
|
+
Decode here is not bandwidth-bound, so bytes stop predicting speed and the ranking
|
|
139
|
+
over-rewards low bits.
|
|
108
140
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
141
|
+
Why no fix instead of a disclaimer: seven points on ONE GPU do not identify a functional
|
|
142
|
+
form, and the last two times a constant moved on thin evidence it cost a public correction.
|
|
143
|
+
So the honest move is to say what we know, and ask for the datapoint that would settle it -
|
|
144
|
+
which is why this note ends in a request rather than an apology. The regime is pinned by a
|
|
145
|
+
ratchet in the test suite so it can improve but never silently worsen.
|
|
113
146
|
"""
|
|
114
|
-
if placement != "all in VRAM"
|
|
147
|
+
if placement != "all in VRAM":
|
|
115
148
|
return None
|
|
116
|
-
|
|
117
|
-
"
|
|
118
|
-
"
|
|
119
|
-
|
|
120
|
-
|
|
149
|
+
note = ("this is the placement our law knows least well. Every model we have measured "
|
|
150
|
+
"all-in-VRAM ran FASTER than predicted - by 2% to 67% - so treat the number above as "
|
|
151
|
+
"a floor, not a ceiling.")
|
|
152
|
+
if bits < 4.5:
|
|
153
|
+
note += (" It also already fits, and going lower-bit buys almost nothing: the same 7B at "
|
|
154
|
+
"Q2_K vs Q4_K_M is 36% smaller and 4% SLOWER (19.17 vs 20.03 tok/s). Quantize "
|
|
155
|
+
"to make a model FIT - once it fits, take the highest bits that still fit.")
|
|
156
|
+
note += ("\n We only have one GPU, and one GPU cannot fix this. If you run this model, "
|
|
157
|
+
"`quantprobe bench --contribute` turns your machine into the datapoint that does - "
|
|
158
|
+
"it prints exactly what would be shared and you submit it yourself. Results that "
|
|
159
|
+
"land OUTSIDE our predicted band are the most valuable ones we can receive.")
|
|
160
|
+
return note
|
|
121
161
|
|
|
122
162
|
|
|
123
163
|
def speculation_advice(moe, placement):
|
|
@@ -314,7 +354,7 @@ def run(args):
|
|
|
314
354
|
kvp = (args.kv_per_pos * 1024 if getattr(args, "kv_per_pos", None)
|
|
315
355
|
else m.get("kvp", DEFAULT_KVP))
|
|
316
356
|
|
|
317
|
-
nlay =
|
|
357
|
+
nlay = effective_n_layer(args, m)
|
|
318
358
|
import os as _os
|
|
319
359
|
_g = getattr(args, 'gguf', None)
|
|
320
360
|
true_size = _os.path.getsize(_g) / 1e9 if _g and _os.path.isfile(_g) else None
|
|
@@ -369,7 +409,12 @@ def run(args):
|
|
|
369
409
|
print(f" tier-boundary advisor: this config is {gap:.1f} GB over the {tier_name} boundary - "
|
|
370
410
|
f"shave it ({lever}) -> ~{promoted[0][1]:.1f} tok/s (x{promoted[0][1]/best[1]:.1f})")
|
|
371
411
|
break # nearest boundary only
|
|
372
|
-
|
|
412
|
+
# Fires only when the layer count is genuinely unknown. It used to test args.n_layer - the raw
|
|
413
|
+
# CLI flag - and so told users to "re-run with --gguf to unlock it" while the exact -ot flags
|
|
414
|
+
# for layers 10-47 sat printed directly above, because presets supply `nl` through the same
|
|
415
|
+
# fallback the placement rows already use. Same class as the v1.10.5 n_layer divergence: a
|
|
416
|
+
# second reader of a value that has a fallback, written without the fallback.
|
|
417
|
+
if moe and vc > 0 and not nlay:
|
|
373
418
|
print("\n note: MoE partial expert offload (measured +12.4% decode, ~2-3x prefill) needs this\n"
|
|
374
419
|
" model's layer count to emit exact -ot flags - re-run with --gguf <file> to unlock it.")
|
|
375
420
|
print("\n (eta bands fitted from published measurements; estimates +/-25%. "
|