ODAR: Principled Adaptive Routing for LLM Reasoning via Active Inference
Organizations: Nanyang Technological University · Carnegie Mellon University · Northeast University (Qinhuangdao Campus) · Beihang University · University of the Chinese Academy of Sciences · Renmin University of China · Sun Yat-sen University
Abstract
The paradigm of large language model (LLM) reasoning is shifting from parameter scaling to test-time compute scaling, yet many existing approaches still rely on uniform brute-force sampling (for example, fixed best-of-N or self-consistency) that is costly, hard to attribute, and can trigger overthinking with diminishing returns. We propose ODAR-Expert, an adaptive routing framework that optimizes the accuracy-efficiency trade-off via principled resource allocation. ODAR uses a difficulty estimator grounded in amortized active inference to dynamically route queries between a heuristic Fast Agent and a deliberative Slow Agent. We further introduce a free-energy-principled, risk-sensitive fusion mechanism that selects answers by minimizing a variational free energy objective, balancing log-likelihood with epistemic uncertainty (varentropy) as a principled alternative to ad hoc voting over heterogeneous candidates. Extensive evaluation across 23 benchmarks shows strong and consistent gains, including 98.2% accuracy on MATH and 54.8% on Humanity's Last Exam (HLE), while improving the compute-accuracy frontier under compute-matched settings. We also validate reproducibility on a fully open-source stack (Llama 4 + DeepSeek), where ODAR surpasses homogeneous sampling strategies while reducing computational costs by 82%. Overall, our results suggest that thinking-optimal scaling requires adaptive resource allocation with free-energy-based decision-making rather than simply increasing test-time compute.
Figures & tables
| Property | Fast Agent ( ) | Slow Agent ( ) |
|---|---|---|
| Base Model | GPT-5.1 | Claude-4.5 Sonnet |
| Temperature | 0.2 (Deterministic) | 0.3 (Exploratory) |
| Token Limit | 512 | 1024 |
| Avg. Latency | 1.8s | 6.4s / 32.0s (Seq.) |
| Primary Role | Hypothesis generation | Verification / Exploration |
| Category | Dataset | GPT-5.1 | Claude-4.5 | Len-Adapt. | Self-Consist. | ODAR (Ours) | Gain |
| Mathematics | MATH Hendrycks et al. (2021) | 91.8 | 89.2 | 94.0 | 94.5 | 98.2 | +6.4 |
| GSM8K Cobbe et al. (2021) | 95.9 | 94.5 | 97.0 | 97.2 | 99.1 | +3.2 | |
| IMO 2025 Mathematical Association of America (2025) | 48.5 | 45.2 | 55.6 | 55.4 | 68.7 | +20.2 | |
| MathVista Lu et al. (2023) | 89.1 | 87.4 | 91.7 | 92.3 | 96.5 | +7.4 | |
| Commonsense | ARC-Challenge Clark et al. (2018) | 92.5 | 90.8 | 94.6 | 94.2 | 98.5 | +6.0 |
| OpenBookQA Mihaylov et al. (2018) | 91.2 | 89.5 | 93.5 | 93.8 | 97.8 | +6.6 |
| Category | Dataset | (A) Llama 4 | (B) DeepSeek | (C) DeepSeek | (D) Open-ODAR | Gain |
| (Fast Agent) | (CoT) | (SC ) | (Llama+DeepSeek) | (vs. SC) | ||
| Math | MATH Hendrycks et al. (2021) | 76.5 | 87.8 | 90.2 | 92.4 | +2.2% |
| GSM8K Cobbe et al. (2021) | 88.4 | 96.3 | 97.1 | 97.8 | +0.7% | |
| Coding | LiveBench White et al. (2024) | 58.2 | 71.4 | 73.5 | 76.1 | +2.6% |
| SWE-bench Jimenez et al. (2023) | 45.5 | 62.5 | 65.8 | 68.2 | +2.4% | |
| Reasoning | GPQA Rein et al. (2024) | 35.8 | 68.4 | 70.5 | 72.8 | +2.3% |
| Method | MATH | BBH | MMLU-Pro | Cost | Eff. † |
|---|---|---|---|---|---|
| Single-Agent Baselines | |||||
| GPT-5.1 Base | 91.8 | 88.0 | 86.2 | 1.0 | 0.0 |
| Claude-4.5 Base | 89.2 | 86.5 | 85.1 | 3.0 | - |
| Multi-Candidate Strategies | |||||
| Self-Consistency ( Wang et al., 2022 ) | 94.5 | 91.2 | 89.5 | 5.0 | 0.6 |
| Best-of-N ( =5) ( Aminian et al., 2025 ) | 95.0 | 92.0 | 90.0 | 5.0 | 0.7 |
Appendix figures & tables40 assets
Supplementary material from the paper’s appendix.
Appendix
| Symbol | Description |
|---|---|
| Variables & Distributions | |
| Input query (text or multimodal) | |
| Candidate answer sequence / Final selected answer | |
| Latent cognitive state (reasoning path) | |
| Variational belief distribution over hidden states | |
| Variational Free Energy (Accuracy + Complexity) | |
| Biological Component | ODAR Abstraction | Computational Role |
|---|---|---|
| Theta Rhythm (4-8Hz) | Difficulty Estimator | Gating Signal: Assesses demand/load |
| Gamma Bursts (30-100Hz) | Slow Agent Execution | Intensive Compute: Expensive processing |
| Phase-Amplitude Coupling | Dynamic Routing ( ) | Conditional Logic: If High Load Activate |
| Metabolic Constraints | Token Cost Budget | Constraint: Maximize accuracy per unit cost |
| Framework | Core Mechanism | Router Training | Inference Overhead | Primary Goal | Reasoning Focus | Bio-Inspired |
|---|---|---|---|---|---|---|
| HierRouter Gupta et al. [2025] | Reinforcement Learning (PPO) | High (Policy Training) | Medium | General Efficiency | Partial | No |
| RTR Pan et al. [2025] | Supervised Regression | Medium (Scalar Predictor) | Low | Strategy Selection | Yes | No |
| MoMA Guo et al. [2025] | Intent Classification | Medium (Capability Profiling) | Low | General Orchestration | No | No |
| CP-Router Su et al. [2025] | Conformal Prediction | Low (Calibration Only) | Medium (Sampling) | Uncertainty/Cost | Yes | No |
| InferenceDynamics Shi et al. [2025] | Capability Knowledge Graph | Medium (Profiling) | Low | Knowledge Routing | No | No |
| ODAR (Ours) | Active Inference & FEP | Low (Lightweight DE) | Low | Test-Time Scaling | Strong (System 2) | Yes (TG-PAC) |
| ID | Feature | Definition | Imp. |
| Lexical Features ( ) | |||
| Character length | Total number of characters in query | 0.012 | |
| Word count | Number of whitespace-separated tokens | 0.018 | |
| Token count | BPE tokens via tiktoken (cl100k_base) | 0.024 | |
| Avg. word length | Mean character count per word | 0.008 | |
| Max word length | Maximum character count across words | 0.006 | |
| Domain | Representative Vocabulary ( ) |
|---|---|
| Mathematics (87) | theorem, derivative, integral, matrix, eigenvalue, convergence, polynomial |
| Coding (92) | algorithm, function, complexity, implement, recursive, runtime, optimize |
| Logic (73) | valid, satisfiable, contradiction, premise, inference, deduction, entailment |
| Rank | Feature | Category | Importance |
|---|---|---|---|
| 1 | Domain: math ( ) | Semantic | 0.056 |
| 2 | Difficulty density ( ) | Semantic | 0.052 |
| 3 | TF-IDF math ( ) | Semantic | 0.048 |
| 4 | Domain: code ( ) | Semantic | 0.047 |
| 5 | Type: proof ( ) | Semantic | 0.044 |
| 6 | Math symbol ( ) | Lexical | 0.042 |
| Configuration | Pearson | Routing Acc. | Task Acc. |
|---|---|---|---|
| Full model (24 features) | 0.79 | 87.3% | 83.5% |
| Without lexical ( ) | 0.76 | 85.1% | 82.8% |
| Without structural ( ) | 0.74 | 83.8% | 82.1% |
| Without semantic ( ) | 0.61 | 74.2% | 79.3% |
| Random baseline | 0.00 | 33.3% | 75.4% |
| Configuration | Macro Avg. | MMLU-Pro | MATH | HLE | Subsample CI |
|---|---|---|---|---|---|
| Base (Single Model) | 77.6% | 89.5% | 91.8% | 42.8% | 0.32% |
| ODAR (Rules Only, No DE Gating) | 79.2% | 90.1% | 93.4% | 44.1% | 0.41% |
| ODAR (ER/MR Off, DE Active) | 88.4% | 93.1% | 96.9% | 53.2% | 0.55% |
| Full ODAR (Final) | 89.6% | 94.2% | 98.2% | 54.8% | 0.45% |
| Randomized (Matched Call-Budget) | 81.3% | 91.2% | 94.1% | 46.5% | 0.85% |
| Error Type | Detailed Description | Count | % |
| System & Routing Failures (34%) | |||
| E1: Difficulty Est. | Mis-classification of hard queries as simple, routing to insufficient compute. | 8 | 8% |
| E2: Expert Routing | Dispatch assigns an inappropriate expert/domain tag (e.g., Math vs. Code), leading to suboptimal model/prompt/strategy. | 5 | 5% |
| E3: Verification Fail. | False Acceptance : Slow Agent incorrectly verifies a wrong Fast answer. | 12 | 12% |
| E4: FEP Selection | Missed Oracle : a correct candidate exists in , but FEP ranks an incorrect candidate as best. | 9 | 9% |
| Model Capability Limitations (66%) | |||
| ID | Source | Reasoning Quality | Answer | Energy ( ) | Risk ( ) | |
|---|---|---|---|---|---|---|
| Fast | Intuitive Guess | |||||
| Slow | Standard Derivation | |||||
| Slow | Rigorous Calculus | 0.0608 ∗ | ||||
| Slow | Sign Error (Logic) | x=1^{{\color[rgb]{1,0,0}\times}} | ||||
| Slow | Vertex Formula | |||||
| Slow | Circular Reasoning |
| Fusion Method | MATH | BBH | TruthfulQA | Avg. |
|---|---|---|---|---|
| Max Confidence | 94.5 | 89.2 | 79.1 | 87.6 |
| Majority Voting (SC) | 95.1 | 90.4 | 80.3 | 88.6 |
| Average Log-Prob | 95.8 | 90.7 | 81.2 | 89.2 |
| FEP Fusion (Ours) | 96.7 | 91.7 | 82.7 | 90.4 |
| Gain vs. Best Baseline | +0.9 | +1.0 | +1.5 | +1.2 |
| Component | Parameters | Values |
|---|---|---|
| Difficulty Estimator | Feature Dimension ( ) | 24 |
| Regularization ( ) | 0.01 | |
| Training Epochs | 50 | |
| Learning Rate | ||
| Batch Size | 32 | |
| Optimizer | Adam |
| Path | Difficulty Range | Distribution | Cost |
|---|---|---|---|
| Simple ( ) | 41% | ||
| Medium ( ) | 35% | ||
| Hard ( ) | 24% | ||
| Weighted Average | 100% | ||
| [SYSTEM] |
|---|
| You are a rapid reasoning assistant optimized for speed and pattern recognition. |
| Behavioral Constraints: |
| 1. Limit reasoning to 3 intermediate steps |
| 2. Prioritize retrieval and pattern matching over deliberation |
| 3. Avoid excessive justification or self-correction |
| Output Format: Answer: <response> |
| System Instruction |
|---|
| You are a careful verification assistant. Your task is to rigorously validate a proposed solution. |
| Verification Protocol: |
| 1. Restate : Summarize the proposed answer and key reasoning steps |
| 2. Validate : Check each logical step for correctness |
| 3. Judge : Output CORRECT or INCORRECT |
| 4. Correct : If incorrect, provide the corrected solution with justification |
| [SYSTEM] |
|---|
| You are a thorough reasoning assistant. Solve the problem using rigorous, step-by-step analysis. |
| Solution Protocol: |
| 1. Analyze : Identify key concepts, constraints, and edge cases |
| 2. Strategize : Select an appropriate solution approach |
| 3. Execute : Implement the solution with explicit intermediate steps |
| 4. Verify : Perform self-check before finalizing |
| Configuration | MATH | BBH |
|---|---|---|
| Full Prompt (Ours) | 98.2 | 95.4 |
| Fast Agent Ablations | ||
| w/o step limit ( 3) | 97.4 (-0.8) | 94.9 (-0.5) |
| w/o “avoid self-correction” | 97.6 (-0.6) | 94.7 (-0.7) |
| Slow Agent Ablations | ||
| w/o verification protocol | 96.9 (-1.3) | 94.2 (-1.2) |
| Path | Distribution | Calls per Query | Contribution |
|---|---|---|---|
| Simple ( ) | 41% | 1 (Fast) | 0.41 |
| Medium ( ) | 35% | 2 (Fast + Slow) | 0.70 |
| Hard ( ) | 24% | 6 (Fast + 5 Slow) | 1.44 |
| Weighted Average | 100% | 2.55 | 2.55 |
| Path | P50 Latency | P95 Latency | Parallelizable |
|---|---|---|---|
| Simple | 1.8s | 3.2s | N/A |
| Medium | 8.2s | 14.5s | No |
| Hard | 12.4s | 28.7s | Yes (5 Slow calls) |
| Overall | 6.1s | 22.3s | Partial |
| Parameter | Fast Agent ( ) | Slow Agent ( ) | Open-ODAR (Ref.) |
|---|---|---|---|
| Model ID | gpt-5.1 | claude-4.5-sonnet | Llama-4-Scout / DeepSeek-V3.2 |
| Deployment | OpenAI API | Anthropic API | vLLM (Local, FP8 Quant) |
| System Prompt | MD5: 7a9c… (See prompts/fast.json) | MD5: b4e1… (See prompts/slow.json) | MD5: … (Identical to API) |
| Temperature | 0.2 (Fixed) | 0.3 (Fixed) | 0.6 (Calibrated for Open Weights) |
| Top-p (Nucleus) | 0.9 | 0.95 | 0.95 |
| Stop Tokens | ["\n\n", "Q:"] | ["Wait", "User:"] | eot_id only |
| Category | Dataset | Test Size | Metric | Reference |
| Mathematics | MATH | 5,000 | Accuracy | Hendrycks et al. [2021] |
| GSM8K | 1,319 | Accuracy | Cobbe et al. [2021] | |
| IMO 2025 | 100 (Shortlist) | Proof Score | IMO Comp. (2025) | |
| MathVista | 1,000 | Accuracy | Lu et al. [2023] | |
| Commonsense | ARC-Challenge | 1,172 | Accuracy | Clark et al. [2018] |
| OpenBookQA | 500 | Accuracy | Mihaylov et al. [2018] |
| Category | Acc. | Simple | Medium | Hard | Cost |
|---|---|---|---|---|---|
| Commonsense | 93.7% | 68% | 24% | 8% | 1.3 |
| Instruction | 97.4% | 82% | 14% | 4% | 1.1 |
| Knowledge QA | 83.7% | 35% | 41% | 24% | 2.6 |
| Multimodal | 91.4% | 39% | 38% | 23% | 2.5 |
| Multi-Hop | 70.9% | 22% | 43% | 35% | 3.4 |
| Mathematics | 90.1% | 31% | 22% | 47% | 4.1 |
| Difficulty | # Datasets | Baseline | ODAR | Gain |
|---|---|---|---|---|
| Simple ( ) | 6 | 92.6% | 98.2% | +5.6% |
| Medium (70–90%) | 9 | 84.0% | 92.5% | +8.5% |
| Hard ( ) | 8 | 51.5% | 63.8% | +12.3% |
| Overall | 23 | 79.8% | 89.6% | +9.8% |
| Model | Acc. | Avg. Cost | Max Cost | Risk Profile |
|---|---|---|---|---|
| DeepSeek-R1 | 92.4% | 1,884 | 3,500 | Underthinking |
| OpenAI o3-mini | 97.8% | 7,150 | 8,192 | Unbounded |
| ODAR (Ours) | 98.2% | 2,550 | 6,900 | Deterministic |
| Metric | MATH | HLE | BoolQ | Avg. |
|---|---|---|---|---|
| Performance (Accuracy) | ||||
| Oracle (Upper Bound) | 99.1% | 62.5% | 99.8% | 95.2% |
| ODAR (Ours) | 98.2% | 54.8% | 98.1% | 89.6% |
| Optimality Ratio | 99.1% | 87.7% | 98.3% | 94.1% |
| Efficiency (Inference Calls) | ||||
| Oracle (Minimum) | 2.10 | 12.5 | 1.00 | 1.95 |
| Method | Model | Pearson | Latency | Throughput |
|---|---|---|---|---|
| LLM-Judge | GPT-4o-mini | 0.78 | 450ms | 2 req/s |
| Deep Learning | DeBERTa-v3 | 0.81 | 15ms (GPU) | 60 req/s |
| ODAR DE | Linear | 0.79 | 1ms (CPU) | 10k req/s |
| MATH | BBH | HLE | Relative Cost | |
|---|---|---|---|---|
| 1 | 91.8 | 88.0 | 42.8 | 1.0 |
| 3 | 96.5 | 93.5 | 50.5 | 3.0 |
| 5 | 98.2 | 95.4 | 54.8 | 5.0 |
| 7 | 98.4 | 95.7 | 55.2 | 7.0 |
| 9 | 98.5 | 95.9 | 55.4 | 9.0 |
| Query Type | Query Content | Intrinsic Diff. | ODAR DE (Ours) | DeBERTa-v3 |
|---|---|---|---|---|
| Fact Retrieval | “Who is considered the father of Quantum Mechanics ?” | Simple | Simple (✓) | Hard (Overfit) |
| Simple Code | “Print ’Hello World’ in C++ .” | Simple | Simple (✓) | Medium (Overfit) |
| Derivation | “Derive the time-dependent Schrödinger equation.” | Hard | Hard (✓) | Hard (✓) |
| Method | Training | GPU-h | MATH | HLE |
|---|---|---|---|---|
| Self-Consistency | None | 0 | 86.5% | 39.5% |
| Supervised PRM | 800k samples | 500 | 97.1% | 45.8% |
| ODAR FEP | None | 0 | 96.7% | 47.3% |
| Scenario | Orig. | Adv. | Cost | Behavior |
|---|---|---|---|---|
| Simple Queries (GSM8K) | ||||
| Standard | 95.5% | — | 1.10 | Correct |
| Complexity Attack | — | 95.3% | +154% | Overthinking |
| Hard Queries (MATH) | ||||
| Standard | 52.4% | — | 4.50 | Correct |
| Shortcut Attack | — | 46.0% | 38% | Underestimation |
| Dataset | Mean Acc. ( ) | Subsample CI | Within MoE | Gain | 95% CI of |
|---|---|---|---|---|---|
| MATH | 98.2% | 0.38% | 0.82% | +6.4% | [5.8%, 7.0%] |
| GSM8K | 99.1% | 0.21% | 0.58% | +3.2% | [2.9%, 3.5%] |
| ARC-Challenge | 98.5% | 0.41% | 0.85% | +6.0% | [5.2%, 6.8%] |
| MMLU-Pro | 94.2% | 0.62% | 1.45% | +4.7% | [3.8%, 5.6%] |
| BBH | 95.4% | 0.55% | 1.31% | +4.2% | [3.5%, 4.9%] |
| HLE | 54.8% | 0.95% | – | +12.0% | [10.2%, 13.8%] |