Download code/README.md from ai4he/trust-calibration-benchmark: direct link, hf CLI and curl.
- Browser
- Download file 5.51 kB
-
https://huggingface.co/datasets/ai4he/trust-calibration-benchmark/resolve/main/code/README.md
- Command line
-
hf download hf://datasets/ai4he/trust-calibration-benchmark/code/README.md
-
curl -L -o README.md https://huggingface.co/datasets/ai4he/trust-calibration-benchmark/resolve/main/code/README.md
TCB: Trust-Calibration Benchmark for Language-Model Workers
A small, auditable qualification test for language models used as components of multi-LLM
pipelines: 60 yes/no items across five domains (arithmetic, dates, geography, science,
language), each tagged easy or hard, with audited gold answers. A model answers
ANSWER: Yes|No and CONF: 0-100; we score accuracy, expected calibration error (ECE),
Brier, yes-rate, strict-format adherence, and availability, under an AUDITED administration
protocol (template-guarded parsing, answers only from tagged or bare final lines,
escalate-on-unparseable budgets, imputation flags).
Files
../data/tcb_benchmark.json— the 60 items (id, question, gold truth, tier), the prompt, and scoring definitions. v0.2.1 corrects one gold label (g7: Astana IS the capital of Kazakhstan), found by the independent audit of all 60 labels (../data/label_audit.json).../data/tcb_v03_trials.json— per-trial records, validated (adequate) protocol.../data/tcb_v03_trials_constrained.json— audited parser, fixed 512-token budget, no escalation (unparseable = unavailable).../data/tcb_v03_trials_naive.json— the naive-protocol records. The naive and constrained protocols consumed the SAME generations;derive_naive.pyre-derives every naive verdict offline from the constrained file's full raw responses using the historical parser (preserved verbatim inside it), with 0/540 mismatches against the original run.../data/tcb_repeat_results_naive.json— the naive-protocol resampling summary (the fabricated flip rates), alongside the validated-protocol repeat files.../data/tcb_harness_comparison.json— the three-protocol comparison summary.../data/tcb_repeat_{results,trials}.json— run-to-run variation (3 repeats, temp 0.7).../data/tcb_decouple{,_trials}.json— the confidence-elicitation manipulation.../data/tcb_criterion{,_trials}.json— the transfer study (SST-2 annotation + battery).analyze_panel.py— canonical analyzer: Table 1, figures, pairwise exact-McNemar + BH, from the shipped validated-protocol trials. Stdlib + matplotlib only.analyze_harness.py— the three-protocol harness-validity comparison (figure + JSON).analyze_decouple.py— Q3 re-analyzer: per-model per-variant accuracy/ECE/mean-confidence fromtcb_decouple_trials.json, checked againsttcb_decouple.json(stdlib only, no endpoint).analyze_criterion.py— Q4 re-analyzer: per-task accuracy/ECE, benchmark-to-downstream Spearman with exact permutation p-values, gate split, and gate-pass/fail calibration ratios with and without the leanstral-2603 outlier, from the shipped trials (stdlib only, no endpoint, no HuggingFace download); Spearman values checked againsttcb_criterion.json.analyze_classwise.py— camera-ready additions: per-model confusion matrices, per-class precision/recall/F1, macro-F1, balanced accuracy (writes../tables/tcb_classwise.tex, with pooled validated and naive rows), plus the confidence-resolution statistics (accuracy at stated confidence below 100 vs at 100, pooled AUROC of stated confidence for correctness) and the panel accuracy-vs-ECE Spearman correlation. Stdlib only.sensitivity.py— ECE with vs without confidence-imputed trials.tcb_parsing.py— the audited parser + escalation rule (single canonical implementation).run_tcb.py— evaluate a new model (one command; appends to the panel).run_panel_v03.py(in the project tree),run_repeat_v03.py,run_decouple.py,run_criterion.py— generation scripts (need an endpoint; all outputs ship).analyze_tcb.py— historical v0.2 analysis, kept for provenance; writes its table fragment totables/tcb_results_v02.texso it never overwrites the canonical 9-modeltcb_results.tex.
Reproduce the paper (no model queries needed)
python3 analyze_panel.py # Table 1, reliability + forest figures, pairwise tests (Q1)
python3 analyze_harness.py # the three-protocol comparison (Figure 3 + summary JSON, Q2)
python3 analyze_classwise.py # confusion matrices + per-class P/R/F1 table, confidence resolution
python3 analyze_decouple.py # the confidence-elicitation manipulation (Q3)
python3 analyze_criterion.py # the transfer study: Spearman + permutation p + gate split (Q4)
python3 sensitivity.py # imputation sensitivity
python3 derive_naive.py # re-derive the naive condition from shipped raws (prints 0/540)
Every table, figure, and statistical test in the paper is reproduced offline by the commands
above from the shipped per-trial data; only the run_*.py generators need a model endpoint.
Evaluate a new model / audit a new harness
python3 run_tcb.py <model-name> > my_trials.json
Append the rows to tcb_v03_trials.json and re-run analyze_panel.py; extra models are
detected automatically. To audit a different harness, run its parser over the shipped raw
responses and compare verdicts against tcb_v03_results.json.
Metrics
- Accuracy (Wilson 95% CI), over parseable responses; availability reported separately.
- ECE, 5 equal-width bins, bootstrap CIs; imputed-confidence trials count (a missing
confidence is an unusable signal), with stated-only sensitivity via
sensitivity.py. - Brier with bootstrap CIs; pairwise exact binomial McNemar, Benjamini-Hochberg corrected.
- Yes-rate vs the 0.60 gold base rate; strict-format adherence out of 60.