nadirclaw-distilbert
A 3-class prompt complexity classifier for NadirClaw, an open-source LLM router. Given a prompt, it predicts which routing tier the request belongs to so the router can send simple prompts to cheap models and hard prompts to capable ones.
Classes
| Label | Tier | Examples |
|---|---|---|
| 0 | simple | short questions, lookups, formatting, file reads |
| 1 | medium (→ mid in NadirClaw) | focused single-function edits, single-file debugging, small refactors |
| 2 | complex | architecture, multi-file refactors, agentic loops, reasoning-heavy prompts |
Model details
- Base:
distilbert-base-uncased, native sequence-classification head (num_labels=3) - Inference: CPU, ~30ms per prompt,
max_length=256 - Artifact size: ~256MB
- Training data: NadirClaw + Horizen prototype prompts + eval prompts (~700 samples)
Usage
from transformers import DistilBertTokenizer, DistilBertForSequenceClassification
import torch
repo = "nadirclaw/nadirclaw-distilbert"
tok = DistilBertTokenizer.from_pretrained(repo)
model = DistilBertForSequenceClassification.from_pretrained(repo)
model.eval()
inputs = tok("design a distributed rate limiter", return_tensors="pt",
truncation=True, max_length=256)
with torch.no_grad():
probs = torch.softmax(model(**inputs).logits[0], dim=-1)
tier = ["simple", "medium", "complex"][int(probs.argmax())]
print(tier, float(probs.max()))
In NadirClaw, just set:
NADIRCLAW_COMPLEXITY_ANALYZER=distilbert
NadirClaw downloads and caches this model automatically on first use.
Calibration
The classifier leans toward over-serving rather than under-serving: when a
simple prediction has confidence < 0.70, it escalates to medium or
complex. It is cheaper to over-serve a simple prompt than to under-serve a
complex one.
License
Apache-2.0, matching the base model. NadirClaw itself is MIT.