evalproof 0.2.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.
- evalproof-0.2.0/.gitignore +16 -0
- evalproof-0.2.0/CHANGELOG.md +99 -0
- evalproof-0.2.0/CITATION.cff +25 -0
- evalproof-0.2.0/LICENSE +202 -0
- evalproof-0.2.0/NOTICE +4 -0
- evalproof-0.2.0/PKG-INFO +279 -0
- evalproof-0.2.0/README.md +259 -0
- evalproof-0.2.0/pyproject.toml +128 -0
- evalproof-0.2.0/src/evalproof/__init__.py +69 -0
- evalproof-0.2.0/src/evalproof/_version.py +3 -0
- evalproof-0.2.0/src/evalproof/cache.py +89 -0
- evalproof-0.2.0/src/evalproof/calibration.py +266 -0
- evalproof-0.2.0/src/evalproof/cli.py +265 -0
- evalproof-0.2.0/src/evalproof/compare.py +169 -0
- evalproof-0.2.0/src/evalproof/config.py +158 -0
- evalproof-0.2.0/src/evalproof/dataset.py +66 -0
- evalproof-0.2.0/src/evalproof/gate.py +107 -0
- evalproof-0.2.0/src/evalproof/models.py +115 -0
- evalproof-0.2.0/src/evalproof/providers/__init__.py +54 -0
- evalproof-0.2.0/src/evalproof/providers/anthropic.py +84 -0
- evalproof-0.2.0/src/evalproof/providers/base.py +75 -0
- evalproof-0.2.0/src/evalproof/providers/ollama.py +70 -0
- evalproof-0.2.0/src/evalproof/providers/openai.py +76 -0
- evalproof-0.2.0/src/evalproof/py.typed +0 -0
- evalproof-0.2.0/src/evalproof/report.py +149 -0
- evalproof-0.2.0/src/evalproof/runner.py +135 -0
- evalproof-0.2.0/src/evalproof/scorers/__init__.py +80 -0
- evalproof-0.2.0/src/evalproof/scorers/deterministic.py +227 -0
- evalproof-0.2.0/src/evalproof/scorers/judge.py +187 -0
- evalproof-0.2.0/src/evalproof/scorers/retrieval.py +64 -0
- evalproof-0.2.0/src/evalproof/stats.py +145 -0
- evalproof-0.2.0/src/evalproof/systems.py +154 -0
- evalproof-0.2.0/tests/__init__.py +0 -0
- evalproof-0.2.0/tests/conftest.py +83 -0
- evalproof-0.2.0/tests/test_cache_systems.py +147 -0
- evalproof-0.2.0/tests/test_calibration.py +145 -0
- evalproof-0.2.0/tests/test_compare_gate_report.py +142 -0
- evalproof-0.2.0/tests/test_config_dataset.py +112 -0
- evalproof-0.2.0/tests/test_providers.py +161 -0
- evalproof-0.2.0/tests/test_public_api.py +37 -0
- evalproof-0.2.0/tests/test_runner_cli.py +232 -0
- evalproof-0.2.0/tests/test_scorers.py +204 -0
- evalproof-0.2.0/tests/test_security.py +72 -0
- evalproof-0.2.0/tests/test_stats.py +137 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes are listed here. The project follows [Semantic Versioning](https://semver.org/).
|
|
4
|
+
|
|
5
|
+
## [0.2.0] — 2026-10-16
|
|
6
|
+
|
|
7
|
+
The first release on PyPI: `pip install evalproof`.
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- A supported Python API: `from evalproof import compare_runs, decide, calibrate, ...`.
|
|
12
|
+
The names in `evalproof.__all__` are the public surface; other modules are internal.
|
|
13
|
+
- Python 3.14 support, tested in CI alongside 3.11 to 3.13.
|
|
14
|
+
- Releases publish to PyPI from GitHub Actions with trusted publishing, so no token is
|
|
15
|
+
stored anywhere. Each file on PyPI carries a PEP 740 attestation, and the GitHub release
|
|
16
|
+
carries the same files with a build-provenance attestation.
|
|
17
|
+
- `SECURITY.md` with private vulnerability reporting and the trust boundaries, backed by a
|
|
18
|
+
test that runs both hosted providers with a fake key and finds it in no file written.
|
|
19
|
+
- `CODE_OF_CONDUCT.md` (Contributor Covenant 2.1), issue and pull-request templates,
|
|
20
|
+
`CITATION.cff`, `CODEOWNERS`, Dependabot for actions and Python dependencies with a
|
|
21
|
+
three-day cooldown, and a pre-commit configuration.
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
|
|
25
|
+
- The version is written once, in `src/evalproof/_version.py`; the build reads it.
|
|
26
|
+
- The README published to PyPI rewrites relative links to GitHub and replaces the Mermaid
|
|
27
|
+
diagram with a link, so the PyPI page has no broken links. CI checks this on every
|
|
28
|
+
commit, along with `twine check --strict` and a clean install of the built wheel.
|
|
29
|
+
- CI pins every action to a commit SHA, checks out without persisted credentials, sets
|
|
30
|
+
timeouts and cancels superseded pull-request runs, and audits the workflows with zizmor.
|
|
31
|
+
The composite action pins `setup-uv` the same way.
|
|
32
|
+
- Package metadata: documentation, source, changelog and live-demo links; classifiers for
|
|
33
|
+
typing, Python 3.14 and beta status.
|
|
34
|
+
|
|
35
|
+
## [0.1.2] — 2026-10-15
|
|
36
|
+
|
|
37
|
+
### Added
|
|
38
|
+
|
|
39
|
+
- `app/`: an interactive Streamlit app, live at https://evalproof.streamlit.app.
|
|
40
|
+
*Check a drop* starts from four scenarios (the recorded run, the same rates on 4× the
|
|
41
|
+
cases, a small but certain drop, a twenty-case suite) or from sliders, and shows the
|
|
42
|
+
gate's verdict, every paired case as a grid, the coin-flip distribution behind the exact
|
|
43
|
+
McNemar p-value, and the suite size at which the same drop would become significant.
|
|
44
|
+
*The recorded run* replays the committed `examples/support-qa` runs: select any of the
|
|
45
|
+
twelve changed answers to read both versions side by side, add a latency budget, and
|
|
46
|
+
calibrate the judge on a gold sample of chosen size. It runs the library from `src/`
|
|
47
|
+
through the same `compare_runs` and `decide` calls as the CLI; CI installs the app's own
|
|
48
|
+
requirements and drives every scenario.
|
|
49
|
+
|
|
50
|
+
### Fixed
|
|
51
|
+
|
|
52
|
+
- `evalproof compare` raised OverflowError when a metric had more than about 1,030
|
|
53
|
+
discordant pairs: the exact McNemar test summed `comb(n, i) * 0.5**n` in floating
|
|
54
|
+
point, and `comb(n, i)` outgrows the largest float. The binomial tail is now summed
|
|
55
|
+
as integers and divided once, so it stays exact at any size.
|
|
56
|
+
|
|
57
|
+
## [0.1.1] — 2026-10-13
|
|
58
|
+
|
|
59
|
+
### Fixed
|
|
60
|
+
|
|
61
|
+
- The Wilson interval now returns exactly 0 at k=0 and exactly 1 at k=n. Computing
|
|
62
|
+
the boundaries by subtraction left platform-dependent rounding (2.8e-17 on x86_64
|
|
63
|
+
Linux, 0.0 on arm64 macOS).
|
|
64
|
+
|
|
65
|
+
### Changed
|
|
66
|
+
|
|
67
|
+
- The three-day `exclude-newer` resolution guard is declared in `[tool.uv]`, so
|
|
68
|
+
`uv.lock` means the same thing on every machine and in CI.
|
|
69
|
+
- CI pins uv to the version that wrote `uv.lock`.
|
|
70
|
+
|
|
71
|
+
## [0.1.0] — 2026-10-13
|
|
72
|
+
|
|
73
|
+
First release.
|
|
74
|
+
|
|
75
|
+
### Added
|
|
76
|
+
|
|
77
|
+
- Suites in YAML: a JSONL golden set, a system under test, scorers, an optional judge,
|
|
78
|
+
calibration settings and a gate.
|
|
79
|
+
- Systems under test: Ollama, Anthropic and OpenAI models with a prompt template; Python
|
|
80
|
+
functions; HTTP endpoints. System failures are recorded per case, never fatal.
|
|
81
|
+
- Scorers: exact match, contains, regex with accept/reject answer keys, a JSON Schema
|
|
82
|
+
subset, numeric tolerance, recall@k, MRR, nDCG, and an LLM judge with a strict JSON
|
|
83
|
+
verdict, one parse retry and an explicit undecided state.
|
|
84
|
+
- Pairwise judging with order swap; position-inconsistent verdicts become ties.
|
|
85
|
+
- Judge calibration: confusion matrix, TPR, FPR, Cohen's κ, and prevalence-corrected pass
|
|
86
|
+
rates by adjusted classify-and-count (bootstrap interval) and prediction-powered
|
|
87
|
+
inference (normal interval).
|
|
88
|
+
- Paired comparison of two runs: exact McNemar for pass/fail, paired bootstrap for scores.
|
|
89
|
+
- A CI gate that fails only on a drop that is both beyond `max_drop` and significant at
|
|
90
|
+
`alpha`, plus p95-latency and cost budgets, with distinct exit codes.
|
|
91
|
+
- Content-addressed response cache; runs record the Ollama version and model digests.
|
|
92
|
+
- Markdown reports for GitHub step summaries, JSON reports, and a composite GitHub Action.
|
|
93
|
+
- Two examples: an offline ticket router (CI's gate contract) and a support assistant for
|
|
94
|
+
a fictional product judged by a local model, with measurements.
|
|
95
|
+
|
|
96
|
+
[0.2.0]: https://github.com/technobasant/evalproof/compare/v0.1.2...v0.2.0
|
|
97
|
+
[0.1.2]: https://github.com/technobasant/evalproof/compare/v0.1.1...v0.1.2
|
|
98
|
+
[0.1.1]: https://github.com/technobasant/evalproof/compare/v0.1.0...v0.1.1
|
|
99
|
+
[0.1.0]: https://github.com/technobasant/evalproof/releases/tag/v0.1.0
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
cff-version: 1.2.0
|
|
2
|
+
message: "If you use evalproof in research or a published evaluation, please cite it."
|
|
3
|
+
title: "evalproof: LLM evaluation as measurement"
|
|
4
|
+
abstract: >-
|
|
5
|
+
Calibrates an LLM judge against a small gold-labelled sample, corrects its pass rate with
|
|
6
|
+
adjusted classify-and-count and prediction-powered inference, compares runs on paired
|
|
7
|
+
cases with the exact McNemar test and a paired bootstrap, and gates CI only on
|
|
8
|
+
regressions that are both larger than a tolerance and statistically significant.
|
|
9
|
+
type: software
|
|
10
|
+
authors:
|
|
11
|
+
- family-names: Bhattarai
|
|
12
|
+
given-names: Basant
|
|
13
|
+
website: "https://basantbhattarai.com.np"
|
|
14
|
+
version: 0.2.0
|
|
15
|
+
date-released: "2026-10-16"
|
|
16
|
+
license: Apache-2.0
|
|
17
|
+
repository-code: "https://github.com/technobasant/evalproof"
|
|
18
|
+
url: "https://pypi.org/project/evalproof/"
|
|
19
|
+
keywords:
|
|
20
|
+
- llm-evaluation
|
|
21
|
+
- llm-as-a-judge
|
|
22
|
+
- calibration
|
|
23
|
+
- prediction-powered inference
|
|
24
|
+
- mcnemar test
|
|
25
|
+
- continuous integration
|
evalproof-0.2.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.
|
evalproof-0.2.0/NOTICE
ADDED
evalproof-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: evalproof
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Treat LLM evaluation as measurement: calibrate the judge, correct the pass rate, gate CI on significant regressions.
|
|
5
|
+
Project-URL: Homepage, https://github.com/technobasant/evalproof
|
|
6
|
+
Project-URL: Documentation, https://github.com/technobasant/evalproof#readme
|
|
7
|
+
Project-URL: Source, https://github.com/technobasant/evalproof
|
|
8
|
+
Project-URL: Issues, https://github.com/technobasant/evalproof/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/technobasant/evalproof/blob/main/CHANGELOG.md
|
|
10
|
+
Project-URL: Live demo, https://evalproof.streamlit.app
|
|
11
|
+
Project-URL: Write-up, https://basantbhattarai.com.np/writing/eval-score-drop-twelve-answers/
|
|
12
|
+
Author: Basant Bhattarai
|
|
13
|
+
License-Expression: Apache-2.0
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
License-File: NOTICE
|
|
16
|
+
Keywords: calibration,ci,evaluation,llm,llm-as-a-judge,statistics
|
|
17
|
+
Classifier: Development Status :: 4 - Beta
|
|
18
|
+
Classifier: Environment :: Console
|
|
19
|
+
Classifier: Intended Audience :: Developers
|
|
20
|
+
Classifier: Intended Audience :: Science/Research
|
|
21
|
+
Classifier: Operating System :: OS Independent
|
|
22
|
+
Classifier: Programming Language :: Python :: 3
|
|
23
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
27
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
28
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
29
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
30
|
+
Classifier: Topic :: Software Development :: Testing
|
|
31
|
+
Classifier: Typing :: Typed
|
|
32
|
+
Requires-Python: >=3.11
|
|
33
|
+
Requires-Dist: httpx>=0.27
|
|
34
|
+
Requires-Dist: numpy>=1.26
|
|
35
|
+
Requires-Dist: pydantic>=2.7
|
|
36
|
+
Requires-Dist: pyyaml>=6.0
|
|
37
|
+
Description-Content-Type: text/markdown
|
|
38
|
+
|
|
39
|
+
# evalproof
|
|
40
|
+
|
|
41
|
+
[](https://pypi.org/project/evalproof/)
|
|
42
|
+
[](https://pypi.org/project/evalproof/)
|
|
43
|
+
[](https://github.com/technobasant/evalproof/actions/workflows/ci.yml)
|
|
44
|
+
[](https://github.com/technobasant/evalproof/blob/main/LICENSE)
|
|
45
|
+
[](https://evalproof.streamlit.app)
|
|
46
|
+
|
|
47
|
+
**Treat LLM evaluation as measurement.** Calibrate the judge, correct its pass rate, and
|
|
48
|
+
gate CI on regressions that are real rather than noise.
|
|
49
|
+
|
|
50
|
+
**Try it in the browser: [evalproof.streamlit.app](https://evalproof.streamlit.app).** Check whether
|
|
51
|
+
a drop between two runs is real, or replay the run below and read the twelve answers that
|
|
52
|
+
changed. It runs this repository's code; after a quiet spell it takes about half a minute to wake.
|
|
53
|
+
|
|
54
|
+
An LLM judge is a classifier with error rates. If it passes bad answers at rate FPR and
|
|
55
|
+
good answers at rate TPR, its pass rate converges to `FPR + (TPR − FPR) · p`, not to the
|
|
56
|
+
true rate `p`. That is classify-and-count, and it is biased the way any classifier's count
|
|
57
|
+
is — the effect is worked through with a seeded simulation in
|
|
58
|
+
[*The classifier was 95% accurate. The trend it counted was a third too flat*](https://basantbhattarai.com.np/writing/count-prevalence-not-classifications/)
|
|
59
|
+
([lab](https://github.com/technobasant/prevalence-shift)).
|
|
60
|
+
|
|
61
|
+
evalproof:
|
|
62
|
+
|
|
63
|
+
1. **measures the judge** against a small gold-labelled sample — confusion matrix, TPR,
|
|
64
|
+
FPR, Cohen's κ;
|
|
65
|
+
2. **corrects its pass rate** with adjusted classify-and-count and prediction-powered
|
|
66
|
+
inference, each with a confidence interval;
|
|
67
|
+
3. **compares runs on paired cases** — exact McNemar for pass/fail, paired bootstrap for
|
|
68
|
+
scores;
|
|
69
|
+
4. **gates CI** only when a drop is both larger than your tolerance *and* statistically
|
|
70
|
+
significant, plus latency and cost budgets, with distinct exit codes.
|
|
71
|
+
|
|
72
|
+
It is local-first: Ollama is the default provider, Anthropic and OpenAI are optional, and
|
|
73
|
+
every model call is cached by content so re-runs are free and reproducible.
|
|
74
|
+
|
|
75
|
+
## Install
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
pip install evalproof # or: uv add evalproof
|
|
79
|
+
uv tool install evalproof # just the CLI
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Python 3.11 to 3.14. `compare`, `calibrate` and `report` work on run files and need no
|
|
83
|
+
model. `run` needs a system to evaluate: a Python function, an HTTP endpoint, a local
|
|
84
|
+
Ollama model, or an Anthropic or OpenAI key.
|
|
85
|
+
|
|
86
|
+
## What it found on a real run
|
|
87
|
+
|
|
88
|
+
A local `qwen3:1.7b` support assistant for a fictional product, judged by `qwen3:8b`, 83
|
|
89
|
+
questions, one Apple M5. Full method and every table in [MEASUREMENTS.md](https://github.com/technobasant/evalproof/blob/main/MEASUREMENTS.md).
|
|
90
|
+
|
|
91
|
+
| Question | Measured |
|
|
92
|
+
|---|---|
|
|
93
|
+
| How good is the 8B judge? | TPR 92.6%, FPR 6.7%, Cohen's κ 0.78 against the answer key |
|
|
94
|
+
| Did swapping the grounded prompt for a "friendly" one regress quality? | −4.8 pts on the judge, 8 cases worse vs 4 better, McNemar p = 0.39 — **gate warns, does not fail**; a delta-only gate would have failed it |
|
|
95
|
+
| What did regress? | p95 latency, 1,469 → 4,422 ms; mean answer 19 → 77 tokens. A 2,500 ms budget fails the change with exit 3 |
|
|
96
|
+
| Does correcting the judge's rate help? | On average yes (offset 4.8 → ~3.8 pts), but with 30 labels the interval doubles; at 83 cases the judge's bias is smaller than its own noise |
|
|
97
|
+
| Was the gold trustworthy? | No: of 13 judge–key disagreements the key was wrong 7 times, the judge 4. Most of the "bias" corrected was the gold's |
|
|
98
|
+
| Is pairwise judging safer? | No: 42% of verdicts flipped with the order of the two answers, and the judge preferred the candidate 42 to 6 — mostly where both answers were right and the candidate's was five times longer |
|
|
99
|
+
| Is it reproducible? | 20/20 identical outputs and verdicts with the cache off; a warm-cache re-run took 0.05 s instead of 363 s |
|
|
100
|
+
|
|
101
|
+
## Five-minute quickstart
|
|
102
|
+
|
|
103
|
+
The offline example lives in the repository:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
git clone https://github.com/technobasant/evalproof && cd evalproof
|
|
107
|
+
uv sync
|
|
108
|
+
|
|
109
|
+
# Offline: no model, no network. Four versions of a ticket router.
|
|
110
|
+
for v in baseline regressed noisy refactored; do
|
|
111
|
+
uv run evalproof run examples/deterministic/suite.yaml \
|
|
112
|
+
--system "python:router:${v}_route" --out "runs/$v.json" --quiet
|
|
113
|
+
done
|
|
114
|
+
uv run evalproof compare runs/baseline.json runs/regressed.json \
|
|
115
|
+
--suite examples/deterministic/suite.yaml --gate; echo "exit $?" # 1: real regression
|
|
116
|
+
uv run evalproof compare runs/baseline.json runs/noisy.json \
|
|
117
|
+
--suite examples/deterministic/suite.yaml --gate; echo "exit $?" # 0: 2 of 60 is noise
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
With Ollama installed, the LLM example is
|
|
121
|
+
[`examples/support-qa`](https://github.com/technobasant/evalproof/blob/main/examples/support-qa) (`ollama pull qwen3:1.7b` and
|
|
122
|
+
`ollama pull qwen3:8b`; about 6–10 minutes per run on an Apple M5).
|
|
123
|
+
|
|
124
|
+
The browser app in [`app/`](https://github.com/technobasant/evalproof/blob/main/app) runs locally too:
|
|
125
|
+
`uv run --with-requirements app/requirements.txt streamlit run app/streamlit_app.py`.
|
|
126
|
+
|
|
127
|
+
## Concepts
|
|
128
|
+
|
|
129
|
+
**Suite** — one YAML file: a JSONL golden set, the system under test, scorers, an optional
|
|
130
|
+
judge, calibration settings and a gate.
|
|
131
|
+
|
|
132
|
+
```yaml
|
|
133
|
+
name: support-qa
|
|
134
|
+
dataset: cases.jsonl # {"id", "input", "reference", ...extra fields}
|
|
135
|
+
system:
|
|
136
|
+
target: ollama:qwen3:1.7b # or anthropic:…, openai:…, python:module:func, https://…
|
|
137
|
+
system_prompt_file: prompt.md
|
|
138
|
+
prompt_template: "{question}"
|
|
139
|
+
params: {temperature: 0, seed: 0, think: false}
|
|
140
|
+
judge:
|
|
141
|
+
target: ollama:qwen3:8b
|
|
142
|
+
scorers:
|
|
143
|
+
- {name: answer_key, type: regex, params: {any_of_field: accept, none_of_field: reject}}
|
|
144
|
+
- {name: judge, type: llm_judge, params: {rubric_file: rubric.md}}
|
|
145
|
+
calibration: {judge_scorer: judge, gold_scorer: answer_key, gold_sample: 30}
|
|
146
|
+
gate: {metric: judge, max_drop: 0.03, alpha: 0.05, min_cases: 40, max_p95_latency_ms: 2500}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**Run** — `evalproof run suite.yaml` writes one self-describing JSON file: every case's
|
|
150
|
+
output, latency, tokens and scores, plus the dataset hash, seed, Ollama version and model
|
|
151
|
+
digests.
|
|
152
|
+
|
|
153
|
+
**Scorers** — `exact_match`, `contains`, `regex` (accept/reject answer keys),
|
|
154
|
+
`json_schema`, `numeric_tolerance`, `recall_at_k`, `mrr`, `ndcg`, and `llm_judge`: a strict
|
|
155
|
+
JSON verdict, one retry on an unparseable reply, and an explicit *undecided* state that is
|
|
156
|
+
counted, never scored as a pass. `evalproof pairwise` judges two runs head to head in both
|
|
157
|
+
orders and reports order-dependent verdicts as ties.
|
|
158
|
+
|
|
159
|
+
**Calibrate** — `evalproof calibrate run.json --judge-scorer judge --labels gold.jsonl`
|
|
160
|
+
(human labels) or `--gold-scorer answer_key --gold-sample 30`:
|
|
161
|
+
|
|
162
|
+
| Estimate | What it is |
|
|
163
|
+
|---|---|
|
|
164
|
+
| raw judge pass rate | classify-and-count, Wilson interval |
|
|
165
|
+
| gold labels only | the labelled sample alone |
|
|
166
|
+
| ACC | `(q − FPR) / (TPR − FPR)`, bootstrap interval over both the judged set and the gold sample |
|
|
167
|
+
| PPI | judge mean on unlabelled cases + mean (label − judge) on the gold sample, normal interval |
|
|
168
|
+
|
|
169
|
+
**Compare and gate** — `evalproof compare baseline.json candidate.json --suite suite.yaml --gate`
|
|
170
|
+
|
|
171
|
+
| Exit | Meaning |
|
|
172
|
+
|---|---|
|
|
173
|
+
| 0 | pass — possibly with warnings (a big drop that is not significant; a significant drop within tolerance) |
|
|
174
|
+
| 1 | quality regression: drop ≥ `max_drop` **and** p < `alpha` |
|
|
175
|
+
| 3 | budget breach: candidate p95 latency or cost over the limit |
|
|
176
|
+
| 4 | cannot gate: fewer than `min_cases` paired cases, or the runs used different data |
|
|
177
|
+
| 2 | usage or configuration error |
|
|
178
|
+
|
|
179
|
+
## From Python
|
|
180
|
+
|
|
181
|
+
The CLI is a thin layer over the same functions:
|
|
182
|
+
|
|
183
|
+
```python
|
|
184
|
+
from evalproof import GateConfig, calibrate, compare_runs, decide, load_run
|
|
185
|
+
|
|
186
|
+
baseline = load_run("runs/baseline.json")
|
|
187
|
+
candidate = load_run("runs/candidate.json")
|
|
188
|
+
|
|
189
|
+
cmp = compare_runs(baseline, candidate) # paired cases: exact McNemar, bootstrap intervals
|
|
190
|
+
decision = decide(cmp, GateConfig(metric="judge", max_drop=0.03))
|
|
191
|
+
print(decision.status, decision.exit_code, decision.warnings)
|
|
192
|
+
|
|
193
|
+
report = calibrate(baseline, "judge", gold_scorer="answer_key", gold_sample=30)
|
|
194
|
+
for est in report.estimates: # raw judge rate, gold only, ACC, PPI
|
|
195
|
+
print(est.method, est.point, est.low, est.high)
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
The names in `evalproof.__all__` are the supported API. Other modules are internal and may
|
|
199
|
+
change between minor versions; see the [changelog](https://github.com/technobasant/evalproof/blob/main/CHANGELOG.md).
|
|
200
|
+
|
|
201
|
+
## Architecture
|
|
202
|
+
|
|
203
|
+
The architecture diagram is in the [README on GitHub](https://github.com/technobasant/evalproof#architecture).
|
|
204
|
+
|
|
205
|
+
## Decisions
|
|
206
|
+
|
|
207
|
+
| Decision | Alternative | Why | ADR |
|
|
208
|
+
|---|---|---|---|
|
|
209
|
+
| Treat the judge as a classifier to be calibrated | Trust the judge's pass rate | Its count is biased by its own error rates, and the bias moves with the true rate | [0001](https://github.com/technobasant/evalproof/blob/main/docs/adr/0001-judge-is-a-classifier.md) |
|
|
210
|
+
| Local Ollama by default, HTTP-only providers, content-addressed cache | Hosted APIs and vendor SDKs | Reproducible, free to re-run, tied to a model digest; no SDK dependency | [0002](https://github.com/technobasant/evalproof/blob/main/docs/adr/0002-local-first-providers.md) |
|
|
211
|
+
| Gate on "large AND significant", on paired cases | "Fail if the score dropped by X" | On a few dozen cases, X-point drops are mostly noise, and a noisy gate gets switched off | [0003](https://github.com/technobasant/evalproof/blob/main/docs/adr/0003-gate-on-significance-not-delta.md) |
|
|
212
|
+
| Gate one metric; report the rest | Gate every metric | Testing many metrics at α = 0.05 each inflates false failures | 0003 |
|
|
213
|
+
| Pointwise verdicts for gating; pairwise as a diagnostic | Pairwise preference for gating | Measured: 42% of pairwise verdicts flipped with answer order, with a strong length preference | [MEASUREMENTS §6](https://github.com/technobasant/evalproof/blob/main/MEASUREMENTS.md) |
|
|
214
|
+
| numpy and the standard library for statistics | SciPy, statsmodels | Small enough to read and to test against hand-worked values | — |
|
|
215
|
+
|
|
216
|
+
## In CI
|
|
217
|
+
|
|
218
|
+
The composite action runs `compare --gate`, appends the report to the job summary, and
|
|
219
|
+
fails the job on exit codes 1, 3 or 4:
|
|
220
|
+
|
|
221
|
+
```yaml
|
|
222
|
+
- uses: technobasant/evalproof@v0.2.0
|
|
223
|
+
with:
|
|
224
|
+
baseline: eval/baseline.json # produced on main, e.g. as a build artifact
|
|
225
|
+
candidate: eval/candidate.json # produced on this branch
|
|
226
|
+
suite: eval/suite.yaml
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
This repository's own CI runs the offline example on every commit and asserts that the
|
|
230
|
+
gate returns 1 for the real regression and 0 for the noisy and refactored candidates.
|
|
231
|
+
|
|
232
|
+
## How it relates to other tools
|
|
233
|
+
|
|
234
|
+
[promptfoo](https://www.promptfoo.dev/docs/intro/) (open-source, local evals of prompts,
|
|
235
|
+
models and RAG pipelines with deterministic and model-graded assertions, a GitHub Action,
|
|
236
|
+
and red teaming), [DeepEval](https://deepeval.com/docs/getting-started) (pytest-style
|
|
237
|
+
LLM tests with research-backed metrics such as G-Eval), [Ragas](https://docs.ragas.io/en/stable/)
|
|
238
|
+
(LLM-driven metrics and experiments for LLM and RAG applications) and
|
|
239
|
+
[Inspect](https://inspect.aisi.org.uk/) (the UK AI Security Institute's framework for
|
|
240
|
+
model and agent evaluations, with sandboxed tools and a log viewer) are broad evaluation
|
|
241
|
+
frameworks.
|
|
242
|
+
|
|
243
|
+
evalproof is deliberately narrow: it is the measurement layer — how much a judge's verdict
|
|
244
|
+
is worth, and whether a difference between two runs is real. Its run file is plain,
|
|
245
|
+
documented JSON, so it can sit beside an existing harness: produce the per-case verdicts
|
|
246
|
+
however you like, then calibrate and gate here.
|
|
247
|
+
|
|
248
|
+
## Limits
|
|
249
|
+
|
|
250
|
+
* The measurements cover one machine, two small local models, one fictional domain and
|
|
251
|
+
83 cases. They show the method; they are not a benchmark of those models.
|
|
252
|
+
* Calibration is only as good as its gold labels — [MEASUREMENTS §4](https://github.com/technobasant/evalproof/blob/main/MEASUREMENTS.md)
|
|
253
|
+
shows a regex answer key being wrong more often than the judge. Use human labels when
|
|
254
|
+
the decision matters.
|
|
255
|
+
* ACC needs both classes in the gold sample and a judge better than chance; PPI needs the
|
|
256
|
+
gold sample to be random. evalproof reports when either does not hold rather than
|
|
257
|
+
printing a number.
|
|
258
|
+
* The percentile-bootstrap p-value for continuous scores is an approximation; pass/fail
|
|
259
|
+
metrics use the exact McNemar test.
|
|
260
|
+
* Cost tracking needs a price table in the suite for hosted models.
|
|
261
|
+
|
|
262
|
+
## Roadmap
|
|
263
|
+
|
|
264
|
+
* Stratified gold sampling (by tag) and per-tag calibration.
|
|
265
|
+
* Multiple-comparison correction when more than one metric is gated.
|
|
266
|
+
* A reasoning judge (`think: true`) measured against the same answer key.
|
|
267
|
+
* Importers for other harnesses' per-case results.
|
|
268
|
+
|
|
269
|
+
## Project
|
|
270
|
+
|
|
271
|
+
[Changelog](https://github.com/technobasant/evalproof/blob/main/CHANGELOG.md) · [Contributing](https://github.com/technobasant/evalproof/blob/main/CONTRIBUTING.md) ·
|
|
272
|
+
[Security policy](https://github.com/technobasant/evalproof/blob/main/SECURITY.md) · [Code of conduct](https://github.com/technobasant/evalproof/blob/main/CODE_OF_CONDUCT.md) ·
|
|
273
|
+
[How to cite](https://github.com/technobasant/evalproof/blob/main/CITATION.cff). Releases are published to PyPI from GitHub Actions with
|
|
274
|
+
[trusted publishing](https://docs.pypi.org/trusted-publishers/), and each file carries a
|
|
275
|
+
signed provenance attestation.
|
|
276
|
+
|
|
277
|
+
## Licence
|
|
278
|
+
|
|
279
|
+
Apache-2.0. See [LICENSE](https://github.com/technobasant/evalproof/blob/main/LICENSE) and [NOTICE](https://github.com/technobasant/evalproof/blob/main/NOTICE).
|