AI
RingSQL bridges synthetic and real data for training SQL-generation models
A new hybrid approach combines template-based queries with LLM paraphrasing to generate high-quality training data that boosts text-to-SQL performance across multiple architectures.
Researchers have introduced RingSQL, a framework designed to tackle a persistent bottleneck in training text-to-SQL systems: the scarcity of high-quality paired examples of natural language questions and their corresponding SQL queries.
The core challenge#
Building effective text-to-SQL models requires substantial annotated training data, a constraint that becomes especially critical for newer reinforcement learning approaches like RLVR. These methods are particularly vulnerable to noisy examples, which can lead to incorrect learned behaviors. While manual data collection produces reliable results, it's labor-intensive and costly. Existing workarounds have exposed a familiar trade-off: template-based generation guarantees correctness but demands schema-specific setup and produces repetitive outputs, whereas language model-based synthesis scales effortlessly but provides no assurance of data quality.
How RingSQL works#
The framework combines the strengths of both approaches through a two-stage process. It begins with schema-independent query templates—reusable SQL patterns that don't depend on specific database structures—ensuring the underlying SQL remains logically sound regardless of complexity. It then applies LLM-based paraphrasing to generate natural language questions that genuinely match each template-generated query, rather than relying on the LLM to independently produce SQL.
By anchoring question creation in validated template queries, RingSQL preserves the semantic link between questions and SQL across all difficulty levels. This grounding solves a fundamental weakness of pure LLM generation, which frequently produces questions that don't faithfully correspond to the queries they purport to ask.
Results and impact#
Testing showed RingSQL achieved an average accuracy of 69.8% when used to train models on multiple standard benchmarks. The synthetic dataset outperformed both the next-best synthetic option by 2.1 percentage points and human-annotated training sets from the Spider and BIRD datasets. Crucially, RingSQL was the only synthetic dataset tested that consistently improved performance across all evaluated model architectures and evaluation sets.
Code and data supporting the work are publicly available for use by the research community.

