quantprobe 1.25.0__tar.gz → 1.26.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. {quantprobe-1.25.0/quantprobe.egg-info → quantprobe-1.26.1}/PKG-INFO +66 -19
  2. {quantprobe-1.25.0 → quantprobe-1.26.1}/README.md +65 -18
  3. {quantprobe-1.25.0 → quantprobe-1.26.1}/pyproject.toml +1 -1
  4. {quantprobe-1.25.0 → quantprobe-1.26.1}/quantprobe/__init__.py +1 -1
  5. {quantprobe-1.25.0 → quantprobe-1.26.1}/quantprobe/__main__.py +9 -9
  6. {quantprobe-1.25.0 → quantprobe-1.26.1}/quantprobe/branding.py +76 -76
  7. {quantprobe-1.25.0 → quantprobe-1.26.1}/quantprobe/cli.py +190 -190
  8. {quantprobe-1.25.0 → quantprobe-1.26.1}/quantprobe/ollama.py +314 -314
  9. {quantprobe-1.25.0 → quantprobe-1.26.1}/quantprobe/plan.py +54 -4
  10. {quantprobe-1.25.0 → quantprobe-1.26.1}/quantprobe/probe.py +15 -2
  11. {quantprobe-1.25.0 → quantprobe-1.26.1}/quantprobe/recipes/mistral-7b.json +50 -50
  12. {quantprobe-1.25.0 → quantprobe-1.26.1}/quantprobe/recipes/qwen2.5-7b.json +50 -50
  13. {quantprobe-1.25.0 → quantprobe-1.26.1}/quantprobe/recipes/qwen3-30b.json +50 -50
  14. {quantprobe-1.25.0 → quantprobe-1.26.1}/quantprobe/recipes/qwen3.5-35b.json +50 -50
  15. {quantprobe-1.25.0 → quantprobe-1.26.1}/quantprobe/recipes.py +75 -75
  16. {quantprobe-1.25.0 → quantprobe-1.26.1}/quantprobe/runtime.py +258 -258
  17. {quantprobe-1.25.0 → quantprobe-1.26.1}/quantprobe/spec.py +245 -245
  18. {quantprobe-1.25.0 → quantprobe-1.26.1}/quantprobe/target.py +91 -91
  19. {quantprobe-1.25.0 → quantprobe-1.26.1/quantprobe.egg-info}/PKG-INFO +66 -19
  20. {quantprobe-1.25.0 → quantprobe-1.26.1}/quantprobe.egg-info/SOURCES.txt +0 -1
  21. quantprobe-1.25.0/quantprobe/smoke.py +0 -2507
  22. {quantprobe-1.25.0 → quantprobe-1.26.1}/LICENSE +0 -0
  23. {quantprobe-1.25.0 → quantprobe-1.26.1}/quantprobe/auto.py +0 -0
  24. {quantprobe-1.25.0 → quantprobe-1.26.1}/quantprobe/calibrate.py +0 -0
  25. {quantprobe-1.25.0 → quantprobe-1.26.1}/quantprobe/dashboard.py +0 -0
  26. {quantprobe-1.25.0 → quantprobe-1.26.1}/quantprobe/detect.py +0 -0
  27. {quantprobe-1.25.0 → quantprobe-1.26.1}/quantprobe/fetch.py +0 -0
  28. {quantprobe-1.25.0 → quantprobe-1.26.1}/quantprobe/optimize.py +0 -0
  29. {quantprobe-1.25.0 → quantprobe-1.26.1}/quantprobe.egg-info/dependency_links.txt +0 -0
  30. {quantprobe-1.25.0 → quantprobe-1.26.1}/quantprobe.egg-info/entry_points.txt +0 -0
  31. {quantprobe-1.25.0 → quantprobe-1.26.1}/quantprobe.egg-info/requires.txt +0 -0
  32. {quantprobe-1.25.0 → quantprobe-1.26.1}/quantprobe.egg-info/top_level.txt +0 -0
  33. {quantprobe-1.25.0 → quantprobe-1.26.1}/setup.cfg +0 -0
  34. {quantprobe-1.25.0 → quantprobe-1.26.1}/tests/test_engine.py +0 -0
  35. {quantprobe-1.25.0 → quantprobe-1.26.1}/tests/test_evaluator.py +0 -0
  36. {quantprobe-1.25.0 → quantprobe-1.26.1}/tests/test_pipeline.py +0 -0
  37. {quantprobe-1.25.0 → quantprobe-1.26.1}/tests/test_transforms.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: quantprobe
3
- Version: 1.25.0
3
+ Version: 1.26.1
4
4
  Summary: Probe-then-quantize for LLMs: measure a model's fragility curve, plan bit/tier placement by the tiered decode law, and emit ready-to-run llama.cpp recipes.
5
5
  Author: Federico Sciuca
6
6
  License: MIT
@@ -24,12 +24,14 @@ Dynamic: license-file
24
24
 
25
25
  <p align="center"><em>the bar is the probe: one column through the memory tiers it prices — VRAM, RAM, disk.</em></p>
26
26
 
27
- 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.
27
+ 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. Then it proves the result: speed re-measured on demand, quality scored by KL divergence, and the recommended config put through **40 machine-checked business tasks** before we called it usable.
28
28
 
