Skip to content
brohum10Public

About

Offline AI evaluation release gates: paired bootstrap comparisons, hidden slice regressions, latency budgets, strict run alignment, and reproducible JSON reports.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

7 Commits

Folders and files

Repository files navigation

EvalDelta

A better average can hide a worse AI product. EvalDelta compares two scored AI evaluation runs, checks individual categories, and returns a machine-readable release decision.

Tests

Python 3.12+ · standard library only · offline · no API key

See the failure an average misses

python demo.py

The demo uses 100 hand-authored synthetic cases, not responses from an actual model:

Slice Cases Baseline score Candidate score Quality decision
Overall 100 0.70 0.80 Pass
Long context 20 0.70 0.40 Regression
Short context 80 0.70 0.90 Pass

The final decision is block, despite a 10-percentage-point overall improvement. These numbers illustrate the checker; they are not an AI accuracy benchmark. The demo runs in a temporary directory and leaves no dataset behind.

Watch a real-model integration

30-second decision-workbench recording

The companion SelectiveML project trains a linear baseline and a NumPy neural candidate on the same training rows, then compares their actual predictions on 275 identical clean test inputs per seed. All three fixed seeds are reported: the candidate has higher overall accuracy in every run, but one run is blocked because its digit-5 check is inconclusive. That means the configured non-regression requirement was not established—not proof that the candidate is worse. Identical-run controls pass. These are retrospective small-dataset results, not production performance, a new blind benchmark, or an LLM evaluation.

The final recording also shows a filterable error atlas, one changed prediction, review-threshold exploration, evidence exports and all seed outcomes. The confusion/reliability tables remain in the app but are omitted from this shorter cut. Captions, cuts and reading holds are added to the actual recording. The sandbox never changes the frozen policy or gate; its test-set what-ifs are not fresh validation. These companion features remain outside EvalDelta's small standard-library comparator.

With both repositories in sibling folders, install SelectiveML's NumPy dependency, then run this from EvalDelta:

python -m pip install -r ../selective-ml/requirements.txt
python ../selective-ml/release_lab.py --evaldelta evaldelta.py --output ../selective-ml/results/release-lab/new-run

The runner calls the actual comparator CLI and writes exported models, every prediction, input hashes, controls, JSON gate reports and a manifest. It exits 0 when analysis completes; add --enforce to return 1 if any planned seed blocks. Its checked-in protocol requires a checksum-verified comparator. The separate verify_gate.py integration exercises CLI 0 / 1 / 2 outcomes using the older noise-stress illustration. Recorded evidence and scope. EvalDelta itself remains standard-library-only and does not run model inference.

What it does

  • Matches baseline and candidate by case ID, not row order.
  • Rejects missing cases, changed case hashes, different scorers, and changed category labels.
  • Estimates paired score-difference intervals using seeded percentile bootstrap resampling.
  • Checks the overall population and every supplied tag slice independently.
  • Blocks on regressions, inconclusive intervals, insufficient samples, or candidate p95 latency over budget.
  • Reports the ten largest individual score drops for investigation.
  • Includes normalized content fingerprints and configuration in every JSON report.
  • Exits with a CI-friendly status: 0 pass, 1 block, 2 invalid comparison.

Architecture

baseline.jsonl ─┐
               ├─ strict validation ─ ID/hash/scorer alignment ─ paired deltas
candidate.jsonl┘                                                  │
                                      overall + tag slices ───────┤
                                                                  ▼
                                            bootstrap + latency checks
                                                                  │
                                                       JSON report + exit code

The scorer and inference system stay outside this program. This separation makes the comparator usable with a local model, a hosted API, retrieval experiments, or human ratings without giving it credentials or raw prompts. It does not run or judge an LLM itself.

Compare your own runs

Download this repository, open its folder, and use Python 3.12 or newer. Nothing needs to be installed with pip.

Produce one JSON object per line in each input file:

