quantprobe 1.3.0__tar.gz → 1.5.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 (31) hide show
  1. quantprobe-1.5.0/PKG-INFO +145 -0
  2. quantprobe-1.5.0/README.md +127 -0
  3. {quantprobe-1.3.0 → quantprobe-1.5.0}/pyproject.toml +1 -1
  4. {quantprobe-1.3.0 → quantprobe-1.5.0}/quantprobe/__init__.py +1 -1
  5. quantprobe-1.5.0/quantprobe/auto.py +106 -0
  6. {quantprobe-1.3.0 → quantprobe-1.5.0}/quantprobe/cli.py +24 -0
  7. quantprobe-1.5.0/quantprobe/dashboard.py +384 -0
  8. {quantprobe-1.3.0 → quantprobe-1.5.0}/quantprobe/detect.py +8 -4
  9. quantprobe-1.5.0/quantprobe/optimize.py +133 -0
  10. {quantprobe-1.3.0 → quantprobe-1.5.0}/quantprobe/plan.py +19 -0
  11. quantprobe-1.5.0/quantprobe.egg-info/PKG-INFO +145 -0
  12. {quantprobe-1.3.0 → quantprobe-1.5.0}/quantprobe.egg-info/SOURCES.txt +2 -0
  13. quantprobe-1.3.0/PKG-INFO +0 -296
  14. quantprobe-1.3.0/README.md +0 -278
  15. quantprobe-1.3.0/quantprobe/dashboard.py +0 -179
  16. quantprobe-1.3.0/quantprobe.egg-info/PKG-INFO +0 -296
  17. {quantprobe-1.3.0 → quantprobe-1.5.0}/LICENSE +0 -0
  18. {quantprobe-1.3.0 → quantprobe-1.5.0}/quantprobe/fetch.py +0 -0
  19. {quantprobe-1.3.0 → quantprobe-1.5.0}/quantprobe/probe.py +0 -0
  20. {quantprobe-1.3.0 → quantprobe-1.5.0}/quantprobe/runtime.py +0 -0
  21. {quantprobe-1.3.0 → quantprobe-1.5.0}/quantprobe/spec.py +0 -0
  22. {quantprobe-1.3.0 → quantprobe-1.5.0}/quantprobe/target.py +0 -0
  23. {quantprobe-1.3.0 → quantprobe-1.5.0}/quantprobe.egg-info/dependency_links.txt +0 -0
  24. {quantprobe-1.3.0 → quantprobe-1.5.0}/quantprobe.egg-info/entry_points.txt +0 -0
  25. {quantprobe-1.3.0 → quantprobe-1.5.0}/quantprobe.egg-info/requires.txt +0 -0
  26. {quantprobe-1.3.0 → quantprobe-1.5.0}/quantprobe.egg-info/top_level.txt +0 -0
  27. {quantprobe-1.3.0 → quantprobe-1.5.0}/setup.cfg +0 -0
  28. {quantprobe-1.3.0 → quantprobe-1.5.0}/tests/test_engine.py +0 -0
  29. {quantprobe-1.3.0 → quantprobe-1.5.0}/tests/test_evaluator.py +0 -0
  30. {quantprobe-1.3.0 → quantprobe-1.5.0}/tests/test_pipeline.py +0 -0
  31. {quantprobe-1.3.0 → quantprobe-1.5.0}/tests/test_transforms.py +0 -0
