加载中…
加载中…
Routes a short user message from a supply-chain / logistics chat agent to one of 12 intents, and to unknown
when the message does not look like any intent it was trained on.
0: ai_agent_performance1: appointment_manager2: chitchat3: customer_support4: document_processing5: knowledge_base6: orders7: other8: shipment_information.analytics9: shipment_information.disruptions10: shipment_information.realtime_query11: yard_managementLD-10234, PO-76540).sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2 (118M parameters, 50+ languages) with a 12-way classification head.| Data | macro-F1 | accuracy |
|---|---|---|
| 5-fold cross-validation, training folds | 1.000 | 1.000 |
| 5-fold cross-validation, validation folds (387 rows) | 0.859 ± 0.045 | 0.876 ± 0.043 |
| Test set (63 rows) | 0.942 | 0.937 |
| Lockbox (50 rows) | 0.910 | 0.920 |
| Challenge set (72 longer / noisier / multilingual messages) | 0.860 | 0.861 |
For comparison (cross-validated macro-F1): TF-IDF + Linear SVM 0.752, frozen multilingual embeddings + logistic regression 0.860.
Non-English: 0.875 accuracy out-of-fold (English: 0.876), 9/9 on test, 6/7 on the lockbox.
Unknown detection (intents yard_management + document_processing removed from training; Ensemble score chosen beforehand on a different held-out pair; threshold keeps 95% of business-intent validation messages):
AUROC 0.838 · retention 0.956 · rejection recall 0.444. At 90% retention the rejection recall is 0.736.
from transformers import AutoTokenizer, AutoModelForSequenceClassification
repo = "palashsharma048/fourkites-intent-classifier"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForSequenceClassification.from_pretrained(repo)
logits = model(**tok(["where is LD-12345 right now?"], return_tensors="pt")).logits
print(model.config.id2label[logits.argmax(-1).item()]) # shipment_information.realtime_query
unknown ruleconfig.json holds unknown_score (Ensemble), unknown_threshold and fallback_intents (other, chitchat).
The Ensemble score is the mean percentile (against the stored validation reference scores) of: the max softmax probability,
the mean cosine similarity to the 5 nearest training messages in this model's mean-pooled, L2-normalised last-layer embeddings,
and the same kNN similarity using the frozen paraphrase-multilingual-MiniLM-L12-v2 sentence encoder.
All required statistics are in router_stats.npz. If the score is below the threshold and the predicted intent is not a
fallback intent, route the message to unknown.
customer_support tickets that mention another intent's object (APT-…, DOC-…), and yard_management vs shipment_information.realtime_query.unknown rate and the confidence distribution in production to detect drift.