Confidence-Aware Annotation Toolkit
CAAT scores, calibrates, evaluates, and triages saved model predictions. Compare confidence signals, measure correctness probabilities, and choose which outputs to accept automatically or send for review. The analysis commands run on a CPU with Python 3.10 or later.
git clone https://github.com/Daveyuwang/caat.git
cd caat
python -m pip install .
caat evaluate examples/ticket_triage.csv --id-column ticket_id --prediction-column model_route --reference-column expected_route --score-column confidence --group-column inbox --threshold 0.75 --probability --output-dir replay/tickets
The example accepts 3 of 5 tickets and makes 1 error. CAAT writes metrics.json
with overall and per-group counts, AUROC, area under the risk–coverage curve
(AURC), and normalized AURC gain. It writes risk_coverage.csv with the
results at each distinct score threshold. A normalized gain of 0 matches
random ordering and 1 matches ordering all correct predictions first.
CSV input
Each row needs a unique id and a finite score. Larger scores indicate
greater confidence. Supply prediction and reference for exact label
matching, or use --correct-column NAME for a grader's 0/1 outcome. Map
different headers with the flags above. An optional group column gives
per-group metrics.
CAAT accepts every row with a score at or above --threshold. Use
--probability to report Brier score, ECE, ACE, and reliability bins for
probabilities of correctness.
The review commands print a short summary. Add --json for machine-readable
stdout or --output FILE to save the JSON report. The CLI and Python API
use the standard library. CSV input · Report fields
Use caat calibrate fit to save a temperature, Platt, isotonic, or histogram
map from labeled calibration rows. Use caat calibrate apply to add its
probabilities to a held-out CSV. Add --html report.html to evaluate,
audit, or policy for a self-contained report.
Calibration examples
Choose and check a cutoff in one command
caat policy examples/ifeval_graders.csv --score-column mean_token_logprob --correct-column strict_pass --check-column helm_strict_pass --risk-target 0.4 --plot replay/policy.svg
caat policy splits one labeled CSV into design, calibration, and held-out
rows. It selects a cutoff on the calibration rows and applies it unchanged
to the held-out rows. The example holds 541 saved IFEval responses graded by
Google's strict grader and by HELM. The command selects
-0.43964836263206303 under the Google grader. On the 217 held-out rows the
policy accepts 144 responses, with 33 errors (22.9%) under Google and 45
(31.2%) under HELM. Both meet the 40% target.
A --check-column grader is reported on held-out rows and takes no part in
selection. Pass it as a second --correct-column to require the target
under both graders. The cutoff then rises to -0.3327795407672605 and the
policy accepts 92 held-out responses, with 19 and 23 errors.
The summary reports AUROC for each grader on the calibration rows and says
when the score ranks no better than random. The split sorts IDs, shuffles
with --seed (default 42), and assigns about 20%, 40%, and 40% of the rows.
--rule and --failure-rate work as in caat select. Add --json for the
full report. The command returns 0 if the held-out rows meet the target
under every listed grader, 1 if no cutoff qualifies or a grader exceeds the
target, and 2 for invalid input.
Compare graders on the same outputs
Run a frozen threshold against separate grader exports. CAAT matches rows by ID and checks that each grader scored the same saved output.
caat audit examples/audit/predictions.csv --output-key-column output_key --grader-file reference=examples/audit/reference.csv --grader-file rubric=examples/audit/rubric.csv --threshold 0.75 --risk-target 0.4
The sample accepts three tickets. The reference grader counts one error,
and the rubric grader counts two. Use --json for the changed
decision, discordant IDs, and per-group counts. For each alternate grader,
overall_risk_change measures the shift on all outputs and
excess_risk_change subtracts that shift from the accepted-set shift.
Add --bootstrap 2000 --seed 42 for paired 95% intervals at the frozen
cutoff. The sample exits 1 because the rubric grader exceeds the 40%
risk target. A policy with zero accepted rows also exits 1 if you supply
a target. Invalid input returns 2.
For separate grader files, include id, output_sha256, and a 0/1
correct column in each export. The prediction file supplies the same
IDs and output hashes plus the score. Use --output-key-column if your
pipeline already records another output identity. If the results are
already aligned in one CSV, repeat --correct-column NAME for each grader.
The first grader is the reference for directional differences.
If a prediction CSV contains multiple runs for the same IDs, select one
with --prediction-filter COLUMN=VALUE.
Real routing example and CI setup
Select a threshold on calibration data
caat select examples/ifeval_strict.csv --score-column mean_token_logprob --correct-column strict_pass --thresholds -0.20 -0.35 -0.60 --risk-target 0.4 --rule empirical
The example selects -0.35, accepting 12 of 24 responses with four
errors on the calibration sample. Supply a fixed list with --thresholds
or use --design DESIGN.csv to derive candidates from score deciles on a
separate file. Repeat --correct-column to require the target under every
grader. The JSON includes per-candidate counts and selected_threshold.
The command returns 0 if it selects a cutoff, 1 if none qualifies, and 2
for invalid input.
For statistical risk control, use --rule ltt-bonferroni (default),
--rule ltt-holm, or --rule ltt-fixed-sequence. These rules assume
independent calibration rows from the target population and a candidate
grid fixed before calibration. Holm's rule tests candidates in order of
increasing p-value. Holm's step-down procedure
--failure-rate defaults to 0.05. Fixed-sequence testing proceeds from
the strictest threshold and stops at the first failure. The empirical rule
has no statistical guarantee. Apply the selected cutoff unchanged to
held-out data with caat evaluate or caat audit.
Score saved responses
caat features examples/token_scores.jsonl --output replay/token_scores.csv
The input supplies response text and token log probabilities. The CSV
contains one row per response, with scores you can use as --score-column
values. JSONL format and available scores
Use caat scores to compare candidate columns at matched coverage budgets
and pick a score on the design split before calibrating a threshold.
Score comparison guide
Use caat queue to order saved predictions for review under a row budget.
It can cap the number of rows per group and compare error yield with a
random queue. Queue guide ·
Course replay
CPU benchmarks
python scripts/replay_benchmarks.py
The command replays the bundled 24-response samples for IFEval, MMLU-Pro, and
TriviaQA and writes replay/benchmarks/summary.csv. The larger HELM comparison
evaluates sequence probability and perplexity rankings and tests empirical
threshold selection against Learn then Test.
Sources, results, and reproduction ·
WildBench and Omni-MATH grader replay
The local Qwen2.5-7B study compares token scores, self-reports, and sample agreement on TriviaQA and MMLU-Pro. It includes a CPU replay and measured collection costs from an RTX 5080. Qwen confidence benchmark
Development
python -m pip install -e .
python -m unittest discover -s tests
The tests include the bundled benchmark replay. CI runs them on Python 3.10 through 3.14 on Linux and on 3.10 and 3.14 on Windows, runs the README examples, and builds and installs the wheel.
Evaluation method and related work
caat plugins lists built-in and installed components. The optional
Transformers backend collects model outputs for later scoring and replay.
Plugin guide ·
Local model collection
Contributing · Roadmap · Changelog
License
MIT. See LICENSE.
Metadata
Release files for caat-annotation 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| caat_annotation-0.2.0.tar.gz | 55.8 kB | With provenance | Details for caat_annotation-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| caat_annotation-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for caat_annotation-0.2.0-py3-none-any.whl |
Total release size: 104.2 kB
Release files / caat_annotation-0.2.0.tar.gz
| Download URL | caat_annotation-0.2.0.tar.gz |
|---|---|
| Size | 55.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d42c66e83d88980e8856f3bc50dde234e07d1913c2067c42632b1c8684316dad
|
|
BLAKE2b-256 checksum How to use checksums |
725b0b16e3bea2724e788d491b6595d589eb26e5f9c6a0b06a21c378848f8124
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.
Transparency logRelease files / caat_annotation-0.2.0-py3-none-any.whl
| Download URL | caat_annotation-0.2.0-py3-none-any.whl |
|---|---|
| Size | 48.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5a1abfca8df71bc74723f9af0f8ab3f6e7cf53a1b7b90a3cc9a9a14dd861620a
|
|
BLAKE2b-256 checksum How to use checksums |
4f2e50da0aa1c6e2df14ffe4b2a25ab29a0793b02b0cf2044d37c7002eae308c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.
Transparency logSecurity for caat-annotation 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for caat_annotation-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.