What is Signal-Driven Decision?
Signal-Driven Decision is the core architecture that enables intelligent routing by extracting multiple signals from requests and combining them to make better routing decisions.
The Core Idea
Traditional routing uses a single signal:
# Traditional: Single classification model
if classifier(query) == "math":
route_to_math_model()
Signal-driven routing uses multiple signals:
# Signal-driven: Multiple signals combined
if (keyword_match AND domain_match) OR high_embedding_similarity:
route_to_math_model()
Why this matters: Multiple signals voting together make more accurate decisions than any single signal.
The 13 Signal Types
1. Keyword Signals
- What: Fast pattern matching with AND/OR operators
- Latency: Less than 1ms
- Use Case: Deterministic routing, compliance, security
signals:
keywords:
- name: "math_keywords"
operator: "OR"
keywords: ["calculate", "equation", "solve", "derivative"]
Example: "Calculate the derivative of x^2" → Matches "calculate" and "derivative"
2. Embedding Signals
- What: Semantic similarity using embeddings
- Latency: 10-50ms
- Use Case: Intent detection, paraphrase handling
signals:
embeddings:
- name: "code_debug"
threshold: 0.70
candidates:
- "My code isn't working, how do I fix it?"
- "Help me debug this function"
Example: "Need help debugging this function" → 0.78 similarity → Match!
3. Domain Signals
- What: MMLU domain classification (14 categories)
- Latency: 50-100ms
- Use Case: Academic and professional domain routing
signals:
domains:
- name: "mathematics"
mmlu_categories: ["abstract_algebra", "college_mathematics"]
Example: "Prove that the square root of 2 is irrational" → Mathematics domain
4. Fact Check Signals
- What: ML-based detection of queries needing fact verification
- Latency: 50-100ms
- Use Case: Healthcare, financial services, education
signals:
fact_checks:
- name: "factual_queries"
threshold: 0.75
Example: "What is the capital of France?" → Needs fact checking
5. User Feedback Signals
- What: Classification of user feedback and corrections
- Latency: 50-100ms
- Use Case: Customer support, adaptive learning
signals:
user_feedbacks:
- name: "negative_feedback"
feedback_types: ["correction", "dissatisfaction"]
Example: "That's wrong, try again" → Negative feedback detected
6. Preference Signals
- What: LLM-based route preference matching
- Latency: 200-500ms
- Use Case: Complex intent analysis
signals:
preferences:
- name: "creative_writing"
llm_endpoint: "http://localhost:8000/v1"
model: "gpt-4"
routes:
- name: "creative"
description: "Creative writing, storytelling, poetry"
Example: "Write a story about dragons" → Creative route preferred
7. Language Signals
- What: Multi-language detection (100+ languages)
- Latency: Less than 1ms
- Use Case: Route queries to language-specific models or apply language-specific policies
signals:
language:
- name: "en"
description: "English language queries"
- name: "es"
description: "Spanish language queries"
- name: "zh"
description: "Chinese language queries"
- name: "ru"
description: "Russian language queries"
- Example 1: "Hola, ¿cómo estás?" → Spanish (es) → Spanish model
- Example 2: "你好,世界" → Chinese (zh) → Chinese model
8. Context Signals
- What: Token-count based routing for short/long request handling
- Latency: 1ms (calculated during processing)
- Use Case: Route long-context requests to models with larger context windows
- Metrics: Tracks input token counts with
llm_context_token_counthistogram
signals:
context_rules:
- name: "low_token_count"
min_tokens: "0"
max_tokens: "1K"
description: "Short requests"
- name: "high_token_count"
min_tokens: "1K"
max_tokens: "128K"
description: "Long requests requiring large context window"
Example: A request with 5,000 tokens → Matches "high_token_count" → Routes to claude-3-opus
9. Complexity Signals
- What: Embedding-based query complexity classification (hard/easy/medium)
- Latency: 50-100ms (embedding computation)
- Use Case: Route complex queries to powerful models, simple queries to efficient models
- Logic: Two-step classification:
- Find best matching rule by comparing query to rule descriptions
- Classify difficulty within that rule using hard/easy candidate embeddings
signals:
complexity:
- name: "code_complexity"
threshold: 0.1
description: "Detects code complexity level"
hard:
candidates:
- "design distributed system"
- "implement consensus algorithm"
- "optimize for scale"
easy:
candidates:
- "print hello world"
- "loop through array"
- "read file"
Example: "How do I implement a distributed consensus algorithm?" → Matches "code_complexity" rule → High similarity to hard candidates → Returns "code_complexity:hard"
How it works:
- Query embedding is compared to each rule's description
- Best matching rule is selected (highest description similarity)
- Within that rule, query is compared to hard and easy candidates
- Difficulty signal = max_hard_similarity - max_easy_similarity
- If signal > threshold: "hard", if signal < -threshold: "easy", else: "medium"