Skip to main content

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:

  1. Single-Provider Contracts: Enterprise agreements may restrict usage to one vendor
  2. Compliance Requirements: Data residency or security policies may limit provider choices
  3. Cost Optimization: Customers may prefer a single, cost-effective provider
  4. Air-Gapped Deployments: Self-hosted environments may only have one model available
  5. 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

  1. Graceful Degradation: MoE must function with 1, 2, or 3+ providers
  2. Confidence Transparency: Verdicts must reflect reduced diversity
  3. Automatic Detection: System should detect available providers at runtime
  4. Per-Persona Fallbacks: Each judge persona needs provider-specific alternatives
  5. 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)

ProviderModelsNotes
Anthropicclaude-opus-4-5, claude-sonnet-4-5, claude-haiku-4-5Sonnet 4.5 is best coding model
OpenAIo3, o4-mini, gpt-4.1, gpt-4.1-minio3 is most reliable reasoning; gpt-4.1 has 1M context
DeepSeekdeepseek-v3.2, deepseek-reasoner, deepseek-chatV3.2 has thinking mode; IMO gold medal performance
Googlegemini-3-pro, gemini-3-flashGemini 3 Pro for agentic workflows
Metallama-4-maverick, llama-4-scoutMaverick beats GPT-4o; Scout fits on single H100
Alibabaqwen2.5-72b, qwen-maxSpecialized 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

  1. Universal Deployment: MoE works for all customers regardless of provider access
  2. Graceful Degradation: Quality degrades predictably, not catastrophically
  3. Transparent Confidence: Verdicts reflect actual diversity achieved
  4. Cost Flexibility: Single-provider mode with DeepSeek is highly cost-effective
  5. Enterprise Ready: Supports single-vendor enterprise agreements
  6. Self-Hosted Support: Works with Meta Llama in air-gapped environments
  7. Model Currency: Updated to January 2026 model versions

Negative

  1. Reduced Diversity: Single-provider mode has inherent vendor bias
  2. Configuration Complexity: More fallback paths to maintain
  3. Testing Surface: Must test all provider combinations
  4. Documentation Overhead: Customers need guidance on mode selection

Mitigations

  1. Confidence Transparency: -10% adjustment clearly signals reduced diversity
  2. Automated Detection: Provider mode auto-detected from API keys
  3. Per-Persona Fallbacks: Each persona has tested alternatives
  4. Prompt Diversity: Even with same model, different prompts provide some diversity

Implementation

Files Modified

FileChanges
config/judge-model-routing.jsonv2.0.0 with provider modes, updated models, fallbacks
config/judge-personas.jsonv2.0.0 with 5 new AI governance personas

Files Implemented

FileStatusCommit
scripts/moe_classifier/core/provider_detector.py✅ Implementedac3b8081
scripts/moe_classifier/core/persona_loader.py✅ Integrated54fd539b
scripts/moe_classifier/core/orchestrator.py✅ Integrated0a512d60
scripts/moe_classifier/core/multi_model_client.py✅ Integratede1503ba0
docs/guides/MOE-PROVIDER-CONFIGURATION-GUIDE.md✅ Created7e61a747

Test Coverage

Test FileTestsStatus
test_provider_detector.py23✅ Passing
test_persona_provider_integration.py19✅ Passing
test_orchestrator_provider_integration.py15✅ Passing
test_multi_model_provider_integration.py22✅ Passing
Total79✅ All Passing

Commands

CommandBehavior Change
/moe-judgesAuto-detects provider mode, adjusts panel composition
/classifyUses appropriate model based on available providers

Configuration Reference

Environment Variables

VariablePurposeValues
CODITECT_PROVIDER_MODEOverride auto-detectionsingle, dual, multi, auto
CODITECT_JUDGE_MODEL_<PERSONA>Override specific persona modelModel ID
ANTHROPIC_API_KEYAnthropic provider accessAPI key
OPENAI_API_KEYOpenAI provider accessAPI key
DEEPSEEK_API_KEYDeepSeek provider accessAPI key
GOOGLE_API_KEYGoogle provider accessAPI key
DASHSCOPE_API_KEYAlibaba/Qwen provider accessAPI key
TOGETHER_API_KEYMeta Llama provider accessAPI key

Provider Capabilities

ProviderSingle-Provider CapableModel TiersSelf-Hostable
AnthropicYes3 (Opus/Sonnet/Haiku)No
OpenAIYes3 (o3/4.1/4.1-mini)No
DeepSeekYes3 (reasoner/v3.2/chat)Yes
GoogleYes3 (Pro/Flash/2.0-Flash)No
MetaYes3 (Maverick/Scout/3.3)Yes
AlibabaNo2 (72b/max)Partial
  • ADR-060: MoE Verification Layer - Constitutional Court Architecture (parent)
  • ADR-052: Intent-Aware Context Management
  • ADR-053: Cloud Context Sync Architecture

References


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 document
  • ac3b8081 - ProviderDetector core implementation
  • 54fd539b - PersonaLoader integration
  • 0a512d60 - MoEOrchestrator integration
  • e1503ba0 - MultiModelClient integration