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.
1{
2 "0": "fast",
3 "1": "balanced",
4 "2": "frontier"
5}
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.
1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3
4repo_id = "appriai/gen-router-t1"
5tokenizer = AutoTokenizer.from_pretrained(repo_id)
6model = AutoModelForSequenceClassification.from_pretrained(repo_id)
7
8inputs = tokenizer("Explain quantum entanglement in detail.", return_tensors="pt")
9with torch.no_grad():
10 logits = model(**inputs).logits
11tier = model.config.id2label[logits.argmax(-1).item()]
12print(tier) # "frontier"
1import onnxruntime as ort
2from transformers import AutoTokenizer
3from huggingface_hub import hf_hub_download
4
5repo_id = "appriai/gen-router-t1"
6tokenizer = AutoTokenizer.from_pretrained(repo_id)
7onnx_path = hf_hub_download(repo_id, "onnx/model.onnx")
8session = ort.InferenceSession(onnx_path, providers=["CUDAExecutionProvider", "CPUExecutionProvider"])
9
10enc = tokenizer("Explain quantum entanglement in detail.", return_tensors="np")
11inputs = {i.name: enc[i.name] for i in session.get_inputs()}
12logits = session.run(["logits"], inputs)[0]