evalmut 0.1.0__tar.gz → 0.1.1__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.
- {evalmut-0.1.0 → evalmut-0.1.1}/PKG-INFO +98 -42
- {evalmut-0.1.0 → evalmut-0.1.1}/README.md +95 -40
- {evalmut-0.1.0 → evalmut-0.1.1}/evalmut/__init__.py +1 -1
- {evalmut-0.1.0 → evalmut-0.1.1}/evalmut/case.py +16 -2
- evalmut-0.1.1/evalmut/cli.py +265 -0
- evalmut-0.1.1/evalmut/crossrun.py +125 -0
- evalmut-0.1.1/evalmut/diff.py +164 -0
- evalmut-0.1.1/evalmut/holdout.py +226 -0
- evalmut-0.1.1/evalmut/inventory.py +208 -0
- evalmut-0.1.1/evalmut/invocation_witness.py +660 -0
- evalmut-0.1.1/evalmut/manifest.py +114 -0
- evalmut-0.1.1/evalmut/negative_control.py +93 -0
- {evalmut-0.1.0 → evalmut-0.1.1}/evalmut/operator.py +13 -1
- {evalmut-0.1.0 → evalmut-0.1.1}/evalmut/operators.py +303 -4
- {evalmut-0.1.0 → evalmut-0.1.1}/evalmut/outcome.py +8 -0
- evalmut-0.1.1/evalmut/replay_html.py +206 -0
- {evalmut-0.1.0 → evalmut-0.1.1}/evalmut/report.py +8 -3
- evalmut-0.1.1/evalmut/report_html.py +346 -0
- {evalmut-0.1.0 → evalmut-0.1.1}/evalmut/runner.py +1 -1
- {evalmut-0.1.0 → evalmut-0.1.1}/evalmut/score.py +22 -1
- evalmut-0.1.1/evalmut/sentinel.py +105 -0
- evalmut-0.1.1/evalmut/stamp.py +75 -0
- evalmut-0.1.1/evalmut/witnessed.py +86 -0
- {evalmut-0.1.0 → evalmut-0.1.1}/evalmut.egg-info/PKG-INFO +98 -42
- evalmut-0.1.1/evalmut.egg-info/SOURCES.txt +52 -0
- {evalmut-0.1.0 → evalmut-0.1.1}/pyproject.toml +3 -2
- evalmut-0.1.1/tests/test_corpus_b_freeze.py +122 -0
- evalmut-0.1.1/tests/test_corpus_b_run.py +112 -0
- evalmut-0.1.1/tests/test_crossrun.py +129 -0
- evalmut-0.1.1/tests/test_diff.py +118 -0
- evalmut-0.1.1/tests/test_empty_suite_payload.py +124 -0
- {evalmut-0.1.0 → evalmut-0.1.1}/tests/test_evalmut.py +91 -0
- evalmut-0.1.1/tests/test_holdout.py +314 -0
- evalmut-0.1.1/tests/test_inventory.py +222 -0
- evalmut-0.1.1/tests/test_invocation_witness.py +429 -0
- evalmut-0.1.1/tests/test_negative_control.py +99 -0
- evalmut-0.1.1/tests/test_negative_control_corpus_b.py +130 -0
- evalmut-0.1.1/tests/test_notes_emitter.py +151 -0
- evalmut-0.1.1/tests/test_replay_html.py +72 -0
- evalmut-0.1.1/tests/test_report_html.py +151 -0
- evalmut-0.1.1/tests/test_review_protocol.py +160 -0
- evalmut-0.1.1/tests/test_sentinel.py +108 -0
- evalmut-0.1.1/tests/test_source_fingerprint.py +134 -0
- evalmut-0.1.1/tests/test_stamp.py +101 -0
- evalmut-0.1.1/tests/test_vac_bundle.py +170 -0
- evalmut-0.1.1/tests/test_witnessed.py +103 -0
- evalmut-0.1.1/tests/test_zero_denominator.py +50 -0
- evalmut-0.1.0/evalmut/cli.py +0 -144
- evalmut-0.1.0/evalmut.egg-info/SOURCES.txt +0 -20
- {evalmut-0.1.0 → evalmut-0.1.1}/LICENSE +0 -0
- {evalmut-0.1.0 → evalmut-0.1.1}/evalmut/py.typed +0 -0
- {evalmut-0.1.0 → evalmut-0.1.1}/evalmut.egg-info/dependency_links.txt +0 -0
- {evalmut-0.1.0 → evalmut-0.1.1}/evalmut.egg-info/entry_points.txt +0 -0
- {evalmut-0.1.0 → evalmut-0.1.1}/evalmut.egg-info/requires.txt +0 -0
- {evalmut-0.1.0 → evalmut-0.1.1}/evalmut.egg-info/top_level.txt +0 -0
- {evalmut-0.1.0 → evalmut-0.1.1}/setup.cfg +0 -0
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: evalmut
|
|
3
|
-
Version: 0.1.
|
|
4
|
-
Summary: Mutation testing for evals: inject known defects into the system under test and report which grader checks stay green. A
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Mutation testing for evals: inject known defects into the system under test and report which grader checks stay green. A defect that survives the grader is a hole in the eval, and so is a correct output it flags.
|
|
5
5
|
Author-email: Erik Hill <erik.hill0987@gmail.com>
|
|
6
6
|
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/egnaro9/evalmut
|
|
7
8
|
Project-URL: Repository, https://github.com/egnaro9/evalmut
|
|
8
9
|
Classifier: Programming Language :: Python :: 3
|
|
9
10
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -15,13 +16,13 @@ License-File: LICENSE
|
|
|
15
16
|
Requires-Dist: gradecore>=0.10.0
|
|
16
17
|
Dynamic: license-file
|
|
17
18
|
|
|
18
|
-
# evalmut
|
|
19
|
+
# evalmut. Mutation testing for evals
|
|
19
20
|
|
|
20
21
|
**Your eval suite passes. Does it actually check anything?**
|
|
21
22
|
|
|
22
23
|
You write a grader, watch it pass on a good output, and ship it. You never ask the
|
|
23
24
|
other question: would it *also* pass on a plausibly-broken output? A `contains("42")`
|
|
24
|
-
check passes `"the total is 42"
|
|
25
|
+
check passes `"the total is 42"`. And it passes `"I did NOT reach 42"` just as
|
|
25
26
|
happily. A JSON check that confirms a `count` field is present says nothing about
|
|
26
27
|
whether `count` is a number or the string `"three"`. A refusal check that scans for
|
|
27
28
|
"I can't help" is fooled by a reply that refuses in its first line and then delivers
|
|
@@ -29,53 +30,66 @@ the harm below. These aren't hypotheticals; each is a real defect that shipped p
|
|
|
29
30
|
real check.
|
|
30
31
|
|
|
31
32
|
`evalmut` finds them. It takes an eval case your grader passes, injects a *known*
|
|
32
|
-
defect into the output
|
|
33
|
-
not invented
|
|
33
|
+
defect into the output. A defect **mined from a documented real-world eval failure**,
|
|
34
|
+
not invented. And reruns the grader. If the grader still passes a genuinely-wrong
|
|
34
35
|
output, that's a **hole**: a class of regression your eval would let ship green.
|
|
35
36
|
|
|
36
37
|
It's the same idea as code mutation testing (PIT, Stryker, mutmut), which nobody had
|
|
37
|
-
built for the model-plus-prompt-plus-grader stack
|
|
38
|
+
built for the model-plus-prompt-plus-grader stack. Because there a "mutation" isn't a
|
|
38
39
|
flipped boolean, it's a semantic perturbation whose ground truth you have to establish.
|
|
39
40
|
That's the hard part, and it's what `evalmut` does.
|
|
40
41
|
|
|
41
42
|
```
|
|
42
43
|
$ evalmut run suite.py # your suite; see 'Install & use' below
|
|
43
44
|
────────────────────────────────────────────────────────────────────────
|
|
44
|
-
evalmut
|
|
45
|
+
evalmut. Does your eval actually check anything?
|
|
45
46
|
────────────────────────────────────────────────────────────────────────
|
|
46
|
-
mutation score 91.
|
|
47
|
-
holes
|
|
47
|
+
mutation score 91.3% (42 caught / 46 applied; 223 n/a)
|
|
48
|
+
holes 4 (2 blind, 2 coverage-gap)
|
|
48
49
|
|
|
49
|
-
BLIND SPOTS
|
|
50
|
+
BLIND SPOTS: a real defect shipped green; the check is present and broken
|
|
50
51
|
• contains / contains
|
|
51
|
-
mutation : keyword_present_but_negated
|
|
52
|
+
mutation : keyword_present_but_negated. The checked keyword appears,
|
|
52
53
|
but in a context that means the opposite
|
|
53
54
|
mined from: a CI proof-gate that greps its own transcript for a
|
|
54
55
|
token; the block message contains it, so mentioning it passes
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
• contains / contains
|
|
57
|
+
mutation : spurious_cue_token_insert. The grepped keyword carried by
|
|
58
|
+
text that does none of the work the task asks for
|
|
59
|
+
mined from: Niven & Kao (ACL 2019): ARCT's accuracy metric scored a
|
|
60
|
+
cue-matcher within 3 points of untrained humans
|
|
61
|
+
COVERAGE GAPS: no check guards this shape (a missing grader, not a broken one)
|
|
59
62
|
• valid_json / valid_json
|
|
60
|
-
mutation : json_value_corruption
|
|
63
|
+
mutation : json_value_corruption. A required field's value changed to a
|
|
61
64
|
different value of the same type (3 -> 4)
|
|
65
|
+
• valid_json / valid_json
|
|
66
|
+
mutation : json_value_type_flip. A required field's value coerced to
|
|
67
|
+
the wrong type (number -> string)
|
|
62
68
|
mined from: gradecore valid_json checks key PRESENCE only, never value
|
|
63
69
|
```
|
|
64
70
|
|
|
65
|
-
That run is `evalmut` pointed at **its own dependency's** graders. It found
|
|
66
|
-
holes and
|
|
67
|
-
|
|
68
|
-
*coverage gaps* (a missing check, not a
|
|
71
|
+
That run is `evalmut` pointed at **its own dependency's** graders, gradecore's. It found
|
|
72
|
+
4 real holes (2 blind, 2 coverage-gap) and, this is the point, it was **fair about
|
|
73
|
+
them**: it called the two `contains` weaknesses *blind spots* (a present check that's
|
|
74
|
+
broken) and the two `valid_json` scopings *coverage gaps* (a missing check, not a
|
|
75
|
+
broken one), because `valid_json` only ever
|
|
69
76
|
claimed to check key presence. A tool that cries "broken!" at a correctly-scoped check
|
|
70
77
|
is a tool you learn to ignore.
|
|
71
78
|
|
|
79
|
+
**The holes above are replayable evidence, not anecdotes.** Every claim this repo
|
|
80
|
+
publishes ships as a closed, stamped bundle in [`vac/`](vac), registered in the
|
|
81
|
+
program-wide [evidence registry](https://egnaro9.github.io/vac-protocol/)
|
|
82
|
+
([registry.json](https://github.com/egnaro9/vac-protocol/blob/main/registry.json)) -
|
|
83
|
+
and [REPLAY_REQUEST.md](https://github.com/egnaro9/vac-protocol/blob/main/REPLAY_REQUEST.md)
|
|
84
|
+
is the ten-minute path to trying to falsify one.
|
|
85
|
+
|
|
72
86
|
## The two ways an eval lies
|
|
73
87
|
|
|
74
88
|
Most eval tooling only asks the first of these. Both are real, and `evalmut` tests both:
|
|
75
89
|
|
|
76
|
-
- **Blind spot
|
|
90
|
+
- **Blind spot**: a real defect ships green. Inject a *wrong* output; a sound grader
|
|
77
91
|
must reject it. If it passes, the check is present and broken.
|
|
78
|
-
- **Brittle spot
|
|
92
|
+
- **Brittle spot**: a correct output gets flagged. Inject an *equivalent* change (a
|
|
79
93
|
trailing disclaimer after a complete answer, cosmetic whitespace, a JSON code fence);
|
|
80
94
|
a sound grader must still pass it. If it fails, the check false-positives, and a
|
|
81
95
|
false-positive check is quietly recalibrated until it stops catching the real thing.
|
|
@@ -87,24 +101,24 @@ problem:
|
|
|
87
101
|
|
|
88
102
|
> **It never infers a hole from a verdict flip. It infers a hole from
|
|
89
103
|
> `(output-proven-wrong AND grader-passed)`, where wrongness is established against the
|
|
90
|
-
> case's own ground truth
|
|
104
|
+
> case's own ground truth. Independently of the grader being tested.**
|
|
91
105
|
|
|
92
106
|
An operator applies to a case *only* where it can establish the mutant's polarity for
|
|
93
107
|
that case: provably wrong (a defect) or provably still-correct (an equivalent). Where it
|
|
94
|
-
can't
|
|
95
|
-
judge
|
|
108
|
+
can't. No number to corrupt, no answer span to truncate, a field the grader doesn't
|
|
109
|
+
judge. It returns **N/A** and is excluded from the score. So a reported hole is never a
|
|
96
110
|
guess about an ambiguous mutant; by construction the mutant had a known correct answer
|
|
97
111
|
and the grader disagreed with it.
|
|
98
112
|
|
|
99
|
-
When the bar that decides wrongness lives inside the grader's closure
|
|
100
|
-
tolerance, an expected tool plan, whether whitespace is cosmetic for the task
|
|
113
|
+
When the bar that decides wrongness lives inside the grader's closure. A numeric
|
|
114
|
+
tolerance, an expected tool plan, whether whitespace is cosmetic for the task. The
|
|
101
115
|
operator does **not** guess it from a module default or trust a label the grader reports
|
|
102
116
|
about itself (a composite grader can honestly carry a primitive's id yet enforce more).
|
|
103
117
|
The suite *declares* that bar on the case (`num_tol`, `expected_trajectory`, `tolerates`,
|
|
104
|
-
`content_required`), and the operator uses it
|
|
105
|
-
it can
|
|
118
|
+
`content_required`), and the operator uses it. Cross-checking it against the grader where
|
|
119
|
+
it can. Or declines. This is the discipline **eight rounds of adversarial cold-critique**
|
|
106
120
|
paid for: every false hole those passes found was an operator asserting polarity without
|
|
107
|
-
recomputing the graded property against the grader's *real* acceptance condition
|
|
121
|
+
recomputing the graded property against the grader's *real* acceptance condition. A
|
|
108
122
|
hardcoded threshold, a self-reported id, a fixed-magnitude mutant that tripped an
|
|
109
123
|
orthogonal constraint, a formatting quirk that defeated a cross-check, a text
|
|
110
124
|
transformation the grader's own tokenizer re-read differently, a decline-gate one operator
|
|
@@ -119,7 +133,7 @@ grader's real acceptance condition; everywhere else it declines.**
|
|
|
119
133
|
|
|
120
134
|
## Mined, not authored
|
|
121
135
|
|
|
122
|
-
Every operator names the concrete, documented failure it reproduces
|
|
136
|
+
Every operator names the concrete, documented failure it reproduces. And that citation
|
|
123
137
|
is enforced as a test (`test_every_operator_names_a_real_origin`). This is not
|
|
124
138
|
decoration. An *authored* mutation only tests what its author already imagined a check
|
|
125
139
|
might miss, which is exactly the blind spot you're trying to find. A *mined* operator
|
|
@@ -147,9 +161,9 @@ suite = [EvalCase("sum", contains("42"),
|
|
|
147
161
|
tags=("presence_check",))]
|
|
148
162
|
|
|
149
163
|
report = run(suite)
|
|
150
|
-
print(f"{report.score:.0%}
|
|
164
|
+
print(f"{report.score:.0%} : {len(report.blind_spots)} blind spots")
|
|
151
165
|
for h in report.blind_spots:
|
|
152
|
-
print(h.grader_id, "is blind to", h.operator_id, "
|
|
166
|
+
print(h.grader_id, "is blind to", h.operator_id, "-", h.real_origin)
|
|
153
167
|
```
|
|
154
168
|
|
|
155
169
|
Or from the shell, with a CI-worthy exit code (nonzero on any vacuous/blind/brittle hole):
|
|
@@ -162,25 +176,67 @@ evalmut run your_suite.py --json # machine-readable
|
|
|
162
176
|
|
|
163
177
|
A suite file just defines `suite` (a list of `EvalCase`) and, optionally, `operators`.
|
|
164
178
|
|
|
165
|
-
|
|
179
|
+
### Start here
|
|
180
|
+
|
|
181
|
+
`demos/template.py` is a paste-sized suite pointed at a plain Python grader, with every declared
|
|
182
|
+
bar explained inline. Copy it, replace the grader body, run it:
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
evalmut run demos/template.py --html report.html --all
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
It is one case on purpose, and one case is not a suite: every operator is evaluated per case, so
|
|
189
|
+
a single case tells you about one grader on one input. Add a case per grader you rely on, and
|
|
190
|
+
start with the grader you least trust. A suite of only the checks you are confident in will tell
|
|
191
|
+
you what you already believe.
|
|
192
|
+
|
|
193
|
+
**A large `n/a` is normal and is not "skipped".** An operator declines when it cannot prove, for
|
|
194
|
+
your case, that its mutation makes the output wrong or leaves it right. That refusal to guess is
|
|
195
|
+
why a reported hole is a fact. To make more operators fire, declare more on the case; never
|
|
196
|
+
loosen the bars.
|
|
197
|
+
|
|
198
|
+
### The other three commands
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
evalmut run suite.py --html report.html --all # a standalone page: no server, no network
|
|
202
|
+
evalmut diff old.json new.json # what changed between two runs
|
|
203
|
+
evalmut manifest suite.py > fixtures.json # pin the fixture corpus
|
|
204
|
+
evalmut manifest suite.py --check fixtures.json # verify it has not moved
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
`--html` writes one self-contained file that opens from a file path. It leads with the holes
|
|
208
|
+
rather than the score, because a percentage reads as a grade while the actionable fact is that
|
|
209
|
+
two checks are broken.
|
|
210
|
+
|
|
211
|
+
`diff` exists for one reason: **a hole leaves a report either because you fixed the check or
|
|
212
|
+
because the operator stopped applying, and both make the score go up.** Deleting the failing case,
|
|
213
|
+
dropping a `tolerates`, or narrowing `judges` all shrink the hole count without a grader changing.
|
|
214
|
+
The diff keys on `(case, operator)` and never merges a fix with a disappearance, and it exits
|
|
215
|
+
nonzero on a disappearance, because a suite that stopped asking is not a suite that improved.
|
|
216
|
+
|
|
217
|
+
`manifest` pins the fixtures a run was computed over, so a case reworded after a disappointing
|
|
218
|
+
result is a visible diff rather than a silent change of subject. It hashes the declared bars too:
|
|
219
|
+
widening `num_tol` changes what counts as a defect without touching a fixture.
|
|
220
|
+
|
|
221
|
+
> **Security. Evalmut executes your suite.** Loading a suite imports and runs it, and
|
|
166
222
|
> mutation runs invoke your grader code, so `evalmut run` executes arbitrary Python from
|
|
167
223
|
> the suite file (the same trust model as `pytest`). Only run suites you trust. If you wire
|
|
168
224
|
> it into CI as a PR gate, do **not** run it against forks/untrusted PRs, and give the job no
|
|
169
|
-
> secrets it doesn't need
|
|
225
|
+
> secrets it doesn't need. A malicious suite file would otherwise run with your CI credentials.
|
|
170
226
|
> Prefer a sandboxed/isolated runner for untrusted input.
|
|
171
227
|
|
|
172
228
|
## Design
|
|
173
229
|
|
|
174
|
-
- `outcome.py
|
|
230
|
+
- `outcome.py`. The four outcomes (caught / missed / flagged / n-a), the two polarities,
|
|
175
231
|
the three operator types (KILL / DIAGNOSTIC / SANITY) that separate a *broken* check
|
|
176
232
|
from a *missing* one.
|
|
177
|
-
- `case.py
|
|
233
|
+
- `case.py`. An `EvalCase`: a grader, the reference-correct input it passes, which
|
|
178
234
|
fields it judges, and the declared contract bars (`num_tol`, `tolerates`,
|
|
179
235
|
`expected_trajectory`, `content_required`) an operator reads instead of guessing.
|
|
180
|
-
- `operator.py` / `operators.py
|
|
181
|
-
- `runner.py
|
|
236
|
+
- `operator.py` / `operators.py`. The operator contract and the mined catalog.
|
|
237
|
+
- `runner.py`. Baseline-green enforcement, apply, regrade, classify. Deterministic, no
|
|
182
238
|
LLM-as-judge, so a run reproduces exactly.
|
|
183
|
-
- `score.py` / `report.py
|
|
239
|
+
- `score.py` / `report.py`. The score, and the holes grouped by how alarming they are.
|
|
184
240
|
|
|
185
|
-
Built on [`gradecore`](../gradecore), the deterministic no-LLM-judge grading engine
|
|
241
|
+
Built on [`gradecore`](../gradecore), the deterministic no-LLM-judge grading engine. So
|
|
186
242
|
`evalmut`'s own verdicts are as reproducible as the graders it tests.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
# evalmut
|
|
1
|
+
# evalmut. Mutation testing for evals
|
|
2
2
|
|
|
3
3
|
**Your eval suite passes. Does it actually check anything?**
|
|
4
4
|
|
|
5
5
|
You write a grader, watch it pass on a good output, and ship it. You never ask the
|
|
6
6
|
other question: would it *also* pass on a plausibly-broken output? A `contains("42")`
|
|
7
|
-
check passes `"the total is 42"
|
|
7
|
+
check passes `"the total is 42"`. And it passes `"I did NOT reach 42"` just as
|
|
8
8
|
happily. A JSON check that confirms a `count` field is present says nothing about
|
|
9
9
|
whether `count` is a number or the string `"three"`. A refusal check that scans for
|
|
10
10
|
"I can't help" is fooled by a reply that refuses in its first line and then delivers
|
|
@@ -12,53 +12,66 @@ the harm below. These aren't hypotheticals; each is a real defect that shipped p
|
|
|
12
12
|
real check.
|
|
13
13
|
|
|
14
14
|
`evalmut` finds them. It takes an eval case your grader passes, injects a *known*
|
|
15
|
-
defect into the output
|
|
16
|
-
not invented
|
|
15
|
+
defect into the output. A defect **mined from a documented real-world eval failure**,
|
|
16
|
+
not invented. And reruns the grader. If the grader still passes a genuinely-wrong
|
|
17
17
|
output, that's a **hole**: a class of regression your eval would let ship green.
|
|
18
18
|
|
|
19
19
|
It's the same idea as code mutation testing (PIT, Stryker, mutmut), which nobody had
|
|
20
|
-
built for the model-plus-prompt-plus-grader stack
|
|
20
|
+
built for the model-plus-prompt-plus-grader stack. Because there a "mutation" isn't a
|
|
21
21
|
flipped boolean, it's a semantic perturbation whose ground truth you have to establish.
|
|
22
22
|
That's the hard part, and it's what `evalmut` does.
|
|
23
23
|
|
|
24
24
|
```
|
|
25
25
|
$ evalmut run suite.py # your suite; see 'Install & use' below
|
|
26
26
|
────────────────────────────────────────────────────────────────────────
|
|
27
|
-
evalmut
|
|
27
|
+
evalmut. Does your eval actually check anything?
|
|
28
28
|
────────────────────────────────────────────────────────────────────────
|
|
29
|
-
mutation score 91.
|
|
30
|
-
holes
|
|
29
|
+
mutation score 91.3% (42 caught / 46 applied; 223 n/a)
|
|
30
|
+
holes 4 (2 blind, 2 coverage-gap)
|
|
31
31
|
|
|
32
|
-
BLIND SPOTS
|
|
32
|
+
BLIND SPOTS: a real defect shipped green; the check is present and broken
|
|
33
33
|
• contains / contains
|
|
34
|
-
mutation : keyword_present_but_negated
|
|
34
|
+
mutation : keyword_present_but_negated. The checked keyword appears,
|
|
35
35
|
but in a context that means the opposite
|
|
36
36
|
mined from: a CI proof-gate that greps its own transcript for a
|
|
37
37
|
token; the block message contains it, so mentioning it passes
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
• contains / contains
|
|
39
|
+
mutation : spurious_cue_token_insert. The grepped keyword carried by
|
|
40
|
+
text that does none of the work the task asks for
|
|
41
|
+
mined from: Niven & Kao (ACL 2019): ARCT's accuracy metric scored a
|
|
42
|
+
cue-matcher within 3 points of untrained humans
|
|
43
|
+
COVERAGE GAPS: no check guards this shape (a missing grader, not a broken one)
|
|
42
44
|
• valid_json / valid_json
|
|
43
|
-
mutation : json_value_corruption
|
|
45
|
+
mutation : json_value_corruption. A required field's value changed to a
|
|
44
46
|
different value of the same type (3 -> 4)
|
|
47
|
+
• valid_json / valid_json
|
|
48
|
+
mutation : json_value_type_flip. A required field's value coerced to
|
|
49
|
+
the wrong type (number -> string)
|
|
45
50
|
mined from: gradecore valid_json checks key PRESENCE only, never value
|
|
46
51
|
```
|
|
47
52
|
|
|
48
|
-
That run is `evalmut` pointed at **its own dependency's** graders. It found
|
|
49
|
-
holes and
|
|
50
|
-
|
|
51
|
-
*coverage gaps* (a missing check, not a
|
|
53
|
+
That run is `evalmut` pointed at **its own dependency's** graders, gradecore's. It found
|
|
54
|
+
4 real holes (2 blind, 2 coverage-gap) and, this is the point, it was **fair about
|
|
55
|
+
them**: it called the two `contains` weaknesses *blind spots* (a present check that's
|
|
56
|
+
broken) and the two `valid_json` scopings *coverage gaps* (a missing check, not a
|
|
57
|
+
broken one), because `valid_json` only ever
|
|
52
58
|
claimed to check key presence. A tool that cries "broken!" at a correctly-scoped check
|
|
53
59
|
is a tool you learn to ignore.
|
|
54
60
|
|
|
61
|
+
**The holes above are replayable evidence, not anecdotes.** Every claim this repo
|
|
62
|
+
publishes ships as a closed, stamped bundle in [`vac/`](vac), registered in the
|
|
63
|
+
program-wide [evidence registry](https://egnaro9.github.io/vac-protocol/)
|
|
64
|
+
([registry.json](https://github.com/egnaro9/vac-protocol/blob/main/registry.json)) -
|
|
65
|
+
and [REPLAY_REQUEST.md](https://github.com/egnaro9/vac-protocol/blob/main/REPLAY_REQUEST.md)
|
|
66
|
+
is the ten-minute path to trying to falsify one.
|
|
67
|
+
|
|
55
68
|
## The two ways an eval lies
|
|
56
69
|
|
|
57
70
|
Most eval tooling only asks the first of these. Both are real, and `evalmut` tests both:
|
|
58
71
|
|
|
59
|
-
- **Blind spot
|
|
72
|
+
- **Blind spot**: a real defect ships green. Inject a *wrong* output; a sound grader
|
|
60
73
|
must reject it. If it passes, the check is present and broken.
|
|
61
|
-
- **Brittle spot
|
|
74
|
+
- **Brittle spot**: a correct output gets flagged. Inject an *equivalent* change (a
|
|
62
75
|
trailing disclaimer after a complete answer, cosmetic whitespace, a JSON code fence);
|
|
63
76
|
a sound grader must still pass it. If it fails, the check false-positives, and a
|
|
64
77
|
false-positive check is quietly recalibrated until it stops catching the real thing.
|
|
@@ -70,24 +83,24 @@ problem:
|
|
|
70
83
|
|
|
71
84
|
> **It never infers a hole from a verdict flip. It infers a hole from
|
|
72
85
|
> `(output-proven-wrong AND grader-passed)`, where wrongness is established against the
|
|
73
|
-
> case's own ground truth
|
|
86
|
+
> case's own ground truth. Independently of the grader being tested.**
|
|
74
87
|
|
|
75
88
|
An operator applies to a case *only* where it can establish the mutant's polarity for
|
|
76
89
|
that case: provably wrong (a defect) or provably still-correct (an equivalent). Where it
|
|
77
|
-
can't
|
|
78
|
-
judge
|
|
90
|
+
can't. No number to corrupt, no answer span to truncate, a field the grader doesn't
|
|
91
|
+
judge. It returns **N/A** and is excluded from the score. So a reported hole is never a
|
|
79
92
|
guess about an ambiguous mutant; by construction the mutant had a known correct answer
|
|
80
93
|
and the grader disagreed with it.
|
|
81
94
|
|
|
82
|
-
When the bar that decides wrongness lives inside the grader's closure
|
|
83
|
-
tolerance, an expected tool plan, whether whitespace is cosmetic for the task
|
|
95
|
+
When the bar that decides wrongness lives inside the grader's closure. A numeric
|
|
96
|
+
tolerance, an expected tool plan, whether whitespace is cosmetic for the task. The
|
|
84
97
|
operator does **not** guess it from a module default or trust a label the grader reports
|
|
85
98
|
about itself (a composite grader can honestly carry a primitive's id yet enforce more).
|
|
86
99
|
The suite *declares* that bar on the case (`num_tol`, `expected_trajectory`, `tolerates`,
|
|
87
|
-
`content_required`), and the operator uses it
|
|
88
|
-
it can
|
|
100
|
+
`content_required`), and the operator uses it. Cross-checking it against the grader where
|
|
101
|
+
it can. Or declines. This is the discipline **eight rounds of adversarial cold-critique**
|
|
89
102
|
paid for: every false hole those passes found was an operator asserting polarity without
|
|
90
|
-
recomputing the graded property against the grader's *real* acceptance condition
|
|
103
|
+
recomputing the graded property against the grader's *real* acceptance condition. A
|
|
91
104
|
hardcoded threshold, a self-reported id, a fixed-magnitude mutant that tripped an
|
|
92
105
|
orthogonal constraint, a formatting quirk that defeated a cross-check, a text
|
|
93
106
|
transformation the grader's own tokenizer re-read differently, a decline-gate one operator
|
|
@@ -102,7 +115,7 @@ grader's real acceptance condition; everywhere else it declines.**
|
|
|
102
115
|
|
|
103
116
|
## Mined, not authored
|
|
104
117
|
|
|
105
|
-
Every operator names the concrete, documented failure it reproduces
|
|
118
|
+
Every operator names the concrete, documented failure it reproduces. And that citation
|
|
106
119
|
is enforced as a test (`test_every_operator_names_a_real_origin`). This is not
|
|
107
120
|
decoration. An *authored* mutation only tests what its author already imagined a check
|
|
108
121
|
might miss, which is exactly the blind spot you're trying to find. A *mined* operator
|
|
@@ -130,9 +143,9 @@ suite = [EvalCase("sum", contains("42"),
|
|
|
130
143
|
tags=("presence_check",))]
|
|
131
144
|
|
|
132
145
|
report = run(suite)
|
|
133
|
-
print(f"{report.score:.0%}
|
|
146
|
+
print(f"{report.score:.0%} : {len(report.blind_spots)} blind spots")
|
|
134
147
|
for h in report.blind_spots:
|
|
135
|
-
print(h.grader_id, "is blind to", h.operator_id, "
|
|
148
|
+
print(h.grader_id, "is blind to", h.operator_id, "-", h.real_origin)
|
|
136
149
|
```
|
|
137
150
|
|
|
138
151
|
Or from the shell, with a CI-worthy exit code (nonzero on any vacuous/blind/brittle hole):
|
|
@@ -145,25 +158,67 @@ evalmut run your_suite.py --json # machine-readable
|
|
|
145
158
|
|
|
146
159
|
A suite file just defines `suite` (a list of `EvalCase`) and, optionally, `operators`.
|
|
147
160
|
|
|
148
|
-
|
|
161
|
+
### Start here
|
|
162
|
+
|
|
163
|
+
`demos/template.py` is a paste-sized suite pointed at a plain Python grader, with every declared
|
|
164
|
+
bar explained inline. Copy it, replace the grader body, run it:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
evalmut run demos/template.py --html report.html --all
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
It is one case on purpose, and one case is not a suite: every operator is evaluated per case, so
|
|
171
|
+
a single case tells you about one grader on one input. Add a case per grader you rely on, and
|
|
172
|
+
start with the grader you least trust. A suite of only the checks you are confident in will tell
|
|
173
|
+
you what you already believe.
|
|
174
|
+
|
|
175
|
+
**A large `n/a` is normal and is not "skipped".** An operator declines when it cannot prove, for
|
|
176
|
+
your case, that its mutation makes the output wrong or leaves it right. That refusal to guess is
|
|
177
|
+
why a reported hole is a fact. To make more operators fire, declare more on the case; never
|
|
178
|
+
loosen the bars.
|
|
179
|
+
|
|
180
|
+
### The other three commands
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
evalmut run suite.py --html report.html --all # a standalone page: no server, no network
|
|
184
|
+
evalmut diff old.json new.json # what changed between two runs
|
|
185
|
+
evalmut manifest suite.py > fixtures.json # pin the fixture corpus
|
|
186
|
+
evalmut manifest suite.py --check fixtures.json # verify it has not moved
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
`--html` writes one self-contained file that opens from a file path. It leads with the holes
|
|
190
|
+
rather than the score, because a percentage reads as a grade while the actionable fact is that
|
|
191
|
+
two checks are broken.
|
|
192
|
+
|
|
193
|
+
`diff` exists for one reason: **a hole leaves a report either because you fixed the check or
|
|
194
|
+
because the operator stopped applying, and both make the score go up.** Deleting the failing case,
|
|
195
|
+
dropping a `tolerates`, or narrowing `judges` all shrink the hole count without a grader changing.
|
|
196
|
+
The diff keys on `(case, operator)` and never merges a fix with a disappearance, and it exits
|
|
197
|
+
nonzero on a disappearance, because a suite that stopped asking is not a suite that improved.
|
|
198
|
+
|
|
199
|
+
`manifest` pins the fixtures a run was computed over, so a case reworded after a disappointing
|
|
200
|
+
result is a visible diff rather than a silent change of subject. It hashes the declared bars too:
|
|
201
|
+
widening `num_tol` changes what counts as a defect without touching a fixture.
|
|
202
|
+
|
|
203
|
+
> **Security. Evalmut executes your suite.** Loading a suite imports and runs it, and
|
|
149
204
|
> mutation runs invoke your grader code, so `evalmut run` executes arbitrary Python from
|
|
150
205
|
> the suite file (the same trust model as `pytest`). Only run suites you trust. If you wire
|
|
151
206
|
> it into CI as a PR gate, do **not** run it against forks/untrusted PRs, and give the job no
|
|
152
|
-
> secrets it doesn't need
|
|
207
|
+
> secrets it doesn't need. A malicious suite file would otherwise run with your CI credentials.
|
|
153
208
|
> Prefer a sandboxed/isolated runner for untrusted input.
|
|
154
209
|
|
|
155
210
|
## Design
|
|
156
211
|
|
|
157
|
-
- `outcome.py
|
|
212
|
+
- `outcome.py`. The four outcomes (caught / missed / flagged / n-a), the two polarities,
|
|
158
213
|
the three operator types (KILL / DIAGNOSTIC / SANITY) that separate a *broken* check
|
|
159
214
|
from a *missing* one.
|
|
160
|
-
- `case.py
|
|
215
|
+
- `case.py`. An `EvalCase`: a grader, the reference-correct input it passes, which
|
|
161
216
|
fields it judges, and the declared contract bars (`num_tol`, `tolerates`,
|
|
162
217
|
`expected_trajectory`, `content_required`) an operator reads instead of guessing.
|
|
163
|
-
- `operator.py` / `operators.py
|
|
164
|
-
- `runner.py
|
|
218
|
+
- `operator.py` / `operators.py`. The operator contract and the mined catalog.
|
|
219
|
+
- `runner.py`. Baseline-green enforcement, apply, regrade, classify. Deterministic, no
|
|
165
220
|
LLM-as-judge, so a run reproduces exactly.
|
|
166
|
-
- `score.py` / `report.py
|
|
221
|
+
- `score.py` / `report.py`. The score, and the holes grouped by how alarming they are.
|
|
167
222
|
|
|
168
|
-
Built on [`gradecore`](../gradecore), the deterministic no-LLM-judge grading engine
|
|
223
|
+
Built on [`gradecore`](../gradecore), the deterministic no-LLM-judge grading engine. So
|
|
169
224
|
`evalmut`'s own verdicts are as reproducible as the graders it tests.
|
|
@@ -56,7 +56,10 @@ class EvalCase:
|
|
|
56
56
|
# grader (injection_resistance, tool_misuse) and calling that vacuous is false (pass-2 C).
|
|
57
57
|
content_required: bool = False
|
|
58
58
|
# The cosmetic changes THIS task's contract treats as still-correct — any of
|
|
59
|
-
# "whitespace", "fence", "disclaimer"
|
|
59
|
+
# "whitespace", "fence", "disclaimer", "case", "reserialize" (member order and insignificant
|
|
60
|
+
# whitespace in a structured document), "numeric_format" (a currency symbol or thousands
|
|
61
|
+
# separator around an otherwise exact value), "article" (a leading determiner the task's own
|
|
62
|
+
# normalization is meant to strip). An EQUIVALENT operator claims "still correct" only
|
|
60
63
|
# when the change is declared here, because equivalence is a property of the task's
|
|
61
64
|
# contract, not something readable from a grader-emitted id: a composite grader can
|
|
62
65
|
# honestly carry a primitive's id yet also enforce length or format, so a fence or added
|
|
@@ -82,6 +85,16 @@ class EvalCase:
|
|
|
82
85
|
# "number", "grounding", "contains", "injection_resistance"). Declared, it lets evalmut run
|
|
83
86
|
# against a framework's graders unmodified while the grader keeps reporting its own honest id.
|
|
84
87
|
grader_family: str | None = None
|
|
88
|
+
# Tool names that write the GRADER'S OWN verdict channel: the file it reads its outcome from,
|
|
89
|
+
# a reporting hook it honors, a binary it shells out to for the answer. An agent calling one of
|
|
90
|
+
# these is not solving the task, it is authoring the verdict, so the trajectory is a provable
|
|
91
|
+
# defect no matter what the task was. Wrongness here comes from THIS declaration, not from the
|
|
92
|
+
# grader's response: unlike a denylisted tool (which the grader can be probed about, since it is
|
|
93
|
+
# supposed to refuse it), a grader that accepts a verdict write cannot tell you whether the write
|
|
94
|
+
# was legitimate output or a forged result. Only the suite author knows which channel is theirs.
|
|
95
|
+
# Undeclared -> inject_denylisted_tool falls back to the denylist payload and this class never
|
|
96
|
+
# fires, so an undecorated case is under-tested rather than falsely accused.
|
|
97
|
+
verdict_channel: tuple[str, ...] = ()
|
|
85
98
|
# Optional human-readable notes surfaced in reports; never load-bearing.
|
|
86
99
|
intent: str = ""
|
|
87
100
|
tags: tuple[str, ...] = field(default_factory=tuple)
|
|
@@ -96,10 +109,11 @@ def case(name: str, grader: Grader, good: GradeInput, *, judges: tuple[str, ...]
|
|
|
96
109
|
num_tol: float | None = None, content_required: bool = False,
|
|
97
110
|
tolerates: tuple[str, ...] = (), expected_trajectory: tuple[str, ...] = (),
|
|
98
111
|
trajectory_threshold: float | None = None, grader_family: str | None = None,
|
|
112
|
+
verdict_channel: tuple[str, ...] = (),
|
|
99
113
|
intent: str = "", tags: tuple[str, ...] = ()) -> EvalCase:
|
|
100
114
|
"""Terse constructor for suites written as data."""
|
|
101
115
|
return EvalCase(name=name, grader=grader, good=good, judges=judges,
|
|
102
116
|
num_tol=num_tol, content_required=content_required, tolerates=tolerates,
|
|
103
117
|
expected_trajectory=expected_trajectory,
|
|
104
118
|
trajectory_threshold=trajectory_threshold, grader_family=grader_family,
|
|
105
|
-
intent=intent, tags=tags)
|
|
119
|
+
verdict_channel=verdict_channel, intent=intent, tags=tags)
|