Duplicate from tgupj/tiny-router
Browse filesCo-authored-by: udara <tgupj@users.noreply.huggingface.co>
- .gitattributes +35 -0
- README.md +153 -0
- added_tokens.json +3 -0
- model.pt +3 -0
- model_config.json +60 -0
- onnx/added_tokens.json +3 -0
- onnx/model_config.json +60 -0
- onnx/onnx_metadata.json +42 -0
- onnx/special_tokens_map.json +51 -0
- onnx/spm.model +3 -0
- onnx/temperature_scaling.json +10 -0
- onnx/tiny_router.int8.onnx +3 -0
- onnx/tiny_router.onnx +3 -0
- onnx/tokenizer_config.json +59 -0
- special_tokens_map.json +15 -0
- spm.model +3 -0
- temperature_scaling.json +10 -0
- tokenizer_config.json +59 -0
- training_args.json +26 -0
.gitattributes
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
base_model:
|
| 4 |
+
- microsoft/deberta-v3-small
|
| 5 |
+
datasets:
|
| 6 |
+
- tgupj/tiny-router-data
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
# tiny-router
|
| 10 |
+
|
| 11 |
+
`tiny-router` is a compact experimental multi-head routing classifier for short, domain-neutral messages with optional interaction context. It predicts four separate signals that downstream systems or agents can use for update handling, action routing, memory policy, and prioritization.
|
| 12 |
+
|
| 13 |
+
## What it predicts
|
| 14 |
+
|
| 15 |
+
```
|
| 16 |
+
relation_to_previous: new | follow_up | correction | confirmation | cancellation | closure
|
| 17 |
+
actionability: none | review | act
|
| 18 |
+
retention: ephemeral | useful | remember
|
| 19 |
+
urgency: low | medium | high
|
| 20 |
+
```
|
| 21 |
+
|
| 22 |
+
The model emits these heads independently at inference time, plus calibrated confidences and an `overall_confidence`.
|
| 23 |
+
|
| 24 |
+
## Intended use
|
| 25 |
+
|
| 26 |
+
- Route short user messages into lightweight automation tiers.
|
| 27 |
+
- Detect whether a message updates prior context or starts something new.
|
| 28 |
+
- Decide whether action is required, review is safer, or no action is needed.
|
| 29 |
+
- Separate disposable details from short-term useful context and longer-term memory candidates.
|
| 30 |
+
- Prioritize items by urgency.
|
| 31 |
+
|
| 32 |
+
Good use cases:
|
| 33 |
+
|
| 34 |
+
- routing message-like requests in assistants or productivity tools
|
| 35 |
+
- triaging follow-ups, corrections, confirmations, and closures
|
| 36 |
+
- conservative automation with review fallback
|
| 37 |
+
|
| 38 |
+
Not good use cases:
|
| 39 |
+
|
| 40 |
+
- fully autonomous high-stakes action without guardrails
|
| 41 |
+
- domains that need expert reasoning or regulated decisions
|
| 42 |
+
|
| 43 |
+
## Training data
|
| 44 |
+
|
| 45 |
+
This checkpoint was trained on the synthetic dataset split in:
|
| 46 |
+
|
| 47 |
+
- `data/synthetic/train.jsonl`
|
| 48 |
+
- `data/synthetic/validation.jsonl`
|
| 49 |
+
- `data/synthetic/test.jsonl`
|
| 50 |
+
|
| 51 |
+
The data follows a structured JSONL schema with:
|
| 52 |
+
|
| 53 |
+
- `current_text`
|
| 54 |
+
- optional `interaction.previous_text`
|
| 55 |
+
- optional `interaction.previous_action`
|
| 56 |
+
- optional `interaction.previous_outcome`
|
| 57 |
+
- optional `interaction.recency_seconds`
|
| 58 |
+
- four label heads under `labels`
|
| 59 |
+
|
| 60 |
+
## Model details
|
| 61 |
+
|
| 62 |
+
- Base encoder: `microsoft/deberta-v3-small`
|
| 63 |
+
- Architecture: encoder-only multitask classifier
|
| 64 |
+
- Pooling: learned attention pooling
|
| 65 |
+
- Structured features:
|
| 66 |
+
- canonicalized `previous_action` embedding
|
| 67 |
+
- `previous_outcome` embedding
|
| 68 |
+
- learned projection of `log1p(recency_seconds)`
|
| 69 |
+
- Head structure:
|
| 70 |
+
- dependency-aware multitask heads
|
| 71 |
+
- later heads condition on learned summaries of earlier head predictions
|
| 72 |
+
- Calibration:
|
| 73 |
+
- post-hoc per-head temperature scaling fit on validation logits
|
| 74 |
+
|
| 75 |
+
This checkpoint was trained with:
|
| 76 |
+
|
| 77 |
+
- `batch_size = 32`
|
| 78 |
+
- `epochs = 20`
|
| 79 |
+
- `max_length = 128`
|
| 80 |
+
- `encoder_lr = 2e-5`
|
| 81 |
+
- `head_lr = 1e-4`
|
| 82 |
+
- `dropout = 0.1`
|
| 83 |
+
- `pooling_type = attention`
|
| 84 |
+
- `use_head_dependencies = true`
|
| 85 |
+
|
| 86 |
+
## Current results
|
| 87 |
+
|
| 88 |
+
Held-out test results from `artifacts/tiny-router/eval.json`:
|
| 89 |
+
|
| 90 |
+
- `macro_average_f1 = 0.7848`
|
| 91 |
+
- `exact_match = 0.4570`
|
| 92 |
+
- `automation_safe_accuracy = 0.6230`
|
| 93 |
+
- `automation_safe_coverage = 0.5430`
|
| 94 |
+
- `ECE = 0.3440`
|
| 95 |
+
|
| 96 |
+
Per-head macro F1:
|
| 97 |
+
|
| 98 |
+
- `relation_to_previous = 0.8415`
|
| 99 |
+
- `actionability = 0.7982`
|
| 100 |
+
- `retention = 0.7809`
|
| 101 |
+
- `urgency = 0.7187`
|
| 102 |
+
|
| 103 |
+
Ablations:
|
| 104 |
+
|
| 105 |
+
- `current_text_only = 0.7058`
|
| 106 |
+
- `current_plus_previous_text = 0.7478`
|
| 107 |
+
- `full_interaction = 0.7848`
|
| 108 |
+
|
| 109 |
+
Interpretation:
|
| 110 |
+
|
| 111 |
+
- interaction context helps
|
| 112 |
+
- actionability and urgency are usable but still imperfect
|
| 113 |
+
- high-confidence automation is possible only with conservative thresholds
|
| 114 |
+
|
| 115 |
+
## Limitations
|
| 116 |
+
|
| 117 |
+
- The benchmark is task-specific and internal to this repo.
|
| 118 |
+
- The dataset is synthetic, so distribution shift to real product traffic is likely.
|
| 119 |
+
- Label quality on subtle boundaries still matters a lot.
|
| 120 |
+
- Confidence calibration is improved but not strong enough to justify broad unattended automation.
|
| 121 |
+
|
| 122 |
+
## Example inference
|
| 123 |
+
|
| 124 |
+
```json
|
| 125 |
+
{
|
| 126 |
+
"relation_to_previous": { "label": "correction", "confidence": 0.94 },
|
| 127 |
+
"actionability": { "label": "act", "confidence": 0.97 },
|
| 128 |
+
"retention": { "label": "useful", "confidence": 0.76 },
|
| 129 |
+
"urgency": { "label": "medium", "confidence": 0.81 },
|
| 130 |
+
"overall_confidence": 0.87
|
| 131 |
+
}
|
| 132 |
+
```
|
| 133 |
+
|
| 134 |
+
## How to load
|
| 135 |
+
|
| 136 |
+
This repo uses a custom checkpoint format. Load it with this project:
|
| 137 |
+
|
| 138 |
+
```python
|
| 139 |
+
from tiny_router.io import load_checkpoint
|
| 140 |
+
from tiny_router.runtime import get_device
|
| 141 |
+
|
| 142 |
+
device = get_device(requested_device="cpu")
|
| 143 |
+
model, tokenizer, config = load_checkpoint("artifacts/tiny-router", device=device)
|
| 144 |
+
```
|
| 145 |
+
|
| 146 |
+
Or run inference with:
|
| 147 |
+
|
| 148 |
+
```bash
|
| 149 |
+
uv run python predict.py \
|
| 150 |
+
--model-dir artifacts/tiny-router \
|
| 151 |
+
--input-json '{"current_text":"Actually next Monday","interaction":{"previous_text":"Set a reminder for Friday","previous_action":"created_reminder","previous_outcome":"success","recency_seconds":45}}' \
|
| 152 |
+
--pretty
|
| 153 |
+
```
|
added_tokens.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"[MASK]": 128000
|
| 3 |
+
}
|
model.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:56812518ded8d9e6f0596b54ad9733722045eb037f2a9637454e9a282a6de975
|
| 3 |
+
size 565320515
|
model_config.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
"relation_to_previous": [
|
| 29 |
+
"new",
|
| 30 |
+
"follow_up",
|
| 31 |
+
"correction",
|
| 32 |
+
"confirmation",
|
| 33 |
+
"cancellation",
|
| 34 |
+
"closure"
|
| 35 |
+
],
|
| 36 |
+
"actionability": [
|
| 37 |
+
"none",
|
| 38 |
+
"review",
|
| 39 |
+
"act"
|
| 40 |
+
],
|
| 41 |
+
"retention": [
|
| 42 |
+
"ephemeral",
|
| 43 |
+
"useful",
|
| 44 |
+
"remember"
|
| 45 |
+
],
|
| 46 |
+
"urgency": [
|
| 47 |
+
"low",
|
| 48 |
+
"medium",
|
| 49 |
+
"high"
|
| 50 |
+
]
|
| 51 |
+
},
|
| 52 |
+
"structured_hidden_dim": 32,
|
| 53 |
+
"recency_embed_dim": 8,
|
| 54 |
+
"pooling_type": "attention",
|
| 55 |
+
"use_head_dependencies": true,
|
| 56 |
+
"dependency_hidden_dim": 32,
|
| 57 |
+
"feature_mode": "full_interaction",
|
| 58 |
+
"max_length": 128,
|
| 59 |
+
"recency_max": 3600
|
| 60 |
+
}
|
onnx/added_tokens.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"[MASK]": 128000
|
| 3 |
+
}
|
onnx/model_config.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
"relation_to_previous": [
|
| 29 |
+
"new",
|
| 30 |
+
"follow_up",
|
| 31 |
+
"correction",
|
| 32 |
+
"confirmation",
|
| 33 |
+
"cancellation",
|
| 34 |
+
"closure"
|
| 35 |
+
],
|
| 36 |
+
"actionability": [
|
| 37 |
+
"none",
|
| 38 |
+
"review",
|
| 39 |
+
"act"
|
| 40 |
+
],
|
| 41 |
+
"retention": [
|
| 42 |
+
"ephemeral",
|
| 43 |
+
"useful",
|
| 44 |
+
"remember"
|
| 45 |
+
],
|
| 46 |
+
"urgency": [
|
| 47 |
+
"low",
|
| 48 |
+
"medium",
|
| 49 |
+
"high"
|
| 50 |
+
]
|
| 51 |
+
},
|
| 52 |
+
"structured_hidden_dim": 32,
|
| 53 |
+
"recency_embed_dim": 8,
|
| 54 |
+
"pooling_type": "attention",
|
| 55 |
+
"use_head_dependencies": true,
|
| 56 |
+
"dependency_hidden_dim": 32,
|
| 57 |
+
"feature_mode": "full_interaction",
|
| 58 |
+
"max_length": 128,
|
| 59 |
+
"recency_max": 3600
|
| 60 |
+
}
|
onnx/onnx_metadata.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_file": "tiny_router.onnx",
|
| 3 |
+
"feature_mode": "full_interaction",
|
| 4 |
+
"heads": [
|
| 5 |
+
"relation_to_previous",
|
| 6 |
+
"actionability",
|
| 7 |
+
"retention",
|
| 8 |
+
"urgency"
|
| 9 |
+
],
|
| 10 |
+
"max_length": 128,
|
| 11 |
+
"label_maps": {
|
| 12 |
+
"relation_to_previous": [
|
| 13 |
+
"new",
|
| 14 |
+
"follow_up",
|
| 15 |
+
"correction",
|
| 16 |
+
"confirmation",
|
| 17 |
+
"cancellation",
|
| 18 |
+
"closure"
|
| 19 |
+
],
|
| 20 |
+
"actionability": [
|
| 21 |
+
"none",
|
| 22 |
+
"review",
|
| 23 |
+
"act"
|
| 24 |
+
],
|
| 25 |
+
"retention": [
|
| 26 |
+
"ephemeral",
|
| 27 |
+
"useful",
|
| 28 |
+
"remember"
|
| 29 |
+
],
|
| 30 |
+
"urgency": [
|
| 31 |
+
"low",
|
| 32 |
+
"medium",
|
| 33 |
+
"high"
|
| 34 |
+
]
|
| 35 |
+
},
|
| 36 |
+
"temperature_scaling": {
|
| 37 |
+
"relation_to_previous": 1.333521,
|
| 38 |
+
"actionability": 2.113489,
|
| 39 |
+
"retention": 2.238721,
|
| 40 |
+
"urgency": 2.660725
|
| 41 |
+
}
|
| 42 |
+
}
|
onnx/special_tokens_map.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": {
|
| 3 |
+
"content": "[CLS]",
|
| 4 |
+
"lstrip": false,
|
| 5 |
+
"normalized": false,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"single_word": false
|
| 8 |
+
},
|
| 9 |
+
"cls_token": {
|
| 10 |
+
"content": "[CLS]",
|
| 11 |
+
"lstrip": false,
|
| 12 |
+
"normalized": false,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
},
|
| 16 |
+
"eos_token": {
|
| 17 |
+
"content": "[SEP]",
|
| 18 |
+
"lstrip": false,
|
| 19 |
+
"normalized": false,
|
| 20 |
+
"rstrip": false,
|
| 21 |
+
"single_word": false
|
| 22 |
+
},
|
| 23 |
+
"mask_token": {
|
| 24 |
+
"content": "[MASK]",
|
| 25 |
+
"lstrip": false,
|
| 26 |
+
"normalized": false,
|
| 27 |
+
"rstrip": false,
|
| 28 |
+
"single_word": false
|
| 29 |
+
},
|
| 30 |
+
"pad_token": {
|
| 31 |
+
"content": "[PAD]",
|
| 32 |
+
"lstrip": false,
|
| 33 |
+
"normalized": false,
|
| 34 |
+
"rstrip": false,
|
| 35 |
+
"single_word": false
|
| 36 |
+
},
|
| 37 |
+
"sep_token": {
|
| 38 |
+
"content": "[SEP]",
|
| 39 |
+
"lstrip": false,
|
| 40 |
+
"normalized": false,
|
| 41 |
+
"rstrip": false,
|
| 42 |
+
"single_word": false
|
| 43 |
+
},
|
| 44 |
+
"unk_token": {
|
| 45 |
+
"content": "[UNK]",
|
| 46 |
+
"lstrip": false,
|
| 47 |
+
"normalized": true,
|
| 48 |
+
"rstrip": false,
|
| 49 |
+
"single_word": false
|
| 50 |
+
}
|
| 51 |
+
}
|
onnx/spm.model
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c679fbf93643d19aab7ee10c0b99e460bdbc02fedf34b92b05af343b4af586fd
|
| 3 |
+
size 2464616
|
onnx/temperature_scaling.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"method": "per_head_temperature_scaling",
|
| 3 |
+
"source_split": "validation",
|
| 4 |
+
"per_head": {
|
| 5 |
+
"relation_to_previous": 1.333521,
|
| 6 |
+
"actionability": 2.113489,
|
| 7 |
+
"retention": 2.238721,
|
| 8 |
+
"urgency": 2.660725
|
| 9 |
+
}
|
| 10 |
+
}
|
onnx/tiny_router.int8.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:772b84fa513ff63a8406ecfa031a9f61ff4ac69a4cfa259c91089a3b1133bf62
|
| 3 |
+
size 171758190
|
onnx/tiny_router.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:817549baf4f6c0531e3230124dcde592d1b8129b439d3a51fcc9f0f50c94f488
|
| 3 |
+
size 565782364
|
onnx/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 |
+
}
|
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,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"method": "per_head_temperature_scaling",
|
| 3 |
+
"source_split": "validation",
|
| 4 |
+
"per_head": {
|
| 5 |
+
"relation_to_previous": 1.333521,
|
| 6 |
+
"actionability": 2.113489,
|
| 7 |
+
"retention": 2.238721,
|
| 8 |
+
"urgency": 2.660725
|
| 9 |
+
}
|
| 10 |
+
}
|
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 |
+
}
|
training_args.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"train_file": "data/synthetic/train.jsonl",
|
| 3 |
+
"validation_file": "data/synthetic/validation.jsonl",
|
| 4 |
+
"test_file": null,
|
| 5 |
+
"output_dir": "artifacts/tiny-router",
|
| 6 |
+
"encoder_name": "microsoft/deberta-v3-small",
|
| 7 |
+
"device": "auto",
|
| 8 |
+
"feature_mode": "full_interaction",
|
| 9 |
+
"pooling_type": "attention",
|
| 10 |
+
"use_head_dependencies": true,
|
| 11 |
+
"dependency_hidden_dim": 32,
|
| 12 |
+
"max_length": 128,
|
| 13 |
+
"recency_max": 3600,
|
| 14 |
+
"batch_size": 32,
|
| 15 |
+
"epochs": 20,
|
| 16 |
+
"encoder_lr": 2e-05,
|
| 17 |
+
"head_lr": 0.0001,
|
| 18 |
+
"weight_decay": 0.01,
|
| 19 |
+
"warmup_ratio": 0.1,
|
| 20 |
+
"dropout": 0.1,
|
| 21 |
+
"seed": 13,
|
| 22 |
+
"patience": 2,
|
| 23 |
+
"mixed_precision": false,
|
| 24 |
+
"confidence_threshold": 0.8,
|
| 25 |
+
"head_loss_weights": "{}"
|
| 26 |
+
}
|