CharanSripadi commited on
Commit
9cf1ef4
·
verified ·
1 Parent(s): d57e6f0

v2.1: add per-task calibration, cascade margins and model card

Browse files
Files changed (2) hide show
  1. README.md +78 -0
  2. tinyjudge.json +59 -0
README.md ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: answerdotai/ModernBERT-base
4
+ pipeline_tag: text-classification
5
+ language: en
6
+ tags:
7
+ - llm-as-judge
8
+ - agent-evaluation
9
+ - ai-agents
10
+ - calibration
11
+ - modernbert
12
+ ---
13
+
14
+ # TinyJudge (v2.1)
15
+
16
+ A 150M-parameter fine-tuned judge for AI-agent behaviour: a fast, calibrated alternative to using
17
+ a large LLM as the judge for yes/no evaluation questions. Code, data pipeline and API:
18
+ [github.com/Charansripadi/tinyjudge](https://github.com/Charansripadi/tinyjudge).
19
+
20
+ It answers three questions about an agent's tool-using conversation:
21
+
22
+ | Task | Question |
23
+ |---|---|
24
+ | `policy` | Did the agent's actions follow the rules? |
25
+ | `tool_choice` | Is the proposed next tool call appropriate? |
26
+ | `grounded` | Is every fact in the agent's reply supported by its tool results? |
27
+
28
+ Outputs are **calibrated probabilities** (Platt scaling per task, fitted on held-out real agent
29
+ traffic), and each task has a **cascade margin**: inside it, the model is not confident enough and the
30
+ case should go to an LLM judge.
31
+
32
+ ## Results on real agent conversations
33
+
34
+ 208 judgements from real LLM-agent conversations (SkillMiner's support agent), never used for
35
+ training or for fitting calibration:
36
+
37
+ | Task | n | TinyJudge (calibrated) | LLM judge (Qwen 3.8 27B) | Cascade | Escalated to LLM |
38
+ |---|---|---|---|---|---|
39
+ | policy | 38 | **97.4%** | 71.1% | 92.1% | 16% |
40
+ | tool_choice | 85 | 88.2% | 87.1% | **92.9%** | 8% |
41
+ | grounded | 85 | 83.5% | 80.0% | **85.9%** | 71% |
42
+ | **all** | 208 | **88.0%** | 81.2% | **89.9%** | 35% |
43
+
44
+ Calibration on the same real test half (ECE = expected calibration error, lower is better):
45
+ grounded 0.201 → 0.101, tool_choice 0.138 → 0.073, policy 0.049 → 0.078.
46
+
47
+ ## Usage
48
+
49
+ ```python
50
+ from tinyjudge.predictor import Judge
51
+ from tinyjudge.tasks import Action, grounded_text
52
+
53
+ judge = Judge("CharanSripadi/tinyjudge", revision="v2.1")
54
+ text = grounded_text([Action("track_shipment", {"order_id": "A1002"},
55
+ {"status": "ok", "shipping_status": "shipped", "eta": "2 days"})],
56
+ "Your order A1002 has shipped and should arrive in 2 days.")
57
+ print(judge.judge([("grounded", text)]))
58
+ ```
59
+
60
+ Inputs must be formatted with `tinyjudge.tasks` (`policy_text`, `tool_choice_text`, `grounded_text`),
61
+ the same functions used in training. Or run the API: `docker run -p 7860:7860 ghcr.io/charansripadi/tinyjudge`.
62
+
63
+ ## Training
64
+
65
+ - Base: `answerdotai/ModernBERT-base`, sequence classification (no / yes), one model for all three tasks.
66
+ - Data v2: 2,806 training examples, generated from a simulated shop with rule-derived (exact) labels:
67
+ correct and mistaken agent trajectories, template and LLM-written replies, one-fact corruptions.
68
+ - 3 epochs, lr 3e-5, batch 16, fp16, max length 512. About 4 minutes on a free Colab T4.
69
+ - Tracked with MLflow; the dataset manifest's SHA-256 is logged with every run.
70
+
71
+ ## Limitations
72
+
73
+ - **One domain.** Trained on a demo online-shop support agent with six tools. Other domains need new data.
74
+ - **Small real test set.** 38 to 85 examples per task; differences of a few points are within noise.
75
+ - **Label assumptions.** Real `grounded` positives assume the agent's own reply matched its tool results;
76
+ at least one such reply contained an invented timeline, so some "errors" are the model being right.
77
+ - **LLM baseline.** Qwen 3.8 27B without reasoning. A stronger or reasoning model would likely do better on `policy`.
78
+ - **Cascade.** Escalating `policy` hurt accuracy here, because the LLM is worse than TinyJudge on that task.
tinyjudge.json ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "version": "v2.1",
3
+ "base_model": "answerdotai/ModernBERT-base",
4
+ "tasks": [
5
+ "policy",
6
+ "tool_choice",
7
+ "grounded"
8
+ ],
9
+ "max_length": 512,
10
+ "calibration": {
11
+ "policy": {
12
+ "a": 0.25333935537538305,
13
+ "b": 1.3174689792288223
14
+ },
15
+ "tool_choice": {
16
+ "a": 0.29362310916824735,
17
+ "b": 1.333555776269693
18
+ },
19
+ "grounded": {
20
+ "a": 0.2253498689511543,
21
+ "b": 1.5729497690903227
22
+ }
23
+ },
24
+ "calibration_method": "Platt scaling per task, fitted on data/v2 real_calib",
25
+ "margins": {
26
+ "policy": 0.34,
27
+ "tool_choice": 0.25,
28
+ "grounded": 0.38
29
+ },
30
+ "cascade_target_accuracy": 0.95,
31
+ "data_version": "v2",
32
+ "data_manifest_sha256": "2c25fd7e5cb31339235911054d4347ab23fdb14581e8bed69eb01b667e8113ec",
33
+ "real_test": {
34
+ "policy": {
35
+ "n": 38,
36
+ "tinyjudge": 0.974,
37
+ "llm": 0.711,
38
+ "cascade": 0.921,
39
+ "escalated": 6,
40
+ "llm_answered": 38
41
+ },
42
+ "tool_choice": {
43
+ "n": 85,
44
+ "tinyjudge": 0.882,
45
+ "llm": 0.871,
46
+ "cascade": 0.929,
47
+ "escalated": 7,
48
+ "llm_answered": 85
49
+ },
50
+ "grounded": {
51
+ "n": 85,
52
+ "tinyjudge": 0.835,
53
+ "llm": 0.8,
54
+ "cascade": 0.859,
55
+ "escalated": 60,
56
+ "llm_answered": 85
57
+ }
58
+ }
59
+ }