quantprobe 1.20.2__tar.gz → 1.22.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.
- {quantprobe-1.20.2/quantprobe.egg-info → quantprobe-1.22.0}/PKG-INFO +25 -15
- {quantprobe-1.20.2 → quantprobe-1.22.0}/README.md +24 -14
- {quantprobe-1.20.2 → quantprobe-1.22.0}/pyproject.toml +1 -1
- {quantprobe-1.20.2 → quantprobe-1.22.0}/quantprobe/__init__.py +1 -1
- {quantprobe-1.20.2 → quantprobe-1.22.0}/quantprobe/__main__.py +9 -9
- {quantprobe-1.20.2 → quantprobe-1.22.0}/quantprobe/cli.py +1 -0
- {quantprobe-1.20.2 → quantprobe-1.22.0}/quantprobe/fetch.py +24 -5
- {quantprobe-1.20.2 → quantprobe-1.22.0}/quantprobe/plan.py +98 -17
- {quantprobe-1.20.2 → quantprobe-1.22.0}/quantprobe/probe.py +334 -334
- {quantprobe-1.20.2 → quantprobe-1.22.0}/quantprobe/recipes/mistral-7b.json +50 -50
- {quantprobe-1.20.2 → quantprobe-1.22.0}/quantprobe/recipes/qwen2.5-7b.json +50 -50
- {quantprobe-1.20.2 → quantprobe-1.22.0}/quantprobe/recipes/qwen3-30b.json +50 -50
- {quantprobe-1.20.2 → quantprobe-1.22.0}/quantprobe/recipes/qwen3.5-35b.json +50 -50
- {quantprobe-1.20.2 → quantprobe-1.22.0}/quantprobe/recipes.py +75 -75
- {quantprobe-1.20.2 → quantprobe-1.22.0}/quantprobe/runtime.py +9 -4
- {quantprobe-1.20.2 → quantprobe-1.22.0}/quantprobe/spec.py +6 -0
- {quantprobe-1.20.2 → quantprobe-1.22.0}/quantprobe/target.py +91 -91
- {quantprobe-1.20.2 → quantprobe-1.22.0/quantprobe.egg-info}/PKG-INFO +25 -15
- {quantprobe-1.20.2 → quantprobe-1.22.0}/LICENSE +0 -0
- {quantprobe-1.20.2 → quantprobe-1.22.0}/quantprobe/auto.py +0 -0
- {quantprobe-1.20.2 → quantprobe-1.22.0}/quantprobe/calibrate.py +0 -0
- {quantprobe-1.20.2 → quantprobe-1.22.0}/quantprobe/dashboard.py +0 -0
- {quantprobe-1.20.2 → quantprobe-1.22.0}/quantprobe/detect.py +0 -0
- {quantprobe-1.20.2 → quantprobe-1.22.0}/quantprobe/optimize.py +0 -0
- {quantprobe-1.20.2 → quantprobe-1.22.0}/quantprobe.egg-info/SOURCES.txt +0 -0
- {quantprobe-1.20.2 → quantprobe-1.22.0}/quantprobe.egg-info/dependency_links.txt +0 -0
- {quantprobe-1.20.2 → quantprobe-1.22.0}/quantprobe.egg-info/entry_points.txt +0 -0
- {quantprobe-1.20.2 → quantprobe-1.22.0}/quantprobe.egg-info/requires.txt +0 -0
- {quantprobe-1.20.2 → quantprobe-1.22.0}/quantprobe.egg-info/top_level.txt +0 -0
- {quantprobe-1.20.2 → quantprobe-1.22.0}/setup.cfg +0 -0
- {quantprobe-1.20.2 → quantprobe-1.22.0}/tests/test_engine.py +0 -0
- {quantprobe-1.20.2 → quantprobe-1.22.0}/tests/test_evaluator.py +0 -0
- {quantprobe-1.20.2 → quantprobe-1.22.0}/tests/test_pipeline.py +0 -0
- {quantprobe-1.20.2 → quantprobe-1.22.0}/tests/test_transforms.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: quantprobe
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.22.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
|
|
@@ -28,23 +28,30 @@ Predicts how fast an LLM will run on your machine — **before you download it**
|
|
|
28
28
|
|
|
29
29
|
```bash
|
|
30
30
|
pip install quantprobe
|
|
31
|
-
quantprobe plan --model qwen3-30b
|
|
31
|
+
quantprobe plan --model qwen3-30b
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
```
|
|
35
35
|
[quantprobe] no hardware flags: auto-detected this machine (vram 6GB@192 | ram 16GB@48 | disk 0.5 GB/s).
|
|
36
|
+
[quantprobe] calibration applied [ram 24.3 GB/s measured; disk 3.13 GB/s measured] (2026-07-28)
|
|
37
|
+
[quantprobe] anchored: CPU x1.18, GPU x0.75 from your calibrate anchor runs [tier ratios; --no-anchors disables]
|
|
36
38
|
|
|
37
|
-
quantprobe plan - Qwen3-30B-A3B @ 2.
|
|
38
|
-
model
|
|
39
|
+
quantprobe plan - Qwen3-30B-A3B @ 2.5-bit on THIS machine [auto-detected]
|
|
40
|
+
model 10.6 GB | active 1.53 GB/token | est. quality cost x1.07 (depth-aware recipe)
|
|
39
41
|
|
|
40
|
-
*
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
3.0 tok/s stream from disk (cold experts) [exceeds RAM - capacity demo]
|
|
42
|
+
* 22.2 tok/s split experts: 34%->VRAM, rest->RAM [pins 7GB of 12GB RAM (CUDA host memory) - …]
|
|
43
|
+
19.0 tok/s hybrid: attention->VRAM, experts->RAM [pins 10GB of 12GB RAM (CUDA host memory) - …]
|
|
44
|
+
13.2 tok/s pure CPU (GPU idle) [RAM boundary - expect bimodal speed]
|
|
44
45
|
|
|
45
|
-
|
|
46
|
+
speculation: pays ONLY when output copies its context (edits, refactors, RAG quoting)
|
|
47
|
+
- on novel generation the ngram drafter produces 0 drafts and changes nothing (D-10,
|
|
48
|
+
independently replicated on an RTX 3090). Details below.
|
|
49
|
+
|
|
50
|
+
run it: llama-server -m model.gguf -ngl 99 -ot "blk\.(16|17|…|47)\.ffn_.*_exps\.=CPU" --no-mmap -b 1024 -ub 1024 --threads 4
|
|
46
51
|
```
|
|
47
52
|
|
|
53
|
+
The first line is what a fresh install prints. The `calibration applied` and `anchored:` lines appear after you run `quantprobe calibrate` once — measured constants and your own anchor runs, not spec sheets.
|
|
54
|
+
|
|
48
55
|
**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
56
|
|
|
50
57
|
Want it to do the whole thing for you?
|
|
@@ -58,6 +65,7 @@ Detects your machine, asks which model you want, picks the best quant for it, do
|
|
|
58
65
|
## What it does
|
|
59
66
|
|
|
60
67
|
- **Predicts tok/s before you download** — across every placement (all-VRAM, hybrid, expert-split, CPU, disk-stream) and picks the winner.
|
|
68
|
+
- **Anchors predictions to *your* machine** — run `quantprobe calibrate` once and two benchmark runs on your own GGUF scale every prediction. That path passed the gate it pre-registered before any number existed (prereg #64): leave-one-out median error **19% → 5.8%** across 5 arms; ~12% median on the full ladder, misses erring low. `--no-anchors` restores the plain law.
|
|
61
69
|
- **Emits the exact command**, including the `-ot` regex most guides get wrong.
|
|
62
70
|
- **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
71
|
- **Measures which layers of *your* model break** under compression, then builds a quant that protects them.
|
|
@@ -95,15 +103,15 @@ Most guides put *all* of a mixture-of-experts model's experts in system RAM and
|
|
|
95
103
|
|---|---|---|---|
|
|
96
104
|
| **code** (edit a file, answer restates its input) | 17.72 | **37.17** | **2.10× — decode doubles** |
|
|
97
105
|
| 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 |
|
|
106
|
+
| code, but **MoE with *all* experts in RAM** | 18.18 | 18.81 | 1.03× — the union tax eats it |
|
|
99
107
|
|
|
100
|
-
Copyability is the whole mechanism: code answers repeat their input, prose invents. Turn it on
|
|
108
|
+
Copyability is the whole mechanism: code answers repeat their input, prose invents. The 1.03× row is the *full* expert-offload arm only — on the expert-split placement the quickstart recommends, **tuned** ngram (`--spec-ngram-simple-size-m 384 --spec-ngram-simple-size-n 4`) measured **4.7×** decode at ~3-bit (21.3 → 98.8 tok/s), shrinking with bit-width (3.4× at Q3_K_M) because the verify round is compute-bound (V-04; preregs #28/#36/#37/#40). Turn it on whenever your output copies its context, on any placement except full expert-offload; on novel generation it drafts nothing and changes nothing.
|
|
101
109
|
|
|
102
110
|
## Measured results
|
|
103
111
|
|
|
104
112
|
| result | number |
|
|
105
113
|
|---|---|
|
|
106
|
-
| Qwen3-30B-A3B on a 2016 desktop | **
|
|
114
|
+
| Qwen3-30B-A3B on a 2016 desktop | **20.4–22.2 tok/s** (healthy-clocks retest, preregs #60/#61) |
|
|
107
115
|
| Same model, partial expert offload | **20.62 tok/s** (+12.4%, free) |
|
|
108
116
|
| Same bytes, different layers protected (Gemma 4 12B) | **byte-identical files, 2.25 ppl apart** |
|
|
109
117
|
| Gemma 4 12B depth-aware 2-bit | 1.91× → **1.45×** quality cost, ~4.5 GB resident |
|
|
@@ -117,8 +125,8 @@ Copyability is the whole mechanism: code answers repeat their input, prose inven
|
|
|
117
125
|
|
|
118
126
|
## When quantprobe won't help you
|
|
119
127
|
|
|
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
|
|
128
|
+
- **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. One lever remains inside a fit: on pre-Ampere cards the *format* sets decode speed — Q4_0 measured **+19%** end-to-end over Q4_K_M (26.87 vs 22.72 tok/s, preregs #52/#53), and Q2_K was slower than Q4_0 while 32% smaller. Speed-only (Q4_K_M is higher quality per byte), one card measured, unverified on Ampere+ — `plan` prints it whenever the all-in-VRAM row wins at ≤5.0 bits.
|
|
129
|
+
- **You want a tight number for a model that fits entirely in VRAM — and you haven't run `calibrate`.** This was the placement the law knew least well, and the ±25% band above does **not** apply to it. Since v1.20.1 there is a real answer: `quantprobe calibrate`'s all-in-VRAM anchor run plus per-format GPU efficiency (the L-16 format ladder) gives a **point prediction** for GPU-resident models — ~12% median error across the full ladder, misses erring low, and the anchor's own arm exact by construction ([MACHINE_LADDER.md](MACHINE_LADDER.md)). Uncalibrated, what we can state is **one-sided and exception-free**: across 8 models and 13 benchmarks, real speed was **≥ 0.90× the printed number every single time**, and in 12 of the 13 it was strictly higher — typically 1.1×–1.8×. That is a falsifiable claim with the same logical form as our ±25% band, just asymmetric: one measurement below 0.90× kills it. We have refuted six candidate explanations for the gap, including our own favourites: it is not fixed overhead, not GPU clock state, not bytes-per-token, not monotone in bit-width, not a per-format constant, and not a bytes-weighted mixture of the actual tensor types. Within a single architecture it moves cleanly with the dominant tensor type; across architectures it does not transfer. We would rather publish that 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
130
|
- **You need task-level eval scores** (MMLU, HellaSwag). quantprobe measures perplexity and KL divergence only.
|
|
123
131
|
- **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
132
|
- **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)
|
|
@@ -131,6 +139,7 @@ Copyability is the whole mechanism: code answers repeat their input, prose inven
|
|
|
131
139
|
quantprobe auto # interactive: detects, asks, decides, runs
|
|
132
140
|
quantprobe plan --gguf model.gguf # predicted tok/s + placement + launch command
|
|
133
141
|
quantprobe hw # what the law sees on THIS machine
|
|
142
|
+
quantprobe calibrate # measure, don't assume: RAM stream, disk, GPU clocks; optional anchor runs
|
|
134
143
|
quantprobe run --gguf model.gguf # plan the placement, then launch chat
|
|
135
144
|
quantprobe bench --gguf model.gguf --contribute # predicted vs measured; opt-in datapoint
|
|
136
145
|
```
|
|
@@ -165,6 +174,7 @@ quantprobe dashboard --gguf 2bit.gguf # the law live, every r
|
|
|
165
174
|
| [docs/EXAMPLES.md](docs/EXAMPLES.md) | worked examples with real output, including the ×5.4 optimizer A/B |
|
|
166
175
|
| [docs/HARDWARE.md](docs/HARDWARE.md) | the 2016 box: exact specs, measured bandwidths, what the next euro buys |
|
|
167
176
|
| [preregistrations/](preregistrations/) | every staked prediction with its verdict — hits **and** misses |
|
|
177
|
+
| [MACHINE_LADDER.md](MACHINE_LADDER.md) | every model four ways — naive default / informed llama.cpp / quantprobe / staked prediction — including the v1.20.2 accuracy correction |
|
|
168
178
|
| [CONTRIBUTING.md](CONTRIBUTING.md) | the method: stake, measure, score *and wire*, audit |
|
|
169
179
|
| [docs/DEEP-DIVE.md](docs/DEEP-DIVE.md) | what's new vs. built-on, parity tables, and the repository map |
|
|
170
180
|
| [papers/arxiv/](papers/arxiv/) | the paper (submission-ready LaTeX) |
|
|
@@ -174,7 +184,7 @@ quantprobe dashboard --gguf 2bit.gguf # the law live, every r
|
|
|
174
184
|
|
|
175
185
|
[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
186
|
|
|
177
|
-
Two community
|
|
187
|
+
Two community contributors 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. MoneroApe then ran the first external replication (RTX 3090 + a 117.6B MoE, register E-06): it exposed five real defects in the shipped tool — the 2× channel-count error, the ubatch cap, a missing pinned-memory warning, a missing `--threads`, the buried speculation note — all fixed in v1.19 with tests named after the report, and `quantprobe calibrate` exists because of it.
|
|
178
188
|
|
|
179
189
|
## License
|
|
180
190
|
|
|
@@ -10,23 +10,30 @@ Predicts how fast an LLM will run on your machine — **before you download it**
|
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
12
|
pip install quantprobe
|
|
13
|
-
quantprobe plan --model qwen3-30b
|
|
13
|
+
quantprobe plan --model qwen3-30b
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
```
|
|
17
17
|
[quantprobe] no hardware flags: auto-detected this machine (vram 6GB@192 | ram 16GB@48 | disk 0.5 GB/s).
|
|
18
|
+
[quantprobe] calibration applied [ram 24.3 GB/s measured; disk 3.13 GB/s measured] (2026-07-28)
|
|
19
|
+
[quantprobe] anchored: CPU x1.18, GPU x0.75 from your calibrate anchor runs [tier ratios; --no-anchors disables]
|
|
18
20
|
|
|
19
|
-
quantprobe plan - Qwen3-30B-A3B @ 2.
|
|
20
|
-
model
|
|
21
|
+
quantprobe plan - Qwen3-30B-A3B @ 2.5-bit on THIS machine [auto-detected]
|
|
22
|
+
model 10.6 GB | active 1.53 GB/token | est. quality cost x1.07 (depth-aware recipe)
|
|
21
23
|
|
|
22
|
-
*
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
3.0 tok/s stream from disk (cold experts) [exceeds RAM - capacity demo]
|
|
24
|
+
* 22.2 tok/s split experts: 34%->VRAM, rest->RAM [pins 7GB of 12GB RAM (CUDA host memory) - …]
|
|
25
|
+
19.0 tok/s hybrid: attention->VRAM, experts->RAM [pins 10GB of 12GB RAM (CUDA host memory) - …]
|
|
26
|
+
13.2 tok/s pure CPU (GPU idle) [RAM boundary - expect bimodal speed]
|
|
26
27
|
|
|
27
|
-
|
|
28
|
+
speculation: pays ONLY when output copies its context (edits, refactors, RAG quoting)
|
|
29
|
+
- on novel generation the ngram drafter produces 0 drafts and changes nothing (D-10,
|
|
30
|
+
independently replicated on an RTX 3090). Details below.
|
|
31
|
+
|
|
32
|
+
run it: llama-server -m model.gguf -ngl 99 -ot "blk\.(16|17|…|47)\.ffn_.*_exps\.=CPU" --no-mmap -b 1024 -ub 1024 --threads 4
|
|
28
33
|
```
|
|
29
34
|
|
|
35
|
+
The first line is what a fresh install prints. The `calibration applied` and `anchored:` lines appear after you run `quantprobe calibrate` once — measured constants and your own anchor runs, not spec sheets.
|
|
36
|
+
|
|
30
37
|
**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
38
|
|
|
32
39
|
Want it to do the whole thing for you?
|
|
@@ -40,6 +47,7 @@ Detects your machine, asks which model you want, picks the best quant for it, do
|
|
|
40
47
|
## What it does
|
|
41
48
|
|
|
42
49
|
- **Predicts tok/s before you download** — across every placement (all-VRAM, hybrid, expert-split, CPU, disk-stream) and picks the winner.
|
|
50
|
+
- **Anchors predictions to *your* machine** — run `quantprobe calibrate` once and two benchmark runs on your own GGUF scale every prediction. That path passed the gate it pre-registered before any number existed (prereg #64): leave-one-out median error **19% → 5.8%** across 5 arms; ~12% median on the full ladder, misses erring low. `--no-anchors` restores the plain law.
|
|
43
51
|
- **Emits the exact command**, including the `-ot` regex most guides get wrong.
|
|
44
52
|
- **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
53
|
- **Measures which layers of *your* model break** under compression, then builds a quant that protects them.
|
|
@@ -77,15 +85,15 @@ Most guides put *all* of a mixture-of-experts model's experts in system RAM and
|
|
|
77
85
|
|---|---|---|---|
|
|
78
86
|
| **code** (edit a file, answer restates its input) | 17.72 | **37.17** | **2.10× — decode doubles** |
|
|
79
87
|
| 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 |
|
|
88
|
+
| code, but **MoE with *all* experts in RAM** | 18.18 | 18.81 | 1.03× — the union tax eats it |
|
|
81
89
|
|
|
82
|
-
Copyability is the whole mechanism: code answers repeat their input, prose invents. Turn it on
|
|
90
|
+
Copyability is the whole mechanism: code answers repeat their input, prose invents. The 1.03× row is the *full* expert-offload arm only — on the expert-split placement the quickstart recommends, **tuned** ngram (`--spec-ngram-simple-size-m 384 --spec-ngram-simple-size-n 4`) measured **4.7×** decode at ~3-bit (21.3 → 98.8 tok/s), shrinking with bit-width (3.4× at Q3_K_M) because the verify round is compute-bound (V-04; preregs #28/#36/#37/#40). Turn it on whenever your output copies its context, on any placement except full expert-offload; on novel generation it drafts nothing and changes nothing.
|
|
83
91
|
|
|
84
92
|
## Measured results
|
|
85
93
|
|
|
86
94
|
| result | number |
|
|
87
95
|
|---|---|
|
|
88
|
-
| Qwen3-30B-A3B on a 2016 desktop | **
|
|
96
|
+
| Qwen3-30B-A3B on a 2016 desktop | **20.4–22.2 tok/s** (healthy-clocks retest, preregs #60/#61) |
|
|
89
97
|
| Same model, partial expert offload | **20.62 tok/s** (+12.4%, free) |
|
|
90
98
|
| Same bytes, different layers protected (Gemma 4 12B) | **byte-identical files, 2.25 ppl apart** |
|
|
91
99
|
| Gemma 4 12B depth-aware 2-bit | 1.91× → **1.45×** quality cost, ~4.5 GB resident |
|
|
@@ -99,8 +107,8 @@ Copyability is the whole mechanism: code answers repeat their input, prose inven
|
|
|
99
107
|
|
|
100
108
|
## When quantprobe won't help you
|
|
101
109
|
|
|
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
|
|
110
|
+
- **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. One lever remains inside a fit: on pre-Ampere cards the *format* sets decode speed — Q4_0 measured **+19%** end-to-end over Q4_K_M (26.87 vs 22.72 tok/s, preregs #52/#53), and Q2_K was slower than Q4_0 while 32% smaller. Speed-only (Q4_K_M is higher quality per byte), one card measured, unverified on Ampere+ — `plan` prints it whenever the all-in-VRAM row wins at ≤5.0 bits.
|
|
111
|
+
- **You want a tight number for a model that fits entirely in VRAM — and you haven't run `calibrate`.** This was the placement the law knew least well, and the ±25% band above does **not** apply to it. Since v1.20.1 there is a real answer: `quantprobe calibrate`'s all-in-VRAM anchor run plus per-format GPU efficiency (the L-16 format ladder) gives a **point prediction** for GPU-resident models — ~12% median error across the full ladder, misses erring low, and the anchor's own arm exact by construction ([MACHINE_LADDER.md](MACHINE_LADDER.md)). Uncalibrated, what we can state is **one-sided and exception-free**: across 8 models and 13 benchmarks, real speed was **≥ 0.90× the printed number every single time**, and in 12 of the 13 it was strictly higher — typically 1.1×–1.8×. That is a falsifiable claim with the same logical form as our ±25% band, just asymmetric: one measurement below 0.90× kills it. We have refuted six candidate explanations for the gap, including our own favourites: it is not fixed overhead, not GPU clock state, not bytes-per-token, not monotone in bit-width, not a per-format constant, and not a bytes-weighted mixture of the actual tensor types. Within a single architecture it moves cleanly with the dominant tensor type; across architectures it does not transfer. We would rather publish that 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
112
|
- **You need task-level eval scores** (MMLU, HellaSwag). quantprobe measures perplexity and KL divergence only.
|
|
105
113
|
- **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
114
|
- **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)
|
|
@@ -113,6 +121,7 @@ Copyability is the whole mechanism: code answers repeat their input, prose inven
|
|
|
113
121
|
quantprobe auto # interactive: detects, asks, decides, runs
|
|
114
122
|
quantprobe plan --gguf model.gguf # predicted tok/s + placement + launch command
|
|
115
123
|
quantprobe hw # what the law sees on THIS machine
|
|
124
|
+
quantprobe calibrate # measure, don't assume: RAM stream, disk, GPU clocks; optional anchor runs
|
|
116
125
|
quantprobe run --gguf model.gguf # plan the placement, then launch chat
|
|
117
126
|
quantprobe bench --gguf model.gguf --contribute # predicted vs measured; opt-in datapoint
|
|
118
127
|
```
|
|
@@ -147,6 +156,7 @@ quantprobe dashboard --gguf 2bit.gguf # the law live, every r
|
|
|
147
156
|
| [docs/EXAMPLES.md](docs/EXAMPLES.md) | worked examples with real output, including the ×5.4 optimizer A/B |
|
|
148
157
|
| [docs/HARDWARE.md](docs/HARDWARE.md) | the 2016 box: exact specs, measured bandwidths, what the next euro buys |
|
|
149
158
|
| [preregistrations/](preregistrations/) | every staked prediction with its verdict — hits **and** misses |
|
|
159
|
+
| [MACHINE_LADDER.md](MACHINE_LADDER.md) | every model four ways — naive default / informed llama.cpp / quantprobe / staked prediction — including the v1.20.2 accuracy correction |
|
|
150
160
|
| [CONTRIBUTING.md](CONTRIBUTING.md) | the method: stake, measure, score *and wire*, audit |
|
|
151
161
|
| [docs/DEEP-DIVE.md](docs/DEEP-DIVE.md) | what's new vs. built-on, parity tables, and the repository map |
|
|
152
162
|
| [papers/arxiv/](papers/arxiv/) | the paper (submission-ready LaTeX) |
|
|
@@ -156,7 +166,7 @@ quantprobe dashboard --gguf 2bit.gguf # the law live, every r
|
|
|
156
166
|
|
|
157
167
|
[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
168
|
|
|
159
|
-
Two community
|
|
169
|
+
Two community contributors 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. MoneroApe then ran the first external replication (RTX 3090 + a 117.6B MoE, register E-06): it exposed five real defects in the shipped tool — the 2× channel-count error, the ubatch cap, a missing pinned-memory warning, a missing `--threads`, the buried speculation note — all fixed in v1.19 with tests named after the report, and `quantprobe calibrate` exists because of it.
|
|
160
170
|
|
|
161
171
|
## License
|
|
162
172
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "quantprobe"
|
|
7
|
-
version = "1.
|
|
7
|
+
version = "1.22.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.
|
|
11
|
+
__version__ = "1.22.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()
|
|
@@ -128,6 +128,7 @@ def main():
|
|
|
128
128
|
|
|
129
129
|
f = sub.add_parser("fetch", help="robust HF download (Range-resume, retry)")
|
|
130
130
|
f.add_argument("repo", help="HF repo, or a preset: qwen3-30b, glm-air, deepseek-16b, qwen3-0.6b"); f.add_argument("dest"); f.add_argument("files", nargs="*")
|
|
131
|
+
f.add_argument("--force", action="store_true", help="re-download even if a same-named file exists (a stale local file with the same name once fed an incompatible draft model to llama-speculative - three crashed runs before the collision was spotted)")
|
|
131
132
|
|
|
132
133
|
a = ap.parse_args()
|
|
133
134
|
if a.cmd == "probe":
|
|
@@ -23,14 +23,33 @@ def token():
|
|
|
23
23
|
return open(p).read().strip() if os.path.exists(p) else None
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
def fetch(repo, dest, fname, tok, tries=100):
|
|
26
|
+
def fetch(repo, dest, fname, tok, tries=100, force=False):
|
|
27
27
|
url = f"https://huggingface.co/{repo}/resolve/main/{fname}"
|
|
28
28
|
out = os.path.join(dest, fname)
|
|
29
29
|
part = out + ".part"
|
|
30
|
-
if os.path.exists(out):
|
|
31
|
-
print(f" {fname}: already complete", flush=True)
|
|
32
|
-
return True
|
|
33
30
|
hdr0 = {"Authorization": f"Bearer {tok}"} if tok else {}
|
|
31
|
+
if os.path.exists(out) and not force:
|
|
32
|
+
# name-only skip once handed an incompatible file to llama-speculative (a June-era GGUF
|
|
33
|
+
# under the target name): compare against the remote before declaring completeness.
|
|
34
|
+
have = os.path.getsize(out)
|
|
35
|
+
try:
|
|
36
|
+
r = requests.head(url, headers=hdr0, allow_redirects=True, timeout=60)
|
|
37
|
+
remote = int(r.headers.get("Content-Length", 0))
|
|
38
|
+
except requests.exceptions.RequestException:
|
|
39
|
+
remote = 0
|
|
40
|
+
if remote and have != remote:
|
|
41
|
+
print(f" {fname}: EXISTING FILE IS NOT THIS FILE - local {have:,} B vs remote "
|
|
42
|
+
f"{remote:,} B. A same-named file from another source is on disk; it may be an "
|
|
43
|
+
f"incompatible model. Re-run with --force to replace it, or fetch to a "
|
|
44
|
+
f"different dest.", flush=True)
|
|
45
|
+
return False
|
|
46
|
+
note = "size matches remote" if remote else "remote size unavailable, name+presence only"
|
|
47
|
+
print(f" {fname}: already complete ({note}; --force re-downloads)", flush=True)
|
|
48
|
+
return True
|
|
49
|
+
if os.path.exists(out) and force:
|
|
50
|
+
os.remove(out)
|
|
51
|
+
if os.path.exists(part):
|
|
52
|
+
os.remove(part)
|
|
34
53
|
r = requests.head(url, headers=hdr0, allow_redirects=True, timeout=60)
|
|
35
54
|
total = int(r.headers.get("Content-Length", 0))
|
|
36
55
|
print(f" {fname}: {total/1e9:.2f} GB", flush=True)
|
|
@@ -77,7 +96,7 @@ def run(a):
|
|
|
77
96
|
print(f"[quantprobe] preset '{a.repo}' -> {repo}/{f}")
|
|
78
97
|
if not files:
|
|
79
98
|
_s.exit("no files given (or use a preset: " + ", ".join(PRESETS) + ")")
|
|
80
|
-
ok = all(fetch(repo, a.dest, fn, token()) for fn in files)
|
|
99
|
+
ok = all(fetch(repo, a.dest, fn, token(), force=getattr(a, "force", False)) for fn in files)
|
|
81
100
|
_s.exit(0 if ok else 1)
|
|
82
101
|
|
|
83
102
|
|
|
@@ -125,8 +125,17 @@ def ubatch_flags(placement, vram_resident_gb, vc):
|
|
|
125
125
|
# Note this also INVERTS which placement is fastest at prefill: at the default ub the split
|
|
126
126
|
# wins (279 vs 200), at ub 2048 the all-CPU placement wins (350 vs 162). Placement and batch
|
|
127
127
|
# are not independent dimensions - they compete for the same VRAM.
|
|
128
|
-
if
|
|
128
|
+
if vc <= 0:
|
|
129
129
|
return None
|
|
130
|
+
if "split experts" in placement:
|
|
131
|
+
# U-16, closed by measurement: the #20-era total exclusion of the split was over-broad.
|
|
132
|
+
# #20's harm was ub 2048 (the compute-buffer cliff: 279 -> 162); #62 measured the SAME
|
|
133
|
+
# split placement at ub 1024 with pp 393.7 AND tg 22.21 - no cliff, both metrics at
|
|
134
|
+
# their best - while the excluded emitted config measured pp 301 (#66). The split gets
|
|
135
|
+
# ub capped at 1024 HARD (never 2048, where the measured cliff lives), still sized by
|
|
136
|
+
# the buffer math against the residual headroom.
|
|
137
|
+
ub = safe_ubatch(vc * 0.90 - vram_resident_gb, cap=1024)
|
|
138
|
+
return "-b %d -ub %d" % (ub, ub) if ub else None
|
|
130
139
|
if not any(k in placement for k in ("->RAM", "CPU", "disk")):
|
|
131
140
|
return None # nothing host-resident: no transfer to amortise
|
|
132
141
|
if vc * 0.90 - vram_resident_gb < UBATCH_HEADROOM_GB:
|
|
@@ -431,19 +440,54 @@ def format_advice(placement, bits):
|
|
|
431
440
|
if bits <= 3.0:
|
|
432
441
|
return ("FORMAT LEVER (pre-Ampere cards): this bit-width is in the regime where unpack "
|
|
433
442
|
"cost has REVERSED the byte ordering - measured Q2_K decodes 19% slower than Q4_0 "
|
|
434
|
-
"on the same model while being 32% smaller
|
|
435
|
-
"
|
|
436
|
-
"
|
|
443
|
+
"on the same model while being 32% smaller, and CODEBOOK IQ formats pay even more "
|
|
444
|
+
"(IQ2_XS/IQ3 measured 36-52% below Q4_K per byte, prereg #70). If a ~4.5-bit file "
|
|
445
|
+
"fits in VRAM, use it instead; prefer Q4_0 or IQ4_NL over Q4_K_M on pre-Ampere "
|
|
446
|
+
"(+19%/+14% measured). On Ampere+ this is unverified and may invert.")
|
|
437
447
|
if bits <= 5.0:
|
|
438
448
|
return ("FORMAT LEVER (pre-Ampere cards): at this bit-width the FORMAT is worth more than "
|
|
439
449
|
"the bytes - Q4_0 measured +19% over Q4_K_M on the same model (26.87 vs 22.72 "
|
|
440
|
-
"tok/s)
|
|
441
|
-
"
|
|
442
|
-
"
|
|
443
|
-
"
|
|
450
|
+
"tok/s), and IQ4_NL measured +14% (25.63) at the same size class WITH imatrix "
|
|
451
|
+
"quality: its kernel is Q4_0-class, not codebook-class (prereg #70), so it is the "
|
|
452
|
+
"quality-per-byte pick of the fast formats here. Mechanism (measured, preregs "
|
|
453
|
+
"#56/#57): metadata application DENSITY - K-quants apply fine-grained scale+min "
|
|
454
|
+
"chains far more often per byte, and that cost is intrinsic to the format "
|
|
455
|
+
"definition, not a kernel bug. Avoid codebook IQ (IQ2/IQ3) for VRAM decode on "
|
|
456
|
+
"this class of card: measured 36-52% below Q4_K per byte. On Ampere+ this is "
|
|
457
|
+
"unverified and may invert.")
|
|
444
458
|
return None
|
|
445
459
|
|
|
446
460
|
|
|
461
|
+
def dense_draft_note(moe, placement):
|
|
462
|
+
"""The dense-target draft cells, measured (preregs #67/#69). All-in-VRAM: 0.5B drafting the
|
|
463
|
+
dense 7B, NOVEL prompts: +11% on code at --spec-draft-n-max 2 (79% acceptance), net NEGATIVE
|
|
464
|
+
on prose at every draft length, and llama.cpp's default K=3 is past the optimum. SPLIT: the
|
|
465
|
+
best speculation cell on this box - the K+1 verify batch reads each CPU-resident layer once,
|
|
466
|
+
so the CPU share of the token amortizes: +33% on the 14B at K=2 (76% acceptance) with the
|
|
467
|
+
draft itself on CPU (-ngld 0, zero VRAM cost). The K-cliff is HARDER on split (K=3+ lands at
|
|
468
|
+
or below baseline) because the CPU draft pays from the same bandwidth pocket the
|
|
469
|
+
amortization saves."""
|
|
470
|
+
if moe:
|
|
471
|
+
return None
|
|
472
|
+
if "layers->VRAM" in (placement or ""):
|
|
473
|
+
return ("dense-SPLIT speculation (measured, prereg #69): a small same-family draft is "
|
|
474
|
+
"the best speculation cell on this box - `-md draft.gguf -ngld 0 "
|
|
475
|
+
"--spec-draft-n-max 2` bought **+33%** decode on a 14B split target (5.5 -> 7.4 "
|
|
476
|
+
"tok/s, 76% acceptance, novel code), and the draft costs ZERO VRAM because it "
|
|
477
|
+
"runs on CPU. Mechanism: the K+1-token verify batch reads each CPU-resident "
|
|
478
|
+
"layer once, so the CPU share of every token amortizes. Keep K=2: every "
|
|
479
|
+
"measured K>=3 landed AT OR BELOW no-draft baseline (the CPU draft spends the "
|
|
480
|
+
"same RAM bandwidth the amortization saves), so llama.cpp's default 3 already "
|
|
481
|
+
"loses here.")
|
|
482
|
+
if "all in VRAM" not in placement:
|
|
483
|
+
return None
|
|
484
|
+
return ("dense-model speculation (measured, prereg #67): pairing this model with a small "
|
|
485
|
+
"same-family draft (-md draft.gguf -ngld 99 --spec-draft-n-max 2) buys ~+11% on "
|
|
486
|
+
"CODE-style novel output at 79% acceptance - and LOSES speed on prose and at "
|
|
487
|
+
"draft lengths >=4 (llama.cpp's default 3 is past the optimum here). Copy-regime "
|
|
488
|
+
"ngram speculation remains the big multiplier where output copies context.")
|
|
489
|
+
|
|
490
|
+
|
|
447
491
|
def speculation_advice(moe, placement):
|
|
448
492
|
"""What speculative decoding is worth for THIS model and placement.
|
|
449
493
|
|
|
@@ -488,8 +532,13 @@ def speculation_advice(moe, placement):
|
|
|
488
532
|
"negative here (0.72x), and stacking a second drafter costs 10%. Note llama-cli "
|
|
489
533
|
"ignores --spec-type silently; the flag only works on llama-server.")
|
|
490
534
|
if moe and experts_offloaded:
|
|
491
|
-
return ("speculation will NOT pay here: measured +3% (ngram) and
|
|
492
|
-
"
|
|
535
|
+
return ("speculation will NOT pay here with external drafts: measured +3% (ngram) and "
|
|
536
|
+
"-24% (MTP, old-generation) with experts offloaded - a verify batch unions "
|
|
537
|
+
"experts, and every extra one is a slow read. ONE measured exception (prereg "
|
|
538
|
+
"#71): models with a TRAINED-IN MTP head (Qwen3.6 class) reach ~93% acceptance, "
|
|
539
|
+
"enough for `--spec-type draft-mtp --spec-draft-n-max 2` to buy +11% - and K "
|
|
540
|
+
"MUST stay at 2: K=4 measured 0.61x on the same pair (the union tax is alive, "
|
|
541
|
+
"the head just out-accepts it at short drafts).")
|
|
493
542
|
if not moe:
|
|
494
543
|
return ("if you write CODE, add `--spec-type ngram-simple` - measured **2.10x decode** "
|
|
495
544
|
"(17.7 -> 37.2 tok/s), one flag, no download, identical output. Prose gains "
|
|
@@ -497,8 +546,19 @@ def speculation_advice(moe, placement):
|
|
|
497
546
|
return None # MoE fully resident: untested here, so we say nothing
|
|
498
547
|
|
|
499
548
|
|
|
549
|
+
|
|
550
|
+
# U-17 (prereg #66): the per-IQ-byte CPU decode penalty. Both IQ2_XS arms of the #66 ladder
|
|
551
|
+
# over-predicted while the tool's IQ warning stayed prose-only. Calibrated on the pure-CPU arm
|
|
552
|
+
# (predicted 14.1 vs measured 11.44 tok/s at iq_share 0.962 -> k = 0.242), cross-validated on
|
|
553
|
+
# the independent expert-split arm (see the retrodiction in tests/smoke.py). NOT V-11's 2.7x:
|
|
554
|
+
# that number is a different regime (isolated prefill-heavy comparison) and would overshoot
|
|
555
|
+
# this correction ~7x - the retrodiction gate rejected it. Scope: weight bytes read from RAM
|
|
556
|
+
# during token generation; KV terms are format-independent and untouched.
|
|
557
|
+
IQ_CPU_TG_PENALTY = 0.242
|
|
558
|
+
|
|
559
|
+
|
|
500
560
|
def evaluate(t, a, ne, moe, bits, vc, vb, rc, rb, db, geta, act_scale=1.0, gl=None, ctx=0, kvp=0.0,
|
|
501
|
-
n_layer=None, true_size_gb=None):
|
|
561
|
+
n_layer=None, true_size_gb=None, iq_share=0.0):
|
|
502
562
|
ab = max(bits, 4.5) # attention protected at ~4-bit (Law 3 recipes)
|
|
503
563
|
size = (ne * ab / 8 + (t - ne) * bits / 8) * 1.08 * act_scale
|
|
504
564
|
# CAPACITY uses the real file size when we have the file. The estimate above assumes the
|
|
@@ -534,6 +594,9 @@ def evaluate(t, a, ne, moe, bits, vc, vb, rc, rb, db, geta, act_scale=1.0, gl=No
|
|
|
534
594
|
kv_gb = ctx * kvp / 1e9 if ctx > 0 else 0.0
|
|
535
595
|
ra = max(rc - 4, 1)
|
|
536
596
|
eta_r = 0.38 if moe else 0.62
|
|
597
|
+
# U-17: price the IQ share into every RAM weight read (pure CPU, hybrid experts, both split
|
|
598
|
+
# kinds, waterfall). iq_share is 0.0 unless a real GGUF was scanned, so presets are untouched.
|
|
599
|
+
eta_r /= (1.0 + iq_share * IQ_CPU_TG_PENALTY)
|
|
537
600
|
if gl is None: gl = geta * 0.6
|
|
538
601
|
# The sub-4-bit GPU DECODE collapse does not exist. It was gated on bit-width (`bits >= 4`),
|
|
539
602
|
# which made 3.99 bits predict 8.75x slower than 4.00. Pre-registration #16 measured decode
|
|
@@ -552,7 +615,14 @@ def evaluate(t, a, ne, moe, bits, vc, vb, rc, rb, db, geta, act_scale=1.0, gl=No
|
|
|
552
615
|
out.append(("all in VRAM", 1 / (act / (geta_w * vb) + kv_gb / (ETA_KV * vb)), None,
|
|
553
616
|
"-ngl 99"))
|
|
554
617
|
if moe and vc > 0:
|
|
555
|
-
|
|
618
|
+
# KV sits with attention in VRAM. The buffer term was a flat 1.2 GB estimate from before
|
|
619
|
+
# the compute buffer was MEASURED (#23: exactly 0.5874 MiB per ubatch token -> 0.60 GB at
|
|
620
|
+
# the ub-1024 the split now emits). 0.9 = measured buffer + 0.3 margin; the flat 1.2 was
|
|
621
|
+
# the same over-reserve class #62 removed once already, and it held the emitted split at
|
|
622
|
+
# 13 residents where the sweep measured 16 as optimal on both metrics (22.21 tg/393.7 pp)
|
|
623
|
+
# with the soft edge two notches away at 18 (-6.6%). This lands the emit at 15 - both
|
|
624
|
+
# sweep neighbors (14: 391/21.67, 16: 394/22.21) measured healthy.
|
|
625
|
+
v_need = ne * ab / 8 * 1.08 + 0.9 + kv_gb
|
|
556
626
|
r_need = size - ne * ab / 8 * 1.08
|
|
557
627
|
if v_need <= vc * 0.95 and r_need <= ra:
|
|
558
628
|
warn = "RAM boundary - needs --no-mmap; can be unstable" if r_need > ra * 0.85 else None
|
|
@@ -600,7 +670,14 @@ def evaluate(t, a, ne, moe, bits, vc, vb, rc, rb, db, geta, act_scale=1.0, gl=No
|
|
|
600
670
|
"auto-placement decide") if ram_left > ra * 0.45 else None)
|
|
601
671
|
out.append((f"split experts: {f:.0%}->VRAM, rest->RAM", 1 / t_split, pin_warn, fl))
|
|
602
672
|
if (not moe) and vc > 0 and size + kv_gb > vc * 0.90 and size + kv_gb <= ra + vc * 0.9:
|
|
603
|
-
|
|
673
|
+
# C-11 (prereg #66): the old budget handed the model vc*0.9 outright - no desktop
|
|
674
|
+
# reserve, no compute buffer - so at d16384 the emitted 26/28-layer config overcommitted
|
|
675
|
+
# VRAM and measured -58% (driver memory fallback, the silent Windows thrash). Budget =
|
|
676
|
+
# VRAM minus the reserve minus the default-ub compute buffer (measured slope, #23),
|
|
677
|
+
# counted once, same discipline as the MoE v_free path above.
|
|
678
|
+
cbuf = 512 * COMPUTE_BUFFER_MIB_PER_UB_TOKEN / 1024
|
|
679
|
+
v_budget = max(0.0, vc * 0.9 - DESKTOP_VRAM_RESERVE - cbuf)
|
|
680
|
+
g = min(0.95, v_budget / (size + kv_gb)) # KV splits with its layers
|
|
604
681
|
# -ngl takes a LAYER COUNT. This emitted `int(g * 99)`, treating 99 - the all-layers
|
|
605
682
|
# sentinel used elsewhere in this file - as if it were a layer count. Two failures, and
|
|
606
683
|
# the second is severe:
|
|
@@ -878,6 +955,7 @@ def run(args):
|
|
|
878
955
|
vb, geta = resolve_gpu_eta(hw, args, a, args.bits, vb, geta)
|
|
879
956
|
rb = resolve_cpu_bw(hw, args, a, args.bits, rb)
|
|
880
957
|
size, act, cfgs = evaluate(t, a, ne, moe, args.bits, vc, vb, rc, rb, db, geta, gl=gl, ctx=ctx,
|
|
958
|
+
iq_share=getattr(args, "iq_share", 0.0),
|
|
881
959
|
kvp=kvp, n_layer=nlay, true_size_gb=true_size)
|
|
882
960
|
q = qual_of(moe, args.bits)
|
|
883
961
|
print(f"\nquantprobe plan - {m.get('hint', 'custom model')} @ {args.bits:g}-bit "
|
|
@@ -961,16 +1039,19 @@ def run(args):
|
|
|
961
1039
|
if fit_adv:
|
|
962
1040
|
print(f"\n note: {fit_adv}")
|
|
963
1041
|
adv = speculation_advice(moe, best[0])
|
|
1042
|
+
dn = dense_draft_note(moe, best[0])
|
|
1043
|
+
if dn:
|
|
1044
|
+
print("\n " + dn)
|
|
964
1045
|
if adv:
|
|
965
1046
|
print(f"\n speculation: {adv}")
|
|
966
1047
|
# upgrade advisor
|
|
967
1048
|
alts = []
|
|
968
1049
|
if rb < 40:
|
|
969
|
-
s2, _, c2 = evaluate(t, a, ne, moe, args.bits, vc, vb, rc, 48, db, geta, gl=gl, ctx=ctx, kvp=kvp)
|
|
1050
|
+
s2, _, c2 = evaluate(t, a, ne, moe, args.bits, vc, vb, rc, 48, db, geta, gl=gl, ctx=ctx, kvp=kvp, iq_share=getattr(args, "iq_share", 0.0))
|
|
970
1051
|
if c2[0][1] > best[1] * 1.08: alts.append(("enable XMP (free)", c2[0][1]))
|
|
971
|
-
s2, _, c2 = evaluate(t, a, ne, moe, args.bits, vc, vb, rc + 16, rb, db, geta, gl=gl, ctx=ctx, kvp=kvp)
|
|
1052
|
+
s2, _, c2 = evaluate(t, a, ne, moe, args.bits, vc, vb, rc + 16, rb, db, geta, gl=gl, ctx=ctx, kvp=kvp, iq_share=getattr(args, "iq_share", 0.0))
|
|
972
1053
|
if c2[0][1] > best[1] * 1.08: alts.append(("+16 GB RAM", c2[0][1]))
|
|
973
|
-
s2, _, c2 = evaluate(t, a, ne, moe, args.bits, vc, vb, rc, rb, 3.5, geta, gl=gl, ctx=ctx, kvp=kvp)
|
|
1054
|
+
s2, _, c2 = evaluate(t, a, ne, moe, args.bits, vc, vb, rc, rb, 3.5, geta, gl=gl, ctx=ctx, kvp=kvp, iq_share=getattr(args, "iq_share", 0.0))
|
|
974
1055
|
if c2[0][1] > best[1] * 1.08: alts.append(("NVMe SSD", c2[0][1]))
|
|
975
1056
|
if alts:
|
|
976
1057
|
print(" upgrade advisor: " + " | ".join(f"{n} -> ~{v:.1f} tok/s" for n, v in alts))
|
|
@@ -987,7 +1068,7 @@ def run(args):
|
|
|
987
1068
|
continue # not a "shave" - a different model class
|
|
988
1069
|
fit_scale = max(0.05, (cap - kvg) / size_now) * 0.995
|
|
989
1070
|
_, _, c9 = evaluate(t, a, ne, moe, args.bits, vc, vb, rc, rb, db, geta, fit_scale, gl,
|
|
990
|
-
ctx=ctx, kvp=kvp)
|
|
1071
|
+
ctx=ctx, kvp=kvp, iq_share=getattr(args, "iq_share", 0.0))
|
|
991
1072
|
promoted = [x for x in c9 if x[0].startswith("all in VRAM")] if "VRAM" in tier_name else [x for x in c9 if x[0].startswith("pure CPU")]
|
|
992
1073
|
if promoted and promoted[0][1] > best[1] * 1.15:
|
|
993
1074
|
print(f" tier-boundary advisor: this config is {gap:.1f} GB over the {tier_name} boundary - "
|