tiny-router 是一款轻量级的实验性多头路由分类器,适用于简短、领域无关的消息,并支持可选的交互上下文。它能预测四个独立信号,供下游系统或智能体用于更新处理、动作路由、内存策略和优先级排序。
relation_to_previous: new | follow_up | correction | confirmation | cancellation | closure
actionability: none | review | act
retention: ephemeral | useful | remember
urgency: low | medium | high模型在推理时独立输出这些头信息,此外还会输出经过校准的置信度和一个 overall_confidence。
适用场景:
不适用场景:
此检查点基于以下合成数据集拆分进行训练:
data/synthetic/train.jsonldata/synthetic/validation.jsonldata/synthetic/test.jsonl数据遵循结构化 JSONL 模式,包含:
current_textinteraction.previous_textinteraction.previous_actioninteraction.previous_outcomeinteraction.recency_secondslabels 下的四个标签头microsoft/deberta-v3-smallprevious_action 嵌入previous_outcome 嵌入log1p(recency_seconds) 的学习投影此检查点的训练参数:
batch_size = 32epochs = 20max_length = 128encoder_lr = 2e-5head_lr = 1e-4dropout = 0.1pooling_type = attentionuse_head_dependencies = true来自 artifacts/tiny-router/eval.json 的留出测试结果:
macro_average_f1 = 0.7848exact_match = 0.4570automation_safe_accuracy = 0.6230automation_safe_coverage = 0.5430ECE = 0.3440每头宏 F1:
relation_to_previous = 0.8415actionability = 0.7982retention = 0.7809urgency = 0.7187消融实验:
current_text_only = 0.7058current_plus_previous_text = 0.7478full_interaction = 0.7848解读:
{
"relation_to_previous": { "label": "correction", "confidence": 0.94 },
"actionability": { "label": "act", "confidence": 0.97 },
"retention": { "label": "useful", "confidence": 0.76 },
"urgency": { "label": "medium", "confidence": 0.81 },
"overall_confidence": 0.87
}此仓库使用自定义的检查点格式。请通过本项目加载它:
from tiny_router.io import load_checkpoint
from tiny_router.runtime import get_device
device = get_device(requested_device="cpu")
model, tokenizer, config = load_checkpoint("artifacts/tiny-router", device=device)或者使用以下命令运行推理:
uv run python predict.py \
--model-dir artifacts/tiny-router \
--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}}' \
--pretty