29
- [**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)
29
+ [**Quickstart**](#quickstart) · [**Browser version**](https://federicots.github.io/quantprobe/) · [**What runs on what**](docs/MATRIX.md) · [**Commands**](#commands) · [**The laws**](LAWS.md) · [**When it won't help**](#when-quantprobe-wont-help-you)
30
30
 
31
31
  ![smoke](https://github.com/FedericoTs/quantprobe/actions/workflows/smoke.yml/badge.svg) ![pypi](https://img.shields.io/pypi/v/quantprobe?color=0f766e) ![license](https://img.shields.io/badge/license-MIT-0f766e) ![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)
32
32
 
33
+ **Validated, not vibes.** 14-model ladder at **8.4% median error** on measured hardware · every printed all-in-VRAM number a documented **floor** (real speed ≥0.90× on 13/13 benchmarks, typically 1.1–1.8× higher) · retrodicts third-party results it never trained on ([airllm's 30× spread, DGX Spark reports, a 1.56 TB Kimi rig](docs/MATRIX.md)) · **every prediction staked before measuring, and the misses published at the same size as the hits.**
34
+
33
35
  ## Quickstart
34
36
 
35
37
  ```bash
@@ -49,14 +51,12 @@ quantprobe plan - Qwen3-30B-A3B @ 2.5-bit on THIS machine [auto-detected]
49
51
  19.0 tok/s hybrid: attention->VRAM, experts->RAM [pins 10GB of 12GB RAM (CUDA host memory) - …]
50
52
  13.2 tok/s pure CPU (GPU idle) [RAM boundary - expect bimodal speed]
51
53
 
52
- speculation: pays ONLY when output copies its context (edits, refactors, RAG quoting)
53
- - on novel generation the ngram drafter produces 0 drafts and changes nothing (D-10,
54
- independently replicated on an RTX 3090). Details below.
54
+ binding constraint: BANDWIDTH-BOUND (system RAM bandwidth) - 51% of every decode token is spent there.
55
55
 
56
56
  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
57
57
  ```
58
58
 
59
- 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.
59
+ 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. The **binding constraint** line is the part most tools never tell you: *3 tok/s, disk-bound* means buy RAM; *3 tok/s, bandwidth-bound* means don't bother.
60
60
 
61
61
  **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.
62
62
 
@@ -70,14 +70,53 @@ Detects your machine, asks which model you want, picks the best quant for it, do
70
70
 
71
71
  ## What it does
72
72
 
73
- - **Predicts tok/s before you download** — across every placement (all-VRAM, hybrid, expert-split, CPU, disk-stream) and picks the winner.
73
+ One pipeline, end to end — most tools ship the first line only:
74
+
75
+ - **Predicts tok/s before you download** — across every placement (all-VRAM, hybrid, expert-split, CPU, disk-stream) and picks the winner, printing **which resource binds** and what fixing it would buy.
74
76
  - **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.
75
77
  - **Emits the exact command**, including the `-ot` regex most guides get wrong.
76
78
  - **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.
77
- - **Measures which layers of *your* model break** under compression, then builds a quant that protects them.
79
+ - **Builds layer-aware quantizations** — measures which layers of *your* model break under compression, then protects them (−9% perplexity at the same file size).
80
+ - **Audits a running Ollama install** — `quantprobe audit-ollama` reads the placement Ollama actually chose, prices it against the planner's, and refuses to compare while VRAM is contended (a measurement discipline most benchmarks skip).
81
+ - **Proves quality, not just speed** — perplexity *and* full-distribution KL divergence via llama.cpp's own `--kl-divergence`, because we measured perplexity moving 23% while the model changed its chosen token on 27% of positions.
78
82
  - **Tells you when to stop** — it declines the expensive path on machines that don't need it.
79
83
  - Runs on stock [llama.cpp](https://github.com/ggml-org/llama.cpp). No custom runtime, nothing to build.
80
84
 
85
+ ## Does the cheap quant actually do the work?
86
+
87
+ Speed numbers are worthless if the model can't do the job. So we staked a bar **before generating a single output** — ≥80% of machine-checked tasks or the config is business-useful; under 60% and every tok/s figure we publish gets qualified — and ran the recommended 2.5-bit 30B through **40 auto-scored business tasks**: JSON extraction with exact values, arithmetic to the cent, single-label classification, code that must execute and pass assertions, summaries where **any number not present in the source fails a deterministic hallucination check**.
88
+
89
+ **Result: 40/40.** Five tasks initially exhausted a 4k context window mid-reasoning; at 16k all five pass (one needed 7,417 tokens of thinking — reasoning models spend their budget before they answer). Honest floor if you count those five as failures anyway: 85%, still above the staked bar. [Full outputs, every check, every verdict →](weights/data/bt_20260803_2228_qwen30b_q2k.json)
90
+
91
+ The task set also carries a **difficulty ladder** for comparing models on identical predicates — up to a tier designed so today's models fail it:
92
+
93
+ | model (same 52 predicates, same box) | staked 40 | T3 hard | T4 ceiling |
94
+ |---|---|---|---|
95
+ | **Qwen3-30B-A3B @ 2.95-bit** (the recommended config) | **40/40** | 5/6 | 1/6 |
96
+ | Qwen2.5-7B @ Q4_K_M | 30/40 | 3/6 | 0/6 |
97
+ | Qwen2.5-7B @ 2-bit (both quants, byte-equal) | 27/40 | 4/6 | 0/6 |
98
+ | Qwen3-0.6B @ Q8 | 22/38* | 3/5* | 1/3* |
99
+
100
+ \* thinking-model truncations quarantined and disclosed, never counted as failures. The 0.6B
101
+ fires the suite's own kill rule (57.9% < 60%) — the instrument correctly refuses to call it
102
+ business-usable. And one honest anomaly the ladder itself exposed: **the only T4 task anyone
103
+ solved (the 5-house logic puzzle) was solved by the *biggest and the smallest* model while both
104
+ 7Bs failed it** — non-monotonic in capability, the signature of training-data recall rather
105
+ than reasoning. That task is being replaced with a generated-novel variant; the score stands as
106
+ recorded.
107
+
108
+ Every T3/T4 answer key is recomputed mechanically by the self-test and both logic puzzles are brute-forced to exactly one solution before any model is scored. The T4 nine-digit multiplication is the tier working as intended: the model *announced it would need a calculator*, then printed a confident 18-digit answer that is wrong at digit 5.
109
+
110
+ ## Check any speed claim without owning the hardware
111
+
112
+ Law 4 is `tok/s = η·BW ÷ bytes-per-token`, and it prices other people's machines as well as yours ([the full hardware × model matrix →](docs/MATRIX.md)):
113
+
114
+ - **"DGX Spark runs 70B Q4 at 35–45 tok/s"** — a 70B dense at Q4 moves 42.5 GB per token; at 273 GB/s the *perfect-efficiency* ceiling is 6.4 tok/s. The claim needs 5.5–7× the bandwidth the hardware has. Whatever was measured, it wasn't single-stream decode.
115
+ - **A 1.56 TB Kimi K3 rig reported as "10 tok/s"** — the repo's own README says *seconds per token*; the relay inverted the unit by 200–320×. Better: its four RAM presets test the law. "Add RAM" predicts 15.6× speedup; Law 4 predicts almost none (the expert working set can't be cached); measured across the presets: **1.63×**.
116
+ - **airllm's unexplained 30× spread** (0.07–2 tok/s across hosts) — the law retrodicts it as a tier boundary: RAM-resident hosts land on the RAM term, disk-bound hosts on the disk term.
117
+
118
+ Same arithmetic the planner runs — you just feed it someone else's bandwidth and bytes.
119
+
81
120
  ## Fast vs Custom
82
121
 
83
122
  | | **Fast** — `quantprobe auto qwen3-30b` | **Custom** — `quantprobe auto qwen3-30b --custom` |
@@ -86,7 +125,7 @@ Detects your machine, asks which model you want, picks the best quant for it, do
86
125
  | time | minutes (mostly download) | **~50 min for a 7B, ~10 h for a 35B** — it tells you before starting |
87
126
  | disk | one file | source + working files, 3–4× bigger |
88
127
  | **speed** | full | **identical** — speed comes from placement, not from the build |
89
- | **quality** | whatever the community published | **−9% perplexity at the same file size** |
128
+ | **quality** | whatever the community published | **−9% ppl** (Gemma-12B) · **−13.2% ppl / −39.5% KLD** (Qwen2.5-7B, byte-matched, [staked](preregistrations/2026-08-04-a2a-depth-aware-vs-uniform.md)) |
90
129
 
91
130
  **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.
92
131
 
@@ -117,8 +156,11 @@ Copyability is the whole mechanism: code answers repeat their input, prose inven
117
156
 
118
157
  | result | number |
119
158
  |---|---|
120
- | Qwen3-30B-A3B on a 2016 desktop | **20.4–22.2 tok/s** (healthy-clocks retest, preregs #60/#61) |
159
+ | Qwen3-30B-A3B on a 2016 desktop | **20.4–22.7 tok/s** (22.69 re-measured 2026-08-03 on a normal working session, [server log](weights/data/bt_server.log); 22.94 on a scrubbed box, not quoted as the headline) |
160
+ | Same config, 40 machine-checked business tasks | **40/40** ([evidence](weights/data/bt_20260803_2228_qwen30b_q2k.json)) |
121
161
  | Same model, partial expert offload | **20.62 tok/s** (+12.4%, free) |
162
+ | Depth-aware vs uniform quant, **equal bytes** (7B @ 2-bit, staked A2A) | **-13.2% perplexity, -39.5% median KLD, +5.1 pts same-token, +6.6% tok/s** at +0.48% file size ([prereg + verdict](preregistrations/2026-08-04-a2a-depth-aware-vs-uniform.md)) |
163
+ | Context window trade, measured | 22.69 tok/s at 4k ctx → **~11.7 at 16k** — KV displaces weights on a 6 GB card; run 4k for chat, open it for long chains |
122
164
  | Same bytes, different layers protected (Gemma 4 12B) | **byte-identical files, 2.25 ppl apart** |
123
165
  | Gemma 4 12B depth-aware 2-bit | 1.91× → **1.45×** quality cost, ~4.5 GB resident |
124
166
  | GLM-4.5-Air **110B** from a SATA drive, 16 GB RAM | **0.19 tok/s** (capacity demo, not usable inference) |
@@ -137,14 +179,16 @@ That is not your machine on a normal day, and we will not pretend otherwise:
137
179
 
138
180
  - **All 14 rows measured faster than the previous pass** — not 13, all of them. Median **+4.6%**,
139
181
  up to +27.5%. The scrubbed box is a **ceiling**, not a typical result.
140
- - Because of that, **the published headline speeds above are unchanged.** Qwen3-30B-A3B measured
141
- **22.94 tok/s** on this pass, above the 20.4–22.2 we quote. We did not raise it. A number you
142
- can only get by stopping services is not a number you can reproduce, and reproducibility is the
143
- only thing that makes these figures worth reading.
182
+ - Because of that, **the published headline speeds above stay conservative.** Qwen3-30B-A3B measured
183
+ **22.94 tok/s** on the scrubbed pass; the headline quotes 22.69, measured with a coding agent and
184
+ desktop apps live, because a number you can only get by stopping services is not a number you can
185
+ reproduce.
144
186
  - The median moved 9.0% → 8.4%, which is **inside our own ±1 point noise floor**, so we report it
145
187
  as *unchanged* rather than improved — even though the smaller number is the flattering one.
146
- - One row is flagged untrustworthy: **gemma4-12B** has returned 13.23, 12.25 and 15.62 tok/s across
147
- three passes, a 27% spread. It is not measuring a stable quantity.
188
+ - An earlier version of this section called the gemma4-12B row "untrustworthy" on a 27% spread.
189
+ **That claim was retracted**: it compared runs across different machine states, violating our own
190
+ C-14 rule. Measured properly — six consecutive same-state runs — the spread is **1.087×**
191
+ (12.17–13.23 tok/s), and the query is scripted so anyone can reproduce it.
148
192
 
149
193
  The disk-tier row is the first disk-tier measurement this project has ever taken, and **it failed
150
194
  its own staked band.** We publish it at the same size as the wins. Details, including the two
@@ -160,8 +204,8 @@ mechanisms we tested and the one that survived: [CHANGELOG](CHANGELOG.md).
160
204
  ## When quantprobe won't help you
161
205
 
162
206
  - **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.
163
- - **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.
164
- - **You need task-level eval scores** (MMLU, HellaSwag). quantprobe measures perplexity and KL divergence only.
207
+ - **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. One Spark row is already logged against us: Gemma-4-26B reports 0.77× our floor — unexplained, published, next in the queue.
208
+ - **You need task-level eval scores** (MMLU, HellaSwag). quantprobe measures perplexity, KL divergence, and its own [40-task business suite](weights/business_tasks.py) — not academic benchmarks.
165
209
  - **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.*
166
210
  - **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)
167
211
  - **You're on a Mac or a 50-series card.** Those presets are extrapolated, not measured. `quantprobe bench --contribute` turns one into a datapoint.
@@ -175,6 +219,7 @@ quantprobe plan --gguf model.gguf # predicted tok/s + placement + l
175
219
  quantprobe hw # what the law sees on THIS machine
176
220
  quantprobe calibrate # measure, don't assume: RAM stream, disk, GPU clocks; optional anchor runs
177
221
  quantprobe run --gguf model.gguf # plan the placement, then launch chat
222
+ quantprobe audit-ollama # what is Ollama's default costing you? measured, contention-guarded
178
223
  quantprobe bench --gguf model.gguf --contribute # predicted vs measured; opt-in datapoint
179
224
  ```
180
225
 
@@ -205,10 +250,12 @@ quantprobe dashboard --gguf 2bit.gguf # the law live, every r
205
250
  |---|---|
206
251
  | [QUICKSTART.md](QUICKSTART.md) | get running, three levels; recipes for fine-tunes, coding agents, hardware buying |
207
252
  | [LAWS.md](LAWS.md) | the four laws — statements, measurements, falsifiable predictions |
253
+ | [docs/MATRIX.md](docs/MATRIX.md) | **what to run on what** — 11 machines × 11 models, every cell priced by the shipped engine, scored against third-party reports |
208
254
  | [docs/EXAMPLES.md](docs/EXAMPLES.md) | worked examples with real output, including the ×5.4 optimizer A/B |
209
255
  | [docs/HARDWARE.md](docs/HARDWARE.md) | the 2016 box: exact specs, measured bandwidths, what the next euro buys |
210
256
  | [preregistrations/](preregistrations/) | every staked prediction with its verdict — hits **and** misses |
211
257
  | [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 |
258
+ | [weights/business_tasks.py](weights/business_tasks.py) | the 52-task suite: 40 staked + T3/T4 ladder, every check executable, self-testing |
212
259
  | [CONTRIBUTING.md](CONTRIBUTING.md) | the method: stake, measure, score *and wire*, audit |
213
260
  | [docs/DEEP-DIVE.md](docs/DEEP-DIVE.md) | what's new vs. built-on, parity tables, and the repository map |
214
261
  | [papers/arxiv/](papers/arxiv/) | the paper (submission-ready LaTeX) |
@@ -6,12 +6,14 @@
6
6
 
7
7
  <p align="center"><em>the bar is the probe: one column through the memory tiers it prices — VRAM, RAM, disk.</em></p>
8
8
 
9
- 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.
9
+ 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. Then it proves the result: speed re-measured on demand, quality scored by KL divergence, and the recommended config put through **40 machine-checked business tasks** before we called it usable.
10
10
 
11
- [**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)
11
+ [**Quickstart**](#quickstart) · [**Browser version**](https://federicots.github.io/quantprobe/) · [**What runs on what**](docs/MATRIX.md) · [**Commands**](#commands) · [**The laws**](LAWS.md) · [**When it won't help**](#when-quantprobe-wont-help-you)
12
12
 
13
13
  ![smoke](https://github.com/FedericoTs/quantprobe/actions/workflows/smoke.yml/badge.svg) ![pypi](https://img.shields.io/pypi/v/quantprobe?color=0f766e) ![license](https://img.shields.io/badge/license-MIT-0f766e) ![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)
14
14
 
15
+ **Validated, not vibes.** 14-model ladder at **8.4% median error** on measured hardware · every printed all-in-VRAM number a documented **floor** (real speed ≥0.90× on 13/13 benchmarks, typically 1.1–1.8× higher) · retrodicts third-party results it never trained on ([airllm's 30× spread, DGX Spark reports, a 1.56 TB Kimi rig](docs/MATRIX.md)) · **every prediction staked before measuring, and the misses published at the same size as the hits.**
16
+
15
17
  ## Quickstart
16
18
 
17
19
  ```bash
@@ -31,14 +33,12 @@ quantprobe plan - Qwen3-30B-A3B @ 2.5-bit on THIS machine [auto-detected]
31
33
  19.0 tok/s hybrid: attention->VRAM, experts->RAM [pins 10GB of 12GB RAM (CUDA host memory) - …]
32
34
  13.2 tok/s pure CPU (GPU idle) [RAM boundary - expect bimodal speed]
33
35
 
34
- speculation: pays ONLY when output copies its context (edits, refactors, RAG quoting)
35
- - on novel generation the ngram drafter produces 0 drafts and changes nothing (D-10,
36
- independently replicated on an RTX 3090). Details below.
36
+ binding constraint: BANDWIDTH-BOUND (system RAM bandwidth) - 51% of every decode token is spent there.
37
37
 
38
38
  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
39
39
  ```
40
40
 
41
- 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.
41
+ 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. The **binding constraint** line is the part most tools never tell you: *3 tok/s, disk-bound* means buy RAM; *3 tok/s, bandwidth-bound* means don't bother.
42
42
 
43
43
  **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.
44
44
 
@@ -52,14 +52,53 @@ Detects your machine, asks which model you want, picks the best quant for it, do
52
52
 
53
53
  ## What it does
54
54
 
55
- - **Predicts tok/s before you download** — across every placement (all-VRAM, hybrid, expert-split, CPU, disk-stream) and picks the winner.
55
+ One pipeline, end to end — most tools ship the first line only:
56
+
57
+ - **Predicts tok/s before you download** — across every placement (all-VRAM, hybrid, expert-split, CPU, disk-stream) and picks the winner, printing **which resource binds** and what fixing it would buy.
56
58
  - **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.
57
59
  - **Emits the exact command**, including the `-ot` regex most guides get wrong.
58
60
  - **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.
59
- - **Measures which layers of *your* model break** under compression, then builds a quant that protects them.
61
+ - **Builds layer-aware quantizations** — measures which layers of *your* model break under compression, then protects them (−9% perplexity at the same file size).
62
+ - **Audits a running Ollama install** — `quantprobe audit-ollama` reads the placement Ollama actually chose, prices it against the planner's, and refuses to compare while VRAM is contended (a measurement discipline most benchmarks skip).
63
+ - **Proves quality, not just speed** — perplexity *and* full-distribution KL divergence via llama.cpp's own `--kl-divergence`, because we measured perplexity moving 23% while the model changed its chosen token on 27% of positions.
60
64
  - **Tells you when to stop** — it declines the expensive path on machines that don't need it.
61
65
  - Runs on stock [llama.cpp](https://github.com/ggml-org/llama.cpp). No custom runtime, nothing to build.
62
66
 
67
+ ## Does the cheap quant actually do the work?
68
+
69
+ Speed numbers are worthless if the model can't do the job. So we staked a bar **before generating a single output** — ≥80% of machine-checked tasks or the config is business-useful; under 60% and every tok/s figure we publish gets qualified — and ran the recommended 2.5-bit 30B through **40 auto-scored business tasks**: JSON extraction with exact values, arithmetic to the cent, single-label classification, code that must execute and pass assertions, summaries where **any number not present in the source fails a deterministic hallucination check**.
70
+
71
+ **Result: 40/40.** Five tasks initially exhausted a 4k context window mid-reasoning; at 16k all five pass (one needed 7,417 tokens of thinking — reasoning models spend their budget before they answer). Honest floor if you count those five as failures anyway: 85%, still above the staked bar. [Full outputs, every check, every verdict →](weights/data/bt_20260803_2228_qwen30b_q2k.json)
72
+
73
+ The task set also carries a **difficulty ladder** for comparing models on identical predicates — up to a tier designed so today's models fail it:
74
+
75
+ | model (same 52 predicates, same box) | staked 40 | T3 hard | T4 ceiling |
76
+ |---|---|---|---|
77
+ | **Qwen3-30B-A3B @ 2.95-bit** (the recommended config) | **40/40** | 5/6 | 1/6 |
78
+ | Qwen2.5-7B @ Q4_K_M | 30/40 | 3/6 | 0/6 |
79
+ | Qwen2.5-7B @ 2-bit (both quants, byte-equal) | 27/40 | 4/6 | 0/6 |
80
+ | Qwen3-0.6B @ Q8 | 22/38* | 3/5* | 1/3* |
81
+
82
+ \* thinking-model truncations quarantined and disclosed, never counted as failures. The 0.6B
83
+ fires the suite's own kill rule (57.9% < 60%) — the instrument correctly refuses to call it
84
+ business-usable. And one honest anomaly the ladder itself exposed: **the only T4 task anyone
85
+ solved (the 5-house logic puzzle) was solved by the *biggest and the smallest* model while both
86
+ 7Bs failed it** — non-monotonic in capability, the signature of training-data recall rather
87
+ than reasoning. That task is being replaced with a generated-novel variant; the score stands as
88
+ recorded.
89
+
90
+ Every T3/T4 answer key is recomputed mechanically by the self-test and both logic puzzles are brute-forced to exactly one solution before any model is scored. The T4 nine-digit multiplication is the tier working as intended: the model *announced it would need a calculator*, then printed a confident 18-digit answer that is wrong at digit 5.
91
+
92
+ ## Check any speed claim without owning the hardware
93
+
94
+ Law 4 is `tok/s = η·BW ÷ bytes-per-token`, and it prices other people's machines as well as yours ([the full hardware × model matrix →](docs/MATRIX.md)):
95
+
96
+ - **"DGX Spark runs 70B Q4 at 35–45 tok/s"** — a 70B dense at Q4 moves 42.5 GB per token; at 273 GB/s the *perfect-efficiency* ceiling is 6.4 tok/s. The claim needs 5.5–7× the bandwidth the hardware has. Whatever was measured, it wasn't single-stream decode.
97
+ - **A 1.56 TB Kimi K3 rig reported as "10 tok/s"** — the repo's own README says *seconds per token*; the relay inverted the unit by 200–320×. Better: its four RAM presets test the law. "Add RAM" predicts 15.6× speedup; Law 4 predicts almost none (the expert working set can't be cached); measured across the presets: **1.63×**.
98
+ - **airllm's unexplained 30× spread** (0.07–2 tok/s across hosts) — the law retrodicts it as a tier boundary: RAM-resident hosts land on the RAM term, disk-bound hosts on the disk term.
99
+
100
+ Same arithmetic the planner runs — you just feed it someone else's bandwidth and bytes.
101
+
63
102
  ## Fast vs Custom
64
103
 
65
104
  | | **Fast** — `quantprobe auto qwen3-30b` | **Custom** — `quantprobe auto qwen3-30b --custom` |
@@ -68,7 +107,7 @@ Detects your machine, asks which model you want, picks the best quant for it, do
68
107
  | time | minutes (mostly download) | **~50 min for a 7B, ~10 h for a 35B** — it tells you before starting |
69
108
  | disk | one file | source + working files, 3–4× bigger |
70
109
  | **speed** | full | **identical** — speed comes from placement, not from the build |
71
- | **quality** | whatever the community published | **−9% perplexity at the same file size** |
110
+ | **quality** | whatever the community published | **−9% ppl** (Gemma-12B) · **−13.2% ppl / −39.5% KLD** (Qwen2.5-7B, byte-matched, [staked](preregistrations/2026-08-04-a2a-depth-aware-vs-uniform.md)) |
72
111
 
73
112
  **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.
74
113
 
@@ -99,8 +138,11 @@ Copyability is the whole mechanism: code answers repeat their input, prose inven
99
138
 
100
139
  | result | number |
101
140
  |---|---|
102
- | Qwen3-30B-A3B on a 2016 desktop | **20.4–22.2 tok/s** (healthy-clocks retest, preregs #60/#61) |
141
+ | Qwen3-30B-A3B on a 2016 desktop | **20.4–22.7 tok/s** (22.69 re-measured 2026-08-03 on a normal working session, [server log](weights/data/bt_server.log); 22.94 on a scrubbed box, not quoted as the headline) |
142
+ | Same config, 40 machine-checked business tasks | **40/40** ([evidence](weights/data/bt_20260803_2228_qwen30b_q2k.json)) |
103
143
  | Same model, partial expert offload | **20.62 tok/s** (+12.4%, free) |
144
+ | Depth-aware vs uniform quant, **equal bytes** (7B @ 2-bit, staked A2A) | **-13.2% perplexity, -39.5% median KLD, +5.1 pts same-token, +6.6% tok/s** at +0.48% file size ([prereg + verdict](preregistrations/2026-08-04-a2a-depth-aware-vs-uniform.md)) |
145
+ | Context window trade, measured | 22.69 tok/s at 4k ctx → **~11.7 at 16k** — KV displaces weights on a 6 GB card; run 4k for chat, open it for long chains |
104
146
  | Same bytes, different layers protected (Gemma 4 12B) | **byte-identical files, 2.25 ppl apart** |
105
147
  | Gemma 4 12B depth-aware 2-bit | 1.91× → **1.45×** quality cost, ~4.5 GB resident |
106
148
  | GLM-4.5-Air **110B** from a SATA drive, 16 GB RAM | **0.19 tok/s** (capacity demo, not usable inference) |
@@ -119,14 +161,16 @@ That is not your machine on a normal day, and we will not pretend otherwise:
119
161
 
120
162
  - **All 14 rows measured faster than the previous pass** — not 13, all of them. Median **+4.6%**,
121
163
  up to +27.5%. The scrubbed box is a **ceiling**, not a typical result.
122
- - Because of that, **the published headline speeds above are unchanged.** Qwen3-30B-A3B measured
123
- **22.94 tok/s** on this pass, above the 20.4–22.2 we quote. We did not raise it. A number you
124
- can only get by stopping services is not a number you can reproduce, and reproducibility is the
125
- only thing that makes these figures worth reading.
164
+ - Because of that, **the published headline speeds above stay conservative.** Qwen3-30B-A3B measured
165
+ **22.94 tok/s** on the scrubbed pass; the headline quotes 22.69, measured with a coding agent and
166
+ desktop apps live, because a number you can only get by stopping services is not a number you can
167
+ reproduce.
126
168
  - The median moved 9.0% → 8.4%, which is **inside our own ±1 point noise floor**, so we report it
127
169
  as *unchanged* rather than improved — even though the smaller number is the flattering one.
128
- - One row is flagged untrustworthy: **gemma4-12B** has returned 13.23, 12.25 and 15.62 tok/s across
129
- three passes, a 27% spread. It is not measuring a stable quantity.
170
+ - An earlier version of this section called the gemma4-12B row "untrustworthy" on a 27% spread.
171
+ **That claim was retracted**: it compared runs across different machine states, violating our own
172
+ C-14 rule. Measured properly — six consecutive same-state runs — the spread is **1.087×**
173
+ (12.17–13.23 tok/s), and the query is scripted so anyone can reproduce it.
130
174
 
131
175
  The disk-tier row is the first disk-tier measurement this project has ever taken, and **it failed
132
176
  its own staked band.** We publish it at the same size as the wins. Details, including the two
@@ -142,8 +186,8 @@ mechanisms we tested and the one that survived: [CHANGELOG](CHANGELOG.md).
142
186
  ## When quantprobe won't help you
143
187
 
144
188
  - **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.
145
- - **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.
146
- - **You need task-level eval scores** (MMLU, HellaSwag). quantprobe measures perplexity and KL divergence only.
189
+ - **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. One Spark row is already logged against us: Gemma-4-26B reports 0.77× our floor — unexplained, published, next in the queue.
190
+ - **You need task-level eval scores** (MMLU, HellaSwag). quantprobe measures perplexity, KL divergence, and its own [40-task business suite](weights/business_tasks.py) — not academic benchmarks.
147
191
  - **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.*
148
192
  - **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)
149
193
  - **You're on a Mac or a 50-series card.** Those presets are extrapolated, not measured. `quantprobe bench --contribute` turns one into a datapoint.
@@ -157,6 +201,7 @@ quantprobe plan --gguf model.gguf # predicted tok/s + placement + l
157
201
  quantprobe hw # what the law sees on THIS machine
158
202
  quantprobe calibrate # measure, don't assume: RAM stream, disk, GPU clocks; optional anchor runs
159
203
  quantprobe run --gguf model.gguf # plan the placement, then launch chat
204
+ quantprobe audit-ollama # what is Ollama's default costing you? measured, contention-guarded
160
205
  quantprobe bench --gguf model.gguf --contribute # predicted vs measured; opt-in datapoint
161
206
  ```
162
207
 
@@ -187,10 +232,12 @@ quantprobe dashboard --gguf 2bit.gguf # the law live, every r
187
232
  |---|---|
188
233
  | [QUICKSTART.md](QUICKSTART.md) | get running, three levels; recipes for fine-tunes, coding agents, hardware buying |
189
234
  | [LAWS.md](LAWS.md) | the four laws — statements, measurements, falsifiable predictions |
235
+ | [docs/MATRIX.md](docs/MATRIX.md) | **what to run on what** — 11 machines × 11 models, every cell priced by the shipped engine, scored against third-party reports |
190
236
  | [docs/EXAMPLES.md](docs/EXAMPLES.md) | worked examples with real output, including the ×5.4 optimizer A/B |
191
237
  | [docs/HARDWARE.md](docs/HARDWARE.md) | the 2016 box: exact specs, measured bandwidths, what the next euro buys |
192
238
  | [preregistrations/](preregistrations/) | every staked prediction with its verdict — hits **and** misses |
193
239
  | [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 |
240
+ | [weights/business_tasks.py](weights/business_tasks.py) | the 52-task suite: 40 staked + T3/T4 ladder, every check executable, self-testing |
194
241
  | [CONTRIBUTING.md](CONTRIBUTING.md) | the method: stake, measure, score *and wire*, audit |
195
242
  | [docs/DEEP-DIVE.md](docs/DEEP-DIVE.md) | what's new vs. built-on, parity tables, and the repository map |
196
243
  | [papers/arxiv/](papers/arxiv/) | the paper (submission-ready LaTeX) |
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "quantprobe"
7
- version = "1.25.0"
7
+ version = "1.26.1"
8
8
  description = "Probe-then-quantize for LLMs: measure a model's fragility curve, plan bit/tier placement by the tiered decode law, and emit ready-to-run llama.cpp recipes."
9
9
  readme = "README.md"
10
10
  license = { text = "MIT" }
@@ -8,4 +8,4 @@ Three commands, all grounded in measured laws (see LAWS.md in the repo):
8
8
  Every constant in `plan` is fitted from measurements published in the repo, including two
9
9
  pre-registered hardware predictions confirmed within 8%.
10
10
  """
11
- __version__ = "1.25.0"
11
+ __version__ = "1.26.1"
@@ -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()
@@ -1,76 +1,76 @@
1
- """The quantprobe mark: a Q that is a gauge - the dial is the Q's circle, the needle its tail.
2
- One 12x12 pixel bitmap is the single source of truth: assets/quantprobe-icon.svg is generated
3
- from it (python -m quantprobe.branding > assets/quantprobe-icon.svg), and the terminal banner
4
- renders the same pixels as ANSI half-blocks. Old-style pixel art on purpose."""
5
- import os
6
- import sys
7
-
8
- # '.' = background, 'o' = dial (teal), 'X' = needle/hub (white)
9
- PIXELS = [
10
- "...oooooo...",
11
- "..oo....oo..",
12
- ".oo......oo.",
13
- ".o........o.",
14
- "oo........oo",
15
- "o....XX....o",
16
- "o....XX....o",
17
- "oo.....X....",
18
- ".o......X...",
19
- ".oo......X..",
20
- "..oo......X.",
21
- "...ooo.....X",
22
- ]
23
- BG, DIAL, NEEDLE = (20, 24, 31), (20, 184, 166), (230, 255, 250)
24
-
25
-
26
- def icon_svg(px=10, pad=4):
27
- w = len(PIXELS[0]) * px + 2 * pad
28
- out = ['<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 %d %d" ' % (w, w)
29
- + 'shape-rendering="crispEdges" role="img" aria-label="quantprobe">',
30
- ' <rect width="%d" height="%d" rx="%d" fill="#14181f"/>' % (w, w, 2 * px)]
31
- for y, row in enumerate(PIXELS):
32
- for x, c in enumerate(row):
33
- if c == '.':
34
- continue
35
- color = "#14b8a6" if c == 'o' else "#e6fffa"
36
- out.append(' <rect x="%d" y="%d" width="%d" height="%d" fill="%s"/>'
37
- % (pad + x * px, pad + y * px, px, px, color))
38
- out.append('</svg>')
39
- return "\n".join(out) + "\n"
40
-
41
-
42
- def _rgb(c):
43
- return {'.': BG, 'o': DIAL, 'X': NEEDLE}[c]
44
-
45
-
46
- def icon_ansi():
47
- """The same pixels as truecolor half-blocks, 12 wide x 6 lines tall."""
48
- lines = []
49
- for y in range(0, len(PIXELS), 2):
50
- top, bot = PIXELS[y], PIXELS[y + 1]
51
- line = []
52
- for t, b in zip(top, bot):
53
- (tr, tg, tb), (br, bg_, bb) = _rgb(t), _rgb(b)
54
- line.append("\x1b[38;2;%d;%d;%dm\x1b[48;2;%d;%d;%dm▀" % (tr, tg, tb, br, bg_, bb))
55
- lines.append("".join(line) + "\x1b[0m")
56
- return "\n".join(lines)
57
-
58
-
59
- def banner(version=""):
60
- """Icon + wordmark for the CLI header. Plain-text fallback off-tty / NO_COLOR / dumb terms."""
61
- plain = not sys.stdout.isatty() or os.environ.get("NO_COLOR") or os.environ.get("TERM") == "dumb"
62
- if not plain:
63
- try: # legacy Windows consoles (cp1252) cannot encode the blocks
64
- "▀".encode(sys.stdout.encoding or "utf-8")
65
- except (UnicodeEncodeError, LookupError):
66
- plain = True
67
- if plain:
68
- return f"quantprobe {version} - placement beats budget"
69
- art = icon_ansi().split("\n")
70
- text = ["", " quantprobe " + version, " placement beats budget",
71
- " predictions before downloads", "", ""]
72
- return "\n".join(a + t for a, t in zip(art, text))
73
-
74
-
75
- if __name__ == "__main__":
76
- sys.stdout.write(icon_svg())
1
+ """The quantprobe mark: a Q that is a gauge - the dial is the Q's circle, the needle its tail.
2
+ One 12x12 pixel bitmap is the single source of truth: assets/quantprobe-icon.svg is generated
3
+ from it (python -m quantprobe.branding > assets/quantprobe-icon.svg), and the terminal banner
4
+ renders the same pixels as ANSI half-blocks. Old-style pixel art on purpose."""
5
+ import os
6
+ import sys
7
+
8
+ # '.' = background, 'o' = dial (teal), 'X' = needle/hub (white)
9
+ PIXELS = [
10
+ "...oooooo...",
11
+ "..oo....oo..",
12
+ ".oo......oo.",
13
+ ".o........o.",
14
+ "oo........oo",
15
+ "o....XX....o",
16
+ "o....XX....o",
17
+ "oo.....X....",
18
+ ".o......X...",
19
+ ".oo......X..",
20
+ "..oo......X.",
21
+ "...ooo.....X",
22
+ ]
23
+ BG, DIAL, NEEDLE = (20, 24, 31), (20, 184, 166), (230, 255, 250)
24
+
25
+
26
+ def icon_svg(px=10, pad=4):
27
+ w = len(PIXELS[0]) * px + 2 * pad
28
+ out = ['<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 %d %d" ' % (w, w)
29
+ + 'shape-rendering="crispEdges" role="img" aria-label="quantprobe">',
30
+ ' <rect width="%d" height="%d" rx="%d" fill="#14181f"/>' % (w, w, 2 * px)]
31
+ for y, row in enumerate(PIXELS):
32
+ for x, c in enumerate(row):
33
+ if c == '.':
34
+ continue
35
+ color = "#14b8a6" if c == 'o' else "#e6fffa"
36
+ out.append(' <rect x="%d" y="%d" width="%d" height="%d" fill="%s"/>'
37
+ % (pad + x * px, pad + y * px, px, px, color))
38
+ out.append('</svg>')
39
+ return "\n".join(out) + "\n"
40
+
41
+
42
+ def _rgb(c):
43
+ return {'.': BG, 'o': DIAL, 'X': NEEDLE}[c]
44
+
45
+
46
+ def icon_ansi():
47
+ """The same pixels as truecolor half-blocks, 12 wide x 6 lines tall."""
48
+ lines = []
49
+ for y in range(0, len(PIXELS), 2):
50
+ top, bot = PIXELS[y], PIXELS[y + 1]
51
+ line = []
52
+ for t, b in zip(top, bot):
53
+ (tr, tg, tb), (br, bg_, bb) = _rgb(t), _rgb(b)
54
+ line.append("\x1b[38;2;%d;%d;%dm\x1b[48;2;%d;%d;%dm▀" % (tr, tg, tb, br, bg_, bb))
55
+ lines.append("".join(line) + "\x1b[0m")
56
+ return "\n".join(lines)
57
+
58
+
59
+ def banner(version=""):
60
+ """Icon + wordmark for the CLI header. Plain-text fallback off-tty / NO_COLOR / dumb terms."""
61
+ plain = not sys.stdout.isatty() or os.environ.get("NO_COLOR") or os.environ.get("TERM") == "dumb"
62
+ if not plain:
63
+ try: # legacy Windows consoles (cp1252) cannot encode the blocks
64
+ "▀".encode(sys.stdout.encoding or "utf-8")
65
+ except (UnicodeEncodeError, LookupError):
66
+ plain = True
67
+ if plain:
68
+ return f"quantprobe {version} - placement beats budget"
69
+ art = icon_ansi().split("\n")
70
+ text = ["", " quantprobe " + version, " placement beats budget",
71
+ " predictions before downloads", "", ""]
72
+ return "\n".join(a + t for a, t in zip(art, text))
73
+
74
+
75
+ if __name__ == "__main__":
76
+ sys.stdout.write(icon_svg())