shad0wllm 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.
- shad0wllm-0.1.0/LICENSE +202 -0
- shad0wllm-0.1.0/NOTICE +11 -0
- shad0wllm-0.1.0/PKG-INFO +221 -0
- shad0wllm-0.1.0/README.md +173 -0
- shad0wllm-0.1.0/pyproject.toml +73 -0
- shad0wllm-0.1.0/setup.cfg +4 -0
- shad0wllm-0.1.0/setup.py +29 -0
- shad0wllm-0.1.0/shad0w/__init__.py +11 -0
- shad0wllm-0.1.0/shad0w/__main__.py +184 -0
- shad0wllm-0.1.0/shad0w/_native/reflex.c +227 -0
- shad0wllm-0.1.0/shad0w/api.py +286 -0
- shad0wllm-0.1.0/shad0w/audit.py +168 -0
- shad0wllm-0.1.0/shad0w/cascade.py +188 -0
- shad0wllm-0.1.0/shad0w/compiler/__init__.py +1 -0
- shad0wllm-0.1.0/shad0w/compiler/distill.py +74 -0
- shad0wllm-0.1.0/shad0w/compiler/encoders.py +53 -0
- shad0wllm-0.1.0/shad0w/compiler/prototypes.py +55 -0
- shad0wllm-0.1.0/shad0w/compiler/selfcompile.py +44 -0
- shad0wllm-0.1.0/shad0w/features.py +61 -0
- shad0wllm-0.1.0/shad0w/mathutil.py +8 -0
- shad0wllm-0.1.0/shad0w/native.py +77 -0
- shad0wllm-0.1.0/shad0w/py.typed +0 -0
- shad0wllm-0.1.0/shad0w/reflex.py +154 -0
- shad0wllm-0.1.0/shad0w/reliability.py +181 -0
- shad0wllm-0.1.0/shad0w/server.py +63 -0
- shad0wllm-0.1.0/shad0w/shadow.py +140 -0
- shad0wllm-0.1.0/shad0wllm.egg-info/PKG-INFO +221 -0
- shad0wllm-0.1.0/shad0wllm.egg-info/SOURCES.txt +36 -0
- shad0wllm-0.1.0/shad0wllm.egg-info/dependency_links.txt +1 -0
- shad0wllm-0.1.0/shad0wllm.egg-info/entry_points.txt +2 -0
- shad0wllm-0.1.0/shad0wllm.egg-info/requires.txt +19 -0
- shad0wllm-0.1.0/shad0wllm.egg-info/top_level.txt +1 -0
- shad0wllm-0.1.0/tests/test_api.py +95 -0
- shad0wllm-0.1.0/tests/test_cascade.py +118 -0
- shad0wllm-0.1.0/tests/test_certificate_validity.py +35 -0
- shad0wllm-0.1.0/tests/test_core.py +87 -0
- shad0wllm-0.1.0/tests/test_js_parity.py +81 -0
- shad0wllm-0.1.0/tests/test_shadow.py +115 -0
shad0wllm-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.
|
shad0wllm-0.1.0/NOTICE
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
shad0w
|
|
2
|
+
Copyright 2026 Gaurav Chauhan
|
|
3
|
+
|
|
4
|
+
The hashed linear table follows the fastText design (Joulin et al., 2016). The certificate is an application of
|
|
5
|
+
Learn-then-Test (Angelopoulos et al., 2021) in the spirit of Trust or Escalate (Jung et al., 2025) and BARGAIN
|
|
6
|
+
(Zeighami et al., 2025). References: https://2796gaurav.github.io/shad0w/docs/certificate.html
|
|
7
|
+
|
|
8
|
+
Optional compile-time encoders (downloaded by the user, never bundled) carry their own licences:
|
|
9
|
+
BAAI/bge-small-en-v1.5 (MIT), sentence-transformers/all-MiniLM-L6-v2 (Apache-2.0),
|
|
10
|
+
intfloat/multilingual-e5-* (MIT), google/embeddinggemma-300m (Gemma Terms of Use).
|
|
11
|
+
Benchmark datasets are downloaded by the scripts and are not redistributed.
|
shad0wllm-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: shad0wllm
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Compile the decisions your LLM already makes into a certified 2 MB table that answers in microseconds on a CPU.
|
|
5
|
+
Author-email: Gaurav Chauhan <2796gaurav@gmail.com>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://2796gaurav.github.io/shad0w
|
|
8
|
+
Project-URL: Documentation, https://2796gaurav.github.io/shad0w/docs/
|
|
9
|
+
Project-URL: Demo, https://2796gaurav.github.io/shad0w/demo/
|
|
10
|
+
Project-URL: Source, https://github.com/2796gaurav/shad0w
|
|
11
|
+
Project-URL: Issues, https://github.com/2796gaurav/shad0w/issues
|
|
12
|
+
Project-URL: Changelog, https://github.com/2796gaurav/shad0w/blob/main/CHANGELOG.md
|
|
13
|
+
Keywords: llm,distillation,classification,intent-detection,routing,cascade,conformal-prediction,learn-then-test,edge-ai,cpu-inference,guardrails,llm-cost,latency
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Intended Audience :: Science/Research
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Classifier: Programming Language :: C
|
|
25
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
26
|
+
Classifier: Topic :: Text Processing :: Linguistic
|
|
27
|
+
Classifier: Typing :: Typed
|
|
28
|
+
Requires-Python: >=3.10
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
License-File: LICENSE
|
|
31
|
+
License-File: NOTICE
|
|
32
|
+
Requires-Dist: numpy>=1.26
|
|
33
|
+
Provides-Extra: compile
|
|
34
|
+
Requires-Dist: scipy>=1.13; extra == "compile"
|
|
35
|
+
Requires-Dist: scikit-learn>=1.5; extra == "compile"
|
|
36
|
+
Requires-Dist: torch>=2.4; extra == "compile"
|
|
37
|
+
Provides-Extra: logs
|
|
38
|
+
Requires-Dist: shad0wllm[compile]; extra == "logs"
|
|
39
|
+
Requires-Dist: sentence-transformers>=3.0; extra == "logs"
|
|
40
|
+
Provides-Extra: demo
|
|
41
|
+
Requires-Dist: shad0wllm[logs]; extra == "demo"
|
|
42
|
+
Requires-Dist: datasets>=3.0; extra == "demo"
|
|
43
|
+
Provides-Extra: dev
|
|
44
|
+
Requires-Dist: shad0wllm[compile]; extra == "dev"
|
|
45
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
46
|
+
Requires-Dist: ruff>=0.6; extra == "dev"
|
|
47
|
+
Dynamic: license-file
|
|
48
|
+
|
|
49
|
+
<p align="center">
|
|
50
|
+
<a href="https://2796gaurav.github.io/shad0w">
|
|
51
|
+
<img src="https://2796gaurav.github.io/shad0w/assets/hero.svg" alt="shad0w: your LLM's decisions, compiled into a certified table that answers in microseconds" width="100%">
|
|
52
|
+
</a>
|
|
53
|
+
</p>
|
|
54
|
+
|
|
55
|
+
<h1 align="center">shad0w</h1>
|
|
56
|
+
|
|
57
|
+
<p align="center">
|
|
58
|
+
<b>Compile the decisions your LLM already makes into a certified 2 MB table that answers in microseconds on a CPU.</b><br>
|
|
59
|
+
It learns from your model's own answers, needs no labels, and tells you in writing how often it will disagree.
|
|
60
|
+
</p>
|
|
61
|
+
|
|
62
|
+
<p align="center">
|
|
63
|
+
<a href="https://pypi.org/project/shad0wllm/"><img alt="PyPI" src="https://img.shields.io/pypi/v/shad0wllm?color=7c5cff&label=pypi"></a>
|
|
64
|
+
<a href="https://www.npmjs.com/package/shad0wllm"><img alt="npm" src="https://img.shields.io/npm/v/shad0wllm?color=7c5cff&label=npm"></a>
|
|
65
|
+
<a href="https://github.com/2796gaurav/shad0w/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/2796gaurav/shad0w/actions/workflows/ci.yml/badge.svg"></a>
|
|
66
|
+
<img alt="Python" src="https://img.shields.io/badge/python-3.10%E2%80%933.13-3776ab">
|
|
67
|
+
<a href="LICENSE"><img alt="License" src="https://img.shields.io/badge/license-Apache--2.0-2ea44f"></a>
|
|
68
|
+
</p>
|
|
69
|
+
|
|
70
|
+
<p align="center">
|
|
71
|
+
<a href="https://2796gaurav.github.io/shad0w/demo/"><b>Live demo</b></a> ·
|
|
72
|
+
<a href="https://2796gaurav.github.io/shad0w/docs/"><b>Docs</b></a> ·
|
|
73
|
+
<a href="https://2796gaurav.github.io/shad0w/#video"><b>2-minute video</b></a> ·
|
|
74
|
+
<a href="https://2796gaurav.github.io/shad0w/docs/benchmarks.html"><b>Benchmarks</b></a>
|
|
75
|
+
</p>
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
Your app sends small, typed decisions to a big model millions of times: *which intent is this, which queue gets this ticket, is this spam, should this agent step run*. Every call takes 20–1,500 ms and a round trip to someone else's GPU.
|
|
80
|
+
|
|
81
|
+
**shad0w** sits in front of that model like a shadow. It watches the answers, learns the decision, and compiles it into a tiny integer table. Before the table answers anything, it **certifies how often it will disagree with your model**. On public intent and topic benchmarks, it then served **45–71%** of traffic itself, at under 5% certified disagreement and in microseconds. Everything else goes to your model, exactly as before.
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
import shad0w
|
|
85
|
+
|
|
86
|
+
sh = shad0w.Shadow("bundle/", teacher=ask_my_llm, log="teacher_log.jsonl")
|
|
87
|
+
|
|
88
|
+
sh.decide("my card was stolen yesterday")
|
|
89
|
+
# Decision(answer='lost_card', source='table', confidence=0.98, certified=True, latency_us=14)
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
<table>
|
|
93
|
+
<tr>
|
|
94
|
+
<td align="center"><b>~1 µs</b><br><sub>per decision in C<br>7–11 µs JS · 15 µs Python</sub></td>
|
|
95
|
+
<td align="center"><b>45–71%</b><br><sub>of LLM traffic served locally<br>at a certified 5% bound</sub></td>
|
|
96
|
+
<td align="center"><b>0 labels</b><br><sub>learns from your model's<br>own logged answers</sub></td>
|
|
97
|
+
<td align="center"><b>2 MB</b><br><sub>one file, no GPU, no network<br>256 KB still keeps 88.5%</sub></td>
|
|
98
|
+
</tr>
|
|
99
|
+
</table>
|
|
100
|
+
|
|
101
|
+
## How it works
|
|
102
|
+
|
|
103
|
+
<p align="center">
|
|
104
|
+
<img src="https://2796gaurav.github.io/shad0w/assets/how-it-works.svg" alt="shadow → compile → certify → serve" width="100%">
|
|
105
|
+
</p>
|
|
106
|
+
|
|
107
|
+
1. **Shadow.** Your model keeps serving. Its answers are logged as `(text, answer)` pairs, either by the `Shadow` wrapper or by your own logging.
|
|
108
|
+
2. **Compile.** The log trains a hashed n‑gram table with int8 weights. There is no tokenizer and no GPU, and it takes seconds to minutes on a laptop.
|
|
109
|
+
3. **Certify.** On a held-out slice, a [Learn‑then‑Test](https://arxiv.org/abs/2110.01052) procedure picks the confidence threshold. Among answers the table serves, disagreement with your model is ≤ α (say 5%), with probability ≥ 1 − δ.
|
|
110
|
+
4. **Serve.** Certified answers come back in microseconds, in your process. Everything else goes to your model and is logged, so the share the table can take grows with traffic: **31% → 70%** as AG News shadow traffic went from 2k to 100k.
|
|
111
|
+
|
|
112
|
+
## Results
|
|
113
|
+
|
|
114
|
+
Measured on public datasets. Every number links to its raw result file on the [benchmarks page](https://2796gaurav.github.io/shad0w/docs/benchmarks.html).
|
|
115
|
+
|
|
116
|
+
| | Result |
|
|
117
|
+
|---|---|
|
|
118
|
+
| LLM traffic answered locally (7 intent/topic tasks, 2 teachers), certified α = 5% | **45–71%**, realised disagreement 3.9–5.7% (mean of 3 seeds) |
|
|
119
|
+
| End-to-end accuracy (table + teacher) vs teacher alone | within **1 point** on every task; **+0.7** with Kev‑0.8B as teacher |
|
|
120
|
+
| Mean latency of the cascade, Kev‑0.8B → BANKING77 | **75 ms → 22 ms** |
|
|
121
|
+
| Offload as shadow traffic grows (AG News, 2k → 100k decisions) | **31% → 70%** at α = 5%; **5% → 52%** at 2% |
|
|
122
|
+
| Per decision | **~1 µs** C · **7–11 µs** JavaScript · **15 µs** Python · 0.19 ms over HTTP |
|
|
123
|
+
| Public benchmark (local‑jev‑bench, BANKING77, 20 options) | **89.7% at 0.018 ms on 1 CPU thread**; Kev‑0.8B 88% at 57.6 ms; Clef‑flash (9B) 97% at 1,274 ms |
|
|
124
|
+
| Out-of-scope queries (CLINC150) separated by confidence | AUROC **0.94** |
|
|
125
|
+
| **Reproduce on your laptop** (`examples/shadow_demo.py`, MIT-licensed teacher, BANKING77) | **69.4%** answered locally at α = 5% (realised 4.6%); cascade 67.8% vs teacher 68.0% |
|
|
126
|
+
|
|
127
|
+
## Compared with what you would otherwise do
|
|
128
|
+
|
|
129
|
+
| | Per decision | Runs on | Needs | Bound on what it serves |
|
|
130
|
+
|---|---|---|---|---|
|
|
131
|
+
| Keep calling the LLM / decision API | 20–1,500 ms | GPU or vendor API | — | it *is* the reference |
|
|
132
|
+
| Semantic cache (GPTCache, gateway caches) | ms (embed + vector search) | embedding model + store | nothing | similarity threshold, no bound |
|
|
133
|
+
| Embedding router (e.g. semantic-router) | ms | embedding model | example utterances | threshold, no bound |
|
|
134
|
+
| Distil into a smaller LLM | 10–100 ms | GPU | teacher outputs | none |
|
|
135
|
+
| Hand-built fastText / SetFit / Model2Vec | µs–ms | CPU | **human labels** | none |
|
|
136
|
+
| **shad0w** | **1–15 µs** | **CPU, in-process, browser, edge** | **your model's logged answers** | **finite-sample, against your model** |
|
|
137
|
+
|
|
138
|
+
It is not new science. The certificate is Learn‑then‑Test, in the spirit of [Trust or Escalate](https://arxiv.org/abs/2407.18370) and [BARGAIN](https://arxiv.org/abs/2509.02896). The table is [fastText](https://arxiv.org/abs/1607.01759)-shaped on purpose. What is new is the packaging: one workflow from shadow logs to a certified, KB-to-MB artifact, with the same decisions in C, Python and JavaScript.
|
|
139
|
+
|
|
140
|
+
## Quick start
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
pip install "shad0wllm[compile]" # the runtime alone is: pip install shad0wllm (numpy only, C core included)
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
The package installs as `shad0wllm` and imports as `shad0w`. The command-line tool is `shad0w`.
|
|
147
|
+
|
|
148
|
+
**1. Log your model's answers.** Wrap the call you already make. With no bundle yet, every call goes to your model and is logged:
|
|
149
|
+
|
|
150
|
+
```python
|
|
151
|
+
import shad0w
|
|
152
|
+
|
|
153
|
+
sh = shad0w.Shadow(None, teacher=ask_my_llm, question="intent", log="teacher_log.jsonl")
|
|
154
|
+
answer = sh.decide(text).answer # = ask_my_llm(text), logged
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
**2. Compile and certify** once you have 1,000+ lines (10k–100k for high offload):
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
shad0w init # starter schema.json: the options your model chooses from
|
|
161
|
+
shad0w shadow --schema schema.json --data teacher_log.jsonl --teacher my-llm-v3 --alpha 0.05 --out bundle/
|
|
162
|
+
shad0w report --bundle bundle/ # the certificate, in plain words and numbers
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
**3. Serve.** Point the wrapper at the bundle. Certified answers come from the table and the rest from your model. 1% of certified answers are spot-checked against your model, so `sh.stats()` shows live disagreement:
|
|
166
|
+
|
|
167
|
+
```python
|
|
168
|
+
sh = shad0w.Shadow("bundle/", teacher=ask_my_llm, log="teacher_log.jsonl")
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
**4. Re-certify** on fresh traffic every week, or when traffic changes:
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
shad0w certify --bundle bundle/ --data last_week.jsonl
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Everywhere else
|
|
178
|
+
|
|
179
|
+
| | |
|
|
180
|
+
|---|---|
|
|
181
|
+
| **JavaScript** (Node, browsers, Workers, Deno, Bun), zero dependencies | `npm i shad0wllm` → `const b = await Bundle.load("bundle/"); b.decide(text)` |
|
|
182
|
+
| **HTTP** sidecar, any language | `shad0w serve --bundle bundle/` → `POST /v1/decide` |
|
|
183
|
+
| **C**, any language with an FFI | `shad0w/_native/reflex.c`: `s0_load`, `s0_decide` |
|
|
184
|
+
| **Decorator** | `@shad0w.cascade("bundle/")` on your existing classify function |
|
|
185
|
+
| **Human labels** instead of a teacher | `shad0w compile --data labels.jsonl` + `shad0w calibrate` (~300 labels) |
|
|
186
|
+
| **No teacher, no labels** | `shad0w compile --unlabeled logs.txt` (option names + raw logs, `pip install "shad0wllm[logs]"`) |
|
|
187
|
+
|
|
188
|
+
Integration recipes for FastAPI, LiteLLM, LangGraph, Cloudflare Workers and the browser are in the [docs](https://2796gaurav.github.io/shad0w/docs/integrations.html).
|
|
189
|
+
|
|
190
|
+
## When not to use it
|
|
191
|
+
|
|
192
|
+
The limits below are measured. Knowing them is what makes the certificate useful.
|
|
193
|
+
|
|
194
|
+
- **Sentiment, tone, emotion.** A hashed table tops out near 79% on SST‑2 even with perfect labels. shad0w certifies almost nothing there and defers everything to your model, which is the correct behaviour.
|
|
195
|
+
- **When you need the most accurate answer.** A 9B decision model is 7 points better on the public BANKING77 file, at ~70,000× the latency. Put shad0w *in front of* such a model, not instead of it.
|
|
196
|
+
- **The bound is against your model, not the truth.** A certified table in front of a wrong model is wrong in the same way. For a bound against the truth, calibrate with ~300 real labels.
|
|
197
|
+
- **The bound holds on traffic like the calibration slice.** A big shift in the request mix can break it. The drift guard flags confidence shifts, the audits watch live disagreement, and `shad0w certify` re-certifies.
|
|
198
|
+
- **Reasoning or world knowledge.** It learns *surface* decisions: intents, routes, topics, policies with distinctive wording.
|
|
199
|
+
|
|
200
|
+
## Documentation
|
|
201
|
+
|
|
202
|
+
[Getting started](https://2796gaurav.github.io/shad0w/docs/) · [Shadow mode guide](https://2796gaurav.github.io/shad0w/docs/shadow-mode.html) · [Integrations](https://2796gaurav.github.io/shad0w/docs/integrations.html) · [The certificate, explained](https://2796gaurav.github.io/shad0w/docs/certificate.html) · [API & CLI](https://2796gaurav.github.io/shad0w/docs/reference.html) · [Architecture & file format](https://2796gaurav.github.io/shad0w/docs/architecture.html) · [Benchmarks](https://2796gaurav.github.io/shad0w/docs/benchmarks.html) · [Limitations](https://2796gaurav.github.io/shad0w/docs/limitations.html) · [FAQ](https://2796gaurav.github.io/shad0w/docs/faq.html)
|
|
203
|
+
|
|
204
|
+
## Contributing
|
|
205
|
+
|
|
206
|
+
Run it on one of your decisions and [share your numbers](https://github.com/2796gaurav/shad0w/issues/new?template=results.yml), including failures. That is the most valuable contribution. Code contributions: see [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
207
|
+
|
|
208
|
+
## Citation
|
|
209
|
+
|
|
210
|
+
```bibtex
|
|
211
|
+
@software{chauhan2026shad0w,
|
|
212
|
+
author = {Chauhan, Gaurav},
|
|
213
|
+
title = {shad0w: certified microsecond decisions compiled from the model you already run},
|
|
214
|
+
year = {2026},
|
|
215
|
+
url = {https://github.com/2796gaurav/shad0w}
|
|
216
|
+
}
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
<p align="center">Built by <a href="https://github.com/2796gaurav">Gaurav Chauhan</a> · Apache-2.0</p>
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://2796gaurav.github.io/shad0w">
|
|
3
|
+
<img src="https://2796gaurav.github.io/shad0w/assets/hero.svg" alt="shad0w: your LLM's decisions, compiled into a certified table that answers in microseconds" width="100%">
|
|
4
|
+
</a>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<h1 align="center">shad0w</h1>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<b>Compile the decisions your LLM already makes into a certified 2 MB table that answers in microseconds on a CPU.</b><br>
|
|
11
|
+
It learns from your model's own answers, needs no labels, and tells you in writing how often it will disagree.
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
<p align="center">
|
|
15
|
+
<a href="https://pypi.org/project/shad0wllm/"><img alt="PyPI" src="https://img.shields.io/pypi/v/shad0wllm?color=7c5cff&label=pypi"></a>
|
|
16
|
+
<a href="https://www.npmjs.com/package/shad0wllm"><img alt="npm" src="https://img.shields.io/npm/v/shad0wllm?color=7c5cff&label=npm"></a>
|
|
17
|
+
<a href="https://github.com/2796gaurav/shad0w/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/2796gaurav/shad0w/actions/workflows/ci.yml/badge.svg"></a>
|
|
18
|
+
<img alt="Python" src="https://img.shields.io/badge/python-3.10%E2%80%933.13-3776ab">
|
|
19
|
+
<a href="LICENSE"><img alt="License" src="https://img.shields.io/badge/license-Apache--2.0-2ea44f"></a>
|
|
20
|
+
</p>
|
|
21
|
+
|
|
22
|
+
<p align="center">
|
|
23
|
+
<a href="https://2796gaurav.github.io/shad0w/demo/"><b>Live demo</b></a> ·
|
|
24
|
+
<a href="https://2796gaurav.github.io/shad0w/docs/"><b>Docs</b></a> ·
|
|
25
|
+
<a href="https://2796gaurav.github.io/shad0w/#video"><b>2-minute video</b></a> ·
|
|
26
|
+
<a href="https://2796gaurav.github.io/shad0w/docs/benchmarks.html"><b>Benchmarks</b></a>
|
|
27
|
+
</p>
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
Your app sends small, typed decisions to a big model millions of times: *which intent is this, which queue gets this ticket, is this spam, should this agent step run*. Every call takes 20–1,500 ms and a round trip to someone else's GPU.
|
|
32
|
+
|
|
33
|
+
**shad0w** sits in front of that model like a shadow. It watches the answers, learns the decision, and compiles it into a tiny integer table. Before the table answers anything, it **certifies how often it will disagree with your model**. On public intent and topic benchmarks, it then served **45–71%** of traffic itself, at under 5% certified disagreement and in microseconds. Everything else goes to your model, exactly as before.
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
import shad0w
|
|
37
|
+
|
|
38
|
+
sh = shad0w.Shadow("bundle/", teacher=ask_my_llm, log="teacher_log.jsonl")
|
|
39
|
+
|
|
40
|
+
sh.decide("my card was stolen yesterday")
|
|
41
|
+
# Decision(answer='lost_card', source='table', confidence=0.98, certified=True, latency_us=14)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
<table>
|
|
45
|
+
<tr>
|
|
46
|
+
<td align="center"><b>~1 µs</b><br><sub>per decision in C<br>7–11 µs JS · 15 µs Python</sub></td>
|
|
47
|
+
<td align="center"><b>45–71%</b><br><sub>of LLM traffic served locally<br>at a certified 5% bound</sub></td>
|
|
48
|
+
<td align="center"><b>0 labels</b><br><sub>learns from your model's<br>own logged answers</sub></td>
|
|
49
|
+
<td align="center"><b>2 MB</b><br><sub>one file, no GPU, no network<br>256 KB still keeps 88.5%</sub></td>
|
|
50
|
+
</tr>
|
|
51
|
+
</table>
|
|
52
|
+
|
|
53
|
+
## How it works
|
|
54
|
+
|
|
55
|
+
<p align="center">
|
|
56
|
+
<img src="https://2796gaurav.github.io/shad0w/assets/how-it-works.svg" alt="shadow → compile → certify → serve" width="100%">
|
|
57
|
+
</p>
|
|
58
|
+
|
|
59
|
+
1. **Shadow.** Your model keeps serving. Its answers are logged as `(text, answer)` pairs, either by the `Shadow` wrapper or by your own logging.
|
|
60
|
+
2. **Compile.** The log trains a hashed n‑gram table with int8 weights. There is no tokenizer and no GPU, and it takes seconds to minutes on a laptop.
|
|
61
|
+
3. **Certify.** On a held-out slice, a [Learn‑then‑Test](https://arxiv.org/abs/2110.01052) procedure picks the confidence threshold. Among answers the table serves, disagreement with your model is ≤ α (say 5%), with probability ≥ 1 − δ.
|
|
62
|
+
4. **Serve.** Certified answers come back in microseconds, in your process. Everything else goes to your model and is logged, so the share the table can take grows with traffic: **31% → 70%** as AG News shadow traffic went from 2k to 100k.
|
|
63
|
+
|
|
64
|
+
## Results
|
|
65
|
+
|
|
66
|
+
Measured on public datasets. Every number links to its raw result file on the [benchmarks page](https://2796gaurav.github.io/shad0w/docs/benchmarks.html).
|
|
67
|
+
|
|
68
|
+
| | Result |
|
|
69
|
+
|---|---|
|
|
70
|
+
| LLM traffic answered locally (7 intent/topic tasks, 2 teachers), certified α = 5% | **45–71%**, realised disagreement 3.9–5.7% (mean of 3 seeds) |
|
|
71
|
+
| End-to-end accuracy (table + teacher) vs teacher alone | within **1 point** on every task; **+0.7** with Kev‑0.8B as teacher |
|
|
72
|
+
| Mean latency of the cascade, Kev‑0.8B → BANKING77 | **75 ms → 22 ms** |
|
|
73
|
+
| Offload as shadow traffic grows (AG News, 2k → 100k decisions) | **31% → 70%** at α = 5%; **5% → 52%** at 2% |
|
|
74
|
+
| Per decision | **~1 µs** C · **7–11 µs** JavaScript · **15 µs** Python · 0.19 ms over HTTP |
|
|
75
|
+
| Public benchmark (local‑jev‑bench, BANKING77, 20 options) | **89.7% at 0.018 ms on 1 CPU thread**; Kev‑0.8B 88% at 57.6 ms; Clef‑flash (9B) 97% at 1,274 ms |
|
|
76
|
+
| Out-of-scope queries (CLINC150) separated by confidence | AUROC **0.94** |
|
|
77
|
+
| **Reproduce on your laptop** (`examples/shadow_demo.py`, MIT-licensed teacher, BANKING77) | **69.4%** answered locally at α = 5% (realised 4.6%); cascade 67.8% vs teacher 68.0% |
|
|
78
|
+
|
|
79
|
+
## Compared with what you would otherwise do
|
|
80
|
+
|
|
81
|
+
| | Per decision | Runs on | Needs | Bound on what it serves |
|
|
82
|
+
|---|---|---|---|---|
|
|
83
|
+
| Keep calling the LLM / decision API | 20–1,500 ms | GPU or vendor API | — | it *is* the reference |
|
|
84
|
+
| Semantic cache (GPTCache, gateway caches) | ms (embed + vector search) | embedding model + store | nothing | similarity threshold, no bound |
|
|
85
|
+
| Embedding router (e.g. semantic-router) | ms | embedding model | example utterances | threshold, no bound |
|
|
86
|
+
| Distil into a smaller LLM | 10–100 ms | GPU | teacher outputs | none |
|
|
87
|
+
| Hand-built fastText / SetFit / Model2Vec | µs–ms | CPU | **human labels** | none |
|
|
88
|
+
| **shad0w** | **1–15 µs** | **CPU, in-process, browser, edge** | **your model's logged answers** | **finite-sample, against your model** |
|
|
89
|
+
|
|
90
|
+
It is not new science. The certificate is Learn‑then‑Test, in the spirit of [Trust or Escalate](https://arxiv.org/abs/2407.18370) and [BARGAIN](https://arxiv.org/abs/2509.02896). The table is [fastText](https://arxiv.org/abs/1607.01759)-shaped on purpose. What is new is the packaging: one workflow from shadow logs to a certified, KB-to-MB artifact, with the same decisions in C, Python and JavaScript.
|
|
91
|
+
|
|
92
|
+
## Quick start
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
pip install "shad0wllm[compile]" # the runtime alone is: pip install shad0wllm (numpy only, C core included)
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
The package installs as `shad0wllm` and imports as `shad0w`. The command-line tool is `shad0w`.
|
|
99
|
+
|
|
100
|
+
**1. Log your model's answers.** Wrap the call you already make. With no bundle yet, every call goes to your model and is logged:
|
|
101
|
+
|
|
102
|
+
```python
|
|
103
|
+
import shad0w
|
|
104
|
+
|
|
105
|
+
sh = shad0w.Shadow(None, teacher=ask_my_llm, question="intent", log="teacher_log.jsonl")
|
|
106
|
+
answer = sh.decide(text).answer # = ask_my_llm(text), logged
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**2. Compile and certify** once you have 1,000+ lines (10k–100k for high offload):
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
shad0w init # starter schema.json: the options your model chooses from
|
|
113
|
+
shad0w shadow --schema schema.json --data teacher_log.jsonl --teacher my-llm-v3 --alpha 0.05 --out bundle/
|
|
114
|
+
shad0w report --bundle bundle/ # the certificate, in plain words and numbers
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
**3. Serve.** Point the wrapper at the bundle. Certified answers come from the table and the rest from your model. 1% of certified answers are spot-checked against your model, so `sh.stats()` shows live disagreement:
|
|
118
|
+
|
|
119
|
+
```python
|
|
120
|
+
sh = shad0w.Shadow("bundle/", teacher=ask_my_llm, log="teacher_log.jsonl")
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**4. Re-certify** on fresh traffic every week, or when traffic changes:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
shad0w certify --bundle bundle/ --data last_week.jsonl
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Everywhere else
|
|
130
|
+
|
|
131
|
+
| | |
|
|
132
|
+
|---|---|
|
|
133
|
+
| **JavaScript** (Node, browsers, Workers, Deno, Bun), zero dependencies | `npm i shad0wllm` → `const b = await Bundle.load("bundle/"); b.decide(text)` |
|
|
134
|
+
| **HTTP** sidecar, any language | `shad0w serve --bundle bundle/` → `POST /v1/decide` |
|
|
135
|
+
| **C**, any language with an FFI | `shad0w/_native/reflex.c`: `s0_load`, `s0_decide` |
|
|
136
|
+
| **Decorator** | `@shad0w.cascade("bundle/")` on your existing classify function |
|
|
137
|
+
| **Human labels** instead of a teacher | `shad0w compile --data labels.jsonl` + `shad0w calibrate` (~300 labels) |
|
|
138
|
+
| **No teacher, no labels** | `shad0w compile --unlabeled logs.txt` (option names + raw logs, `pip install "shad0wllm[logs]"`) |
|
|
139
|
+
|
|
140
|
+
Integration recipes for FastAPI, LiteLLM, LangGraph, Cloudflare Workers and the browser are in the [docs](https://2796gaurav.github.io/shad0w/docs/integrations.html).
|
|
141
|
+
|
|
142
|
+
## When not to use it
|
|
143
|
+
|
|
144
|
+
The limits below are measured. Knowing them is what makes the certificate useful.
|
|
145
|
+
|
|
146
|
+
- **Sentiment, tone, emotion.** A hashed table tops out near 79% on SST‑2 even with perfect labels. shad0w certifies almost nothing there and defers everything to your model, which is the correct behaviour.
|
|
147
|
+
- **When you need the most accurate answer.** A 9B decision model is 7 points better on the public BANKING77 file, at ~70,000× the latency. Put shad0w *in front of* such a model, not instead of it.
|
|
148
|
+
- **The bound is against your model, not the truth.** A certified table in front of a wrong model is wrong in the same way. For a bound against the truth, calibrate with ~300 real labels.
|
|
149
|
+
- **The bound holds on traffic like the calibration slice.** A big shift in the request mix can break it. The drift guard flags confidence shifts, the audits watch live disagreement, and `shad0w certify` re-certifies.
|
|
150
|
+
- **Reasoning or world knowledge.** It learns *surface* decisions: intents, routes, topics, policies with distinctive wording.
|
|
151
|
+
|
|
152
|
+
## Documentation
|
|
153
|
+
|
|
154
|
+
[Getting started](https://2796gaurav.github.io/shad0w/docs/) · [Shadow mode guide](https://2796gaurav.github.io/shad0w/docs/shadow-mode.html) · [Integrations](https://2796gaurav.github.io/shad0w/docs/integrations.html) · [The certificate, explained](https://2796gaurav.github.io/shad0w/docs/certificate.html) · [API & CLI](https://2796gaurav.github.io/shad0w/docs/reference.html) · [Architecture & file format](https://2796gaurav.github.io/shad0w/docs/architecture.html) · [Benchmarks](https://2796gaurav.github.io/shad0w/docs/benchmarks.html) · [Limitations](https://2796gaurav.github.io/shad0w/docs/limitations.html) · [FAQ](https://2796gaurav.github.io/shad0w/docs/faq.html)
|
|
155
|
+
|
|
156
|
+
## Contributing
|
|
157
|
+
|
|
158
|
+
Run it on one of your decisions and [share your numbers](https://github.com/2796gaurav/shad0w/issues/new?template=results.yml), including failures. That is the most valuable contribution. Code contributions: see [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
159
|
+
|
|
160
|
+
## Citation
|
|
161
|
+
|
|
162
|
+
```bibtex
|
|
163
|
+
@software{chauhan2026shad0w,
|
|
164
|
+
author = {Chauhan, Gaurav},
|
|
165
|
+
title = {shad0w: certified microsecond decisions compiled from the model you already run},
|
|
166
|
+
year = {2026},
|
|
167
|
+
url = {https://github.com/2796gaurav/shad0w}
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
<p align="center">Built by <a href="https://github.com/2796gaurav">Gaurav Chauhan</a> · Apache-2.0</p>
|