passgate 0.1.1__tar.gz → 0.2.2__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.
- {passgate-0.1.1 → passgate-0.2.2}/LICENSE +1 -1
- passgate-0.2.2/PKG-INFO +196 -0
- passgate-0.2.2/README.md +167 -0
- {passgate-0.1.1 → passgate-0.2.2}/pyproject.toml +15 -13
- passgate-0.2.2/src/passgate/__init__.py +26 -0
- {passgate-0.1.1 → passgate-0.2.2}/src/passgate/__main__.py +0 -1
- passgate-0.2.2/src/passgate/cli.py +302 -0
- {passgate-0.1.1 → passgate-0.2.2}/src/passgate/gate.py +214 -174
- {passgate-0.1.1 → passgate-0.2.2}/src/passgate/stats.py +122 -79
- passgate-0.2.2/src/passgate.egg-info/PKG-INFO +196 -0
- {passgate-0.1.1 → passgate-0.2.2}/src/passgate.egg-info/SOURCES.txt +2 -1
- passgate-0.2.2/tests/test_gate.py +299 -0
- passgate-0.2.2/tests/test_junit.py +49 -0
- passgate-0.2.2/tests/test_packaging.py +25 -0
- {passgate-0.1.1 → passgate-0.2.2}/tests/test_stats.py +136 -85
- passgate-0.1.1/PKG-INFO +0 -112
- passgate-0.1.1/README.md +0 -87
- passgate-0.1.1/src/passgate/__init__.py +0 -17
- passgate-0.1.1/src/passgate/cli.py +0 -149
- passgate-0.1.1/src/passgate.egg-info/PKG-INFO +0 -112
- passgate-0.1.1/tests/test_cli_edge.py +0 -134
- passgate-0.1.1/tests/test_gate.py +0 -97
- {passgate-0.1.1 → passgate-0.2.2}/setup.cfg +0 -0
- {passgate-0.1.1 → passgate-0.2.2}/src/passgate/py.typed +0 -0
- {passgate-0.1.1 → passgate-0.2.2}/src/passgate.egg-info/dependency_links.txt +0 -0
- {passgate-0.1.1 → passgate-0.2.2}/src/passgate.egg-info/entry_points.txt +0 -0
- {passgate-0.1.1 → passgate-0.2.2}/src/passgate.egg-info/top_level.txt +0 -0
passgate-0.2.2/PKG-INFO
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: passgate
|
|
3
|
+
Version: 0.2.2
|
|
4
|
+
Summary: Statistical pass^N gate: require an eval candidate to clear a Wilson-bound bar on every round, not just on average
|
|
5
|
+
Author-email: "Calas Automations Inc." <office@calasautomations.com>
|
|
6
|
+
Maintainer-email: "Calas Automations Inc." <office@calasautomations.com>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Project-URL: Homepage, https://github.com/calasdan-sketch/passgate
|
|
9
|
+
Project-URL: Repository, https://github.com/calasdan-sketch/passgate
|
|
10
|
+
Project-URL: Issues, https://github.com/calasdan-sketch/passgate/issues
|
|
11
|
+
Project-URL: Changelog, https://github.com/calasdan-sketch/passgate/blob/main/CHANGELOG.md
|
|
12
|
+
Keywords: evals,llm,reliability,wilson,statistics,gate,regression,ci,pass-at-k,flaky-evals
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Topic :: Software Development :: Testing
|
|
23
|
+
Classifier: Environment :: Console
|
|
24
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
25
|
+
Requires-Python: >=3.9
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
|
|
30
|
+
<!-- Image URLs are absolute on purpose: GitHub resolves relative paths, PyPI does not. -->
|
|
31
|
+

