How Cursor Router Picks the Best Model for Each Task

Peter Bubenik · Cursor · · Source
How Cursor Router Picks the Best Model for Each Task

Concept 1: The Core Problem — Why Not Just Use One Model?

The fundamental tension in AI-powered coding tools:

ApproachProblem
Always use the best modelExtremely expensive, even for simple tasks
Always use the cheapest modelPoor quality on complex tasks
Pick manuallyImpractical at scale

The insight: Not every coding task needs the same level of intelligence.

  • Typing a Git commit message ≠ Debugging a complex performance issue
  • The goal is to match task complexity to model capability, automatically

Think of it like staffing: you don't hire a senior architect to make coffee, but you don't send an intern to design your database schema either.


Concept 2: Building a Real-World Dataset (Not Benchmarks)

Why benchmarks aren't enough:

Most AI systems are evaluated on standardized tests (benchmarks). Cursor took a different approach — they learned from real developer traffic.

Real Traffic → Dataset → Router Training
     ↑
Preserves actual:
- Task mix
- Surrounding context
- Model-switching costs
- Cache behavior

Each data point captured two things:

1. Performance Signal

User moves on to next task  →  ✅ Strong POSITIVE signal
User corrects the agent     →  ❌ Strong NEGATIVE signal

2. Cost Signal

Cost = API pricing × token usage per turn
(Including hidden costs like cache misses from switching models)

Key principle: The data reflects production conditions, not lab conditions. This matters because real costs (like cache misses) don't show up in benchmarks.


Concept 3: Compass — Predicting Complexity

What is Compass?

Compass is a complexity predictor — a model trained to answer:

"Will the user be satisfied with the response on this turn?"

How it works:

Input Signals:
├── Task category (structured feature)
├── Recent tool calls
└── Broader conversation context
         ↓
    [COMPASS MODEL]
         ↓
Output: Complexity Score (0.0 → 1.0)

The clever proxy logic:

Compass doesn't directly measure complexity — it predicts satisfaction. But satisfaction correlates with complexity:

Simple task (e.g., git commit)  →  Rarely needs correction  →  High satisfaction
Complex task (e.g., debug race condition)  →  Often needs follow-up  →  Lower satisfaction

Compass accuracy in production:

Compass RatingPositive Performance Signal
Most likely to succeed96% of the time
Least likely to succeed71% of the time

The threshold mechanism:

Score: [0 ————————|threshold|———————— 1]
         Simple              Complex
            ↓                   ↓
    Price-efficient         Frontier
       model                  model
  • Lower threshold → More traffic stays on cheap model → Lower cost, some quality risk
  • Higher threshold → More traffic upgraded → Higher quality, higher cost

This single dial lets Cursor tune the cost-quality tradeoff for different modes (Auto Balance vs. Auto Intelligence).


Concept 4: The Task Taxonomy — Matching Tasks to Model Strengths

The second question: Once Compass says "this needs a frontier model," which frontier model?

Key discovery: No single model dominates everything.

Cursor built a 3-dimensional taxonomy from real developer traffic:

Every Turn is described by:

DOMAIN          TASK              MODIFIER
(Where?)        (What?)           (How?)
   │               │                 │
Backend        Fix bugs          Bounded edits
Database       Run commands      Product questions  
Frontend       Write tests       Visual-heavy changes

Model specializations discovered:

GROK    →  Broad, routine work (Git commands, general DB ops)
           Strength: Low cost + solid performance on common tasks

SOL     →  Planning & codebase comprehension
           Strength: Strong on implementation at lower frontier cost

OPUS    →  Execution-heavy work (DevOps, DB queries, performance optimization)
           Strength: Deep technical execution

FABLE   →  Debugging & visual implementation
           Strength: Highest quality on complex tasks (worth the premium)

Think of this like a sports team: you don't play your goalkeeper as striker. Each model has a position where it excels.


Concept 5: The Routing Algorithm — Putting It Together

The two-stage decision process:

INCOMING TURN
      │
      ▼
[COMPASS SCORES COMPLEXITY]
      │
   Score < threshold?
   ┌───┴───┐
  YES      NO
   │        │
   ▼        ▼
 GROK    [TAXONOMY ROUTER]
(cheap)       │
         Two rules apply:
              │
    Rule 1: Is improvement REAL?
    → Need 75% confidence that
      candidate model beats Grok
              │
    Rule 2: Best mix within budget?
    → Pick combination that maximizes
      performance gain within cost limit
              │
              ▼
         Best frontier model
         for this task type

The two routing rules explained:

Rule 1 — Only Route When Performance is Clearly Better

Candidate model eligible ONLY IF:
  observed performance > price-efficient model
  with 75% confidence (one-sided uplift threshold)

Why? Prevents routing to expensive models for marginal gains

Rule 2 — Best Mix Within Budget

From eligible candidates:
  Maximize: expected performance gain
  Subject to: average cost per turn ≤ budget

Why? Ensures the mode stays within its cost envelope

Concept 6: Auto Balance vs. Auto Intelligence — Two Points on the Curve

Both modes use the same algorithm but with different settings:

COST ←————————————————————————→ QUALITY

Auto Balance                Auto Intelligence
     │                              │
     ▼                              ▼
Higher Compass threshold    Lower Compass threshold
Smaller task router budget  Larger task router budget
More traffic on Grok        More traffic on frontier models

Real-world results:

Modevs. Opus 4.8Satisfaction
Auto Balance41% lower costHigher satisfaction
Auto Intelligence68% lower cost vs. FableNear Fable-level satisfaction

You get better or equal quality at significantly lower cost — because you're paying frontier prices only when frontier quality is actually needed.


Concept 7: Evaluation — Offline Then Online

Why two-stage evaluation?

Stage 1: OFFLINE (Cross-validation)
├── Tune Compass thresholds
├── Tune optimization budgets
├── Eliminate weak candidates
└── Limitation: Can't capture all production effects

         ↓

Stage 2: ONLINE (Live traffic)
├── Measure real user satisfaction
├── Capture actual token usage
├── Capture real caching behavior
└── Capture model-switching costs

The honest limitation acknowledged:

Offline analysis cannot fully capture production behavior. Live developer traffic remains the most representative test.

This is why they test on real users before declaring success.


The Big Picture — How It All Connects

Real Traffic
    │
    ▼
Dataset (performance + cost signals)
    │
    ├──→ Train COMPASS (complexity predictor)
    │         │
    │         ▼
    │    Score each turn (0→1)
    │         │
    └──→ Build TAXONOMY (domain × task × modifier)
              │
              ▼
         Learn model strengths per category
              │
              ▼
    ┌─────────────────────┐
    │   ROUTING ALGORITHM  │
    │  Compass + Taxonomy  │
    │  + Budget constraints│
    └─────────────────────┘
              │
    ┌─────────┴─────────┐
    ▼                   ▼
Auto Balance      Auto Intelligence
(cost-focused)    (quality-focused)

The core philosophy in one sentence:

Model selection should be learned from real performance data, not inferred from benchmark scores — and it should route each task to the model that's actually best for that specific work, not just the most powerful model overall.

More to study