Skip to content

marcusjihansson/routing-intelligence

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Adaptive Reasoning System

An intelligent question-answering system that routes questions to different reasoning strategies based on their characteristics (breadth and depth).

Quick Start

# Install dependencies
uv sync

# Run demo (no API keys needed - uses mock LM)
uv run python -m thinking.scripts.demo_proof_of_concept

# Run with real LM via OpenRouter
export OPENROUTER_API_KEY='sk-or-v1-...'
uv run python -m thinking.scripts.lm_proof_of_concept

Overview

This project focuses on routing intelligence—analyzing a question and selecting the optimal reasoning strategy for answering it. This is distinct from model routing, which routes questions to different model tiers based on cost.

Key Distinction

Aspect Routing Intelligence Model Routing
What is routed Questions → Reasoning forms Questions → Model tiers
Basis for routing Question complexity (breadth/depth) Question complexity + cost constraints
Goal Match reasoning strategy to question type Minimize cost while maintaining quality

Reasoning Modes

The system implements 6 reasoning modes:

Mode Description Best For
DIRECT Single prediction Simple factual questions
COT (Chain of Thought) Step-by-step reasoning Questions requiring logical steps
TOT (Tree of Thoughts) Multiple interpretation paths Ambiguous questions with multiple valid interpretations
GoT (Graph of Thoughts) Interconnected concept analysis Complex multi-domain queries
AoT (Atom of Thoughts) First-principles decomposition Technical troubleshooting, deep understanding
COMBINED Multi-strategy synthesis Complex problems requiring multiple approaches

Core Mechanism

Question → Breadth/Depth Analysis → Classifier → Reasoning Mode Selection → Answer

Breadth Score

Does this question require information from multiple domains?

  • Low: "What's my total revenue this month?"
  • High: "How should I restructure my product categories for better SEO and easier inventory management?"

Depth Score

Does this question require understanding underlying mechanisms?

  • Low: "Show me my top 10 products"
  • High: "Why is my inventory sync failing for this specific SKU?"

Research Focus Areas

  1. How well can AI classify questions by their reasoning needs?
  2. Can thresholds improve routing robustness?
  3. Does GEPA optimization improve classifier accuracy?

Project Structure

src/thinking/
├── core/           # Routing + reasoning modes
├── scripts/        # Runnable demos (python -m thinking.scripts...)
├── experiments/    # Evaluation harness + reports
├── optimizations/  # Training/evaluation utilities (GEPA/teleprompt)
└── docs/           # Detailed documentation

Documentation

Shopify-Specific Documentation

For the Shopify Sidekick use case, see:

Acknowledgments

This project draws on the public case study available at claude.com/customers/shopify.

About

This is a research project of the premise that: we should be able to route different queries to different thought models (eg. chain of thought) and then optimize this routing of queries.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors