Abstract
Recent advances in Text-to-SQL have achieved strong results in static, single-turn tasks, where models generate SQL queries from natural language questions. However, these systems fall short in real-world interactive scenarios, where user intents evolve and queries must be refined over multiple turns. In applications such as finance and business analytics, users iteratively adjust query constraints or dimensions based on intermediate results. To evaluate such dynamic capabilities, we introduce DySQL-Bench, a benchmark assessing model performance under evolving user interactions. Unlike previous manually curated datasets, DySQL-Bench is built through an automated two-stage pipeline of task synthesis and verification. Structured tree representations derived from raw database tables guide LLM-based task generation, followed by interaction-oriented filtering and expert validation. Human evaluation confirms 100% correctness of the synthesized data. We further propose a multi-turn evaluation framework simulating realistic interactions among an LLM-simulated user, the model under test, and an executable database. The model must adapt its reasoning and SQL generation as user intents change. DySQL-Bench covers 13 domains across BIRD and Spider 2 databases, totaling 1,072 tasks. Even GPT-4o attains only 58.34% overall accuracy and 23.81% on the Pass@5 metric, underscoring the benchmark's difficulty.
Introduction: Beyond Static Queries
Most Text-to-SQL research treats database interaction as a static, one-and-done task: a user asks a question, and the model provides a SELECT query. In the real world, data exploration is messy and iterative. Users might start with a vague request, refine their constraints based on intermediate results, or need to update and delete records as they go.
Existing benchmarks like Spider or BIRD fail to capture this "stateful" reality. They largely ignore write operations (INSERT, UPDATE, DELETE) and don't account for how a model must adapt when the database state changes between turns. To address this, we propose moving from "Text-to-SQL" to "Text-to-Interaction."
Methodology: The DySQL-Bench Pipeline
To create a high-quality, automated benchmark that reflects real-world complexity, we developed a two-stage pipeline focusing on task synthesis and rigorous verification.
1. Task Synthesis via Tree Structures
Instead of inefficiently querying live databases to find samples, we transform relational tables into hierarchical tree structures. This representation allows an LLM (GPT-4o) to sample related data points efficiently and generate realistic multi-turn instructions that maintain logical consistency across turns.
2. Task Verification and Refinement
To ensure the data is "gold standard," we employ a "Verifier Committee" of multiple LLMs to filter out hallucinations and syntax errors. This is followed by a final round of manual inspection by ten human experts to ensure 100% correctness.
3. Triadic Interaction Framework
For evaluation, we use a triadic setup:
- Simulated User: An LLM (Qwen2.5-72B) acting as a human with a specific goal.
- Evaluated Agent: The model under test (e.g., GPT-4o, Llama-3).
- Executable Database: A real SQLite environment providing feedback and maintaining state.
Key Insights and Results
DySQL-Bench comprises 1,072 tasks across 13 domains. Notably, nearly 50% of the operations are UPDATE queries, reflecting real-world data management needs. Our evaluation revealed several critical bottlenecks in current LLM capabilities:
- The "Extrinsic Hallucination" Trap: Models frequently hallucinate query results. Instead of waiting for the database to return a value (like a User ID), models often "make up" a value and proceed. DeepSeek-V3, for instance, showed a hallucination rate exceeding 44%.
- The Scaling Plateau: Performance generally improves as models scale to roughly 70B parameters. However, beyond this point, gains in interaction logic diminish, suggesting that language proficiency alone is insufficient for complex state management.
- Repetition Loops: Some models fall into "infinite loops," repeatedly outputting the same SQL query even after successful execution, failing to recognize task progression.
- Performance Benchmarks: Even top-tier models struggle. GPT-4o achieved only 58.34% overall accuracy. The Qwen2.5 series (Max and 72B-Instruct) generally outperformed others, showing superior reasoning stability across multiple turns.
Conclusion
DySQL-Bench highlights that current LLMs lack robust logic for stateful, multi-turn database interactions. Future work must focus on schema-aware pretraining and reinforcement learning to penalize hallucinations and reward successful state transitions. Moving toward "pragmatic interaction"—where models know when to terminate a task or how to handle ambiguity—is essential for deploying AI agents in real-world business and analytics environments.
Summary updated