The growing volume of structured data across domains poses a major barrier for non-technical users, who are prevented from unlocking its value by the inherent complexity of SQL-based interactions. This model limits access to data and hinders agile, evidence-based decision-making. In this paper, introduce a novel question-and-answer multi-agent system that processes natural-language questions and generates real SQL queries to generate logical explanations or live data displays, thereby aiding users’ understanding of and confidence in search results. The system is typically described as a highly specialized set of agents, with a central ReAct-style SQL agent that performs reasoning and query generation. This base agent is supplemented by an Optimizer Agent for rapid optimization and an Explanation Agent for a parsed explanation of the query intent. We extensively benchmark the framework in a head-to-head comparison of two state-of-the-art LLMs (AIMS, MISTral) on a fine-grained, stratified SQL task benchmark. Experimental results consistently demonstrate that Gemini outperforms Mistral in terms of syntactic fidelity and exact-match precision, particularly for low- to mid-complexity queries. Mistral, on the other hand, exhibits strong semantic robustness, with high execution accuracy even for queries that use syntactically variant but semantically similar SQL. The findings demonstrate the transformative potential of emerging agent architectures to democratize complex and structured datasets by fostering greater data literacy and organizational agility.
Paper
Full text
An Agentic Framework for Robust and Explainable Natural Language to SQL Generation
Semantic Scholar · 2025
Abstract
The growing volume of structured data across domains poses a major barrier for non-technical users, who are prevented from unlocking its value by the inherent complexity of SQL-based interactions. This model limits access to data and hinders agile, evidence-based decision-making. In this paper, introduce a novel question-and-answer multi-agent system that processes natural-language questions and generates real SQL queries to generate logical explanations or live data displays, thereby aiding users’ understanding of and confidence in search results. The system is typically described as a highly specialized set of agents, with a central ReAct-style SQL agent that performs reasoning and query generation. This base agent is supplemented by an Optimizer Agent for rapid optimization and an Explanation Agent for a parsed explanation of the query intent. We extensively benchmark the framework in a head-to-head comparison of two state-of-the-art LLMs (AIMS, MISTral) on a fine-grained, stratified SQL task benchmark. Experimental results consistently demonstrate that Gemini outperforms Mistral in terms of syntactic fidelity and exact-match precision, particularly for low- to mid-complexity queries. Mistral, on the other hand, exhibits strong semantic robustness, with high execution accuracy even for queries that use syntactically variant but semantically similar SQL. The findings demonstrate the transformative potential of emerging agent architectures to democratize complex and structured datasets by fostering greater data literacy and organizational agility.