Table of Contents
Fetching ...

Sparks of Tabular Reasoning via Text2SQL Reinforcement Learning

Josefa Lia Stoisser, Marc Boubnovski Martell, Julien Fauqueur

TL;DR

This work reframes Text-to-SQL as a pathway for developing transferable tabular reasoning in LLMs, moving beyond mere query generation. It introduces a two-stage framework: synthetic chain-of-thought supervision to ground reasoning in SQL structure, and Group Relative Policy Optimization (GRPO) to align execution accuracy with generalizable table reasoning. Empirical results show improvements on standard Text-to-SQL benchmarks and substantial gains on reasoning-intensive CPT tasks like CRT-QA, with a distilled LLaMA achieving a relative increase of 33.9% and Qwen 14.5%. The findings suggest SQL can serve as an effective scaffold for robust tabular reasoning, with potential for scaling to larger models and richer reward configurations.

Abstract

This work reframes the Text-to-SQL task as a pathway for teaching large language models (LLMs) to reason over and manipulate tabular data--moving beyond the traditional focus on query generation. We propose a two-stage framework that leverages SQL supervision to develop transferable table reasoning capabilities. First, we synthesize detailed chain-of-thought (CoT) traces from real-world SQL queries, providing step-by-step, clause-level supervision that teaches the model how to traverse, filter, and aggregate table fields. Second, we introduce a Group Relative Policy Optimization (GRPO) reinforcement learning objective that connects SQL execution accuracy to generalizable reasoning by encouraging steps that extend beyond task-specific syntax and transfer across datasets. Empirically, our approach improves performance on standard Text-to-SQL benchmarks and achieves substantial gains on reasoning-intensive datasets such as BIRD and CRT-QA, demonstrating enhanced generalization and interpretability. Specifically, the distilled-quantized LLaMA model achieved a relative 33.9\% increase in accuracy when trained on Text-to-SQL tasks, while Qwen achieved a relative 14.5\% increase. These results suggest that SQL can serve not only as a target formalism but also as an effective scaffold for learning robust, transferable reasoning over structured data.

Sparks of Tabular Reasoning via Text2SQL Reinforcement Learning

TL;DR

This work reframes Text-to-SQL as a pathway for developing transferable tabular reasoning in LLMs, moving beyond mere query generation. It introduces a two-stage framework: synthetic chain-of-thought supervision to ground reasoning in SQL structure, and Group Relative Policy Optimization (GRPO) to align execution accuracy with generalizable table reasoning. Empirical results show improvements on standard Text-to-SQL benchmarks and substantial gains on reasoning-intensive CPT tasks like CRT-QA, with a distilled LLaMA achieving a relative increase of 33.9% and Qwen 14.5%. The findings suggest SQL can serve as an effective scaffold for robust tabular reasoning, with potential for scaling to larger models and richer reward configurations.

Abstract

This work reframes the Text-to-SQL task as a pathway for teaching large language models (LLMs) to reason over and manipulate tabular data--moving beyond the traditional focus on query generation. We propose a two-stage framework that leverages SQL supervision to develop transferable table reasoning capabilities. First, we synthesize detailed chain-of-thought (CoT) traces from real-world SQL queries, providing step-by-step, clause-level supervision that teaches the model how to traverse, filter, and aggregate table fields. Second, we introduce a Group Relative Policy Optimization (GRPO) reinforcement learning objective that connects SQL execution accuracy to generalizable reasoning by encouraging steps that extend beyond task-specific syntax and transfer across datasets. Empirically, our approach improves performance on standard Text-to-SQL benchmarks and achieves substantial gains on reasoning-intensive datasets such as BIRD and CRT-QA, demonstrating enhanced generalization and interpretability. Specifically, the distilled-quantized LLaMA model achieved a relative 33.9\% increase in accuracy when trained on Text-to-SQL tasks, while Qwen achieved a relative 14.5\% increase. These results suggest that SQL can serve not only as a target formalism but also as an effective scaffold for learning robust, transferable reasoning over structured data.
Paper Structure (25 sections, 2 equations, 4 figures, 2 tables)

This paper contains 25 sections, 2 equations, 4 figures, 2 tables.

Figures (4)

  • Figure 1: Training on Text-to-SQL, Evaluating on Dual Tasks. Our framework is trained solely on Text-to-SQL data, using structured supervision from CoT traces and reinforcement learning objectives. At evaluation time, we assess performance on both Text-to-SQL benchmarks and tabular question answering tasks. This setup tests whether SQL-centered training can induce reasoning capabilities that generalize beyond query generation to broader table-based inference.
  • Figure 2: Overview of the training pipeline. Given a natural language question and schema, we generate SQL queries and CoT traces using a pretrained o3-mini. A second model filters these outputs by judging correctness and consistency. Verified traces are used for supervised fine-tuning on Clinton, followed by GRPO on the BIRD dataset. This two-stage training process promotes generalization across both SQL generation and tabular question answering.
  • Figure 3: SQL-Structured Reasoning in Tabular QA. An LLM answering a natural language question over a table. While the output is a binary response ("Yes"), the model’s internal reasoning implicitly follows an SQL-like logic: it compares subsets of rows filtered by different conditions to support its answer. This illustrates how models may invoke formal query structures even when the task does not explicitly require SQL, reflecting an internal alignment between table QA and SQL semantics.
  • Figure 4: Table-Guided CoT in LLMs for SQL Generation. A reasoning trace from an LLM translating a natural language question into SQL. The model first interprets the task by examining the schema and example table rows, breaks the logic down into actionable steps, and validates the final SQL query through hypothetical execution. This illustrates how structured table understanding can guide accurate SQL synthesis.