---
title: 'TwinRouterBench: Dual-Track LLM Routing Benchmark'
url: https://www.emergentmind.com/topics/twinrouterbench
type: topic
---

# TwinRouterBench: Dual-Track LLM Routing Benchmark

TwinRouterBench is a comprehensive, dual-track benchmark designed to evaluate step-level routing policies in agentic large language model (LLM) systems operating over long-horizon trajectories. It addresses the limitations of prior one-shot routing benchmarks by providing both deterministic, offline static evaluation across diverse agent benchmarks and dynamic live harnesses measuring real API usage and task resolution in coding agents. TwinRouterBench anchors policy evaluation in execution-verified labels and strict arithmetic cost formulas rather than LLM- or human-in-the-loop judging, supporting reproducibility and extensibility across models and domains [2605.18859].

## 1. Motivation and Rationale

Contemporary agentic systems involve long, multi-turn workflows in which LLMs interact with evolving, stateful prefixes comprised of chat messages, tool outputs, code edits, and retrieval results. Routing each LLM call to the cheapest sufficient model is essential for cost-sensitive applications, especially where agent trajectories are lengthy and heterogeneous in complexity. Existing router benchmarks typically restrict evaluation to single-turn, one-shot prompts, neglecting (1) the need to expose the actual intermediate state visible to routers at each step, (2) failure propagation across steps, and (3) the necessity of matching downstream trajectory success rather than single-step correctness.

TwinRouterBench resolves these deficits by supplying two evaluation tracks:
- A static track featuring 970 agentic prefixes from 520 instances across five representative workloads (SWE-bench, BFCL, mtRAG, QMSum, PinchBench), each paired with an execution-verified label identifying the cheapest model tier sufficient for successful trajectory completion.
- A dynamic track with a live agent harness running the SWE-bench Verified suite, wherein routers select models per step, and the system logs realized API cost and end-to-end task success using deterministic predicates.

This dual-track design enables both rapid, LLM-independent offline routing policy development and genuine end-to-end system validation.

## 2. Mathematical Formulation and Label Construction

Let a trajectory be $\tau = (x_1, x_2, \ldots, x_N)$, where $x_i$ encodes the router-visible prefix up to the $i$-th LLM call. The step-level routing policy is formalized as
$$
\pi : x_i \rightarrow t_i \in \mathcal{T},
$$
with $\mathcal{T} = \{\text{low}, \text{mid}, \text{mid\_high}, \text{high}\}$ ordered by increasing cost and capability, and each tier $t$ mapped to a pool of models $\mathcal{M}_t$.

The ideal but unobservable tier for step $i$ is
$$
t_i^* = \min \{ t \in \mathcal{T} : \exists m \in \mathcal{M}_t \ \text{such that} \ V_i(m; x_i) = 1 \},
$$
where $V_i(m; x_i)=1$ if model $m$ succeeds on $x_i$ (approximated for multi-turn tasks by trajectory completion without step count inflation). Since $t_i^*$ cannot be computed directly, TwinRouterBench releases an execution-verified estimate $\hat{t}_i$ via the downgrade-and-cascade protocol.

**Downgrade-and-Cascade Labeling:**  
For each step, starting from the highest tier, the protocol prunes implausible candidates with strong-model hints and attempts to lock steps to lower tiers while maintaining full trajectory success metrics. For non-low tiers, it tests up to three models per pool, accepting $t$ if any succeed. Manual audits confirm label “tightness,” with only one out of 64 reviewed cases found further downgradeable and subsequently corrected.

## 3. Static Track: Dataset, Metrics, and Cost Scoring

### Data Coverage
The static track comprises 970 annotated rows from successful strong-model executions distributed as follows:

| Workload    | Instances | Source/License                       |
|-------------|-----------|--------------------------------------|
| SWE-bench   | 40        | Code repair (Apache-2.0)             |
| BFCL        | 130       | Function-calling (CC BY 4.0)         |
| mtRAG       | 193       | RAG QA (IBM Research)                |
| QMSum       | 145       | Meeting summarization (MIT)          |
| PinchBench  | 12        | General agent tasks (MIT)            |

*Target tier distribution*: 689 low, 62 mid, 49 mid_high, 170 high (Table A.2).

### Scoring Formulas and Metrics
Let $\hat{t}_i$ be the label, $\tilde{t}_i$ the router’s prediction, and $c_i(t)$ the computed tier cost for row $i$.

- **Pass/Exact Metrics:**  
  - $\text{RowPass}_i = 1[\tilde{t}_i \geq \hat{t}_i]$
  - $\text{RowExact}_i = 1[\tilde{t}_i = \hat{t}_i]$
- **Trajectory Metrics:**  
  - $\text{TrajPass}_b = 1$ if all steps in $b$ have $\text{RowPass}_i = 1$.
  - Always-high trajectory cost: $D_b = \sum_{i \in b} c_i(\text{high})$
