Campus Assistant Multi-Label Edge Router (ONNX)
This is an optimized, ONNX-quantized DistilBERT model trained to route student queries to 18 specific university departments. It is designed for FAANG-grade multi-agent orchestrator architectures.
Because it is quantized to ONNX, it achieves a ~4x latency reduction on CPU compared to standard PyTorch models, making it ideal for edge deployment.
Supported Domains (18)
The model supports multi-label classification (can detect multiple intents at once) across the following domains: Academics, Admissions, Athletics & Recreation, Campus Security & Safety, Career Services, Dining & Nutrition, Disciplinary, Facilities, Fees & Finance, General, Health & Wellness, Housing, IT Helpdesk & Tech Support, International, Library Services, Registration, Student Life, Transportation & Parking.
How to use this model
Anyone can pull this model and use it in their own Python applications using the optimum library.
1. Install Dependencies
pip install transformers optimum[onnxruntime] torch
2. Run Inference
Here is the exact code snippet to run multi-label classification:
import torch
import json
from transformers import AutoTokenizer
from optimum.onnxruntime import ORTModelForSequenceClassification
# 1. Load Model & Tokenizer
model_id = "your-username/campus-assistant-router" # Change this to the repo name
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = ORTModelForSequenceClassification.from_pretrained(model_id)
# 2. Define Query
query = "I need to pay my tuition and book a study room in the library"
inputs = tokenizer(query, return_tensors="pt", truncation=True, max_length=128)
# 3. Run Inference
with torch.no_grad():
outputs = model(**inputs)
probs = torch.sigmoid(outputs.logits)[0] # Sigmoid for multi-label
# 4. Extract Domains (Threshold = 0.2)
threshold = 0.2
above_threshold = (probs > threshold).nonzero(as_tuple=True)[0]
domains = []
# You can load the id2domain mapping from label_mapping.json in the repo!
id2domain = model.config.id2label
if len(above_threshold) > 0:
for idx in above_threshold:
domains.append(id2domain[idx.item()])
else:
# Fallback to highest confidence
confidence, predicted_class = torch.max(probs, dim=-1)
domains.append(id2domain[predicted_class.item()])
print(f"Query: {query}")
print(f"Routed Domains: {domains}")
Intended Use
This model is intended to act as the "Semantic Router" for Multi-Agent AI systems (like LangGraph or AutoGen). Instead of a single LLM trying to answer everything, this ONNX model instantly categorizes the user's intent and triggers the correct sub-agent downstream.
- Downloads last month
- 15