@@ -0,0 +1,145 @@
1
+ Metadata-Version: 2.4
2
+ Name: quantprobe
3
+ Version: 1.5.0
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
+ ### Placement beats budget
22
+
23
+ **Where your bits sit — which layers, which memory tier — matters more than how many you have. Four falsification-tested laws for running big LLMs on hardware you already own, every number measured on one 2016 desktop (GTX 1060 6 GB · 16 GB DDR4 · SATA SSD).**
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) ![data--free](https://img.shields.io/badge/quantization-data--free-1d9e70) ![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
+ > **▶ Try the interactive calculator: [Will it run — and how fast?](https://federicots.github.io/quantprobe/)**
30
+ > Pick any model + your machine → predicted tok/s, memory fit, quality cost, and your cheapest next upgrade — from the law below, with your config plotted against every validated measurement.
31
+
32
+
33
+ **New here? → [QUICKSTART.md](QUICKSTART.md) gets you running in 60 seconds.** Two tiers: `plan`/`target` and the web calculator need *nothing* installed; `quantize`/`probe`/`run`/`bench`/`dashboard` drive [llama.cpp](https://github.com/ggml-org/llama.cpp/releases) (point quantprobe at it with `--llama-dir`, `QUANTPROBE_LLAMA_DIR`, or `PATH`). Preview any command without llama.cpp using `--dry`. 16 machine presets ship in (`--machine`): GTX 1060 → RTX 5090, Apple `mac-m2/m3/m4-*`, DGX Spark, Epyc — or pass raw specs. Multi-GPU / RAID? Comma lists aggregate: `--vram 24,24 --disk-bw 14,14`. Big-VRAM + disk-streaming rigs get the three-tier expert-cache row (v1.3).
34
+
35
+
36
+ ---
37
+
38
+ ## What this is
39
+
40
+ My 2016 desktop can't run frontier models the way a datacenter does — so instead of brute force, I asked *where* every bit and byte should go, and answered it by measurement. Months of experiments later, the result is four laws, a 30-minute probe tool, copy-paste llama.cpp recipes, and one equation that predicts decode speed from 7B to 744B — validated against my own pre-registered predictions and against [colibri](https://github.com/JustVugg/colibri)'s independently published 744B numbers.
41
+
42
+ ## Headline results
43
+
44
+ | result | number |
45
+ |---|---|
46
+ | 16B MoE, 2-bit, **data-free**, resident on a 6 GB card | ppl 6.31 → 6.96 (**1.10×**) — beats calibrated SOTA's gap-ratio |
47
+ | Same bytes, different layers (Gemma 4 12B, stock llama.cpp) | **byte-identical files, 2.25 ppl apart** (12.27 vs 10.02) |
48
+ | Gemma 4 12B depth-aware 2-bit | 1.91× → **1.45×** quality cost, ~4.5 GB resident |
49
+ | Qwen3-30B-A3B on the 2016 desktop | **19.3 tok/s** — hybrid placement, *predicted 19 before measuring* |
50
+ | GLM-4.5-Air **110B** from a SATA drive, 16 GB RAM | 0.19 tok/s — inside the law's pre-registered 0.2–0.3 band |
51
+ | RAM overclock (XMP, 2133→3000) | dense **+52%**, pre-registered ×1.41+ |
52
+
53
+ ## Why the evidence is unusually strong
54
+
55
+ Most benchmark posts report what happened. I report what I **predicted before it happened** — I wrote the number down, then ran the hardware, and this is the strongest form of empirical evidence I know how to produce:
56
+
57
+ | prediction (made first) | measured (after) |
58
+ |---|---|
59
+ | 110B streamed from SATA: **0.2–0.3 tok/s** | **0.19** |
60
+ | RAM overclock scales in-RAM decode **×1.41+** | **×1.52** |
61
+ | 30B hybrid placement: **~19 tok/s** | **19.30 ± 0.88** |
62
+ | a day-old 118B (Laguna S 2.1) streamed from this SATA drive: **0.2–0.4** ([staked pre-download](preregistrations/2026-07-23-laguna-s-2.1-on-2016-desktop.md)) | **0.38 ± 0.17** |
63
+ | colibri's own 128 GB / 25 GB tiers, from our η bands | land **inside** the bands |
64
+
65
+ Add to that: a **byte-identical control** (two GGUFs the same size, 2.25 ppl apart — only placement differs), a full **claim → script → log manifest** (every number reproducible in-tree), and a set of **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).
66
+
67
+ <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>
68
+ <p align="center"><em>One frame, no cuts: Task Manager (16 GB @ 3000 MT/s, GTX 1060 6 GB, RAM at 91% — the hybrid placement using the whole machine) beside llama.cpp chatting Qwen3-30B-A3B at <b>20.4 tok/s generation</b> — above the pre-registered 19. Raw logs, hardware attestation + GGUF SHA256: <a href="weights/data/validation_19tok/EVIDENCE.txt">EVIDENCE.txt</a>. Third bench run: 19.26 ± 0.45 (series 19.30 → 19.55 → 19.26).</em></p>
69
+
70
+ **Open pre-registrations** — predictions staked publicly *before* measurement: [colibri v1.1, five falsifiable predictions (2026-07-23)](preregistrations/2026-07-23-colibri-v1.1.md) — dual-SSD scaling, int3 speedup, lattice-vs-scalar, AVX-512 tier-scoping, MTP×MoE antagonism.
71
+
72
+
73
+ ## The four placement laws
74
+
75
+ Full statements, each with its establishing measurement and a falsifiable prediction, in **[LAWS.md](LAWS.md)**.
76
+
77
+ 1. **Rotation is rank-conditional.** Incoherence rotation (QuIP#/QTIP/QuaRot) helps full-rank tensors (+0.006 ppl) and destroys low-rank bottlenecks (+1623 ppl) — a ~270,000× swing on effective rank alone.
78
+ 2. **Trained networks are dense everywhere.** Experts sit *exactly* at the rate-distortion floor; routing is flat (even across domains — Jaccard 1.00 prose vs code); activations are diffuse. **2-bit is the floor.**
79
+ 3. **Fragility is measurable, not predictable.** Gemma late-fragile 4×, Mistral **early-fragile 25×** — architectural near-twins pointing opposite ways. Weight statistics mislead. **Only a 30-minute functional probe decides.**
80
+ 4. **The tiered decode law.** `tok/s = η(tier)·BW ÷ active-bytes`, η collapsing per tier across 7B→744B and both projects' hardware. **v1.1 adds the context term**: each generated token also re-reads the whole KV cache from *its* tier — `--ctx` prices it, `bench --depth` measures it (measured here: 20.02 → 16.12 tok/s at 16k depth).
81
+
82
+ <p align="center"><img src="weights/data/x_chart_E_scalinglaw.png" width="700" alt="One scaling law, 7B to 744B, predicted vs measured, including colibri's published tiers"></p>
83
+
84
+ <p align="center"><img src="weights/data/x_chart_D_placement.png" width="700" alt="Byte-identical GGUF files, 2.25 perplexity apart — placement is worth twice the byte budget"></p>
85
+ <p align="center"><img src="weights/data/x_chart_I_kvdepth.png" width="700" alt="Decode speed versus context depth: measured 20.02 tok/s at depth zero falling to 16.12 at 16384, on the Law 4 v2 curve with eta_kv 0.70"></p>
86
+
87
+
88
+ ## Install — and the eleven commands
89
+
90
+ ```bash
91
+ pip install quantprobe
92
+ quantprobe auto qwen3-coder --tps 15 --run # empty machine -> optimal quant chosen, fetched, chatting
93
+ ```
94
+
95
+ **Zero-config on your own box**: `quantprobe plan --gguf model.gguf` auto-detects the machine and reads the model from the file. Presets/flags estimate any *other* machine. `hw`/`plan`/`target`/`optimize` need nothing else installed (`auto` needs network for the fetch); the rest drive stock [llama.cpp](https://github.com/ggml-org/llama.cpp/releases) (point at it with `--llama-dir`/`QUANTPROBE_LLAMA_DIR`/`PATH`; preview any command with `--dry`).
96
+
97
+ ```bash
98
+ quantprobe auto qwen3-30b --tps 15 # ONE command: optimizer picks bits, closest quant fetched, run command printed
99
+ quantprobe hw # what the law sees on THIS machine (every value source-tagged)
100
+ quantprobe plan --gguf model.gguf # zero-config prediction: placement + tok/s + the launch command
101
+ quantprobe optimize --tps 20 # CHEAPEST PATH to a target: bits x placement x hardware, Pareto-ranked
102
+ quantprobe target --tps 5 --machine gaming --ladder # inverse: target -> smartest model + speed-intelligence ladder
103
+ quantprobe fetch qwen3-30b ./models # robust, resumable download
104
+ quantprobe quantize --gguf f16.gguf --out 2bit.gguf # COMPRESS: depth-aware ~2-bit GGUF (verified: loads + generates)
105
+ quantprobe probe --gguf f16.gguf --eval wiki.test.raw # measure YOUR model's fragile band (~30 min); --apply builds it
106
+ quantprobe run --gguf 2bit.gguf # plan the placement, then LAUNCH llama.cpp chat
107
+ quantprobe bench --gguf 2bit.gguf --contribute # predicted vs measured on your box; opt-in datapoint
108
+ quantprobe dashboard --gguf 2bit.gguf # the law LIVE: neuron galaxy + thinking toggle, every reply scored vs prediction
109
+ ```
110
+
111
+ The loop is self-validating: `plan` predicted 17.5 for a file we then measured at **18.32 ± 0.17**; the config months of research converged to is what `optimize` picks blind. A measured example of what that's worth: the same model, mis-specified vs law-routed, is **3.38 vs 18.32 tok/s (×5.4)** — [worked examples](docs/EXAMPLES.md).
112
+
113
+ ## Help grow the law
114
+
115
+ `quantprobe bench --contribute` prints exactly what would be shared (hardware label, model, predicted-vs-measured) plus a pre-filled issue link — **you review and submit; nothing is ever sent automatically**. Contributed points land on the law chart; the ones *outside* the bands are the most valuable. Open falsifiable predictions anyone can settle: [preregistrations/](preregistrations/).
116
+
117
+ ## Deep dives
118
+
119
+ | | |
120
+ |---|---|
121
+ | [QUICKSTART.md](QUICKSTART.md) | 60-second start, three levels; Ollama interop; llama.cpp version notes |
122
+ | [LAWS.md](LAWS.md) | the four laws — statements, measurements, falsifiable predictions, the general form |
123
+ | [docs/EXAMPLES.md](docs/EXAMPLES.md) | worked examples with real outputs: zero-config, the ×5.4 optimizer A/B, probe walkthrough, troubleshooting |
124
+ | [docs/HARDWARE.md](docs/HARDWARE.md) | the 2016 box: exact specs, measured bandwidths, what the next euro buys |
125
+ | [docs/DEEP-DIVE.md](docs/DEEP-DIVE.md) | what's new vs. what's built-on, parity tables, the 744B-at-home projection, repository map |
126
+ | [preregistrations/](preregistrations/) | every staked prediction with its verdict — hits, the near-miss, and the honest miss |
127
+ | [papers/arxiv/](papers/arxiv/) | the paper (submission-ready LaTeX) |
128
+ | [CHANGELOG.md](CHANGELOG.md) | v1.0 → v1.4, every release |
129
+
130
+ ## Honest limitations
131
+
132
+ - Perplexity on WikiText-2 is my primary metric; I haven't run task-level evals (MMLU/HellaSwag) yet.
133
+ - My fragility atlas covers four model families — enough to *disprove* universality, not to chart every architecture.
134
+ - 0.19 tok/s for a 110B is a **capacity demonstration, not usable inference** — the honest speed only arrives with faster storage.
135
+ - Speed numbers are single-stream decode on one machine (±25% across environments); the tiered-decode η values are fitted, not derived.
136
+ - No custom runtime: everything rides stock llama.cpp and streaming eval harnesses. The one CUDA kernel is verified in reference, not built.
137
+
138
+
139
+ ## Credits
140
+
141
+ [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; every claim is measured, and every negative that redirected the work is documented. The Law 4 context term (v1.1) was prompted by **u/RogerAI--fyi** (Reddit), who correctly observed the original formulation omitted per-token KV reads — measured, confirmed, and shipped within a day.
142
+
143
+ ## License
144
+
145
+ MIT — see [LICENSE](LICENSE). © 2026 Federico Sciuca.
@@ -0,0 +1,127 @@
1
+ # quantprobe
2
+
3
+ ### Placement beats budget
4
+
5
+ **Where your bits sit — which layers, which memory tier — matters more than how many you have. Four falsification-tested laws for running big LLMs on hardware you already own, every number measured on one 2016 desktop (GTX 1060 6 GB · 16 GB DDR4 · SATA SSD).**
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) ![data--free](https://img.shields.io/badge/quantization-data--free-1d9e70) ![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
+ > **▶ Try the interactive calculator: [Will it run — and how fast?](https://federicots.github.io/quantprobe/)**
12
+ > Pick any model + your machine → predicted tok/s, memory fit, quality cost, and your cheapest next upgrade — from the law below, with your config plotted against every validated measurement.
13
+
14
+
15
+ **New here? → [QUICKSTART.md](QUICKSTART.md) gets you running in 60 seconds.** Two tiers: `plan`/`target` and the web calculator need *nothing* installed; `quantize`/`probe`/`run`/`bench`/`dashboard` drive [llama.cpp](https://github.com/ggml-org/llama.cpp/releases) (point quantprobe at it with `--llama-dir`, `QUANTPROBE_LLAMA_DIR`, or `PATH`). Preview any command without llama.cpp using `--dry`. 16 machine presets ship in (`--machine`): GTX 1060 → RTX 5090, Apple `mac-m2/m3/m4-*`, DGX Spark, Epyc — or pass raw specs. Multi-GPU / RAID? Comma lists aggregate: `--vram 24,24 --disk-bw 14,14`. Big-VRAM + disk-streaming rigs get the three-tier expert-cache row (v1.3).
16
+
17
+
18
+ ---
19
+
20
+ ## What this is
21
+
22
+ My 2016 desktop can't run frontier models the way a datacenter does — so instead of brute force, I asked *where* every bit and byte should go, and answered it by measurement. Months of experiments later, the result is four laws, a 30-minute probe tool, copy-paste llama.cpp recipes, and one equation that predicts decode speed from 7B to 744B — validated against my own pre-registered predictions and against [colibri](https://github.com/JustVugg/colibri)'s independently published 744B numbers.
23
+
24
+ ## Headline results
25
+
26
+ | result | number |
27
+ |---|---|
28
+ | 16B MoE, 2-bit, **data-free**, resident on a 6 GB card | ppl 6.31 → 6.96 (**1.10×**) — beats calibrated SOTA's gap-ratio |
29
+ | Same bytes, different layers (Gemma 4 12B, stock llama.cpp) | **byte-identical files, 2.25 ppl apart** (12.27 vs 10.02) |
30
+ | Gemma 4 12B depth-aware 2-bit | 1.91× → **1.45×** quality cost, ~4.5 GB resident |
31
+ | Qwen3-30B-A3B on the 2016 desktop | **19.3 tok/s** — hybrid placement, *predicted 19 before measuring* |
32
+ | GLM-4.5-Air **110B** from a SATA drive, 16 GB RAM | 0.19 tok/s — inside the law's pre-registered 0.2–0.3 band |
33
+ | RAM overclock (XMP, 2133→3000) | dense **+52%**, pre-registered ×1.41+ |
34
+
35
+ ## Why the evidence is unusually strong
36
+
37
+ Most benchmark posts report what happened. I report what I **predicted before it happened** — I wrote the number down, then ran the hardware, and this is the strongest form of empirical evidence I know how to produce:
38
+
39
+ | prediction (made first) | measured (after) |
40
+ |---|---|
41
+ | 110B streamed from SATA: **0.2–0.3 tok/s** | **0.19** |
42
+ | RAM overclock scales in-RAM decode **×1.41+** | **×1.52** |
43
+ | 30B hybrid placement: **~19 tok/s** | **19.30 ± 0.88** |
44
+ | a day-old 118B (Laguna S 2.1) streamed from this SATA drive: **0.2–0.4** ([staked pre-download](preregistrations/2026-07-23-laguna-s-2.1-on-2016-desktop.md)) | **0.38 ± 0.17** |
45
+ | colibri's own 128 GB / 25 GB tiers, from our η bands | land **inside** the bands |
46
+
47
+ Add to that: a **byte-identical control** (two GGUFs the same size, 2.25 ppl apart — only placement differs), a full **claim → script → log manifest** (every number reproducible in-tree), and a set of **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).
48
+
49
+ <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>
50
+ <p align="center"><em>One frame, no cuts: Task Manager (16 GB @ 3000 MT/s, GTX 1060 6 GB, RAM at 91% — the hybrid placement using the whole machine) beside llama.cpp chatting Qwen3-30B-A3B at <b>20.4 tok/s generation</b> — above the pre-registered 19. Raw logs, hardware attestation + GGUF SHA256: <a href="weights/data/validation_19tok/EVIDENCE.txt">EVIDENCE.txt</a>. Third bench run: 19.26 ± 0.45 (series 19.30 → 19.55 → 19.26).</em></p>
51
+
52
+ **Open pre-registrations** — predictions staked publicly *before* measurement: [colibri v1.1, five falsifiable predictions (2026-07-23)](preregistrations/2026-07-23-colibri-v1.1.md) — dual-SSD scaling, int3 speedup, lattice-vs-scalar, AVX-512 tier-scoping, MTP×MoE antagonism.
53
+
54
+
55
+ ## The four placement laws
56
+
57
+ Full statements, each with its establishing measurement and a falsifiable prediction, in **[LAWS.md](LAWS.md)**.
58
+
59
+ 1. **Rotation is rank-conditional.** Incoherence rotation (QuIP#/QTIP/QuaRot) helps full-rank tensors (+0.006 ppl) and destroys low-rank bottlenecks (+1623 ppl) — a ~270,000× swing on effective rank alone.
60
+ 2. **Trained networks are dense everywhere.** Experts sit *exactly* at the rate-distortion floor; routing is flat (even across domains — Jaccard 1.00 prose vs code); activations are diffuse. **2-bit is the floor.**
61
+ 3. **Fragility is measurable, not predictable.** Gemma late-fragile 4×, Mistral **early-fragile 25×** — architectural near-twins pointing opposite ways. Weight statistics mislead. **Only a 30-minute functional probe decides.**
62
+ 4. **The tiered decode law.** `tok/s = η(tier)·BW ÷ active-bytes`, η collapsing per tier across 7B→744B and both projects' hardware. **v1.1 adds the context term**: each generated token also re-reads the whole KV cache from *its* tier — `--ctx` prices it, `bench --depth` measures it (measured here: 20.02 → 16.12 tok/s at 16k depth).
63
+
64
+ <p align="center"><img src="weights/data/x_chart_E_scalinglaw.png" width="700" alt="One scaling law, 7B to 744B, predicted vs measured, including colibri's published tiers"></p>
65
+
66
+ <p align="center"><img src="weights/data/x_chart_D_placement.png" width="700" alt="Byte-identical GGUF files, 2.25 perplexity apart — placement is worth twice the byte budget"></p>
67
+ <p align="center"><img src="weights/data/x_chart_I_kvdepth.png" width="700" alt="Decode speed versus context depth: measured 20.02 tok/s at depth zero falling to 16.12 at 16384, on the Law 4 v2 curve with eta_kv 0.70"></p>
68
+
69
+
70
+ ## Install — and the eleven commands
71
+
72
+ ```bash
73
+ pip install quantprobe
74
+ quantprobe auto qwen3-coder --tps 15 --run # empty machine -> optimal quant chosen, fetched, chatting
75
+ ```
76
+
77
+ **Zero-config on your own box**: `quantprobe plan --gguf model.gguf` auto-detects the machine and reads the model from the file. Presets/flags estimate any *other* machine. `hw`/`plan`/`target`/`optimize` need nothing else installed (`auto` needs network for the fetch); the rest drive stock [llama.cpp](https://github.com/ggml-org/llama.cpp/releases) (point at it with `--llama-dir`/`QUANTPROBE_LLAMA_DIR`/`PATH`; preview any command with `--dry`).
78
+
79
+ ```bash
80
+ quantprobe auto qwen3-30b --tps 15 # ONE command: optimizer picks bits, closest quant fetched, run command printed
81
+ quantprobe hw # what the law sees on THIS machine (every value source-tagged)
82
+ quantprobe plan --gguf model.gguf # zero-config prediction: placement + tok/s + the launch command
83
+ quantprobe optimize --tps 20 # CHEAPEST PATH to a target: bits x placement x hardware, Pareto-ranked
84
+ quantprobe target --tps 5 --machine gaming --ladder # inverse: target -> smartest model + speed-intelligence ladder
85
+ quantprobe fetch qwen3-30b ./models # robust, resumable download
86
+ quantprobe quantize --gguf f16.gguf --out 2bit.gguf # COMPRESS: depth-aware ~2-bit GGUF (verified: loads + generates)
87
+ quantprobe probe --gguf f16.gguf --eval wiki.test.raw # measure YOUR model's fragile band (~30 min); --apply builds it
88
+ quantprobe run --gguf 2bit.gguf # plan the placement, then LAUNCH llama.cpp chat
89
+ quantprobe bench --gguf 2bit.gguf --contribute # predicted vs measured on your box; opt-in datapoint
90
+ quantprobe dashboard --gguf 2bit.gguf # the law LIVE: neuron galaxy + thinking toggle, every reply scored vs prediction
91
+ ```
92
+
93
+ The loop is self-validating: `plan` predicted 17.5 for a file we then measured at **18.32 ± 0.17**; the config months of research converged to is what `optimize` picks blind. A measured example of what that's worth: the same model, mis-specified vs law-routed, is **3.38 vs 18.32 tok/s (×5.4)** — [worked examples](docs/EXAMPLES.md).
94
+
95
+ ## Help grow the law
96
+
97
+ `quantprobe bench --contribute` prints exactly what would be shared (hardware label, model, predicted-vs-measured) plus a pre-filled issue link — **you review and submit; nothing is ever sent automatically**. Contributed points land on the law chart; the ones *outside* the bands are the most valuable. Open falsifiable predictions anyone can settle: [preregistrations/](preregistrations/).
98
+
99
+ ## Deep dives
100
+
101
+ | | |
102
+ |---|---|
103
+ | [QUICKSTART.md](QUICKSTART.md) | 60-second start, three levels; Ollama interop; llama.cpp version notes |
104
+ | [LAWS.md](LAWS.md) | the four laws — statements, measurements, falsifiable predictions, the general form |
105
+ | [docs/EXAMPLES.md](docs/EXAMPLES.md) | worked examples with real outputs: zero-config, the ×5.4 optimizer A/B, probe walkthrough, troubleshooting |
106
+ | [docs/HARDWARE.md](docs/HARDWARE.md) | the 2016 box: exact specs, measured bandwidths, what the next euro buys |
107
+ | [docs/DEEP-DIVE.md](docs/DEEP-DIVE.md) | what's new vs. what's built-on, parity tables, the 744B-at-home projection, repository map |
108
+ | [preregistrations/](preregistrations/) | every staked prediction with its verdict — hits, the near-miss, and the honest miss |
109
+ | [papers/arxiv/](papers/arxiv/) | the paper (submission-ready LaTeX) |
110
+ | [CHANGELOG.md](CHANGELOG.md) | v1.0 → v1.4, every release |
111
+
112
+ ## Honest limitations
113
+
114
+ - Perplexity on WikiText-2 is my primary metric; I haven't run task-level evals (MMLU/HellaSwag) yet.
115
+ - My fragility atlas covers four model families — enough to *disprove* universality, not to chart every architecture.
116
+ - 0.19 tok/s for a 110B is a **capacity demonstration, not usable inference** — the honest speed only arrives with faster storage.
117
+ - Speed numbers are single-stream decode on one machine (±25% across environments); the tiered-decode η values are fitted, not derived.
118
+ - No custom runtime: everything rides stock llama.cpp and streaming eval harnesses. The one CUDA kernel is verified in reference, not built.
119
+
120
+
121
+ ## Credits
122
+
123
+ [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; every claim is measured, and every negative that redirected the work is documented. The Law 4 context term (v1.1) was prompted by **u/RogerAI--fyi** (Reddit), who correctly observed the original formulation omitted per-token KV reads — measured, confirmed, and shipped within a day.
124
+
125
+ ## License
126
+
127
+ 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.3.0"
7
+ version = "1.5.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.3.0"
11
+ __version__ = "1.5.0"
@@ -0,0 +1,106 @@
1
+ """quantprobe auto — one command: model in, running setup out.
2
+
3
+ quantprobe auto qwen3-30b --tps 15 # preset
4
+ quantprobe auto unsloth/Qwen3-30B-A3B-GGUF # any HF GGUF repo (params read from filenames' size)
5
+
6
+ The two-speed design:
7
+ FAST PATH (this command): detect the machine -> ask the optimizer for the best effective-bits ->
8
+ scan the HF repo's file list and pick the closest-matching quant BY SIZE (bits = size*8/params —
9
+ no fragile name parsing) -> fetch it -> print the prediction and the run command (--run launches).
10
+ CUSTOM PATH (the actual product, printed at the end): probe YOUR model's fragile band and build a
11
+ depth-aware GGUF at the same bits — better quality at the same bytes. `probe --apply` does it.
12
+ """
13
+ from __future__ import annotations
14
+ import json, urllib.request
15
+
16
+ from . import plan as planmod
17
+ from . import optimize as optmod
18
+
19
+ # preset -> (repo, total params B, active B, always-active B, moe)
20
+ MODEL_REPOS = {
21
+ "qwen3-30b": ("unsloth/Qwen3-30B-A3B-GGUF", 30.5, 3.3, 1.2, True),
22
+ "qwen3-coder": ("unsloth/Qwen3-Coder-30B-A3B-Instruct-GGUF", 30.5, 3.3, 1.2, True),
23
+ "glm-air": ("unsloth/GLM-4.5-Air-GGUF", 110, 12, 2.7, True),
24
+ "laguna-s": ("unsloth/Laguna-S-2.1-GGUF", 117.6, 8, 2.5, True),
25
+ "gemma-12b": ("unsloth/gemma-4-12b-it-GGUF", 11.9, 11.9, 11.9, False),
26
+ "mistral-7b": ("unsloth/Mistral-7B-Instruct-v0.3-GGUF", 7.2, 7.2, 7.2, False),
27
+ }
28
+
29
+
30
+ def list_ggufs(repo):
31
+ """[(path, size_bytes)] for a HF repo, via the public tree API."""
32
+ req = urllib.request.Request(f"https://huggingface.co/api/models/{repo}/tree/main",
33
+ headers={"User-Agent": "quantprobe-auto"})
34
+ with urllib.request.urlopen(req, timeout=30) as r:
35
+ return [(f["path"], f.get("size", 0)) for f in json.load(r)
36
+ if f["path"].endswith(".gguf") and f.get("size", 0) > 1e8
37
+ and "mmproj" not in f["path"].lower() and "draft" not in f["path"].lower()]
38
+
39
+
40
+ def run(a):
41
+ target = a.target
42
+ if target in MODEL_REPOS:
43
+ repo, t, ac, ne, moe = MODEL_REPOS[target]
44
+ else:
45
+ repo = target
46
+ if not getattr(a, "total", None):
47
+ raise SystemExit(f"'{target}' is not a preset ({', '.join(MODEL_REPOS)}) - for a raw HF "
48
+ "repo also pass --total (B params) and, for MoE, --active/--always-active")
49
+ t, ac = a.total, a.active or a.total
50
+ ne = a.always_active or (ac if ac >= t * 0.9 else ac * 0.35)
51
+ moe = ac < t * 0.9
52
+ a.total, a.active, a.always_active, a.model = t, ac, ne, None
53
+
54
+ # 1. what does the optimizer want on THIS machine?
55
+ a.gguf = None
56
+ ranked = optmod.run(a)
57
+ want_bits = ranked[0]["bits"]
58
+ _, _, _, _, _, (vc, vb, rc, rb, db, geta, gl), ctx, kvp = optmod.resolve(a)
59
+
60
+ # 2. pick the closest file BY SIZE (bits = size*8/params; honest, format-agnostic)
61
+ try:
62
+ files = list_ggufs(repo)
63
+ except Exception as e:
64
+ raise SystemExit(f"could not list {repo}: {e}")
65
+ if not files:
66
+ raise SystemExit(f"no GGUF files found in {repo}")
67
+ scored = []
68
+ for path, size in files:
69
+ bits = size * 8 / (t * 1e9)
70
+ if bits < 1.0 or bits > 9:
71
+ continue
72
+ _, _, cfgs = planmod.evaluate(t, ac, ne, moe, bits, vc, vb, rc, rb, db, geta, 1.0, gl,
73
+ ctx=ctx, kvp=kvp)
74
+ cfgs = [c for c in cfgs if "expert cache" not in c[0]]
75
+ if not cfgs:
76
+ continue
77
+ scored.append((abs(bits - want_bits), -cfgs[0][1], path, size, bits, cfgs[0]))
78
+ if not scored:
79
+ raise SystemExit("no usable quant in that repo for this machine")
80
+ scored.sort()
81
+ _, _, path, size, bits, best = scored[0]
82
+ print(f"\n[quantprobe auto] optimizer wants ~{want_bits:g}-bit; closest file in {repo}:")
83
+ print(f" {path} ({size/1e9:.1f} GB, {bits:.2f} effective bits)")
84
+ print(f" predicted on this machine: {best[1]:.1f} tok/s ({best[0]})")
85
+ if getattr(a, "dry", False):
86
+ print(" (--dry: nothing downloaded)")
87
+ return path
88
+ # 3. fetch it (resumable), then hand off
89
+ from . import fetch as fetchmod
90
+ dest = getattr(a, "dir", None) or "./models"
91
+ import os
92
+ os.makedirs(dest, exist_ok=True)
93
+ ok = fetchmod.fetch(repo, dest, path, fetchmod.token())
94
+ if not ok:
95
+ raise SystemExit("download failed (it resumes: re-run the same command)")
96
+ full = os.path.join(dest, os.path.basename(path))
97
+ print(f"\n[quantprobe auto] ready. Run it:")
98
+ print(f" quantprobe run --gguf {full}")
99
+ print(f"\n Want better quality at the SAME size? That's the custom path (the actual product):")
100
+ print(f" fetch the f16, then: quantprobe probe --gguf <f16>.gguf --eval wiki.test.raw --apply")
101
+ if getattr(a, "run", False):
102
+ from . import runtime
103
+ a.gguf = full
104
+ a.bits = None # let autospec read the real file
105
+ runtime.run(a)
106
+ return full
@@ -84,6 +84,24 @@ def main():
84
84
  z.add_argument("--llama-dir", default=None)
85
85
  z.add_argument("--dry", action="store_true")
86
86
 
87
+ o = sub.add_parser("optimize", help="cheapest path to a target speed: search bits x placement x KV x hardware over the law")
88
+ o.add_argument("--tps", type=float, default=None, help="target tok/s (omit for the speed frontier)")
89
+ o.add_argument("--max-quality", type=float, default=None, help="quality-cost ceiling (default 1.12)")
90
+ o.add_argument("--any-runtime", action="store_true", help="include placements needing expert-caching runtimes (ktransformers-class), not just stock llama.cpp")
91
+ o.add_argument("--allow-prune", action="store_true", help="include REAP-class pruned variants (domain-specialized: +39%% out-of-domain ppl measured)")
92
+ hwargs(o)
93
+
94
+ au = sub.add_parser("auto", help="ONE command: model in, running setup out - optimizer picks the bits, the closest quant is fetched, run command printed")
95
+ au.add_argument("target", help="model preset (qwen3-30b, qwen3-coder, glm-air, laguna-s, gemma-12b, mistral-7b) or a HF GGUF repo id")
96
+ au.add_argument("--dir", default="./models", help="download directory (default ./models)")
97
+ au.add_argument("--run", action="store_true", help="launch chat immediately after the download")
98
+ hwargs(au)
99
+ au.add_argument("--tps", type=float, default=None, help="target tok/s for the optimizer")
100
+ au.add_argument("--max-quality", type=float, default=None)
101
+ au.add_argument("--allow-prune", action="store_true"); au.add_argument("--any-runtime", action="store_true")
102
+ au.add_argument("--serve", action="store_true", help="with --run: llama-server instead of chat")
103
+ au.add_argument("--extra", default=None)
104
+
87
105
  hwp = sub.add_parser("hw", help="detect THIS machine's memory tiers (no flags needed); every value tagged with its source")
88
106
  hwp.add_argument("--measure", default=None, metavar="FILE", help="also MEASURE sequential disk read on a real file (e.g. a GGUF)")
89
107
 
@@ -109,6 +127,12 @@ def main():
109
127
  elif a.cmd == "target":
110
128
  from . import target
111
129
  target.run(a)
130
+ elif a.cmd == "auto":
131
+ from . import auto
132
+ auto.run(a)
133
+ elif a.cmd == "optimize":
134
+ from . import optimize
135
+ optimize.run(a)
112
136
  elif a.cmd == "hw":
113
137
  from . import detect
114
138
  detect.run(a)