- **CostSave (failure-penalized):**  
  $$
  N_b = 
    \begin{cases}
      \sum_i [c_i(\text{high}) - c_i(\tilde{t}_i)], & \text{passing trajectories} \\
      -\sum_i c_i(\tilde{t}_i), & \text{failing trajectories}
    \end{cases}
  $$
  $$
  \text{CostSave} = \sum_b w_b (N_b / D_b), \quad w_b = n_b / 970
  $$
  Combined score: average of RowPass, RowExact, TrajPass, and CostSave.

- **Token Billing Formula:**  
  $$
  c_i(t) = \frac{n_i^{\text{inp}} p_t^{\text{inp}} + n_i^{\text{cr}} p_t^{\text{cr}} + n_i^{\text{cw}} p_t^{\text{cw}} + n_i^{\text{out}} p_t^{\text{out}}}{1e6}
  $$
  where $n_i^{\text{inp}}$, $n_i^{\text{cr}}$, $n_i^{\text{cw}}$, $n_i^{\text{out}}$ are input, cache_read, cache_write, output tokens; $p_t^{\cdot}$ are per-tier costs. Cache misses on tier switches accrue cache_write costs at the new tier’s rate.

## 4. Dynamic Track: Live Agent Harness and Evaluation

The dynamic track runs the full 500-case SWE-bench Verified suite, with evaluation reported on a 100-case held-out split disjoint from static supervision examples. At each agent step, the router observes $x_i$ (the prefix), possible models, cache state, and budget, selecting $m_i$ from a locked pool of 11 models (Table A3).

**API usage is bucketed by token type** (input, cache_read, cache_write, output) per provider logs.

- **Per-instance cost:**  
  $A_j = \sum_{i \in \tau_j} c_i(m_i)$  
- **Task resolution:**  
  $resolved_j \in \{0, 1\}$, per SWE-bench predicate.
- **Penalty for unresolved cases:**  
  $\gamma = \$0.60$ (approximate perfect solver cost).

- **Final bill:**  
  $bill_j = A_j + (1 - resolved_j) \gamma$
  
Leaderboards rank by $\sum_j bill_j$ (lower is better), reporting API and penalty costs separately.

## 5. Experimental Results

### Static Track Performance

| Method                     | RowPass | RowExact | TrajPass | CostSave | Combined |
|----------------------------|---------|----------|----------|----------|----------|
| SR-KNN (in-sample upper)   | 91.9%   | 78.8%    | 84.7%    | 56.2%    | 77.9%    |
| ClawRouter (rule-based)    | –       | –        | –        | –        | 52.8%    |
| UncommonRoute (rule-based) | –       | –        | –        | –        | 57.0%    |
| Always-high (Opus 4.6)     | –       | –        | –        | –        | 54.4%    |

SWE-bench accounts for 34.6% of total static score weight and is the major driver of failures and negative CostSave (penalized for failed trajectories). On non-SWE workloads, cost savings frequently exceed 85%.

### Dynamic Track Results

| Method                                 | Resolved/100 | API/case | Penalty | Bill     |
|-----------------------------------------|-------------|----------|---------|----------|
| Unrouted Opus 4.6                      | 74          | \$0.55   | \$15.60 | \$70.33  |
| SR-KNN router                          | 75          | \$0.56   | –       | \$70.61  |
| UncommonRoute (trained on static labels)| 75          | \$0.26   | –       | \$40.66  |
| UncommonRoute (rule-based)              | 73          | \$1.73   | –       | \$188.76 |

A logistic policy trained on static labels achieves a 53% real-world cost reduction at matched resolution rate compared to the always-high baseline.

## 6. Implications for Research and System Development

TwinRouterBench’s dual-track design enables rapid, reproducible benchmarking of routing policies with:
- **Fast offline iteration:** Static scoring requires only milliseconds per policy, supporting massive, LLM-free router search and rapid ablation.
- **Live validation:** The dynamic SWE harness assesses entire agent behaviors, including tool and cache effects, tracking API spend and actual task resolution rather than proxy measures. This design uncovers phenomena such as mixed-model out-of-distribution drift, which static proxies may overlook.
- **Reproducibility and extensibility:** The benchmark versions all model pools, pricing constants, and scoring logic. Any model or pricing update can trigger protocol-consistent re-labeling, preserving results comparability.

Exposing the full per-step epistemic state and execution-verified cost/label information sets a rigorous standard for routing evaluation in agentic LLM systems.

## 7. Prospects for Future Work

TwinRouterBench paves avenues for advancing LLM routing research by:
- Extending to broader tool suites and languages beyond English.
- Jointly optimizing routing and caching policies for further cost-effectiveness.
- Developing evaluation protocols that allocate partial credit for subtasks (e.g., code test coverage).

A plausible implication is that systematic, execution-grounded routing benchmarks like TwinRouterBench will facilitate both efficient LLM utilization and improved transparency in agentic system development. All code, datasets, and detailed methodologies are openly available at https://github.com/CommonstackAI/TwinRouterBench, supporting ongoing experimentation and community contributions [2605.18859].

Source: https://www.emergentmind.com/topics/twinrouterbench