{"id":"case-001","case_hash":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","suite":"support-v1","scorer":"rubric-v2","run":"baseline-v1","tags":["long_context"],"score":0.7,"latency_ms":240}

That hash is a placeholder. In your exporter, hash a canonical representation of the case input and expected answer. The tool checks equality of supplied hashes but cannot verify the hidden case content. Use the same suite, scorer version, tags, and case hash for both runs. Only the run label, score, and latency should change. Include failed inferences with a score defined by your rubric rather than dropping them. Latency must be measured by your inference runner with consistent timing boundaries.

All eight fields are required; additional fields are rejected. Scores must be finite numbers between 0 and 1, with higher meaning better. Latency is a nonnegative finite millisecond value. Labels contain only ASCII letters, digits, _ . : / - and are at most 100 characters. Up to 8 distinct tags per case and 32 distinct tags per run are supported. Untagged cases still contribute to the overall result. Raw prompts, outputs, and secrets do not belong in these files.

python evaldelta.py baseline.jsonl candidate.jsonl \
  --margin 0.02 --min-cases 20 --samples 2000 \
  --seed 42 --max-p95-ms 1000 > report.json

Choose the score-loss margin and latency budget before looking at candidate results. In this example, a score loss of up to 0.02 is allowed. The margin is absolute score units, not relative percent. Every slice uses the same margin and minimum sample count.

Decision rules

For each group, compute candidate_score - baseline_score per case. Resample those paired differences, preserving pairing, and calculate a mean for each resample. The 2.5th and 97.5th percentiles form an approximate 95% interval:

Condition Quality status
Fewer than min_cases observations insufficient_data
Lower interval bound ≥ negative margin pass
Upper interval bound < negative margin regression
Otherwise inconclusive

A pass requires every group to pass quality and latency. Candidate latency p95 uses linear interpolation at (n-1)*0.95; it is a descriptive budget check, not a statistical latency comparison. An identical run can pass at a nonnegative margin. pass means the configured empirical checks passed, not proof that a model is safe or universally equivalent.

Reproducibility and scope

Row order and tag order do not change the result. Sorted case IDs, a global seed, and a slice-specific seed make repeated runs reproducible on the tested Python runtimes. Hashes cover normalized records, including measured scores, latencies, and run labels; they detect changes, but are not signatures or proof of trustworthy scoring.

Inputs are bounded to 8 MB and 5,000 cases per file. Bootstrap work is capped at 30 million resampled observations across all slices. Oversized work is rejected rather than silently sampling fewer cases. Time is approximately O(B × sum of slice sizes), plus percentile sorting; memory includes the input records and B bootstrap means for one slice at a time.

Tests

python -m unittest -v

The 34 tests cover hidden subgroup regressions, inconclusive and underpowered comparisons, latency boundaries, ID/hash/scorer mismatches, duplicate JSON keys, invalid scores, resource limits, deterministic ordering, known quantiles, bootstrap fixtures, and real CLI exit codes. GitHub Actions runs the suite and demo on Python 3.12 and 3.14.

Important limitations

  • The built-in example is synthetic. SelectiveML's Model Release Lab uses actual model-version predictions on clean inputs; its older walkthrough uses simulated corruption with unverified label preservation. Neither demonstrates production savings, serving performance, or live LLM quality.
  • Percentile bootstrap intervals are approximate and can be unreliable for small, skewed, or degenerate samples. Twenty cases is a configurable operational floor, not a power analysis.
  • Intervals are unadjusted per slice, not simultaneous confidence guarantees. Overlapping tags and repeated experiments complicate interpretation. This is a conservative workflow gate, not a formal family-wise statistical test.
  • Resampling assumes independent cases. Clustered conversations, repeated users, or multiple generations per prompt require an appropriate clustered/hierarchical method not implemented here.
  • One scalar score hides rubric dimensions. Run separate comparisons for genuinely different metrics. Scorer quality and representative evaluation design remain your responsibility.
  • There is no model adapter, dashboard, cloud integration, authentication, BCa correction, or automatic deployment. A release job must actually honor the process exit code.
  • Treat evaluator data as untrusted. Do not upload private production logs; .jsonl files are ignored by default.

Method reference: SciPy's bootstrap documentation explains paired resampling and percentile intervals, and discusses alternative interval methods. EvalDelta implements its own small standard-library version; it does not depend on SciPy.

License

MIT. See LICENSE.

About

Offline AI evaluation release gates: paired bootstrap comparisons, hidden slice regressions, latency budgets, strict run alignment, and reproducible JSON reports.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages