LLM Routing for Text-to-SQL
An LLM routing orchestration framework for academic research on NL2SQL agentic workflows, implementing three distinct routing strategies.
About this Project
Built an LLM routing orchestration framework for my Master's research on NL2SQL agentic workflows. The framework implements three routing strategies to optimize model selection for database query generation:
**Matrix Router**: A neural network-based approach that learns routing patterns from query characteristics and historical performance data.
**RAG Router**: Uses semantic search to find similar past queries and routes based on which models performed best for those queries.
**Supervisor Agent Router**: A meta-LLM that analyzes incoming queries and makes routing decisions based on query complexity, domain, and required capabilities.
The system integrates with MLflow for performance tracking using custom SQL accuracy metrics, supporting models from Vertex AI, Anthropic, OpenAI, and local deployments. This research contributes to understanding how intelligent routing can balance cost, latency, and accuracy in production NL2SQL systems.
Key Highlights
- Implemented 3 routing strategies: Matrix, RAG, and Supervisor Agent
- Custom SQL accuracy metrics integrated with MLflow
- Multi-provider support: Vertex AI, Anthropic, OpenAI
- Part of MEng thesis research at Stellenbosch University