Abstract
We present SpotIt+, an open-source tool for evaluating Text-to-SQL systems via bounded equivalence verification. Given a generated SQL query and the ground truth, SpotIt+ actively searches for database instances that differentiate the two queries. To ensure that the generated counterexamples reflect practically relevant discrepancies, we introduce a constraint-mining pipeline that combines rule-based specification mining over example databases with LLM-based validation. Experimental results on the BIRD dataset show that the mined constraints enable SpotIt+ to generate more realistic differentiating databases, while preserving its ability to efficiently uncover numerous discrepancies between generated and gold SQL queries that are missed by standard test-based evaluation.
Introduction
The current standard for evaluating Text-to-SQL systems relies on test-based evaluation, where a generated query's output is compared against a reference "gold" query on a fixed database. However, this approach is often overly optimistic; two logically distinct queries may yield identical results on a specific, limited dataset, leading to false positives in accuracy metrics. While formal verification using SMT solvers can identify any logical discrepancy, traditional tools often produce "pathological" counterexamples—mathematically valid but practically impossible database states. SpotIt+ addresses this by incorporating realistic database constraints into the verification process.
Methodology
SpotIt+ introduces a constraint-mining pipeline to bridge the gap between formal logic and real-world data distributions. The system architecture integrates automated mining with LLM-based refinement to ensure the verifier operates within plausible domain boundaries.
The pipeline consists of three primary stages:
- Specification Mining: The tool analyzes the example database to infer implicit constraints, including numeric ranges, categorical sets, nullability, functional dependencies, and ordering inequalities.
- LLM Validation and Repair: To prevent overfitting to small samples, an LLM (e.g., GPT-4o) acts as a domain expert to validate these constraints and relax overly restrictive bounds (e.g., adjusting an observed age range of 30–60 to a more general 0–120).
- Bounded Equivalence Verification: Validated constraints are passed to VeriEQL, an SMT-based engine that searches for a small database instance (up to 5 rows) where the generated and gold queries diverge while adhering to the realistic constraints.
Experimental Results
The system was evaluated on the BIRD (Big Bench for Large-scale Database Grounding) dataset, covering 1,533 questions across 11 domains. We tested 10 state-of-the-art Text-to-SQL methods currently on the BIRD leaderboard.
As shown in the performance table, SpotIt+ reveals a significant "realism gap." While models might achieve high accuracy on standard test sets (EX-test), their logical accuracy drops significantly when subjected to rigorous verification (EX-SpotIt+). For instance, the top-performing model's accuracy fell from approximately 71% to 63%.
Key Findings
- Uncovering Hidden Errors: Verification identifies discrepancies missed by static test databases, proving that many "correct" queries are only accidentally correct on specific data.
- Improved Realism: Counterexamples generated with constraints are more readable and domain-relevant, using plausible strings (e.g., "Prague") and numeric values rather than random noise.
- Efficiency: The addition of constraints actually speeds up verification (0.9s vs 1.7s average) by pruning the SMT solver's search space.
Conclusion and Future Work
SpotIt+ demonstrates that combining formal verification with automated constraint mining provides a more robust and realistic evaluation of Text-to-SQL systems. By moving from mathematical identity to functional identity within real-world contexts, it offers a more reliable metric for model performance. Future work will focus on expanding constraint mining to cross-table relationships and increasing the coverage of complex SQL fragments.
Summary updated