Skip to main content
Documentation

Algorithm

Overview

Version: Latest

Algorithm

Overview

Latest algorithm tutorials mirror the fragment catalog under config/algorithm/.

Algorithms only matter after a decision matches and exposes multiple candidate models in modelRefs. The router then uses decision.algorithm to choose or coordinate those candidates.

Key Advantages

  • Separates route eligibility from model selection policy.
  • Lets one decision keep several candidate models without inlining ranking logic.
  • Supports both one-model ranking and multi-model orchestration.
  • Mirrors the repo fragment tree exactly: one tutorial page per algorithm under config/algorithm/selection/ and config/algorithm/looper/.

What Problem Does It Solve?

Once a route matches, the router still needs a principled way to choose among candidate models. Without an algorithm layer, teams either hard-code one winner or duplicate ranking logic across routes.

Algorithms solve that by making the post-match selection policy explicit and reusable.

When to Use

Use algorithm/ when:

  • modelRefs contains more than one candidate
  • route policy depends on latency, feedback, semantic fit, or online exploration
  • one decision should orchestrate several models instead of choosing exactly one
  • you want model choice to evolve without changing the decision rule itself

Configuration

In canonical v0.3 YAML, algorithms live inside each matched decision:

routing:
decisions:
- name: computer-science-reasoning
rules:
operator: AND
conditions:
- type: domain
name: "computer science"
modelRefs:
- model: qwen2.5:7b
- model: qwen3:14b
algorithm:
type: router_dc
router_dc:
temperature: 0.07

The repo now keeps one tutorial page per algorithm.

Algorithm Comparison

Selection Algorithms (single model from candidates)

AlgorithmTypeFeedbackPersonalizationKey PaperBest For
StaticFixedNoNoSimplest possible selection, curated ordering
EloFeedback-drivenYesPer-categoryRouteLLM (2406.18665)Online learning from pairwise comparisons
Router DCSemanticYesNoDual Contrastive (2409.19886)Query-to-model semantic matching
AutoMixPOMDPVia logprobNoAutoMix (2310.12963)Cost-quality cascaded routing
HybridCompositeYes (3 sub)NoHybrid LLM (2404.14618)Blending multiple ranking signals
RL DrivenRLYesPer-userRouter-R1 (2506.09033)Exploration + personalization
GMT RouterGNNYesPer-userGMTRouter (2511.08590)Multi-turn personalized routing
KNNML (Rust)No (offline)NoInterpretable example-based routing
KMeansML (Rust)No (offline)NoCluster-based routing
SVMML (Rust)No (offline)NoDecision boundary classification
MLPML (GPU)No (offline)NoNon-linear neural network routing
Latency AwareMetricsNoNoFastest model selection by TPOT/TTFT

Looper Algorithms (multi-model orchestration)

AlgorithmDescriptionKey Feature
ConfidenceSmall-to-large escalationLogprob-based confidence evaluation
RatingsBounded concurrent executionConcurrency cap + rating aggregation
ReMoMMulti-round parallel reasoningBreadth schedule + intelligent synthesis

Algorithm Decision Guide

Selection Algorithms

Looper Algorithms