Abstract
This paper benchmarks the impact of "agentic" workflows—structured multi-step reasoning processes—on Large Language Model (LLM) performance in Text-to-SQL tasks. By evaluating strategies such as Divide-and-Conquer, result verification, and parallel scaling across models like Gemini 2.5 Flash and GPT-4o, we analyze the trade-offs between accuracy, latency, and token cost. Our findings reveal that while reasoning-optimized models benefit significantly from procedural guidance, the selection of a superior base model often yields greater performance gains than increasing workflow complexity.
Introduction
Translating natural language into SQL (Text2SQL) is essential for democratizing data access. To improve accuracy, the field has shifted from simple prompting toward complex "agentic workflows" that incorporate self-correction and sub-task decomposition. However, the emergence of "reasoning models" (e.g., OpenAI o-series, Gemini 2.5) raises a critical question: do these models still require complex external wrappers? This study evaluates these trade-offs using the BIRD Mini-Dev benchmark, a complex dataset of 500 question-SQL pairs requiring deep understanding of large industrial database schemas.
Methods
We evaluated six representative agentic workflows across four LLMs: Gemini 1.5 Flash, Gemini 2.5 Flash, GPT-4o, and o4-mini. The strategies included:
- CoT + ReAct (Baseline): A loop of thinking, acting, and observing to refine queries based on execution errors.
- Divide-and-Conquer (DC): Breaking complex queries into manageable sub-problems.
- Few-Shot Demonstrations: Utilizing three examples of successful task completion.
- Parallel Scaling: Generating multiple candidates and selecting the best via majority vote or a selector agent.
- Result Verification: Adding a feedback step to ensure semantic alignment with the user's request.
- Retrieval-based Reasoning: Pruning database schemas using keyword and entity retrieval before generation.
Key Results and Insights
Accuracy vs. Model Capability
One of the most significant findings is that a superior base model often acts as a "trump card." For instance, Gemini 2.5 Flash using a simple baseline workflow outperformed GPT-4o even when the latter utilized the most complex agentic workflows. This suggests that practitioners should prioritize model selection before workflow optimization.
However, reasoning models still benefit from guidance. The o4-mini model saw its Soft F1 score jump from 56.3 to 65.5 when using the Divide-and-Conquer workflow, indicating that internal reasoning capabilities do not entirely replace the need for external procedural maps.
The Latency-Accuracy Trade-off
While complex workflows like "Verification" provide consistent performance boosts, they incur a heavy "latency tax." As shown in the inference time data, adding verification steps can nearly double the time required for a response. For example, GPT-4o's latency increased from approximately 14 seconds to 28 seconds under the verification strategy.
The Retrieval Trap
Contrary to expectations, retrieval-based reasoning often degraded performance. If the retrieval step failed to identify even a single necessary column, the subsequent SQL generation was fundamentally compromised, leading to higher logic error rates than the baseline.
Conclusion
The study concludes that the combination of Divide-and-Conquer + 3-shot examples + ReAct is the most consistent and efficient strategy for industrial Text2SQL applications. While agentic workflows offer clear benefits, their high latency and token costs must be balanced against the inherent capabilities of the base model. Future work should focus on optimizing the retrieval phase to prevent the "blindness" issues observed and exploring speed-vs-accuracy modes for end-user applications.
Summary updated