ADR-073: MoE Provider Flexibility - Single to Multi-Provider Modes
Status
Implemented - January 16, 2026
Context
Problem Statement
The MoE Constitutional Court architecture (ADR-060) was designed assuming customers have access to multiple LLM providers (Anthropic, OpenAI, DeepSeek, Google, Meta). However, enterprise customers often have constraints:
- Single-Provider Contracts: Enterprise agreements may restrict usage to one vendor
- Compliance Requirements: Data residency or security policies may limit provider choices
- Cost Optimization: Customers may prefer a single, cost-effective provider
- Air-Gapped Deployments: Self-hosted environments may only have one model available
- API Key Availability: Not all customers have accounts with multiple providers
Current Limitation
ADR-060 specifies:
- Minimum 3 model families required
- Maximum 40% weight on single model
- Multi-provider diversity for bias reduction
This excludes customers who cannot meet these requirements.
Requirements
- Graceful Degradation: MoE must function with 1, 2, or 3+ providers
- Confidence Transparency: Verdicts must reflect reduced diversity
- Automatic Detection: System should detect available providers at runtime
- Per-Persona Fallbacks: Each judge persona needs provider-specific alternatives
- Model Currency: Support for latest models (January 2026)
Decision
Extend the MoE architecture with Provider Modes that adapt the Constitutional Court pattern based on available LLM providers.
1. Provider Mode Architecture
┌─────────────────────────────────────────────────────────────────────────────┐
│ PROVIDER MODE DETECTION │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ Startup Detection │
│ ┌──────────────────────────────────────────────────────────────────────┐ │
│ │ 1. Check environment variables for API keys │ │
│ │ ANTHROPIC_API_KEY, OPENAI_API_KEY, DEEPSEEK_API_KEY, etc. │ │
│ │ │ │
│ │ 2. Check CODITECT_PROVIDER_MODE override (optional) │ │
│ │ Values: "single", "dual", "multi", "auto" (default) │ │
│ │ │ │
│ │ 3. Determine mode based on available providers │ │
│ └──────────────────────────────────────────────────────────────────────┘ │
│ │
│ │ │
│ ┌───────────────┼───────────────┐ │
│ │ │ │ │
│ ▼ ▼ ▼ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ SINGLE │ │ DUAL │ │ MULTI │ │
│ │ PROVIDER │ │ PROVIDER │ │ PROVIDER │ │
│ │ │ │ │ │ │ │
│ │ 1 provider │ │ 2 providers │ │ 3+ providers │ │
│ │ available │ │ available │ │ available │ │
│ └──────────────┘ └──────────────┘ └──────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
2. Single-Provider Mode
When only ONE LLM provider is available, the system uses Model Tier Diversity to simulate multiple perspectives:
┌─────────────────────────────────────────────────────────────────────────────┐
│ SINGLE-PROVIDER MODE │
│ Diversity Strategy: Model Tiers │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ ANTHROPIC-ONLY EXAMPLE │
│ ────────────────────── │
│ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │
│ │ FLAGSHIP │ │ BALANCED │ │ FAST │ │
│ │ │ │ │ │ │ │
│ │ claude-opus-4-5 │ │claude-sonnet-4-5│ │ claude-haiku-4-5│ │
│ │ │ │ │ │ │ │
│ │ • AI Risk │ │ • Technical │ │ • QA Evaluator │ │
│ │ Officer │ │ Architect │ │ │ │
│ │ • Privacy DPO │ │ • Ethics Review │ │ │ │
│ │ • Compliance │ │ • Security │ │ │ │
│ └─────────────────┘ └─────────────────┘ └─────────────────┘ │
│ │
│ DIVERSITY MECHANISMS │
│ ──────────────────── │
│ 1. Model Tier Separation │
│ • Flagship: Deep reasoning, complex analysis (Opus) │
│ • Balanced: General evaluation (Sonnet) │
│ • Fast: Quick checks, screening (Haiku) │
│ │
│ 2. Prompt Diversity │
│ • Each judge persona has unique evaluation prompts │
│ • Different focus areas even with same model │
│ • Persona demographics influence evaluation style │
│ │
│ 3. Confidence Adjustment: -10% │
│ • Verdicts reflect single-vendor bias risk │
│ • Final confidence = calculated_confidence × 0.90 │
│ │
│ SUPPORTED SINGLE-PROVIDER CONFIGURATIONS │
│ ┌────────────────┬─────────────────────────────────────────────────────┐ │
│ │ Provider │ Model Tiers (Flagship → Balanced → Fast) │ │
│ ├────────────────┼─────────────────────────────────────────────────────┤ │
│ │ Anthropic │ opus-4-5 → sonnet-4-5 → haiku-4-5 │ │
│ │ OpenAI │ o3 → gpt-4.1 → gpt-4.1-mini │ │
│ │ DeepSeek │ reasoner → v3.2 → chat │ │
│ │ Google │ gemini-3-pro → gemini-3-flash → gemini-2.0-flash │ │
│ │ Meta │ llama-4-maverick → llama-4-scout → llama-3.3-70b │ │
│ └────────────────┴─────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
3. Dual-Provider Mode
When TWO providers are available, the system uses Provider Alternation:
┌─────────────────────────────────────────────────────────────────────────────┐
│ DUAL-PROVIDER MODE │
│ Diversity Strategy: Alternation │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ ANTHROPIC + OPENAI EXAMPLE │
│ ─────────────────────────── │
│ │
│ ANTHROPIC OPENAI │
│ ┌─────────────────────┐ ┌─────────────────────┐ │
│ │ • Technical Arch │ │ • Compliance │ │
│ │ • Ethics Reviewer │ │ • Privacy DPO │ │
│ │ • QA Evaluator │ │ • Data Governance │ │
│ │ • AI Risk Officer │ │ │ │
│ └─────────────────────┘ └─────────────────────┘ │
│ │
│ RECOMMENDED PROVIDER PAIRS │
│ ┌────────────────────────┬─────────────────────────────────────────────┐ │
│ │ Pair │ Best For │ │
│ ├────────────────────────┼─────────────────────────────────────────────┤ │
│ │ Anthropic + OpenAI │ Best general coverage, enterprise │ │
│ │ Anthropic + DeepSeek │ Cost-optimized, strong coding │ │
│ │ OpenAI + Google │ Enterprise focus, multimodal │ │
│ │ DeepSeek + Meta │ Open-source friendly, self-hostable │ │
│ │ Google + Anthropic │ Multimodal + reasoning │ │
│ └────────────────────────┴─────────────────────────────────────────────┘ │
│ │
│ DIVERSITY MECHANISMS │
│ ──────────────────── │
│ 1. Provider Alternation │
│ • Personas distributed across providers │
│ • Cross-provider verification on disagreements │
│ │
│ 2. Architecture Diversity │
│ • Different training data, architectures │
│ • Reduces systematic blind spots │
│ │
│ 3. Confidence Adjustment: -5% │
│ • Final confidence = calculated_confidence × 0.95 │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
4. Multi-Provider Mode (Full Constitutional Court)
When THREE or more providers are available, the full ADR-060 pattern applies:
┌─────────────────────────────────────────────────────────────────────────────┐
│ MULTI-PROVIDER MODE │
│ Full Constitutional Court (ADR-060 Compliant) │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ PROVIDER DISTRIBUTION (10 Personas across 4+ Providers) │
│ ───────────────────────────────────────────────────────── │
│ │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ ANTHROPIC │ │ OPENAI │ │ DEEPSEEK │ │ ALIBABA │ │
│ │ (30%) │ │ (25%) │ │ (20%) │ │ (15%) │ │
│ ├─────────────┤ ├─────────────┤ ├─────────────┤ ├─────────────┤ │
│ │Tech Arch │ │Compliance │ │Security │ │Healthcare │ │
│ │Ethics Review│ │Privacy DPO │ │ │ │Finance │ │
│ │AI Risk │ │Data Gov │ │ │ │ │ │
│ │QA Evaluator │ │ │ │ │ │ │ │
│ └─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘ │
│ │
│ CONSTRAINTS (from ADR-060) │
│ ────────────────────────── │
│ • Minimum 3 model families │
│ • Maximum 40% weight on single provider │
│ • Automatic fallback on provider failure │
│ │
│ CONFIDENCE ADJUSTMENT: 0% │
│ • Full diversity achieved │
│ • No penalty applied │
│ │
│ HIGH-RISK AI REVIEW PANEL (5 Judges, 3 Providers) │
│ ┌────────────────────────┬─────────────┬──────────────────────┐ │
│ │ Judge Persona │ Provider │ Model │ │
│ ├────────────────────────┼─────────────┼──────────────────────┤ │
│ │ ai_risk_officer │ Anthropic │ claude-opus-4-5 │ │
│ │ compliance_auditor │ OpenAI │ gpt-4.1 │ │
│ │ security_analyst │ DeepSeek │ deepseek-v3.2 │ │
│ │ ai_ethics_reviewer │ Anthropic │ claude-sonnet-4-5 │ │
│ │ privacy_dpo_specialist │ OpenAI │ gpt-4.1 │ │
│ └────────────────────────┴─────────────┴──────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
5. Model Routing Configuration (v2.0.0)
Each persona now has a single_provider_fallback map for graceful degradation:
{
"routing": {
"technical_architect": {
"primary_model": "claude-sonnet-4-5",
"backup_model": "claude-opus-4-5",
"model_family": "anthropic",
"single_provider_fallback": {
"anthropic": "claude-sonnet-4-5",
"openai": "gpt-4.1",
"deepseek": "deepseek-v3.2",
"google": "gemini-3-pro",
"meta": "llama-4-maverick"
}
}
}
}
6. Updated Model Support (January 2026)
| Provider | Models | Notes |
|---|---|---|
| Anthropic | claude-opus-4-5, claude-sonnet-4-5, claude-haiku-4-5 | Sonnet 4.5 is best coding model |
| OpenAI | o3, o4-mini, gpt-4.1, gpt-4.1-mini | o3 is most reliable reasoning; gpt-4.1 has 1M context |
| DeepSeek | deepseek-v3.2, deepseek-reasoner, deepseek-chat | V3.2 has thinking mode; IMO gold medal performance |
| gemini-3-pro, gemini-3-flash | Gemini 3 Pro for agentic workflows | |
| Meta | llama-4-maverick, llama-4-scout | Maverick beats GPT-4o; Scout fits on single H100 |
| Alibaba | qwen2.5-72b, qwen-max | Specialized for multilingual |
7. Runtime Behavior
class ProviderModeDetector:
"""Detect and configure provider mode at runtime."""
def detect_mode(self) -> ProviderMode:
"""
Detection priority:
1. CODITECT_PROVIDER_MODE environment variable
2. Auto-detect from available API keys
"""
override = os.getenv("CODITECT_PROVIDER_MODE")
if override:
return ProviderMode(override)
available = self._detect_available_providers()
if len(available) >= 3:
return ProviderMode.MULTI
elif len(available) == 2:
return ProviderMode.DUAL
else:
return ProviderMode.SINGLE
def _detect_available_providers(self) -> List[str]:
"""Check which providers have valid API keys."""
providers = []
env_keys = {
"anthropic": "ANTHROPIC_API_KEY",
"openai": "OPENAI_API_KEY",
"deepseek": "DEEPSEEK_API_KEY",
"google": "GOOGLE_API_KEY",
"alibaba": "DASHSCOPE_API_KEY",
"meta": "TOGETHER_API_KEY"
}
for provider, env_var in env_keys.items():
if os.getenv(env_var):
providers.append(provider)
return providers
class PersonaLoader:
"""Extended persona loader with provider mode support."""
def get_model_for_persona(
self,
persona_id: str,
mode: ProviderMode,
available_providers: List[str]
) -> str:
"""
Model selection with provider mode awareness.
Priority:
1. Environment: CODITECT_JUDGE_MODEL_<PERSONA_ID>
2. Runtime override from API call
3. Mode-appropriate selection from routing config
"""
# Check environment override
env_key = f"CODITECT_JUDGE_MODEL_{persona_id.upper()}"
if os.getenv(env_key):
return os.getenv(env_key)
routing = self.routing_config["routing"][persona_id]
if mode == ProviderMode.SINGLE:
provider = available_providers[0]
return routing["single_provider_fallback"][provider]
elif mode == ProviderMode.DUAL:
# Alternate between providers
return self._select_for_dual_mode(persona_id, available_providers)
else:
# Multi-provider: use primary model
return routing["primary_model"]
def adjust_confidence(
self,
confidence: float,
mode: ProviderMode
) -> float:
"""Apply mode-based confidence adjustment."""
adjustments = {
ProviderMode.SINGLE: -0.10,
ProviderMode.DUAL: -0.05,
ProviderMode.MULTI: 0.0
}
return confidence + adjustments[mode]
8. Configuration Examples
Single-Provider (Anthropic Only)
# Environment
export ANTHROPIC_API_KEY=sk-ant-...
export CODITECT_PROVIDER_MODE=single # Optional, auto-detected
# Panel composition uses model tiers
# AI Risk Officer → claude-opus-4-5 (flagship)
# Technical Architect → claude-sonnet-4-5 (balanced)
# QA Evaluator → claude-haiku-4-5 (fast)
Dual-Provider (Anthropic + DeepSeek)
# Environment
export ANTHROPIC_API_KEY=sk-ant-...
export DEEPSEEK_API_KEY=sk-...
# Personas alternate between providers
# Technical Architect → claude-sonnet-4-5
# Security Analyst → deepseek-v3.2
# Ethics Reviewer → claude-sonnet-4-5
# Compliance → deepseek-v3.2
Multi-Provider (Full Diversity)
# Environment
export ANTHROPIC_API_KEY=sk-ant-...
export OPENAI_API_KEY=sk-...
export DEEPSEEK_API_KEY=sk-...
export GOOGLE_API_KEY=...
# Full Constitutional Court pattern
# Primary models used for each persona
# Maximum diversity, no confidence penalty
Consequences
Positive
- Universal Deployment: MoE works for all customers regardless of provider access
- Graceful Degradation: Quality degrades predictably, not catastrophically
- Transparent Confidence: Verdicts reflect actual diversity achieved
- Cost Flexibility: Single-provider mode with DeepSeek is highly cost-effective
- Enterprise Ready: Supports single-vendor enterprise agreements
- Self-Hosted Support: Works with Meta Llama in air-gapped environments
- Model Currency: Updated to January 2026 model versions
Negative
- Reduced Diversity: Single-provider mode has inherent vendor bias
- Configuration Complexity: More fallback paths to maintain
- Testing Surface: Must test all provider combinations
- Documentation Overhead: Customers need guidance on mode selection
Mitigations
- Confidence Transparency: -10% adjustment clearly signals reduced diversity
- Automated Detection: Provider mode auto-detected from API keys
- Per-Persona Fallbacks: Each persona has tested alternatives
- Prompt Diversity: Even with same model, different prompts provide some diversity
Implementation
Files Modified
| File | Changes |
|---|---|
config/judge-model-routing.json | v2.0.0 with provider modes, updated models, fallbacks |
config/judge-personas.json | v2.0.0 with 5 new AI governance personas |
Files Implemented
| File | Status | Commit |
|---|---|---|
scripts/moe_classifier/core/provider_detector.py | ✅ Implemented | ac3b8081 |
scripts/moe_classifier/core/persona_loader.py | ✅ Integrated | 54fd539b |
scripts/moe_classifier/core/orchestrator.py | ✅ Integrated | 0a512d60 |
scripts/moe_classifier/core/multi_model_client.py | ✅ Integrated | e1503ba0 |
docs/guides/MOE-PROVIDER-CONFIGURATION-GUIDE.md | ✅ Created | 7e61a747 |
Test Coverage
| Test File | Tests | Status |
|---|---|---|
test_provider_detector.py | 23 | ✅ Passing |
test_persona_provider_integration.py | 19 | ✅ Passing |
test_orchestrator_provider_integration.py | 15 | ✅ Passing |
test_multi_model_provider_integration.py | 22 | ✅ Passing |
| Total | 79 | ✅ All Passing |
Commands
| Command | Behavior Change |
|---|---|
/moe-judges | Auto-detects provider mode, adjusts panel composition |
/classify | Uses appropriate model based on available providers |
Configuration Reference
Environment Variables
| Variable | Purpose | Values |
|---|---|---|
CODITECT_PROVIDER_MODE | Override auto-detection | single, dual, multi, auto |
CODITECT_JUDGE_MODEL_<PERSONA> | Override specific persona model | Model ID |
ANTHROPIC_API_KEY | Anthropic provider access | API key |
OPENAI_API_KEY | OpenAI provider access | API key |
DEEPSEEK_API_KEY | DeepSeek provider access | API key |
GOOGLE_API_KEY | Google provider access | API key |
DASHSCOPE_API_KEY | Alibaba/Qwen provider access | API key |
TOGETHER_API_KEY | Meta Llama provider access | API key |
Provider Capabilities
| Provider | Single-Provider Capable | Model Tiers | Self-Hostable |
|---|---|---|---|
| Anthropic | Yes | 3 (Opus/Sonnet/Haiku) | No |
| OpenAI | Yes | 3 (o3/4.1/4.1-mini) | No |
| DeepSeek | Yes | 3 (reasoner/v3.2/chat) | Yes |
| Yes | 3 (Pro/Flash/2.0-Flash) | No | |
| Meta | Yes | 3 (Maverick/Scout/3.3) | Yes |
| Alibaba | No | 2 (72b/max) | Partial |
Related ADRs
- ADR-060: MoE Verification Layer - Constitutional Court Architecture (parent)
- ADR-052: Intent-Aware Context Management
- ADR-053: Cloud Context Sync Architecture
References
- Anthropic Claude Models
- OpenAI o3 and o4-mini
- OpenAI GPT-4.1
- DeepSeek V3.2
- Meta Llama 4
- Google Gemini Models
Author: CODITECT Team
Reviewers: Architecture Council
Design Commits: 0091e7ae (judge-personas v2.0.0), 2d6517aa (model-routing v2.0.0)
Implementation Commits:
775b8560- ADR-073 documentac3b8081- ProviderDetector core implementation54fd539b- PersonaLoader integration0a512d60- MoEOrchestrator integratione1503ba0- MultiModelClient integration