Downloads · 30 days
15
33% of all-time downloads
appriai/gen-router-t1
gen-router-t1 is a text classification model from appriai. Use it when you need a label for a piece of text. The card lists the license as apache-2.0.
Every LLM-powered application has to decide, for each incoming prompt, which model should answer it. Get that decision wrong in either direction and it costs you:
Downloads · 30 days
15
33% of all-time downloads
All-time downloads
46
Public
Parameters
142M
1.1 GB on disk
Likes
1
Public
Click a slice to open those files.
.onnx568 MB · 50%
From the Hugging Face model README
Every LLM-powered application has to decide, for each incoming prompt, which model should answer it. Get that decision wrong in either direction and it costs you:
This model exists to make that per-request decision automatically and cheaply: given a prompt, predict whether it belongs on a fast, tier, balanced tier, or frontier tier model — before any generation happens — so a routing layer can send each request to the right-sized model. Because the classifier itself is small (see benchmark below), the routing decision adds negligible cost and latency compared to running the prompt through an oversized model unnecessarily.
| Tier | Intended for |
|---|---|
fast | Simple, single-step tasks — factual lookups, short translations, basic formatting/classification |
balanced | Multi-step tasks needing real reasoning — code generation, summarization, structured writing |
frontier | Expert-level or deep multi-step reasoning — complex system design, proofs, research synthesis, adversarial edge cases |
| Metric | Value |
|---|---|
| Accuracy | 0.890 |
| F1 Macro | 0.797 |
| F1 Fast | 0.928 |
| F1 Balanced | 0.848 |
| F1 Frontier | 0.615 |
{
"0": "fast",
"1": "balanced",
"2": "frontier"
}
| Source | n | Accuracy |
|---|---|---|
| flan | 4,108 | 97.4% |
| openhermes | 5,929 | 87.5% |
| evol | 2,479 | 85.0% |
| sharegpt | 1,431 | 78.3% |
Expected Calibration Error (ECE): 0.053.
| Config | p50 | p95 | p99 | Mean |
|---|---|---|---|---|
| PyTorch GPU (T4) | 15.83ms | 23.62ms | 43.95ms | 16.99ms |
| ONNX GPU (T4) | 4.93ms | 10.86ms | 12.48ms | 5.67ms |
| PyTorch CPU | 158.17ms | 412.04ms | 483.39ms | 204.57ms |
| ONNX CPU | 77.77ms | 360.32ms | 488.04ms | 111.39ms |
The ONNX export runs ~3x faster on GPU and ~2x faster on CPU than the native PyTorch model, with accuracy verified identical on the full test set (89.02% for both). CPU tail latency (p95/p99) reflects a constrained benchmarking environment and is not representative of a dedicated server.
fast): 3.6%frontier): 0.17%The error asymmetry favors safety: the model is far more likely to over-provision an easy prompt (wasting some cost) than under-provision a hard one (risking a bad answer) — the direction you want a router to err in.
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
repo_id = "appriai/gen-router-t1"
tokenizer = AutoTokenizer.from_pretrained(repo_id)
model = AutoModelForSequenceClassification.from_pretrained(repo_id)
inputs = tokenizer("Explain quantum entanglement in detail.", return_tensors="pt")
with torch.no_grad():
logits = model(**inputs).logits
tier = model.config.id2label[logits.argmax(-1).item()]
print(tier) # "frontier"
import onnxruntime as ort
from transformers import AutoTokenizer
from huggingface_hub import hf_hub_download
repo_id = "appriai/gen-router-t1"
tokenizer = AutoTokenizer.from_pretrained(repo_id)
onnx_path = hf_hub_download(repo_id, "onnx/model.onnx")
session = ort.InferenceSession(onnx_path, providers=["CUDAExecutionProvider", "CPUExecutionProvider"])
enc = tokenizer("Explain quantum entanglement in detail.", return_tensors="np")
inputs = {i.name: enc[i.name] for i in session.get_inputs()}
logits = session.run(["logits"], inputs)[0]