|
|
32
|
+
|
|
33
|
+
**A statistical reliability gate for LLM evals: a candidate must clear a Wilson-bound pass bar on every evaluation round, not just on average.**
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pip install passgate && passgate gate rounds.json --threshold 0.9 --min-rounds 3
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Needs Python 3.9 or newer, nothing else (standard library only). `rounds.json` is one entry per eval round (example below).
|
|
40
|
+
|
|
41
|
+
A real run on three rounds. Exit code 1, so CI fails:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
passgate: 1/3 round(s) clear Wilson-lower >= 0.900 (lower bound of the two-sided 95% Wilson interval, ~97.5% one-sided; min 3 rounds)
|
|
45
|
+
FAIL baseline-eval-set: 93/100 = 0.930 (lower 0.863)
|
|
46
|
+
FAIL adversarial-set: 95/100 = 0.950 (lower 0.888)
|
|
47
|
+
PASS regression-set: 116/120 = 0.967 (lower 0.917)
|
|
48
|
+
verdict: FAIL
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
*Pasted from a real run in a temporary folder. 93/100 does not certify 0.9 at 95% confidence: you need more data or a lower bar.*
|
|
52
|
+
|
|
53
|
+
- **Every round has to clear the bar.** Each round's conservative pass rate (lower bound of the Wilson score interval) must reach your threshold. Averaging hides the weak round; this does not.
|
|
54
|
+
- **Plan and compare.** `passgate plan` says how many trials a round needs; `passgate compare` tests a candidate against a baseline (pooled z-test, Fisher's exact, or paired McNemar).
|
|
55
|
+
- **Fits CI.** Reads JSON, CSV or JUnit XML, `--json` for machines, `--markdown` appends to `$GITHUB_STEP_SUMMARY`.
|
|
56
|
+
|
|
57
|
+
[](https://github.com/calasdan-sketch/passgate/actions/workflows/ci.yml)
|
|
58
|
+
[](https://pypi.org/project/passgate/)
|
|
59
|
+

|
|
60
|
+

|
|
61
|
+
|
|
62
|
+
## Limits up front
|
|
63
|
+
|
|
64
|
+
- The bar is the lower bound of the two-sided 95% Wilson interval (about 97.5% one-sided): conservative, not exactly 95%.
|
|
65
|
+
- pass^N here means every round clears the bar. It is not tau-bench's pass^k (all k trials of one task succeed).
|
|
66
|
+
- `plan` is a planning estimate, not a power calculation: at the expected rate a round of that size still fails some of the time.
|
|
67
|
+
- `compare` exits 0 only when the improvement is significant at `--alpha`; "inconclusive" exits 1 like "not better".
|
|
68
|
+
- Exit codes: 0 passed, 1 the gate failed (or `compare` found no significant improvement), 2 the input could not be used (missing or malformed file, bad number, `--alpha` outside 0 to 1).
|
|
69
|
+
|
|
70
|
+
More detail in [Notes](#notes). Changes: [CHANGELOG.md](CHANGELOG.md).
|
|
71
|
+
|
|
72
|
+
Eval flakiness is the quiet killer: a prompt scores 91% once, ships, and regresses. `passgate` requires each round's conservative pass-rate estimate to clear your bar, so a candidate that needs 3 good rounds to ship must produce 3 good rounds.
|
|
73
|
+
|
|
74
|
+
## Install
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
pip install passgate
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## The gate
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
passgate gate rounds.json --threshold 0.9 --min-rounds 3
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
`rounds.json` (or `.csv`) holds one entry per round:
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
[
|
|
90
|
+
{ "label": "baseline-eval-set", "trials": 100, "passes": 93 },
|
|
91
|
+
{ "label": "adversarial-set", "trials": 100, "passes": 95 },
|
|
92
|
+
{ "label": "regression-set", "trials": 120, "passes": 116 }
|
|
93
|
+
]
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
A `.xml` file is read as JUnit XML (`pytest --junitxml`, most eval runners and CI):
|
|
97
|
+
each `<testsuite>` is one round, failures and errors are fails, skipped cases are not counted as trials.
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
pytest evals/ --junitxml=rounds.xml && passgate gate rounds.xml --threshold 0.9 --min-rounds 3
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Output is a per-round scoreboard and a verdict; exit code `1` fails CI:
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
passgate: 1/3 round(s) clear Wilson-lower >= 0.900 (lower bound of the two-sided 95% Wilson interval, ~97.5% one-sided; min 3 rounds)
|
|
107
|
+
FAIL baseline-eval-set: 93/100 = 0.930 (lower 0.863)
|
|
108
|
+
FAIL adversarial-set: 95/100 = 0.950 (lower 0.888)
|
|
109
|
+
PASS regression-set: 116/120 = 0.967 (lower 0.917)
|
|
110
|
+
verdict: FAIL
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Note what the gate does: **93/100 does not certify ≥ 0.9** at 95% confidence with 100 trials — you need more data or a lower bar. That is the point: the bar scales with evidence, not vibes. Add `--json` for machines.
|
|
114
|
+
|
|
115
|
+
## How many trials do I need?
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
passgate plan --threshold 0.9 --expected-rate 0.95
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
passgate plan: 140 trials per round to clear Wilson-lower >= 0.900
|
|
123
|
+
assumptions:
|
|
124
|
+
- each round scores exactly floor(expected_rate * n) passes (133/140); real rounds vary
|
|
125
|
+
- planning estimate, not a power calculation: at that true rate a round of this size will still fail some of the time, so add margin
|
|
126
|
+
- bar = lower bound of the two-sided 95% Wilson interval
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
`plan` returns the smallest round size that *could* clear the bar if the round scored exactly the rate you expect. It is not a power calculation. A flawless round (the default `--expected-rate 1.0`) needs 35 trials to clear 0.9. If the expected rate is at or below the threshold, no round size can clear it, and `plan` exits `2`.
|
|
130
|
+
|
|
131
|
+
## Candidate vs baseline
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
passgate compare --candidate 93/100 --candidate 95/100 \
|
|
135
|
+
--baseline 85/100 --baseline 88/100
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Pooled two-proportion z-test with a one-sided p-value, plus Fisher's exact p (exact hypergeometric enumeration — right for small rounds where the normal approximation lies). Exit `0` only when the improvement is statistically significant at `--alpha` (default 0.05). The verdict uses the z-test; Fisher's p is reported alongside as a cross-check, not used for the verdict.
|
|
139
|
+
|
|
140
|
+
### Paired: the same cases run by both
|
|
141
|
+
|
|
142
|
+
When candidate and baseline ran the **same** eval cases, the pooled test above throws away the pairing. Use `--paired` with one JSON line per case:
|
|
143
|
+
|
|
144
|
+
```jsonl
|
|
145
|
+
{"id": "case-001", "candidate": true, "baseline": false}
|
|
146
|
+
{"id": "case-002", "candidate": true, "baseline": true}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
passgate compare --paired cases.jsonl
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
This runs an exact McNemar test: b = cases only the candidate passed, c = cases only the baseline passed, and the one-sided p-value is P(X >= b) for X ~ Binomial(b + c, 1/2), computed from exact integer binomial sums. Cases both passed or both failed carry no information about which is better and are ignored. The output shows b, c and the discordant count. With no discordant cases the verdict is `inconclusive`. Duplicate ids, or `candidate`/`baseline` values that are not `true`/`false`, exit `2`.
|
|
154
|
+
|
|
155
|
+
## Markdown summary
|
|
156
|
+
|
|
157
|
+
`gate` and `compare` take `--markdown PATH` to append a markdown table and the verdict to a file. It appends rather than overwrites, so it works with GitHub's `$GITHUB_STEP_SUMMARY`:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
passgate gate rounds.json --threshold 0.9 --markdown "$GITHUB_STEP_SUMMARY"
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Python API
|
|
164
|
+
|
|
165
|
+
```python
|
|
166
|
+
from passgate import Round, evaluate_rounds, compare
|
|
167
|
+
|
|
168
|
+
result = evaluate_rounds(
|
|
169
|
+
[Round(trials=100, passes=93), Round(trials=100, passes=95)],
|
|
170
|
+
threshold=0.9, confidence=0.95, min_rounds=2,
|
|
171
|
+
)
|
|
172
|
+
assert result.passed, str(result)
|
|
173
|
+
|
|
174
|
+
cmp = compare([Round(100, 93)], [Round(100, 85)])
|
|
175
|
+
print(cmp.verdict) # candidate-better | baseline-better | inconclusive
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## CI
|
|
179
|
+
|
|
180
|
+
```yaml
|
|
181
|
+
- run: pip install passgate
|
|
182
|
+
- run: python run_evals.py --out rounds.json # your eval runner
|
|
183
|
+
- run: passgate gate rounds.json --threshold 0.9 --min-rounds 3
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Notes
|
|
187
|
+
|
|
188
|
+
- Wilson interval (not Wald): behaves correctly near 0% and 100%, where the naive interval explodes.
|
|
189
|
+
- The bar is the lower bound of the two-sided 95% Wilson interval (`--confidence 0.95`). That is equivalent to a ~97.5% one-sided bound: conservative, not exactly 95%.
|
|
190
|
+
- pass^N here means *every round* clears the bar. It is not tau-bench's pass^k (all k trials of the same task succeed).
|
|
191
|
+
- `gate` fails when rounds < `--min-rounds`, so "we only ran it once" cannot pass a 3-round gate.
|
|
192
|
+
- Pure stdlib — no scipy, no pandas.
|
|
193
|
+
|
|
194
|
+
## License
|
|
195
|
+
|
|
196
|
+
MIT — see `LICENSE`.
|
passgate-0.2.2/README.md
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
<!-- Image URLs are absolute on purpose: GitHub resolves relative paths, PyPI does not. -->
|
|
2
|
+

|
|
3
|
+
|
|
4
|
+
**A statistical reliability gate for LLM evals: a candidate must clear a Wilson-bound pass bar on every evaluation round, not just on average.**
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
pip install passgate && passgate gate rounds.json --threshold 0.9 --min-rounds 3
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
Needs Python 3.9 or newer, nothing else (standard library only). `rounds.json` is one entry per eval round (example below).
|
|
11
|
+
|
|
12
|
+
A real run on three rounds. Exit code 1, so CI fails:
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
passgate: 1/3 round(s) clear Wilson-lower >= 0.900 (lower bound of the two-sided 95% Wilson interval, ~97.5% one-sided; min 3 rounds)
|
|
16
|
+
FAIL baseline-eval-set: 93/100 = 0.930 (lower 0.863)
|
|
17
|
+
FAIL adversarial-set: 95/100 = 0.950 (lower 0.888)
|
|
18
|
+
PASS regression-set: 116/120 = 0.967 (lower 0.917)
|
|
19
|
+
verdict: FAIL
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
*Pasted from a real run in a temporary folder. 93/100 does not certify 0.9 at 95% confidence: you need more data or a lower bar.*
|
|
23
|
+
|
|
24
|
+
- **Every round has to clear the bar.** Each round's conservative pass rate (lower bound of the Wilson score interval) must reach your threshold. Averaging hides the weak round; this does not.
|
|
25
|
+
- **Plan and compare.** `passgate plan` says how many trials a round needs; `passgate compare` tests a candidate against a baseline (pooled z-test, Fisher's exact, or paired McNemar).
|
|
26
|
+
- **Fits CI.** Reads JSON, CSV or JUnit XML, `--json` for machines, `--markdown` appends to `$GITHUB_STEP_SUMMARY`.
|
|
27
|
+
|
|
28
|
+
[](https://github.com/calasdan-sketch/passgate/actions/workflows/ci.yml)
|
|
29
|
+
[](https://pypi.org/project/passgate/)
|
|
30
|
+

|
|
31
|
+

|
|
32
|
+
|
|
33
|
+
## Limits up front
|
|
34
|
+
|
|
35
|
+
- The bar is the lower bound of the two-sided 95% Wilson interval (about 97.5% one-sided): conservative, not exactly 95%.
|
|
36
|
+
- pass^N here means every round clears the bar. It is not tau-bench's pass^k (all k trials of one task succeed).
|
|
37
|
+
- `plan` is a planning estimate, not a power calculation: at the expected rate a round of that size still fails some of the time.
|
|
38
|
+
- `compare` exits 0 only when the improvement is significant at `--alpha`; "inconclusive" exits 1 like "not better".
|
|
39
|
+
- Exit codes: 0 passed, 1 the gate failed (or `compare` found no significant improvement), 2 the input could not be used (missing or malformed file, bad number, `--alpha` outside 0 to 1).
|
|
40
|
+
|
|
41
|
+
More detail in [Notes](#notes). Changes: [CHANGELOG.md](CHANGELOG.md).
|
|
42
|
+
|
|
43
|
+
Eval flakiness is the quiet killer: a prompt scores 91% once, ships, and regresses. `passgate` requires each round's conservative pass-rate estimate to clear your bar, so a candidate that needs 3 good rounds to ship must produce 3 good rounds.
|
|
44
|
+
|
|
45
|
+
## Install
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pip install passgate
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## The gate
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
passgate gate rounds.json --threshold 0.9 --min-rounds 3
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
`rounds.json` (or `.csv`) holds one entry per round:
|
|
58
|
+
|
|
59
|
+
```json
|
|
60
|
+
[
|
|
61
|
+
{ "label": "baseline-eval-set", "trials": 100, "passes": 93 },
|
|
62
|
+
{ "label": "adversarial-set", "trials": 100, "passes": 95 },
|
|
63
|
+
{ "label": "regression-set", "trials": 120, "passes": 116 }
|
|
64
|
+
]
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
A `.xml` file is read as JUnit XML (`pytest --junitxml`, most eval runners and CI):
|
|
68
|
+
each `<testsuite>` is one round, failures and errors are fails, skipped cases are not counted as trials.
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
pytest evals/ --junitxml=rounds.xml && passgate gate rounds.xml --threshold 0.9 --min-rounds 3
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Output is a per-round scoreboard and a verdict; exit code `1` fails CI:
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
passgate: 1/3 round(s) clear Wilson-lower >= 0.900 (lower bound of the two-sided 95% Wilson interval, ~97.5% one-sided; min 3 rounds)
|
|
78
|
+
FAIL baseline-eval-set: 93/100 = 0.930 (lower 0.863)
|
|
79
|
+
FAIL adversarial-set: 95/100 = 0.950 (lower 0.888)
|
|
80
|
+
PASS regression-set: 116/120 = 0.967 (lower 0.917)
|
|
81
|
+
verdict: FAIL
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Note what the gate does: **93/100 does not certify ≥ 0.9** at 95% confidence with 100 trials — you need more data or a lower bar. That is the point: the bar scales with evidence, not vibes. Add `--json` for machines.
|
|
85
|
+
|
|
86
|
+
## How many trials do I need?
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
passgate plan --threshold 0.9 --expected-rate 0.95
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
passgate plan: 140 trials per round to clear Wilson-lower >= 0.900
|
|
94
|
+
assumptions:
|
|
95
|
+
- each round scores exactly floor(expected_rate * n) passes (133/140); real rounds vary
|
|
96
|
+
- planning estimate, not a power calculation: at that true rate a round of this size will still fail some of the time, so add margin
|
|
97
|
+
- bar = lower bound of the two-sided 95% Wilson interval
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
`plan` returns the smallest round size that *could* clear the bar if the round scored exactly the rate you expect. It is not a power calculation. A flawless round (the default `--expected-rate 1.0`) needs 35 trials to clear 0.9. If the expected rate is at or below the threshold, no round size can clear it, and `plan` exits `2`.
|
|
101
|
+
|
|
102
|
+
## Candidate vs baseline
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
passgate compare --candidate 93/100 --candidate 95/100 \
|
|
106
|
+
--baseline 85/100 --baseline 88/100
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Pooled two-proportion z-test with a one-sided p-value, plus Fisher's exact p (exact hypergeometric enumeration — right for small rounds where the normal approximation lies). Exit `0` only when the improvement is statistically significant at `--alpha` (default 0.05). The verdict uses the z-test; Fisher's p is reported alongside as a cross-check, not used for the verdict.
|
|
110
|
+
|
|
111
|
+
### Paired: the same cases run by both
|
|
112
|
+
|
|
113
|
+
When candidate and baseline ran the **same** eval cases, the pooled test above throws away the pairing. Use `--paired` with one JSON line per case:
|
|
114
|
+
|
|
115
|
+
```jsonl
|
|
116
|
+
{"id": "case-001", "candidate": true, "baseline": false}
|
|
117
|
+
{"id": "case-002", "candidate": true, "baseline": true}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
passgate compare --paired cases.jsonl
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
This runs an exact McNemar test: b = cases only the candidate passed, c = cases only the baseline passed, and the one-sided p-value is P(X >= b) for X ~ Binomial(b + c, 1/2), computed from exact integer binomial sums. Cases both passed or both failed carry no information about which is better and are ignored. The output shows b, c and the discordant count. With no discordant cases the verdict is `inconclusive`. Duplicate ids, or `candidate`/`baseline` values that are not `true`/`false`, exit `2`.
|
|
125
|
+
|
|
126
|
+
## Markdown summary
|
|
127
|
+
|
|
128
|
+
`gate` and `compare` take `--markdown PATH` to append a markdown table and the verdict to a file. It appends rather than overwrites, so it works with GitHub's `$GITHUB_STEP_SUMMARY`:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
passgate gate rounds.json --threshold 0.9 --markdown "$GITHUB_STEP_SUMMARY"
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Python API
|
|
135
|
+
|
|
136
|
+
```python
|
|
137
|
+
from passgate import Round, evaluate_rounds, compare
|
|
138
|
+
|
|
139
|
+
result = evaluate_rounds(
|
|
140
|
+
[Round(trials=100, passes=93), Round(trials=100, passes=95)],
|
|
141
|
+
threshold=0.9, confidence=0.95, min_rounds=2,
|
|
142
|
+
)
|
|
143
|
+
assert result.passed, str(result)
|
|
144
|
+
|
|
145
|
+
cmp = compare([Round(100, 93)], [Round(100, 85)])
|
|
146
|
+
print(cmp.verdict) # candidate-better | baseline-better | inconclusive
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## CI
|
|
150
|
+
|
|
151
|
+
```yaml
|
|
152
|
+
- run: pip install passgate
|
|
153
|
+
- run: python run_evals.py --out rounds.json # your eval runner
|
|
154
|
+
- run: passgate gate rounds.json --threshold 0.9 --min-rounds 3
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Notes
|
|
158
|
+
|
|
159
|
+
- Wilson interval (not Wald): behaves correctly near 0% and 100%, where the naive interval explodes.
|
|
160
|
+
- The bar is the lower bound of the two-sided 95% Wilson interval (`--confidence 0.95`). That is equivalent to a ~97.5% one-sided bound: conservative, not exactly 95%.
|
|
161
|
+
- pass^N here means *every round* clears the bar. It is not tau-bench's pass^k (all k trials of the same task succeed).
|
|
162
|
+
- `gate` fails when rounds < `--min-rounds`, so "we only ran it once" cannot pass a 3-round gate.
|
|
163
|
+
- Pure stdlib — no scipy, no pandas.
|
|
164
|
+
|
|
165
|
+
## License
|
|
166
|
+
|
|
167
|
+
MIT — see `LICENSE`.
|
|
@@ -4,17 +4,16 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "passgate"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.2.2"
|
|
8
8
|
description = "Statistical pass^N gate: require an eval candidate to clear a Wilson-bound bar on every round, not just on average"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
11
11
|
license = "MIT"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
keywords = ["evals", "llm", "reliability", "wilson", "statistics", "gate", "regression", "ci"]
|
|
12
|
+
authors = [{ name = "Calas Automations Inc.", email = "office@calasautomations.com" }]
|
|
13
|
+
maintainers = [{ name = "Calas Automations Inc.", email = "office@calasautomations.com" }]
|
|
14
|
+
keywords = ["evals", "llm", "reliability", "wilson", "statistics", "gate", "regression", "ci", "pass-at-k", "flaky-evals"]
|
|
15
15
|
classifiers = [
|
|
16
16
|
"Development Status :: 4 - Beta",
|
|
17
|
-
"Environment :: Console",
|
|
18
17
|
"Intended Audience :: Developers",
|
|
19
18
|
"Operating System :: OS Independent",
|
|
20
19
|
"Programming Language :: Python :: 3",
|
|
@@ -23,24 +22,27 @@ classifiers = [
|
|
|
23
22
|
"Programming Language :: Python :: 3.11",
|
|
24
23
|
"Programming Language :: Python :: 3.12",
|
|
25
24
|
"Programming Language :: Python :: 3.13",
|
|
26
|
-
"Topic :: Scientific/Engineering :: Information Analysis",
|
|
27
25
|
"Topic :: Software Development :: Testing",
|
|
28
|
-
"
|
|
26
|
+
"Environment :: Console",
|
|
27
|
+
"Topic :: Scientific/Engineering :: Information Analysis",
|
|
29
28
|
]
|
|
30
29
|
|
|
30
|
+
[project.urls]
|
|
31
|
+
Homepage = "https://github.com/calasdan-sketch/passgate"
|
|
32
|
+
Repository = "https://github.com/calasdan-sketch/passgate"
|
|
33
|
+
Issues = "https://github.com/calasdan-sketch/passgate/issues"
|
|
34
|
+
Changelog = "https://github.com/calasdan-sketch/passgate/blob/main/CHANGELOG.md"
|
|
35
|
+
|
|
31
36
|
[project.scripts]
|
|
32
37
|
passgate = "passgate.cli:main"
|
|
33
38
|
|
|
34
39
|
[tool.setuptools.packages.find]
|
|
35
40
|
where = ["src"]
|
|
36
41
|
|
|
37
|
-
[tool.setuptools.package-data]
|
|
38
|
-
passgate = ["py.typed"]
|
|
39
|
-
|
|
40
42
|
[tool.ruff]
|
|
41
|
-
extend-exclude = [".venv-sop", "build", "dist"]
|
|
42
43
|
target-version = "py39"
|
|
44
|
+
line-length = 100
|
|
43
45
|
|
|
44
46
|
[tool.ruff.lint]
|
|
45
|
-
select = ["E", "F", "I", "
|
|
46
|
-
ignore = ["E501"]
|
|
47
|
+
select = ["E", "F", "I", "W"]
|
|
48
|
+
ignore = ["E501"]
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"""passgate — statistical pass^N reliability gate for evals."""
|
|
2
|
+
|
|
3
|
+
from .gate import GateResult, Round, compare, evaluate_rounds
|
|
4
|
+
from .stats import (
|
|
5
|
+
fisher_exact_2x2,
|
|
6
|
+
mcnemar_exact,
|
|
7
|
+
min_trials,
|
|
8
|
+
two_proportion_z,
|
|
9
|
+
wilson_interval,
|
|
10
|
+
wilson_lower,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
__version__ = "0.2.2"
|
|
14
|
+
__all__ = [
|
|
15
|
+
"Round",
|
|
16
|
+
"GateResult",
|
|
17
|
+
"evaluate_rounds",
|
|
18
|
+
"compare",
|
|
19
|
+
"wilson_lower",
|
|
20
|
+
"wilson_interval",
|
|
21
|
+
"two_proportion_z",
|
|
22
|
+
"fisher_exact_2x2",
|
|
23
|
+
"min_trials",
|
|
24
|
+
"mcnemar_exact",
|
|
25
|
+
"__version__",
|
|
26
|
+
]
|