pranavkarthik10 commited on
Commit
e07ba76
·
verified ·
1 Parent(s): aff031e

coding-router v6: ONNX (int8+fp32) + PyTorch weights, tokenizer, calibration, eval results

Browse files
README.md ADDED
@@ -0,0 +1,234 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--
2
+ This file is the Hugging Face model card. When published to
3
+ huggingface.co/afterbuild/coding-router it becomes the repo's README.md
4
+ (HF renders the YAML frontmatter below as model metadata).
5
+ -->
6
+ ---
7
+ license: apache-2.0
8
+ language:
9
+ - en
10
+ library_name: onnxruntime
11
+ pipeline_tag: text-classification
12
+ base_model: microsoft/deberta-v3-small
13
+ tags:
14
+ - coding-agent
15
+ - routing
16
+ - multi-head-classifier
17
+ - onnx
18
+ - deberta-v3
19
+ - model-router
20
+ metrics:
21
+ - accuracy
22
+ - f1
23
+ ---
24
+
25
+ # coding-router (spawn-router)
26
+
27
+ A compact, fast, **local-first** multi-head classifier for **coding-agent task
28
+ routing**. Given a task prompt at kickoff, it predicts stable task properties; a
29
+ downstream policy/config then maps those properties to a model, provider, and
30
+ execution behavior. The classifier predicts the *ontology*; your config owns the
31
+ *orchestration*.
32
+
33
+ This is the model component of **spawn** — see
34
+ [`Afterbuild/coding-router`](https://github.com/Afterbuild/coding-router) for the
35
+ training code and [`spawn-gateway`](https://github.com/Afterbuild) for the local
36
+ gateway that wraps Claude Code / Codex and routes with these weights.
37
+
38
+ - **Backbone:** `microsoft/deberta-v3-small` (multi-head)
39
+ - **Checkpoint:** v6 (final text-only training run)
40
+ - **Inference:** torch-free ONNX path, ~7 ms/prompt CPU, ~140 MB deps
41
+ - **Input:** text only (`current_text`), 256-token max
42
+
43
+ ## What it predicts
44
+
45
+ ```
46
+ complexity: easy | medium | hard
47
+ + sub-dims (0..1 regression): reasoning_depth, scope_breadth,
48
+ domain_knowledge, spec_completeness (inverted: low spec = harder)
49
+ task_type: bugfix | feature | refactor | test | design | docs | migration | exploration
50
+ risk: low | medium | high
51
+ + sub-dims (0..1 regression): security_surface, data_sensitivity,
52
+ production_exposure, reversal_cost
53
+ + per-head confidences (post-hoc temperature-scaled) and overall_confidence
54
+ ```
55
+
56
+ - `complexity` → capability tier (small / mid / large model)
57
+ - `task_type` → model specialty (e.g. design → Claude, systems → GPT, docs → small)
58
+ - `risk` → tier bumper (easy + high-risk still routes capable) and confirmation gate
59
+
60
+ > **Note on the ONNX export:** the published `.onnx` graphs emit the **three
61
+ > classification heads only** (`complexity`, `task_type`, `risk` logits). The
62
+ > regression sub-dimensions exist in the PyTorch model (`model.pt`) but are not in
63
+ > the ONNX outputs yet — load `model.pt` with the training code if you need them.
64
+
65
+ Routing is **kickoff-only**: classify once at task start and lock the model for
66
+ the whole task cycle (no per-turn re-routing → no context thrash).
67
+
68
+ ## Files
69
+
70
+ | File | What |
71
+ |---|---|
72
+ | `tiny_router.int8.onnx` | int8-quantized graph — **recommended for serving** (~164 MB) |
73
+ | `tiny_router.onnx` | fp32 graph (~540 MB) |
74
+ | `model.pt` | PyTorch state dict — for fine-tuning / sub-dim outputs (~565 MB) |
75
+ | `spm.model` + `*tokenizer*.json` | SentencePiece (DeBERTa-v2/spm) tokenizer |
76
+ | `model_config.json` | architecture + label maps |
77
+ | `temperature_scaling.json` | per-head calibration temperatures |
78
+ | `*_metrics.json`, `battery_results.json` | evaluation results |
79
+
80
+ ## Usage (ONNX, torch-free)
81
+
82
+ Needs only `onnxruntime`, `numpy`, and `sentencepiece` — no torch, no transformers.
83
+
84
+ ```python
85
+ import numpy as np
86
+ import onnxruntime as ort
87
+ import sentencepiece as spm
88
+
89
+ MODEL_DIR = "." # dir containing tiny_router.int8.onnx, spm.model, *.json
90
+ MAX_LEN = 256
91
+ LABELS = {
92
+ "complexity_logits": ["easy", "medium", "hard"],
93
+ "task_type_logits": ["bugfix", "feature", "refactor", "test",
94
+ "design", "docs", "migration", "exploration"],
95
+ "risk_logits": ["low", "medium", "high"],
96
+ }
97
+ TEMPS = { # from temperature_scaling.json; output name -> head temperature
98
+ "complexity_logits": 0.891251,
99
+ "task_type_logits": 0.707946,
100
+ "risk_logits": 1.059254,
101
+ }
102
+
103
+ sp = spm.SentencePieceProcessor(model_file=f"{MODEL_DIR}/spm.model")
104
+ sess = ort.InferenceSession(f"{MODEL_DIR}/tiny_router.int8.onnx",
105
+ providers=["CPUExecutionProvider"])
106
+
107
+ def classify(text: str) -> dict:
108
+ # DeBERTa-v3 spm tokenizer: [CLS]=1 + pieces (truncated) + [SEP]=2
109
+ pieces = sp.encode(f"Current: {text}", out_type=int)[: MAX_LEN - 2]
110
+ ids = [1, *pieces, 2]
111
+ feeds = { # structured inputs are text-only sentinels (no interaction context)
112
+ "input_ids": np.array([ids], dtype=np.int64),
113
+ "attention_mask": np.ones((1, len(ids)), dtype=np.int64),
114
+ "previous_action_id": np.array([0], dtype=np.int64), # "none"
115
+ "previous_outcome_id": np.array([4], dtype=np.int64), # "unknown"
116
+ "log_recency_seconds": np.array([0.0], dtype=np.float32),
117
+ "has_interaction": np.array([0], dtype=np.int64),
118
+ "has_recency": np.array([0], dtype=np.int64),
119
+ }
120
+ out = {o.name: v for o, v in zip(sess.get_outputs(), sess.run(None, feeds))}
121
+ result = {}
122
+ for name, labels in LABELS.items():
123
+ logits = out[name][0] / TEMPS[name]
124
+ p = np.exp(logits - logits.max()); p /= p.sum()
125
+ i = int(p.argmax())
126
+ result[name.replace("_logits", "")] = {
127
+ "label": labels[i], "confidence": round(float(p[i]), 4),
128
+ }
129
+ return result
130
+
131
+ print(classify("refactor JWT key rotation in prod"))
132
+ # {'complexity': {'label': 'medium', ...}, 'task_type': {'label': 'refactor', ...},
133
+ # 'risk': {'label': 'medium', ...}}
134
+ ```
135
+
136
+ ## Evaluation
137
+
138
+ Two complementary measures (eval scripts in
139
+ [`Afterbuild/coding-router`](https://github.com/Afterbuild/coding-router):
140
+ `scripts/eval_battery.py`, `eval.py`):
141
+
142
+ **Locked kickoff battery** (83 hand-labeled probes, never in training — the
143
+ canonical cross-version benchmark):
144
+
145
+ | Metric | v6 |
146
+ |---|---|
147
+ | Unified kickoff score | **69.5%** |
148
+ | Exact match (all 3 heads) | 37.4% |
149
+ | complexity | 65.1% |
150
+ | task_type | 78.3% |
151
+ | risk | 65.1% |
152
+
153
+ **Held-out test split** (n=174, mirrors the training distribution):
154
+
155
+ | Head | Accuracy | Macro F1 |
156
+ |---|---|---|
157
+ | complexity | 67.8% | 68.1% |
158
+ | task_type | 86.8% | 87.2% |
159
+ | risk | 66.7% | 62.2% |
160
+ | **Exact match** | **39.1%** | — |
161
+
162
+ Sub-dimension regression R² (PyTorch model): reasoning_depth 0.51, scope_breadth
163
+ 0.47, spec_completeness 0.34, domain_knowledge 0.30; reversal_cost 0.55,
164
+ production_exposure 0.51, data_sensitivity 0.25, security_surface 0.19.
165
+
166
+ Calibration: per-head temperature scaling fit on validation. ECE on the held-out
167
+ split is ~0.37 at the 0.8 automation threshold — **confidence is not yet
168
+ well-calibrated for aggressive automation**; gate on it conservatively.
169
+
170
+ ## Intended use
171
+
172
+ - Pick a capability tier / provider for a coding task **at kickoff**, before the
173
+ first expensive agent call.
174
+ - Drive a confirmation gate for high-blast-radius work (risk/security/prod).
175
+ - Spread work across tiers to reduce rate-limit pressure.
176
+
177
+ **Out of scope:** per-turn routing; non-coding prompts; high-stakes autonomous
178
+ action without a human gate; languages other than English (trained on English).
179
+
180
+ ## Limitations
181
+
182
+ - **Cold-start ceiling.** Effort/blast-radius isn't fully derivable from prompt
183
+ text — `complexity=medium` and `risk=high` are the weakest bands, especially on
184
+ short imperatives. Production signals (overrides, retries, session duration) are
185
+ the intended path past this; this checkpoint predates that loop.
186
+ - **Synthetic-label ceiling.** Much training data is LLM-labeled; expect a
187
+ ~75–80% ceiling per head until real disagreement signals are mixed in.
188
+ - **ONNX omits sub-dims** (see note above).
189
+
190
+ ## Training
191
+
192
+ - Backbone `microsoft/deberta-v3-small`, attention pooling, head dependencies,
193
+ 3 softmax heads + 8 regression heads; `current_text_only` feature mode.
194
+ - 5 epochs, batch 16, encoder LR 2e-5, head LR 1e-4, weight decay 0.01, warmup
195
+ 0.1, seed 13; post-hoc per-head temperature scaling on validation.
196
+ - Data: v6 mixed set (train 1141 / val 174 / test 174) — a mix of synthetic
197
+ coding-task prompts and real coding-agent kickoff prompts. **The merged
198
+ training set is not distributed** (it embeds third-party trace text and
199
+ personal usage traces); the synthetic seed data and the full data pipeline
200
+ are in the code repo. See "Training data provenance" below.
201
+
202
+ ## Training data provenance
203
+
204
+ Disclosed in full so downstream users can do their own diligence:
205
+
206
+ - **Synthetic coding-task prompts** (majority of the mix) — written by Claude
207
+ sub-agents and hand-labeled; included in the code repo.
208
+ - **SWE-bench problem statements** — used only as Claude-paraphrased
209
+ short-imperative prompts (no code, patches, or full issue text). The
210
+ SWE-bench benchmark code is MIT; the aggregated issue text is owned by its
211
+ authors and the HF dataset card carries no license tag.
212
+ - **Public coding-agent trace datasets** (`badlogicgames/pi-mono`,
213
+ `armand0e/gpt-5.5-agent`, `lewtun/ml-intern-sessions`) — kickoff prompts
214
+ extracted and labeled. These carry `license: other` or no license; their raw
215
+ text is **not redistributed** here.
216
+ - **The author's own local agent traces** — first-task prompts only; not
217
+ redistributed.
218
+ - Labels and paraphrases were produced with **Anthropic Claude**; per
219
+ Anthropic's Commercial Terms, outputs are customer-owned. No other
220
+ provider's models were used for generation or labeling.
221
+
222
+ The model is a non-generative classifier (three softmax heads over 256-token
223
+ inputs); it emits logits, not text, and cannot reproduce training data.
224
+
225
+ ## Credits & provenance
226
+
227
+ - Scaffolding began as a fork of **[tiny-router](https://github.com/UdaraJay/tiny-router)
228
+ by Udara Jay** (MIT); the ontology, data, heads, and serving path were rebuilt
229
+ for coding-agent routing.
230
+ - Backbone: **DeBERTa-v3** (He et al.; `microsoft/deberta-v3-small`, MIT).
231
+ - Related prior art: Vercel v0 Auto and NVIDIA's
232
+ prompt-task-and-complexity-classifier.
233
+ - **License: Apache-2.0** (weights), with the training-data provenance
234
+ disclosed above; the training/serving code repo is MIT.
added_tokens.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {
2
+ "[MASK]": 128000
3
+ }
battery_results.json ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "battery_size": 83,
3
+ "unified_score": 0.6948,
4
+ "exact_match": 0.3735,
5
+ "per_head": {
6
+ "complexity": 0.6506,
7
+ "task_type": 0.7831,
8
+ "risk": 0.6506
9
+ },
10
+ "per_tier": {
11
+ "complexity": {
12
+ "easy": "16/24",
13
+ "hard": "15/20",
14
+ "medium": "23/39"
15
+ },
16
+ "task_type": {
17
+ "bugfix": "11/14",
18
+ "design": "1/3",
19
+ "docs": "2/5",
20
+ "exploration": "3/4",
21
+ "feature": "28/29",
22
+ "migration": "7/11",
23
+ "refactor": "10/14",
24
+ "test": "3/3"
25
+ },
26
+ "risk": {
27
+ "high": "14/28",
28
+ "low": "26/31",
29
+ "medium": "14/24"
30
+ }
31
+ },
32
+ "per_length_exact_match": {
33
+ "short": "23/63",
34
+ "medium": "5/12",
35
+ "long": "3/8"
36
+ }
37
+ }
metrics.json ADDED
@@ -0,0 +1,323 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "per_head": {
3
+ "complexity": {
4
+ "accuracy": 0.6954,
5
+ "macro_f1": 0.7011,
6
+ "per_label": {
7
+ "easy": {
8
+ "precision": 0.7258,
9
+ "recall": 0.75,
10
+ "f1": 0.7377,
11
+ "support": 60
12
+ },
13
+ "medium": {
14
+ "precision": 0.6232,
15
+ "recall": 0.6418,
16
+ "f1": 0.6324,
17
+ "support": 67
18
+ },
19
+ "hard": {
20
+ "precision": 0.7674,
21
+ "recall": 0.7021,
22
+ "f1": 0.7333,
23
+ "support": 47
24
+ }
25
+ },
26
+ "confusion_matrix": [
27
+ [
28
+ 45,
29
+ 15,
30
+ 0
31
+ ],
32
+ [
33
+ 14,
34
+ 43,
35
+ 10
36
+ ],
37
+ [
38
+ 3,
39
+ 11,
40
+ 33
41
+ ]
42
+ ]
43
+ },
44
+ "task_type": {
45
+ "accuracy": 0.9138,
46
+ "macro_f1": 0.9093,
47
+ "per_label": {
48
+ "bugfix": {
49
+ "precision": 0.9565,
50
+ "recall": 0.88,
51
+ "f1": 0.9167,
52
+ "support": 25
53
+ },
54
+ "feature": {
55
+ "precision": 0.9302,
56
+ "recall": 0.9524,
57
+ "f1": 0.9412,
58
+ "support": 42
59
+ },
60
+ "refactor": {
61
+ "precision": 0.8696,
62
+ "recall": 0.9524,
63
+ "f1": 0.9091,
64
+ "support": 21
65
+ },
66
+ "test": {
67
+ "precision": 1.0,
68
+ "recall": 0.8571,
69
+ "f1": 0.9231,
70
+ "support": 14
71
+ },
72
+ "design": {
73
+ "precision": 0.9375,
74
+ "recall": 0.9375,
75
+ "f1": 0.9375,
76
+ "support": 16
77
+ },
78
+ "docs": {
79
+ "precision": 0.9333,
80
+ "recall": 0.9333,
81
+ "f1": 0.9333,
82
+ "support": 15
83
+ },
84
+ "migration": {
85
+ "precision": 0.9167,
86
+ "recall": 1.0,
87
+ "f1": 0.9565,
88
+ "support": 22
89
+ },
90
+ "exploration": {
91
+ "precision": 0.7778,
92
+ "recall": 0.7368,
93
+ "f1": 0.7568,
94
+ "support": 19
95
+ }
96
+ },
97
+ "confusion_matrix": [
98
+ [
99
+ 22,
100
+ 1,
101
+ 0,
102
+ 0,
103
+ 0,
104
+ 0,
105
+ 0,
106
+ 2
107
+ ],
108
+ [
109
+ 0,
110
+ 40,
111
+ 1,
112
+ 0,
113
+ 0,
114
+ 0,
115
+ 0,
116
+ 1
117
+ ],
118
+ [
119
+ 0,
120
+ 0,
121
+ 20,
122
+ 0,
123
+ 0,
124
+ 0,
125
+ 1,
126
+ 0
127
+ ],
128
+ [
129
+ 1,
130
+ 1,
131
+ 0,
132
+ 12,
133
+ 0,
134
+ 0,
135
+ 0,
136
+ 0
137
+ ],
138
+ [
139
+ 0,
140
+ 0,
141
+ 1,
142
+ 0,
143
+ 15,
144
+ 0,
145
+ 0,
146
+ 0
147
+ ],
148
+ [
149
+ 0,
150
+ 0,
151
+ 0,
152
+ 0,
153
+ 0,
154
+ 14,
155
+ 0,
156
+ 1
157
+ ],
158
+ [
159
+ 0,
160
+ 0,
161
+ 0,
162
+ 0,
163
+ 0,
164
+ 0,
165
+ 22,
166
+ 0
167
+ ],
168
+ [
169
+ 0,
170
+ 1,
171
+ 1,
172
+ 0,
173
+ 1,
174
+ 1,
175
+ 1,
176
+ 14
177
+ ]
178
+ ]
179
+ },
180
+ "risk": {
181
+ "accuracy": 0.6954,
182
+ "macro_f1": 0.6554,
183
+ "per_label": {
184
+ "low": {
185
+ "precision": 0.8,
186
+ "recall": 0.8276,
187
+ "f1": 0.8136,
188
+ "support": 87
189
+ },
190
+ "medium": {
191
+ "precision": 0.5333,
192
+ "recall": 0.6038,
193
+ "f1": 0.5664,
194
+ "support": 53
195
+ },
196
+ "high": {
197
+ "precision": 0.7083,
198
+ "recall": 0.5,
199
+ "f1": 0.5862,
200
+ "support": 34
201
+ }
202
+ },
203
+ "confusion_matrix": [
204
+ [
205
+ 72,
206
+ 13,
207
+ 2
208
+ ],
209
+ [
210
+ 16,
211
+ 32,
212
+ 5
213
+ ],
214
+ [
215
+ 2,
216
+ 15,
217
+ 17
218
+ ]
219
+ ]
220
+ }
221
+ },
222
+ "overall": {
223
+ "exact_match": 0.4655,
224
+ "macro_average_f1": 0.7553,
225
+ "automation_safe_accuracy": 0.6935,
226
+ "automation_safe_coverage": 0.3563,
227
+ "confidence_threshold": 0.8,
228
+ "confidence_calibration": {
229
+ "ece": 0.303072,
230
+ "bins": [
231
+ {
232
+ "range": [
233
+ 0.5,
234
+ 0.6
235
+ ],
236
+ "count": 5,
237
+ "avg_confidence": 0.586,
238
+ "accuracy": 0.0
239
+ },
240
+ {
241
+ "range": [
242
+ 0.6,
243
+ 0.7
244
+ ],
245
+ "count": 48,
246
+ "avg_confidence": 0.6575,
247
+ "accuracy": 0.2917
248
+ },
249
+ {
250
+ "range": [
251
+ 0.7,
252
+ 0.8
253
+ ],
254
+ "count": 59,
255
+ "avg_confidence": 0.7473,
256
+ "accuracy": 0.4068
257
+ },
258
+ {
259
+ "range": [
260
+ 0.8,
261
+ 0.9
262
+ ],
263
+ "count": 33,
264
+ "avg_confidence": 0.8512,
265
+ "accuracy": 0.5758
266
+ },
267
+ {
268
+ "range": [
269
+ 0.9,
270
+ 1.0
271
+ ],
272
+ "count": 29,
273
+ "avg_confidence": 0.9333,
274
+ "accuracy": 0.8276
275
+ }
276
+ ]
277
+ }
278
+ },
279
+ "temperature_scaling": {
280
+ "method": "per_head_temperature_scaling",
281
+ "per_head": {
282
+ "complexity": 0.891251,
283
+ "task_type": 0.707946,
284
+ "risk": 1.059254
285
+ }
286
+ },
287
+ "complexity_subdims": {
288
+ "reasoning_depth": {
289
+ "mae": 0.1069,
290
+ "r2": 0.5888
291
+ },
292
+ "spec_completeness": {
293
+ "mae": 0.1033,
294
+ "r2": 0.3667
295
+ },
296
+ "scope_breadth": {
297
+ "mae": 0.1076,
298
+ "r2": 0.5044
299
+ },
300
+ "domain_knowledge": {
301
+ "mae": 0.1036,
302
+ "r2": 0.4405
303
+ }
304
+ },
305
+ "risk_subdims": {
306
+ "security_surface": {
307
+ "mae": 0.1517,
308
+ "r2": 0.1937
309
+ },
310
+ "data_sensitivity": {
311
+ "mae": 0.1184,
312
+ "r2": 0.3094
313
+ },
314
+ "production_exposure": {
315
+ "mae": 0.1182,
316
+ "r2": 0.6323
317
+ },
318
+ "reversal_cost": {
319
+ "mae": 0.1045,
320
+ "r2": 0.6316
321
+ }
322
+ }
323
+ }
model.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:168ffa72cd2ec515f227d519ce7761a03ef3cb551dffda552ea0de9beb21c5d6
3
+ size 565346323
model_config.json ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "encoder_name": "microsoft/deberta-v3-small",
3
+ "dropout": 0.1,
4
+ "action_vocab": [
5
+ "none",
6
+ "create",
7
+ "update",
8
+ "send",
9
+ "store",
10
+ "route",
11
+ "schedule",
12
+ "dismissed",
13
+ "clarify",
14
+ "search",
15
+ "notify",
16
+ "cancel",
17
+ "complete",
18
+ "other"
19
+ ],
20
+ "outcome_vocab": [
21
+ "success",
22
+ "pending",
23
+ "failed",
24
+ "cancelled",
25
+ "unknown"
26
+ ],
27
+ "label_maps": {
28
+ "complexity": [
29
+ "easy",
30
+ "medium",
31
+ "hard"
32
+ ],
33
+ "task_type": [
34
+ "bugfix",
35
+ "feature",
36
+ "refactor",
37
+ "test",
38
+ "design",
39
+ "docs",
40
+ "migration",
41
+ "exploration"
42
+ ],
43
+ "risk": [
44
+ "low",
45
+ "medium",
46
+ "high"
47
+ ]
48
+ },
49
+ "structured_hidden_dim": 32,
50
+ "recency_embed_dim": 8,
51
+ "pooling_type": "attention",
52
+ "use_head_dependencies": true,
53
+ "dependency_hidden_dim": 32,
54
+ "feature_mode": "current_text_only",
55
+ "max_length": 256,
56
+ "recency_max": 3600
57
+ }
onnx_metadata.json ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model_file": "tiny_router.onnx",
3
+ "feature_mode": "current_text_only",
4
+ "heads": [
5
+ "complexity",
6
+ "task_type",
7
+ "risk"
8
+ ],
9
+ "max_length": 256,
10
+ "label_maps": {
11
+ "complexity": [
12
+ "easy",
13
+ "medium",
14
+ "hard"
15
+ ],
16
+ "task_type": [
17
+ "bugfix",
18
+ "feature",
19
+ "refactor",
20
+ "test",
21
+ "design",
22
+ "docs",
23
+ "migration",
24
+ "exploration"
25
+ ],
26
+ "risk": [
27
+ "low",
28
+ "medium",
29
+ "high"
30
+ ]
31
+ },
32
+ "temperature_scaling": {
33
+ "complexity": 0.891251,
34
+ "task_type": 0.707946,
35
+ "risk": 1.059254
36
+ }
37
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "[CLS]",
3
+ "cls_token": "[CLS]",
4
+ "eos_token": "[SEP]",
5
+ "mask_token": "[MASK]",
6
+ "pad_token": "[PAD]",
7
+ "sep_token": "[SEP]",
8
+ "unk_token": {
9
+ "content": "[UNK]",
10
+ "lstrip": false,
11
+ "normalized": true,
12
+ "rstrip": false,
13
+ "single_word": false
14
+ }
15
+ }
spm.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c679fbf93643d19aab7ee10c0b99e460bdbc02fedf34b92b05af343b4af586fd
3
+ size 2464616
temperature_scaling.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "method": "per_head_temperature_scaling",
3
+ "source_split": "validation",
4
+ "per_head": {
5
+ "complexity": 0.891251,
6
+ "task_type": 0.707946,
7
+ "risk": 1.059254
8
+ }
9
+ }
test_metrics.json ADDED
@@ -0,0 +1,323 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "per_head": {
3
+ "complexity": {
4
+ "accuracy": 0.6782,
5
+ "macro_f1": 0.6806,
6
+ "per_label": {
7
+ "easy": {
8
+ "precision": 0.5758,
9
+ "recall": 0.8636,
10
+ "f1": 0.6909,
11
+ "support": 44
12
+ },
13
+ "medium": {
14
+ "precision": 0.7941,
15
+ "recall": 0.5745,
16
+ "f1": 0.6667,
17
+ "support": 94
18
+ },
19
+ "hard": {
20
+ "precision": 0.65,
21
+ "recall": 0.7222,
22
+ "f1": 0.6842,
23
+ "support": 36
24
+ }
25
+ },
26
+ "confusion_matrix": [
27
+ [
28
+ 38,
29
+ 6,
30
+ 0
31
+ ],
32
+ [
33
+ 26,
34
+ 54,
35
+ 14
36
+ ],
37
+ [
38
+ 2,
39
+ 8,
40
+ 26
41
+ ]
42
+ ]
43
+ },
44
+ "task_type": {
45
+ "accuracy": 0.8678,
46
+ "macro_f1": 0.8718,
47
+ "per_label": {
48
+ "bugfix": {
49
+ "precision": 0.875,
50
+ "recall": 0.84,
51
+ "f1": 0.8571,
52
+ "support": 25
53
+ },
54
+ "feature": {
55
+ "precision": 0.875,
56
+ "recall": 0.8333,
57
+ "f1": 0.8537,
58
+ "support": 42
59
+ },
60
+ "refactor": {
61
+ "precision": 0.84,
62
+ "recall": 1.0,
63
+ "f1": 0.913,
64
+ "support": 21
65
+ },
66
+ "test": {
67
+ "precision": 1.0,
68
+ "recall": 0.8571,
69
+ "f1": 0.9231,
70
+ "support": 14
71
+ },
72
+ "design": {
73
+ "precision": 0.8667,
74
+ "recall": 0.8125,
75
+ "f1": 0.8387,
76
+ "support": 16
77
+ },
78
+ "docs": {
79
+ "precision": 0.9286,
80
+ "recall": 0.8667,
81
+ "f1": 0.8966,
82
+ "support": 15
83
+ },
84
+ "migration": {
85
+ "precision": 0.9524,
86
+ "recall": 0.9091,
87
+ "f1": 0.9302,
88
+ "support": 22
89
+ },
90
+ "exploration": {
91
+ "precision": 0.6957,
92
+ "recall": 0.8421,
93
+ "f1": 0.7619,
94
+ "support": 19
95
+ }
96
+ },
97
+ "confusion_matrix": [
98
+ [
99
+ 21,
100
+ 0,
101
+ 2,
102
+ 0,
103
+ 0,
104
+ 0,
105
+ 1,
106
+ 1
107
+ ],
108
+ [
109
+ 0,
110
+ 35,
111
+ 1,
112
+ 0,
113
+ 1,
114
+ 0,
115
+ 0,
116
+ 5
117
+ ],
118
+ [
119
+ 0,
120
+ 0,
121
+ 21,
122
+ 0,
123
+ 0,
124
+ 0,
125
+ 0,
126
+ 0
127
+ ],
128
+ [
129
+ 1,
130
+ 1,
131
+ 0,
132
+ 12,
133
+ 0,
134
+ 0,
135
+ 0,
136
+ 0
137
+ ],
138
+ [
139
+ 0,
140
+ 1,
141
+ 1,
142
+ 0,
143
+ 13,
144
+ 1,
145
+ 0,
146
+ 0
147
+ ],
148
+ [
149
+ 0,
150
+ 1,
151
+ 0,
152
+ 0,
153
+ 0,
154
+ 13,
155
+ 0,
156
+ 1
157
+ ],
158
+ [
159
+ 1,
160
+ 1,
161
+ 0,
162
+ 0,
163
+ 0,
164
+ 0,
165
+ 20,
166
+ 0
167
+ ],
168
+ [
169
+ 1,
170
+ 1,
171
+ 0,
172
+ 0,
173
+ 1,
174
+ 0,
175
+ 0,
176
+ 16
177
+ ]
178
+ ]
179
+ },
180
+ "risk": {
181
+ "accuracy": 0.6667,
182
+ "macro_f1": 0.6217,
183
+ "per_label": {
184
+ "low": {
185
+ "precision": 0.8068,
186
+ "recall": 0.8353,
187
+ "f1": 0.8208,
188
+ "support": 85
189
+ },
190
+ "medium": {
191
+ "precision": 0.5102,
192
+ "recall": 0.4545,
193
+ "f1": 0.4808,
194
+ "support": 55
195
+ },
196
+ "high": {
197
+ "precision": 0.5405,
198
+ "recall": 0.5882,
199
+ "f1": 0.5634,
200
+ "support": 34
201
+ }
202
+ },
203
+ "confusion_matrix": [
204
+ [
205
+ 71,
206
+ 11,
207
+ 3
208
+ ],
209
+ [
210
+ 16,
211
+ 25,
212
+ 14
213
+ ],
214
+ [
215
+ 1,
216
+ 13,
217
+ 20
218
+ ]
219
+ ]
220
+ }
221
+ },
222
+ "overall": {
223
+ "exact_match": 0.3908,
224
+ "macro_average_f1": 0.7247,
225
+ "automation_safe_accuracy": 0.6167,
226
+ "automation_safe_coverage": 0.3448,
227
+ "confidence_threshold": 0.8,
228
+ "confidence_calibration": {
229
+ "ece": 0.369827,
230
+ "bins": [
231
+ {
232
+ "range": [
233
+ 0.5,
234
+ 0.6
235
+ ],
236
+ "count": 2,
237
+ "avg_confidence": 0.5761,
238
+ "accuracy": 0.0
239
+ },
240
+ {
241
+ "range": [
242
+ 0.6,
243
+ 0.7
244
+ ],
245
+ "count": 52,
246
+ "avg_confidence": 0.6519,
247
+ "accuracy": 0.3077
248
+ },
249
+ {
250
+ "range": [
251
+ 0.7,
252
+ 0.8
253
+ ],
254
+ "count": 60,
255
+ "avg_confidence": 0.7476,
256
+ "accuracy": 0.25
257
+ },
258
+ {
259
+ "range": [
260
+ 0.8,
261
+ 0.9
262
+ ],
263
+ "count": 41,
264
+ "avg_confidence": 0.8439,
265
+ "accuracy": 0.5366
266
+ },
267
+ {
268
+ "range": [
269
+ 0.9,
270
+ 1.0
271
+ ],
272
+ "count": 19,
273
+ "avg_confidence": 0.9391,
274
+ "accuracy": 0.7895
275
+ }
276
+ ]
277
+ }
278
+ },
279
+ "temperature_scaling": {
280
+ "method": "per_head_temperature_scaling",
281
+ "per_head": {
282
+ "complexity": 0.891251,
283
+ "task_type": 0.707946,
284
+ "risk": 1.059254
285
+ }
286
+ },
287
+ "complexity_subdims": {
288
+ "reasoning_depth": {
289
+ "mae": 0.1117,
290
+ "r2": 0.513
291
+ },
292
+ "spec_completeness": {
293
+ "mae": 0.1165,
294
+ "r2": 0.3356
295
+ },
296
+ "scope_breadth": {
297
+ "mae": 0.1082,
298
+ "r2": 0.4687
299
+ },
300
+ "domain_knowledge": {
301
+ "mae": 0.1199,
302
+ "r2": 0.3003
303
+ }
304
+ },
305
+ "risk_subdims": {
306
+ "security_surface": {
307
+ "mae": 0.1627,
308
+ "r2": 0.1921
309
+ },
310
+ "data_sensitivity": {
311
+ "mae": 0.1182,
312
+ "r2": 0.2477
313
+ },
314
+ "production_exposure": {
315
+ "mae": 0.1387,
316
+ "r2": 0.5113
317
+ },
318
+ "reversal_cost": {
319
+ "mae": 0.1103,
320
+ "r2": 0.5463
321
+ }
322
+ }
323
+ }
tiny_router.int8.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3d1b18a823744e68e89e0bd20cdd1a0b386442b3c08e7cce0a58992e593c13f2
3
+ size 171752203
tiny_router.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:31ebcb1174adf14fc0bc8609f6b8c5e92f2f40b5f5c96c3cffdb864d072c237b
3
+ size 565776017
tokenizer_config.json ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "[PAD]",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "1": {
12
+ "content": "[CLS]",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "2": {
20
+ "content": "[SEP]",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "3": {
28
+ "content": "[UNK]",
29
+ "lstrip": false,
30
+ "normalized": true,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "128000": {
36
+ "content": "[MASK]",
37
+ "lstrip": false,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ }
43
+ },
44
+ "bos_token": "[CLS]",
45
+ "clean_up_tokenization_spaces": false,
46
+ "cls_token": "[CLS]",
47
+ "do_lower_case": false,
48
+ "eos_token": "[SEP]",
49
+ "extra_special_tokens": {},
50
+ "mask_token": "[MASK]",
51
+ "model_max_length": 1000000000000000019884624838656,
52
+ "pad_token": "[PAD]",
53
+ "sep_token": "[SEP]",
54
+ "sp_model_kwargs": {},
55
+ "split_by_punct": false,
56
+ "tokenizer_class": "DebertaV2Tokenizer",
57
+ "unk_token": "[UNK]",
58
+ "vocab_type": "spm"
59
+ }