deltacert 1.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,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.
@@ -0,0 +1,202 @@
1
+ Metadata-Version: 2.4
2
+ Name: deltacert
3
+ Version: 1.1.0
4
+ Summary: Calibrated divergence certification for LLM serving systems
5
+ License-Expression: Apache-2.0
6
+ Requires-Python: >=3.9
7
+ Description-Content-Type: text/markdown
8
+ License-File: LICENSE
9
+ Requires-Dist: numpy
10
+ Requires-Dist: torch>=2.0
11
+ Requires-Dist: transformers>=4.38
12
+ Requires-Dist: accelerate>=0.30
13
+ Requires-Dist: cryptography>=42.0
14
+ Provides-Extra: bnb
15
+ Requires-Dist: bitsandbytes>=0.43; extra == "bnb"
16
+ Provides-Extra: peft
17
+ Requires-Dist: peft>=0.9; extra == "peft"
18
+ Provides-Extra: vllm
19
+ Requires-Dist: vllm>=0.4; extra == "vllm"
20
+ Provides-Extra: gptq
21
+ Requires-Dist: gptqmodel>=1.0; extra == "gptq"
22
+ Requires-Dist: optimum>=1.20; extra == "gptq"
23
+ Provides-Extra: validation
24
+ Requires-Dist: datasets>=2.20; extra == "validation"
25
+ Requires-Dist: lm-eval>=0.4; extra == "validation"
26
+ Requires-Dist: matplotlib; extra == "validation"
27
+ Requires-Dist: human-eval>=1.0; extra == "validation"
28
+ Dynamic: license-file
29
+
30
+ # DeltaCert
31
+
32
+ **Certify any change to your LLM serving stack — quantization, engine upgrades, batch size, model updates — with a mathematical bound, before you deploy.**
33
+
34
+ [PyPI](https://pypi.org/project/deltacert/) · [SPEC.md](SPEC.md) · [LICENSE](LICENSE)
35
+
36
+ ```bash
37
+ pip install deltacert
38
+ ```
39
+
40
+ ---
41
+
42
+ ## The catch
43
+
44
+ Standard benchmarks said this 4-bit quantized model was fine:
45
+
46
+ | Config | Short eval said | d_COMM | safe_until_token | failure_after_token | Verdict |
47
+ |---|---|---|---|---|---|
48
+ | Llama-3.1-8B fp16 → nf4 | GSM8K 5-shot exact-match +1.0% (looks safe) | 0.00 | 31 | 14 | **unsafe** |
49
+
50
+ GSM8K said +1.0% — looks safe. DeltaCert flagged it unsafe. The generated text actually forks from the fp16 model at **token 14**, on long-form coding generations, well before the math bound (token 31) would even flag it. Same nf4 config, three independent signals, one real finding: a standard short-form benchmark missed a regression that shows up on longer generations.
51
+
52
+ Reproduce it yourself:
53
+
54
+ ```bash
55
+ deltacert generate-cases --model meta-llama/Llama-3.1-8B-Instruct --output cases.jsonl
56
+ deltacert certify --model meta-llama/Llama-3.1-8B-Instruct --quantization int4 \
57
+ --checks trajectory --trajectory-cases cases.jsonl
58
+ ```
59
+
60
+ Every number above traces to a real certificate in `validation_results/`; every row in the table below reproduces with one script.
61
+
62
+ ## The proof
63
+
64
+ Seven real flagship tests, each a full before/after comparison on a real model, real GPU, real downstream benchmark:
65
+
66
+ | Change | Business gain | d_COMM | Downstream effect | Verdict |
67
+ |---|---|---|---|---|
68
+ | Llama-3.1-8B batch=1 → batch=64 | 64 concurrent requests, same GPU | 6.21 | GSM8K -1.0 pt | ✅ Safe |
69
+ | vLLM 0.8.5 → vLLM 0.9.0 | take the upgrade same-week, not months later | 16.09 | GSM8K -1.0 pt | ✅ Safe |
70
+ | KV cache default → fp8 (vLLM native) | 2x concurrent capacity | 4.83 | GSM8K -1.0 pt | ✅ Safe |
71
+ | gpt-4o-mini pinned snapshot → current alias | same-day provider-drift check | 6.65 | canary acc +0.0 pt | ✅ Safe |
72
+ | Standard decode → speculative decode (k=5) | claimed ~2x throughput | 15.38 | GSM8K +0.0 pt, **measured 0.28x** (slower) | ✅ Safe on quality, not on speed |
73
+ | Llama-3.1-8B fp16 → nf4 (W4) | +60% VRAM reduction | 0.00 | forks at token 14 on long generations | ❌ Unsafe |
74
+ | Llama-3.1-8B fp16 → GPTQ int4 | +75% VRAM reduction | 1.16 | GSM8K -8.0 pts | ❌ Unsafe |
75
+
76
+ Five safe, two unsafe. A tool that only ever says "safe" isn't measuring anything — the two unsafe rows above are DeltaCert doing its job.
77
+
78
+ ## How it works
79
+
80
+ DeltaCert compares output distributions before and after a change. From the cosine similarity `c` between two runs, it computes:
81
+
82
+ ```
83
+ Δ = 4c√(1-c²) (commutator magnitude)
84
+ d = -log(Δ/2) (algebraic distance)
85
+ divergence_bound = 2·exp(-d)
86
+ ```
87
+
88
+ `d` is an algebraic distance; `2e⁻ᵈ` is the certified bound on output divergence — deterministic, minutes to compute, checkable at every token position, no eval harness or labeled data required.
89
+
90
+ > **"Certified" throughout this document means:** measured against a calibrated threshold with a stated bound — not a guarantee of downstream quality.
91
+
92
+ - **Full derivation, clamp behavior, per-method calibration (with sample sizes disclosed), and the top-k logprobs caveat:** see `SPEC.md`.
93
+ - **This README asserts. The spec defends. Nothing here is a proof.**
94
+
95
+ ## Getting started
96
+
97
+ ```bash
98
+ pip install deltacert
99
+
100
+ deltacert certify --model meta-llama/Llama-3.1-8B-Instruct --quantization int8
101
+ ```
102
+
103
+ That uses DeltaCert's shipped reference calibration (from the 7-test suite above). For a threshold tuned to **your own model and workload**, run the sweep yourself:
104
+
105
+ ```bash
106
+ deltacert capture --model your-model --output baseline.npz
107
+ deltacert capture --model your-model --quantization int8 --output candidate.npz
108
+ deltacert calibrate --baseline baseline.npz --candidates candidate.npz \
109
+ --names int8 --downstream-file your_evals.json
110
+ ```
111
+
112
+ `deltacert certify` always tells you when it's using the shipped calibration instead of your own.
113
+
114
+ ## Integrations
115
+
116
+ - **vLLM plugin** — official `vllm.general_plugins` entry point, already wired in this package. Opt-in only: complete no-op unless `DELTACERT_ENFORCE=1` is set, so `pip install deltacert` is safe in a shared image; when enabled, a serving engine refuses to start on an uncertified change.
117
+ - **CI/CD gate** — `python -m deltacert.integrations.cicd_hook --cert ./cert.json` exits 1 (blocks the pipeline) if not certified, 0 if certified. Works with GitHub Actions, GitLab CI, Jenkins, or any CI that checks exit codes.
118
+ - **HuggingFace auto-wiring** — `from deltacert.integrations.hf_integration import auto_certify` picks the right collectors for you from what's active in your config (quantization, LoRA, prefix cache) instead of calling `certify_system()` with raw parameters yourself.
119
+
120
+ ## Verifying a certificate
121
+
122
+ Optional — certificates work unsigned; signing adds tamper-evidence for sharing certs across teams or with auditors.
123
+
124
+ ```bash
125
+ deltacert keygen --private-key mykey.pem --public-key mykey.pub
126
+ deltacert sign --cert cert.json --key-file mykey.pem
127
+ deltacert verify --cert cert.json --key-file mykey.pub
128
+ ```
129
+
130
+ `verify` exits 0 if the signature is valid, 1 if the certificate was modified after signing or signed by a different key. Every certificate also carries a `validation_status` field (`flagship_validated` vs `implemented_pending_validation`) — signed as part of the payload, so a signature can never make an unvalidated collector's result look more trustworthy than it is.
131
+
132
+ Keep your private key secret — never commit it, never share it. Only the public key is meant to be distributed.
133
+
134
+ All 13 reference certificates in `validation_results/` are signed with Threvo's key (`deltacert-public.pem`, committed in this repo). Don't take our numbers on faith — check them yourself:
135
+
136
+ ```bash
137
+ deltacert verify --cert validation_results/weight_quant/cert_nf4.json --key-file deltacert-public.pem
138
+ ```
139
+
140
+ ## What it certifies
141
+
142
+ DeltaCert ships all 20 collectors described in the design — the code is real, tested, and doesn't get deleted just because a given check hasn't been run in a full end-to-end validation yet. Only 7 have real flagship validation results behind them so far (the table above); the rest are working code with the same math, not yet run through that process.
143
+
144
+ | # | Check | CLI-drivable | Status |
145
+ |---|---|---|---|
146
+ | 1 | `weight_quant` | ✅ | ✅ validated |
147
+ | 2 | `kv_cache_quant` | ✅ | ✅ validated |
148
+ | 3 | `batch_divergence` | ✅ (needs vLLM) | ✅ validated |
149
+ | 4 | `spec_decoding` | ✅ (needs vLLM) | ✅ validated |
150
+ | 5 | `engine_swap` | ✅ | ✅ validated |
151
+ | 6 | `provider_drift` | ✅ | ✅ validated |
152
+ | 7 | `trajectory` | ✅ | ✅ validated |
153
+ | 8 | `activation_quant` | ✅ | 🔬 code exists, not yet validated |
154
+ | 9 | `prefix_cache` | ✅ | 🔬 code exists, not yet validated |
155
+ | 10 | `lora` | ✅ | 🔬 code exists, not yet validated |
156
+ | 11 | `model_swap` | ✅ | 🔬 code exists, not yet validated |
157
+ | 12 | `prompt_swap` | ✅ | 🔬 code exists, not yet validated |
158
+ | 13 | `sparse_attention` | Python API only | 🔬 code exists, not yet validated |
159
+ | 14 | `moe_token_dropping` | Python API only | 🔬 code exists, not yet validated |
160
+ | 15 | `neuron_skipping` | Python API only | 🔬 code exists, not yet validated |
161
+ | 16 | `allreduce_tp` | Python API only | 🔬 code exists, not yet validated |
162
+ | 17 | `alltoall_ep` | Python API only | 🔬 code exists, not yet validated |
163
+ | 18 | `pipeline_parallel` | Python API only | 🔬 code exists, not yet validated |
164
+ | 19 | `kv_transfer` | Python API only | 🔬 code exists, not yet validated |
165
+ | 20 | `gradient_compress` | Python API only | 🔬 code exists, not yet validated |
166
+
167
+ "Python API only" means the check needs code you supply (a custom `compress_fn`, attention mask, etc.) — the CLI can't conjure that for you; see `import deltacert as dc; dc.certify_system(...)`.
168
+
169
+ ## Limitations (stated up front, not discovered by you later)
170
+
171
+ - The 7 validated results above all use one model family (Llama-3.1-8B-Instruct) plus one hosted API (gpt-4o-mini). Cross-model generalization isn't proven yet.
172
+ - Per-method calibration (e.g. the bnb/GPTQ thresholds) is an initial calibration from n=5 configs on one model — not a settled constant. Run `deltacert calibrate` on your own model/workload rather than trusting the shipped default for anything production-critical.
173
+ - The provider_drift result above is a same-day proxy (pinned snapshot vs. current alias), not the real weekly-cadence drift measurement, which needs two runs across real time.
174
+ - `d_comm` is a reliable within-method damage indicator but is not directly comparable across different compression methods — see `SPEC.md` for the bnb-vs-GPTQ false-negative this caused and how it's handled.
175
+
176
+ ## Roadmap
177
+
178
+ - More models, more downstream tasks — firming up per-method calibration beyond n=5
179
+ - Full validation pass on the remaining 13 collectors
180
+ - Real weekly-cadence provider_drift run (beyond the same-day proxy)
181
+
182
+ ## Citation
183
+
184
+ If you use DeltaCert, cite it as:
185
+
186
+ ```bibtex
187
+ @software{deltacert2026,
188
+ title = {DeltaCert: Calibrated Divergence Certification for LLM Serving Systems},
189
+ author = {Shorya},
190
+ year = {2026},
191
+ url = {https://pypi.org/project/deltacert/}
192
+ }
193
+ ```
194
+
195
+ ## License
196
+
197
+ Apache-2.0. See [LICENSE](LICENSE).
198
+
199
+ ## Contact
200
+
201
+ - Issues and questions: open a GitHub issue
202
+ - Full validation data: `validation_results/` in this repo
@@ -0,0 +1,173 @@
1
+ # DeltaCert
2
+
3
+ **Certify any change to your LLM serving stack — quantization, engine upgrades, batch size, model updates — with a mathematical bound, before you deploy.**
4
+
5
+ [PyPI](https://pypi.org/project/deltacert/) · [SPEC.md](SPEC.md) · [LICENSE](LICENSE)
6
+
7
+ ```bash
8
+ pip install deltacert
9
+ ```
10
+
11
+ ---
12
+
13
+ ## The catch
14
+
15
+ Standard benchmarks said this 4-bit quantized model was fine:
16
+
17
+ | Config | Short eval said | d_COMM | safe_until_token | failure_after_token | Verdict |
18
+ |---|---|---|---|---|---|
19
+ | Llama-3.1-8B fp16 → nf4 | GSM8K 5-shot exact-match +1.0% (looks safe) | 0.00 | 31 | 14 | **unsafe** |
20
+
21
+ GSM8K said +1.0% — looks safe. DeltaCert flagged it unsafe. The generated text actually forks from the fp16 model at **token 14**, on long-form coding generations, well before the math bound (token 31) would even flag it. Same nf4 config, three independent signals, one real finding: a standard short-form benchmark missed a regression that shows up on longer generations.
22
+
23
+ Reproduce it yourself:
24
+
25
+ ```bash
26
+ deltacert generate-cases --model meta-llama/Llama-3.1-8B-Instruct --output cases.jsonl
27
+ deltacert certify --model meta-llama/Llama-3.1-8B-Instruct --quantization int4 \
28
+ --checks trajectory --trajectory-cases cases.jsonl
29
+ ```
30
+
31
+ Every number above traces to a real certificate in `validation_results/`; every row in the table below reproduces with one script.
32
+
33
+ ## The proof
34
+
35
+ Seven real flagship tests, each a full before/after comparison on a real model, real GPU, real downstream benchmark:
36
+
37
+ | Change | Business gain | d_COMM | Downstream effect | Verdict |
38
+ |---|---|---|---|---|
39
+ | Llama-3.1-8B batch=1 → batch=64 | 64 concurrent requests, same GPU | 6.21 | GSM8K -1.0 pt | ✅ Safe |
40
+ | vLLM 0.8.5 → vLLM 0.9.0 | take the upgrade same-week, not months later | 16.09 | GSM8K -1.0 pt | ✅ Safe |
41
+ | KV cache default → fp8 (vLLM native) | 2x concurrent capacity | 4.83 | GSM8K -1.0 pt | ✅ Safe |
42
+ | gpt-4o-mini pinned snapshot → current alias | same-day provider-drift check | 6.65 | canary acc +0.0 pt | ✅ Safe |
43
+ | Standard decode → speculative decode (k=5) | claimed ~2x throughput | 15.38 | GSM8K +0.0 pt, **measured 0.28x** (slower) | ✅ Safe on quality, not on speed |
44
+ | Llama-3.1-8B fp16 → nf4 (W4) | +60% VRAM reduction | 0.00 | forks at token 14 on long generations | ❌ Unsafe |
45
+ | Llama-3.1-8B fp16 → GPTQ int4 | +75% VRAM reduction | 1.16 | GSM8K -8.0 pts | ❌ Unsafe |
46
+
47
+ Five safe, two unsafe. A tool that only ever says "safe" isn't measuring anything — the two unsafe rows above are DeltaCert doing its job.
48
+
49
+ ## How it works
50
+
51
+ DeltaCert compares output distributions before and after a change. From the cosine similarity `c` between two runs, it computes:
52
+
53
+ ```
54
+ Δ = 4c√(1-c²) (commutator magnitude)
55
+ d = -log(Δ/2) (algebraic distance)
56
+ divergence_bound = 2·exp(-d)
57
+ ```
58
+
59
+ `d` is an algebraic distance; `2e⁻ᵈ` is the certified bound on output divergence — deterministic, minutes to compute, checkable at every token position, no eval harness or labeled data required.
60
+
61
+ > **"Certified" throughout this document means:** measured against a calibrated threshold with a stated bound — not a guarantee of downstream quality.
62
+
63
+ - **Full derivation, clamp behavior, per-method calibration (with sample sizes disclosed), and the top-k logprobs caveat:** see `SPEC.md`.
64
+ - **This README asserts. The spec defends. Nothing here is a proof.**
65
+
66
+ ## Getting started
67
+
68
+ ```bash
69
+ pip install deltacert
70
+
71
+ deltacert certify --model meta-llama/Llama-3.1-8B-Instruct --quantization int8
72
+ ```
73
+
74
+ That uses DeltaCert's shipped reference calibration (from the 7-test suite above). For a threshold tuned to **your own model and workload**, run the sweep yourself:
75
+
76
+ ```bash
77
+ deltacert capture --model your-model --output baseline.npz
78
+ deltacert capture --model your-model --quantization int8 --output candidate.npz
79
+ deltacert calibrate --baseline baseline.npz --candidates candidate.npz \
80
+ --names int8 --downstream-file your_evals.json
81
+ ```
82
+
83
+ `deltacert certify` always tells you when it's using the shipped calibration instead of your own.
84
+
85
+ ## Integrations
86
+
87
+ - **vLLM plugin** — official `vllm.general_plugins` entry point, already wired in this package. Opt-in only: complete no-op unless `DELTACERT_ENFORCE=1` is set, so `pip install deltacert` is safe in a shared image; when enabled, a serving engine refuses to start on an uncertified change.
88
+ - **CI/CD gate** — `python -m deltacert.integrations.cicd_hook --cert ./cert.json` exits 1 (blocks the pipeline) if not certified, 0 if certified. Works with GitHub Actions, GitLab CI, Jenkins, or any CI that checks exit codes.
89
+ - **HuggingFace auto-wiring** — `from deltacert.integrations.hf_integration import auto_certify` picks the right collectors for you from what's active in your config (quantization, LoRA, prefix cache) instead of calling `certify_system()` with raw parameters yourself.
90
+
91
+ ## Verifying a certificate
92
+
93
+ Optional — certificates work unsigned; signing adds tamper-evidence for sharing certs across teams or with auditors.
94
+
95
+ ```bash
96
+ deltacert keygen --private-key mykey.pem --public-key mykey.pub
97
+ deltacert sign --cert cert.json --key-file mykey.pem
98
+ deltacert verify --cert cert.json --key-file mykey.pub
99
+ ```
100
+
101
+ `verify` exits 0 if the signature is valid, 1 if the certificate was modified after signing or signed by a different key. Every certificate also carries a `validation_status` field (`flagship_validated` vs `implemented_pending_validation`) — signed as part of the payload, so a signature can never make an unvalidated collector's result look more trustworthy than it is.
102
+
103
+ Keep your private key secret — never commit it, never share it. Only the public key is meant to be distributed.
104
+
105
+ All 13 reference certificates in `validation_results/` are signed with Threvo's key (`deltacert-public.pem`, committed in this repo). Don't take our numbers on faith — check them yourself:
106
+
107
+ ```bash
108
+ deltacert verify --cert validation_results/weight_quant/cert_nf4.json --key-file deltacert-public.pem
109
+ ```
110
+
111
+ ## What it certifies
112
+
113
+ DeltaCert ships all 20 collectors described in the design — the code is real, tested, and doesn't get deleted just because a given check hasn't been run in a full end-to-end validation yet. Only 7 have real flagship validation results behind them so far (the table above); the rest are working code with the same math, not yet run through that process.
114
+
115
+ | # | Check | CLI-drivable | Status |
116
+ |---|---|---|---|
117
+ | 1 | `weight_quant` | ✅ | ✅ validated |
118
+ | 2 | `kv_cache_quant` | ✅ | ✅ validated |
119
+ | 3 | `batch_divergence` | ✅ (needs vLLM) | ✅ validated |
120
+ | 4 | `spec_decoding` | ✅ (needs vLLM) | ✅ validated |
121
+ | 5 | `engine_swap` | ✅ | ✅ validated |
122
+ | 6 | `provider_drift` | ✅ | ✅ validated |
123
+ | 7 | `trajectory` | ✅ | ✅ validated |
124
+ | 8 | `activation_quant` | ✅ | 🔬 code exists, not yet validated |
125
+ | 9 | `prefix_cache` | ✅ | 🔬 code exists, not yet validated |
126
+ | 10 | `lora` | ✅ | 🔬 code exists, not yet validated |
127
+ | 11 | `model_swap` | ✅ | 🔬 code exists, not yet validated |
128
+ | 12 | `prompt_swap` | ✅ | 🔬 code exists, not yet validated |
129
+ | 13 | `sparse_attention` | Python API only | 🔬 code exists, not yet validated |
130
+ | 14 | `moe_token_dropping` | Python API only | 🔬 code exists, not yet validated |
131
+ | 15 | `neuron_skipping` | Python API only | 🔬 code exists, not yet validated |
132
+ | 16 | `allreduce_tp` | Python API only | 🔬 code exists, not yet validated |
133
+ | 17 | `alltoall_ep` | Python API only | 🔬 code exists, not yet validated |
134
+ | 18 | `pipeline_parallel` | Python API only | 🔬 code exists, not yet validated |
135
+ | 19 | `kv_transfer` | Python API only | 🔬 code exists, not yet validated |
136
+ | 20 | `gradient_compress` | Python API only | 🔬 code exists, not yet validated |
137
+
138
+ "Python API only" means the check needs code you supply (a custom `compress_fn`, attention mask, etc.) — the CLI can't conjure that for you; see `import deltacert as dc; dc.certify_system(...)`.
139
+
140
+ ## Limitations (stated up front, not discovered by you later)
141
+
142
+ - The 7 validated results above all use one model family (Llama-3.1-8B-Instruct) plus one hosted API (gpt-4o-mini). Cross-model generalization isn't proven yet.
143
+ - Per-method calibration (e.g. the bnb/GPTQ thresholds) is an initial calibration from n=5 configs on one model — not a settled constant. Run `deltacert calibrate` on your own model/workload rather than trusting the shipped default for anything production-critical.
144
+ - The provider_drift result above is a same-day proxy (pinned snapshot vs. current alias), not the real weekly-cadence drift measurement, which needs two runs across real time.
145
+ - `d_comm` is a reliable within-method damage indicator but is not directly comparable across different compression methods — see `SPEC.md` for the bnb-vs-GPTQ false-negative this caused and how it's handled.
146
+
147
+ ## Roadmap
148
+
149
+ - More models, more downstream tasks — firming up per-method calibration beyond n=5
150
+ - Full validation pass on the remaining 13 collectors
151
+ - Real weekly-cadence provider_drift run (beyond the same-day proxy)
152
+
153
+ ## Citation
154
+
155
+ If you use DeltaCert, cite it as:
156
+
157
+ ```bibtex
158
+ @software{deltacert2026,
159
+ title = {DeltaCert: Calibrated Divergence Certification for LLM Serving Systems},
160
+ author = {Shorya},
161
+ year = {2026},
162
+ url = {https://pypi.org/project/deltacert/}
163
+ }
164
+ ```
165
+
166
+ ## License
167
+
168
+ Apache-2.0. See [LICENSE](LICENSE).
169
+
170
+ ## Contact
171
+
172
+ - Issues and questions: open a GitHub issue
173
+ - Full validation data: `validation_results/` in this repo