Technical Reports / TR-2025-02
—v1.0.0
Hybrid Model Routing
Architecture specification for Mavaia's HybridBridgeService achieving 96.7% local routing success. Documents intelligent routing between local models (Ollama) and cloud fallback, capability detection, and performance optimization.
Report ID
TR-2025-02
Type
Technical Analysis
Date
2025-10-28
Version
v1.0.0
Authors
Infrastructure Team
Abstract
We present Mavaia's Hybrid Model Routing architecture, a system that intelligently routes queries between local models and cloud APIs based on capability requirements, achieving 96.7% local routing success with graceful cloud fallback.
1. Introduction
Mavaia's Hybrid Model Routing addresses a fundamental challenge in local-first AI architectures: balancing privacy and offline capability with access to enhanced cloud model capabilities when needed. The HybridBridgeService implements intelligent routing that attempts local inference first, evaluates output quality, and conditionally escalates to cloud models only when local results are insufficient. This differs from cloud-first architectures that route all requests remotely, and pure local systems that lack cloud fallback. The routing system maintains 96.7% local success rate, meaning only 3.3% of queries require cloud escalation for genuine capability gaps rather than local model limitations.
2. Methodology
Hybrid routing operates through four-stage decision process. First, Query Analysis examines request complexity, required capabilities, and context requirements to predict whether local models can handle the query. Second, Local Inference executes the request using Ollama-hosted models (qwen3:1.7b, granite3.2:2b). Third, Quality Evaluation analyzes the local output using confidence scoring, factual consistency checks, and completeness assessment. Fourth, Conditional Escalation routes to cloud models (via Ollama Cloud API or direct provider APIs) if local output quality falls below acceptance threshold (0.70 confidence). The system maintains capability profiles for local models, learning which query types consistently require cloud escalation.
3. Results
Routing evaluation across 10,000 production queries showed 96.7% local routing success, with only 3.3% escalated to cloud models. Query analysis correctly predicted local capability in 94% of cases, with 6% requiring quality evaluation to determine escalation. Quality evaluation achieved 0.73 correlation between confidence scores and user-validated output quality. Cloud escalation improved response quality by 31% for the 3.3% of escalated queries. Average latency: 1.8s for local-only, 4.2s for cloud-escalated queries. The system maintained 100% offline functionality by providing best-effort local responses when cloud connectivity was unavailable.
4. Discussion
The Hybrid Model Routing architecture demonstrates that most AI assistant queries can be handled by smaller local models without sacrificing user experience. The 96.7% local success rate proves that cloud capabilities are only necessary for a small percentage of complex queries. The 31% quality improvement for escalated queries validates that cloud fallback provides genuine value rather than serving as unnecessary escalation. The architecture's strength lies in treating local-first as default while maintaining cloud access as enhancement rather than requirement. The 100% offline functionality ensures the system remains useful without network connectivity, degrading gracefully rather than failing completely.
5. Limitations
Current limitations include: (1) Query analysis prediction (94% accuracy) occasionally misroutes simple queries to cloud, incurring unnecessary latency and cost, (2) Quality evaluation adds 200-400ms latency even for queries that ultimately use local results, (3) Capability profiles learn slowly, requiring 50-100 examples before reliably predicting escalation needs, (4) The 0.70 confidence threshold is manually tuned rather than adaptive to user quality preferences, (5) Cloud escalation uses Ollama Cloud API as primary provider without intelligent model selection across multiple cloud services, (6) The system doesn't yet implement hybrid inference where local and cloud models collaborate on single queries.
6. Conclusion
Mavaia's Hybrid Model Routing architecture enables local-first AI with intelligent cloud fallback, achieving 96.7% local routing success while maintaining quality through conditional escalation. The system demonstrates that privacy-preserving local inference can handle the vast majority of AI assistant queries, with cloud capabilities reserved for genuine complexity gaps. Future work will focus on improved query analysis prediction, reduced quality evaluation latency, faster capability profile learning, adaptive confidence thresholds, multi-provider cloud routing, and hybrid inference where local and cloud models collaborate on challenging queries.