Architecture overview Nadir's binary classifier has three stages: Embedding - DistilBERT encodes the prompt into a 384-dim vector (~10ms) Centroid matching - Compare against learned centroids for simple/medium/complex (~1ms) Tier assignment - Map complexity tier to model selection (~0ms) Total: ~50-100ms classification overhead. Stage 1: Embedding We use sentence-transformers/all-MiniLM-L6-v2 to encode prompts. It runs locally on CPU, no GPU needed. The model is 22MB and loads in ~2 seconds on startup. Why not a larger model? Because the embedding is just for classification, not generation. MiniLM-L6 captures enough semantic signal to distinguish "what is 2+2" from "design a distributed system" reliably. Stage 2: Centroid matching During training, we compute centroid embeddings for each complexity tier from labeled examples. At inference time, we compute cosine similarity between the prompt embedding and each centroid. The classifier outputs: Tier probabilities: e.g., simple=0.99, medium=0.003, complex=0.003 Confidence score: 0.0 (simple) to 1.0 (complex) Tier name: simple / medium / complex Stage 3: Model selection The tier maps to a model selection strategy: | Tier | Strategy | Example models | |------|----------|----------------| | Simple (score < 0.2) | Cheapest available | Gemini Flash, GPT-3.5 | | Medium (0.2 - 0.7) | Mid-tier | GPT-4o-mini, Haiku | | Complex (score > 0.7) | Premium (benchmark model) | Sonnet, GPT-4o, Opus | The ranker filters available models by the user's allowed list, then sorts by cost within the tier. Accuracy The binary classifier alone hits routing accuracy in the high 80s on small held-out evals. On RouterBench held-out (n=11,420), the prompt-only classifier preserves 96.6% of always-Opus quality. That is the ceiling for any router that sees only the input. To push past it, you have to read the cheap-model answer before you ship; that is what the verifier-gated cascade adds, taking quality preservation to 98%. What's next We're training a confidence-aware analyzer that escalates uncertain classifications to a secondary check. If the primary classifier scores between 0.3-0.7, it runs a lightweight keyword analysis before committing to a tier. This should push accuracy above 98%.