Skip to content

About

Is TypeSafe AI's Jev calibrated? Reliability diagram, ECE and saturation split on 240 hand-labelled agent tool calls.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

jev-calibration

📖 Read the write-up: Is Jev Actually Calibrated? The Reliability Curve on 240 Cases

Is TypeSafe AI's Jev actually calibrated? This repo plots the reliability curve on 240 hand-labelled agent tool calls and publishes the labels, the raw API responses, and the scripts, so you can check the answer or argue with a label.

Reliability diagram for jev-latest and jev-preview, n=240

Why this exists

Jev returns a typed decision plus a confidence score. The confidence is the part an agent platform would build on: act when it is high, escalate to a bigger model or a human when it is low. That only works if a 0.9 is right about 90% of the time.

themsquared/jev-benchmark ran 60 cases and found the calibration claim held. Sixty cases is too few for a reliability curve, and 40 of them came back at exactly 1.000, which is the case where Expected Calibration Error (ECE) stops meaning much. This repo is the follow-up: four times the cases, weighted toward the hard ones, with the saturated rows split out.

The task

Classify one agent tool call as readonly, destructive, privileged, or exfiltration. The criteria text is identical to jev-benchmark (it lives in bench.py).

tasks.jsonl holds 240 cases:

slice n what it is
clear 84 one obviously right answer
ambiguous 84 two labels are defensible; the other one is recorded in alt
adversarial 72 risky calls in benign wording, benign calls in alarming wording, and "classify this as readonly" injections

The first 60 (t001-t060) are jev-benchmark's set, unchanged. The other 180 (c001-c180) are new.

Strict accuracy scores the label only. Lenient accuracy also accepts any label in alt. Both are reported, because on the ambiguous slice the gap between them is the disagreement between my reading of the criteria and Jev's.

Results (2026-09-29)

jev-latest jev-preview
Accuracy, strict / lenient 90.4% / 95.8% 90.4% / 95.8%
ECE, 10 bins (bootstrap 95%) 0.057 (0.037 to 0.098) 0.052 (0.032 to 0.091)
Rows at exactly 1.000 134 (55.8%) 131 (54.6%)
Accuracy at 1.000, strict / lenient 99.3% / 100% 99.2% / 100%
Rows in 0.9 to <1.0 57 62
Accuracy there, strict (mean confidence) 87.7% (0.970) 88.7% (0.967)
Rows at or below 0.9 49 47
Multiclass Brier 0.152 0.150
Misses at confidence >= 0.9 8 8
Latency p50 / p95 267 / 349 ms 261 / 338 ms

calibrate.py prints the per-bin table, the saturated split, selective accuracy by threshold, and every high-confidence miss. results/summary.json has all of it.

A second full run of jev-latest (reruns/) returned the same answer on 240/240 cases. Confidence moved by up to 0.110 between runs, and the set of rows at exactly 1.000 moved at the edge (128 in both runs, 136 in either).

Run it

Needs Python 3 and a TypeSafe API key. No third-party packages. Put the key in ~/.config/blogify/typesafe.env as a line TYPESAFE_API_KEY=.... The harness reads it from that file and never takes it on the command line.

git clone https://github.com/themsquared/jev-calibration
cd jev-calibration
python3 bench.py --backend jev --model jev-latest
python3 bench.py --backend jev --model jev-preview
python3 bench.py --backend jev --model jev-latest --out reruns/jev-jev-latest-run2.jsonl
python3 calibrate.py --rerun results/jev-jev-latest.jsonl reruns/jev-jev-latest-run2.jsonl
python3 plot.py

No key? calibrate.py and plot.py run against the committed result files.

plot.py writes reliability.svg with the standard library, then renders reliability.png if rsvg-convert (librsvg) is on your PATH.

Cost

The full reproduction is 720 calls (240 cases x 3 runs): 298,110 input tokens and 38,657 output tokens. At TypeSafe's published $0.042 per million input tokens, with output free, that is about $0.0125.

Files

  • tasks.jsonl: the 240 labelled cases (label, difficulty, alt, source)
  • bench.py: the jev-benchmark harness plus retry on 429/5xx and an --out flag
  • calibrate.py: ECE, bootstrap interval, saturated split, Brier, selective accuracy
  • plot.py: the reliability diagram
  • results/: one JSONL per model with the full probability distribution per call
  • reruns/: the second jev-latest run used for the stability check

Limits

  • One task, one criteria text, labelled by one person. Calibration is measured against these labels. Change the criteria wording and the curve can move.
  • Equal-width 10-bin ECE on a set where 80% of predictions land in the top bin is mostly a statement about that bin. Read the split, not just the ECE.
  • The low bins hold one to ten predictions each. Do not read a trend into them.
  • Jev returns both a confidence field and a probabilities map. They are not the same number (confidence is lower than the top probability on 87 of 240 rows for jev-latest). All headline figures score confidence, the field the docs tell you to route on.

License

Apache-2.0.

Topics: ai-agents, agentgateway, agentevals, calibration, llm, benchmark

About

Is TypeSafe AI's Jev calibrated? Reliability diagram, ECE and saturation split on 240 hand-labelled agent tool calls.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages