clausius 0.1.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.
@@ -0,0 +1,26 @@
1
+ # The measurement corpus IS the differentiated asset and is published:
2
+ # records/frontier, records/regress, records/context (~5 MB, 159 files)
3
+ # Everything else under records/ is a 6 GB pile of LoRA adapters, training
4
+ # corpora and routing traces — derivable, huge, and not what anyone needs.
5
+ records/*
6
+ !records/frontier/
7
+ !records/regress/
8
+ !records/context/
9
+ !records/quantladder/
10
+ !records/backend/
11
+ *.jsonl.gz
12
+ *.safetensors
13
+ *.npy
14
+
15
+ # scratch
16
+ *.log
17
+ __pycache__/
18
+ *.py[cod]
19
+ .venv/
20
+ venv/
21
+ .DS_Store
22
+ .obsidian/
23
+ .pytest_cache/
24
+ *.egg-info/
25
+ dist/
26
+ build/
clausius-0.1.0/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
clausius-0.1.0/NOTICE ADDED
@@ -0,0 +1,48 @@
1
+ clausius
2
+ Copyright 2026 Beata Kouchnir
3
+
4
+ This product includes software developed for measuring the effect of
5
+ deployment-time changes on language models.
6
+
7
+ The research package (`knowledge/`) vendors code under `knowledge/_vendor/`,
8
+ copied from the author's other work rather than depended on, so that this
9
+ repository is self-contained. It carries the same license as the rest.
10
+
11
+ --------------------------------------------------------------------------
12
+ DATASETS
13
+
14
+ The measurement corpus under `records/` holds results DERIVED from the public
15
+ evaluation datasets below — accuracy, entropy and per-item scores. No dataset
16
+ is bundled: `knowledge/` fetches each one from the Hugging Face Hub at run
17
+ time, so reproducing an experiment means obtaining the data from its original
18
+ source under that source's own terms.
19
+
20
+ GSM8K openai/gsm8k MIT
21
+ MMLU-Pro TIGER-Lab/MMLU-Pro MIT
22
+ PopQA akariasai/popqa no license declared
23
+ HumanEval+ evalplus/humanevalplus Apache-2.0
24
+ IFEval google/IFEval Apache-2.0
25
+ GPQA Idavidrein/gpqa CC BY 4.0, gated
26
+ AA-Omniscience ArtificialAnalysis/AA-Omniscience-Public Apache-2.0
27
+ HLE cais/hle MIT, gated
28
+
29
+ Two files redistribute source items verbatim, under the MIT terms above:
30
+
31
+ records/quantladder/prompts.gsm8k100.jsonl 100 GSM8K questions
32
+ records/quantladder/prompts.gsm8k200.jsonl 200 GSM8K questions
33
+
34
+ and the gold answers for those items are stored alongside the model's
35
+ predictions in `records/quantladder/acc.*.json`. They are included so that the
36
+ same-item comparison in FINDINGS F14c can be checked exactly rather than
37
+ approximately.
38
+
39
+ GPQA is treated differently, at its authors' request: they ask that the
40
+ dataset not be posted in plain text online, to keep it out of future training
41
+ corpora. No GPQA question, answer option or gold answer appears anywhere in
42
+ this repository, and the model's generated answer text was removed from
43
+ `records/stage_a.gpqa*.json` for the same reason. What remains is derived
44
+ measurement — correctness, entropy, and the domain label.
45
+
46
+ IFEval scoring uses Google Research's `instruction_following_eval` registry
47
+ (Apache-2.0), which is NOT bundled here. Where it is absent the scorer returns
48
+ no verdict for that item rather than guessing.
@@ -0,0 +1,272 @@
1
+ Metadata-Version: 2.4
2
+ Name: clausius
3
+ Version: 0.1.0
4
+ Summary: Detect whether a deployment change degraded your model — without a labeled eval set
5
+ Project-URL: Homepage, https://github.com/beatakouchnir/clausius
6
+ Project-URL: Findings, https://github.com/beatakouchnir/clausius/blob/main/FINDINGS.md
7
+ Project-URL: Issues, https://github.com/beatakouchnir/clausius/issues
8
+ License-Expression: Apache-2.0
9
+ License-File: LICENSE
10
+ License-File: NOTICE
11
+ Keywords: llm,mixture-of-experts,mlx,quantization,regression-testing
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
16
+ Requires-Python: >=3.9
17
+ Requires-Dist: numpy>=1.24
18
+ Provides-Extra: dev
19
+ Requires-Dist: pytest>=7; extra == 'dev'
20
+ Provides-Extra: mlx
21
+ Requires-Dist: mlx-lm>=0.20; extra == 'mlx'
22
+ Description-Content-Type: text/markdown
23
+
24
+ # clausius — did the thing you changed break your model?
25
+
26
+ Two questions, both answered on consumer hardware (M5 Max, 128 GB), across five
27
+ model families:
28
+
29
+ 1. **What is the best model you can actually run in the memory you have?**
30
+ 2. **If you change anything — config, quantization, fine-tune — how would you
31
+ know it broke the model, without a labeled eval set?**
32
+
33
+ ## What's new here
34
+
35
+ - **Accuracy measured across MoE offload configurations at all** — four surveyed
36
+ implementations report none. It inverts the default advice: at matched memory,
37
+ aggressive quantization costs **73 points** of instruction adherence where
38
+ exact expert offload costs **1.0**.
39
+ - **Label-free regression detection, checked against independently measured
40
+ damage.** Predictive entropy is well studied; using it to detect that *a
41
+ deployment change broke the model* — validated against five unrelated damage
42
+ mechanisms whose true cost was measured separately — appears not to be. It
43
+ flagged a −2.2pp quantization regression on **60 unlabeled prompts**, where
44
+ paired McNemar on gold labels needed **n=878** to reach p<0.05 (F14).
45
+ - **The corpus is committed, so the tables below rebuild on a laptop** — no
46
+ model, no accelerator, two commands. Negatives included: eight controlled
47
+ failures where the interesting signal lost to a simpler one, and seven places
48
+ where a result did not survive its own check and the record says so.
49
+
50
+ **Scope, up front.** Capturing needs Apple Silicon (`mlx-lm`). Everything else —
51
+ `compare`, the analysis, and re-deriving every table below from the committed
52
+ corpus — is pure numpy and runs anywhere, with no model downloads:
53
+
54
+ ```bash
55
+ git clone https://github.com/beatakouchnir/clausius && cd clausius
56
+ pip install ".[dev]" && pytest -q # 36 tests, no accelerator
57
+ python -m knowledge.quantladder analyze # rebuilds F14's ladder from records
58
+ python -m knowledge.frontier report # rebuilds the 3-axis Pareto frontier
59
+ ```
60
+
61
+ That is the fastest way to check whether the numbers here are real.
62
+
63
+ ---
64
+
65
+ *Named for Rudolf Clausius, who coined the word **entropy** in 1865 — from the
66
+ Greek `trope`, transformation, shaped to echo "energy" so the two would sound
67
+ like the related quantities they are. Entropy is the signal this tool reads.*
68
+
69
+ ## Quickstart
70
+
71
+ ```bash
72
+ pip install "clausius[mlx] @ git+https://github.com/beatakouchnir/clausius"
73
+ ```
74
+
75
+ Take 60 prompts of your own — production traffic is ideal, and **no labels are
76
+ needed** — or start with the 60 in [`examples/prompts.jsonl`](https://github.com/beatakouchnir/clausius/blob/main/examples/prompts.jsonl).
77
+ Capture the configuration you trust, capture the one you changed, compare:
78
+
79
+ ```bash
80
+ clausius capture --model ./gemma-26b-a4b-4bit --prompts examples/prompts.jsonl \
81
+ --out ref.json --max-tokens 1536
82
+ clausius capture --model ./gemma-26b-a4b-2bit --prompts examples/prompts.jsonl \
83
+ --out cand.json --max-tokens 1536
84
+ clausius compare ref.json cand.json --show 3
85
+ ```
86
+
87
+ ```
88
+ REGRESSION (max d_z = +5.922, threshold 0.3, one-sided)
89
+ compared 20 paired items, dropped 5 truncated
90
+ all signals: max +5.92 p90 +11.64 mean +10.43 mean_top10 +9.00 first +2.80 gen_len +10.55
91
+ ```
92
+
93
+ That is a real run, on 25 unlabeled prompts. The two checkpoints differ only in
94
+ quantization; the 2-bit one independently measures **73 points lower** on
95
+ instruction adherence. `compare` exits non-zero on a regression, so it drops
96
+ into CI without glue.
97
+
98
+ **→ [USAGE.md](https://github.com/beatakouchnir/clausius/blob/main/USAGE.md) is the operating manual**: choosing prompts, setting
99
+ the token cap, reading `d_z` and its interval, calibrating your own null, and
100
+ running it as a CI gate. Start there after your first run.
101
+
102
+ **Every default is a measured result, not a preference** — the 0.3 threshold
103
+ comes from 13 configurations known to be harmless, the one-sided test from a
104
+ construction that fools a two-sided one, the truncation filter from an effect
105
+ that doubles once you apply it. `src/clausius/core.py` states each one and
106
+ [FINDINGS.md](https://github.com/beatakouchnir/clausius/blob/main/FINDINGS.md) has the evidence.
107
+
108
+ > **Status.** `clausius` is installable and tested (36 tests, no accelerator
109
+ > required). The `knowledge/` research package that produced the findings is
110
+ > *not* packaged — it needs local model checkpoints and an external artifact
111
+ > store, and is kept for reproducibility rather than reuse.
112
+
113
+ ---
114
+
115
+ ## What was measured
116
+
117
+ Full evidence, positives *and* negatives, in
118
+ [FINDINGS.md](https://github.com/beatakouchnir/clausius/blob/main/FINDINGS.md) —
119
+ which opens with a prior-art accounting stating which parts independently
120
+ re-derive published work and which appear to be new. The headline results:
121
+
122
+ | | result | where |
123
+ |---|---|---|
124
+ | **Offload beats downsizing** | an offloaded 35B at **3.40 GB** scores **0.9447** on gsm8k, against a natively-fitting 4B at 3.91 GB scoring 0.8426. Same ordering on popqa (+13.9pp) and mmlu_pro (+20.9pp). The whole cost is latency. | F3–F6 |
125
+ | **The lossy shortcut is dominated** | *dropping* non-resident experts instead of fetching them costs **91% of gsm8k accuracy** at 50% residency, while being slower. | F6 |
126
+ | **Label-free detection works** | validated against five unrelated damage mechanisms whose true damage was measured independently. Benign controls stay clean: a 3.3× memory reduction changes ~25% of generations textually and moves no signal. | F8 |
127
+ | **It is more sensitive than labels** | the −2.2pp regression above: flagged on 60 unlabeled prompts, where labels needed n=878. | F14 |
128
+ | **Forgetting is detectable too** | move the reference and it becomes a training monitor: LoRA checkpoints on a held-out domain read d_z +0.74 to +0.84 at −16 to −26pp accuracy. | F9 |
129
+ | **Short benchmarks understate damage ~14×** | factual QA loses 1.5pp where structured generation loses 18–21pp under the same quantization — the axis agents live on. | F11 |
130
+ | **Routing carries a fact-level address** | ablate the experts a fact routes to and that fact degrades far more than a paraphrase, a same-relation fact, or a random control. Two architectures. A **mechanism** result, not a product. | R9–R10 |
131
+
132
+ ### What it does not do
133
+
134
+ - **Sensitivity is the weaker half.** Specificity is 13/13; a −5.7pp config is
135
+ missed at any threshold that preserves that record.
136
+ - **Confidence-increasing damage would be invisible** to a one-sided detector.
137
+ Three mechanisms were built to produce it and none did, but it is not excluded.
138
+ - **d_z is ordinal, not proportional.** 3-bit loses 25× more accuracy than 4-bit
139
+ and reads 2× the d_z. "Something moved, and roughly how hard" is supportable;
140
+ "you lost k accuracy points" is not.
141
+ - Needs logits and a reference config; it cannot score a config in isolation.
142
+ - **The threshold is calibrated on one stack.** On a different framework, device
143
+ or quantizer, measure your own null first —
144
+ [USAGE.md](https://github.com/beatakouchnir/clausius/blob/main/USAGE.md#calibrating-your-own-null) has the recipe.
145
+
146
+ ### Scope: local models, GPU capture
147
+
148
+ **Local and self-hosted only, deliberately.** Anthropic exposes no logprobs at
149
+ all, Gemini's are missing on current frontier models, and OpenAI caps
150
+ `top_logprobs` at 20 — *truncated* entropy, a different quantity. Hosted-API
151
+ support and cascade routing are recorded as **don't-build** decisions in
152
+ [EXPERIMENT.md](https://github.com/beatakouchnir/clausius/blob/main/EXPERIMENT.md).
153
+
154
+ **Capture targets a GPU**: Apple Silicon via MLX in this release, CUDA next,
155
+ CPU never — measured here, 7B decode runs 6.7 tok/s on CPU against 22 on the
156
+ same machine's GPU, the gap widens with size, and the 26B MoE behind the
157
+ findings is impractical there. Two terms that are often conflated:
158
+
159
+ | | | |
160
+ |---|---|---|
161
+ | **framework** | mlx, PyTorch | which library runs the forward pass |
162
+ | **device** | cuda, mps, cpu | which hardware PyTorch dispatches to |
163
+
164
+ Nothing about the *method* needs Apple Silicon, and a working PyTorch framework
165
+ backend exists on the `feat/torch-backend` branch — **deliberately not
166
+ shipped**. It was measured on mps and cpu (F15, F15c), so the framework path is
167
+ exercised; what has never been calibrated is the **cuda device** and the
168
+ CUDA-native quantizers (bitsandbytes, GPTQ, AWQ). Shipping a runtime whose
169
+ threshold is uncalibrated on the device most users would run would contradict
170
+ the claim this package makes about its defaults. The bar it must clear is in
171
+ [EXPERIMENT.md](https://github.com/beatakouchnir/clausius/blob/main/EXPERIMENT.md).
172
+
173
+ ## Claim taxonomy — keep these separate
174
+
175
+ Two halves making **different kinds of claim**. Conflating them would overstate
176
+ one and undersell the other.
177
+
178
+ | half | signal | claim type | validated by | breadth |
179
+ |---|---|---|---|---|
180
+ | **online** | predictive entropy | *"this answer is likely wrong"*, *"this change broke the model"* — a **correctness** claim | Stages A–D, F8–F9 | 5 models, 6 task configs, 5 damage mechanisms |
181
+ | **offline** | routing ablation | *"this came from stored fact X"* — a **mechanism** claim | R3, R9, R9c, R10 | 2 architectures, probe-style |
182
+
183
+ **Entropy is mechanism-blind** — it reports that the model was uncertain, not
184
+ *how* the answer was produced. So *"flag the answers the model was least sure
185
+ of"* is defensible and *"our telemetry tells you how the answer was generated"*
186
+ is not. **Neither half claims to improve accuracy.**
187
+
188
+ ## What did not work
189
+
190
+ Eight controlled negatives where routing lost to a simpler signal — usually
191
+ reading the prompt text, or predictive entropy. The structural reason: routing
192
+ is downstream of the residual stream *and* the prompt, so it is bounded by
193
+ both. Part II of
194
+ [FINDINGS.md](https://github.com/beatakouchnir/clausius/blob/main/FINDINGS.md)
195
+ records them so they are not re-run.
196
+
197
+ ## Seven corrections worth reading
198
+
199
+ The record keeps its own failures, because they were load-bearing:
200
+
201
+ - **A planned 16-50 GPU-hour sweep was canceled after reading the
202
+ implementation.** `policy='exact'` fetches missing experts before computing —
203
+ it would have measured a guaranteed flat line.
204
+ - **A confident mechanistic hypothesis died with its own bug fix.** A tidy
205
+ shared-expert explanation for a gemma-vs-qwen top-k split evaporated when a
206
+ ranking error was corrected — `argpartition` guarantees membership, not order.
207
+ - **An instrumentation bug meant a whole axis was never measured.**
208
+ `mx.get_peak_memory()` captured the model load before the cache freed it, so
209
+ every configuration reported identical memory.
210
+ - **A published-looking result was a scoring artifact.** The RAG conditional
211
+ claim read −0.431 in the predicted direction until the scorer accepted any
212
+ gold alias; it then read +0.066, the wrong direction. Recorded as open.
213
+ - **A rationale in the shipped code was wrong for three runs running.** The
214
+ truncation filter was justified by "a damaged model rambles into the token
215
+ cap" — but a *healthy* 4-bit truncated 47/60 items at cap 512 where a
216
+ destroyed 2-bit truncated 3, and two LoRA fine-tunes truncated 22 and 33 of 50
217
+ where their base truncated none. Rambling tracks off-distribution, not damage.
218
+ The filter was right; the reason was not (F14b).
219
+ - **A calibration claim was falsified by the next measurement.** A widened null
220
+ (+0.172) was attributed to the reference being unquantized; the same pair
221
+ reads −0.062 on gsm8k. It was the prompt set. Superseded, not overwritten
222
+ (F14c).
223
+ - **An assumption made the exact error the finding warns against.** F14 assumed
224
+ 3-bit "sits between two measured points in damage" — right about the ordering,
225
+ badly wrong about the distance: −56.6pp, a broken deployment, at only 2x
226
+ 4-bit's d_z. Kept visible as a worked example of ordinal-not-proportional
227
+ (F14d).
228
+
229
+ Two method rules came out of them, applied throughout:
230
+
231
+ > **Read a knob's implementation before scoping a sweep over it.**
232
+ > **A wiring control must be able to fail on the assumption it protects.**
233
+
234
+ The second has teeth: a top-k no-op control passed 16/16 while the ranking
235
+ assumption beneath it was wrong, because keeping every position is
236
+ order-independent.
237
+
238
+ ## Prior art
239
+
240
+ Applied, not ours: MoE expert offloading with an LRU cache
241
+ ([Mixtral-offloading](https://arxiv.org/pdf/2312.17238)), speculative expert
242
+ prefetch ([HOBBIT](https://arxiv.org/pdf/2411.01433), ExpertFlow, CommitMoE),
243
+ predictive entropy, McNemar, Belady, Pareto dominance.
244
+
245
+ What appears new: **accuracy measured across MoE offload configurations at
246
+ all** (four surveyed implementations report none); exact offload being
247
+ **capacity-non-reproducible but fixed-capacity deterministic**, which
248
+ invalidates output-diffing as a validation method; **prefill admitting *optimal*
249
+ caching**, since a layer's routing for the whole prompt yields the access
250
+ sequence before any fetch; and **label-free config-regression detection
251
+ validated against independently-known damage**.
252
+
253
+ ---
254
+
255
+ ## Repository layout
256
+
257
+ | path | what | needs |
258
+ |---|---|---|
259
+ | `src/clausius/` | **the tool** — capture, compare, CLI | numpy; mlx-lm only to capture |
260
+ | `tests/` | 36 tests, none load a model; CI installs the built wheel | numpy |
261
+ | `records/` | **the measurement corpus** — the evidence behind FINDINGS.md, ~10 MB | — |
262
+ | `knowledge/` | the research package that produced the findings | local checkpoints, external artifact store (`CLAUSIUS_ARTIFACTS`) |
263
+ | `USAGE.md` | **the operating manual** — prompts, caps, reading the output, CI | — |
264
+ | `FINDINGS.md` | the full experimental record, positives and negatives | — |
265
+ | `EXPERIMENT.md` | designs, scope decisions, what was deliberately not built, and ten hard-won operational cautions | — |
266
+
267
+ The split is deliberate: the detector **needs no labels and no benchmark harness
268
+ to be used** — scoring exists only to *validate* it, which is what `knowledge/`
269
+ does ([its README](https://github.com/beatakouchnir/clausius/blob/main/knowledge/README.md)
270
+ documents every module and how to obtain the datasets). Analysis is stdlib/numpy
271
+ and loads no model, deliberately: MLX uses unified memory, so pinning to
272
+ `mx.cpu` isolates nothing — the axis that matters is loads-a-model vs doesn't.