Reinforcing Code Generation: Improving Text-to-SQL with Execution-Based Learning

Atharv Kulkarni, Vivek Srikumar
6/6/2025
cs.CL

No confident code implementation found for this paper.

Abstract

In this work, we study the problem of code generation with a large language model (LLM), with a focus on generating SQL queries from natural language questions. We ask: Instead of using supervised fine tuning with text-code pairs, can we tune a model by having it interact with a database engine? We frame this problem as a reinforcement learning problem where the model receives execution-based feedback from the environment in the form of scalar rewards. These rewards penalize execution failures and assign positive values when a query returns a correct answer. We use the rewards within the Group Relative Policy Optimization (GRPO) framework. We use a tabular reasoning benchmark to test and evaluate our findings. We find that with only weak supervision in the form of question-answer pairs, RL-tuning improves the accuracy of model generated SQL code from 31.49 to 49.83 while reducing error percentage from 25.43% to 14.71%. This improvement allowed the model nearly match the performance performance to the larger SQLCoder-70B model. Our work demonstrates the potential of using execution-based feedback to improve symbolic reasoning capabilities of LLMs.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{kulkarni2025reinforcing,
  title  = {Reinforcing Code Generation: Improving Text-to-SQL with Execution-Based Learning},
  author = {Atharv Kulkarni and Vivek Srikumar},
  year   = {2025},
  eprint = {2506.06093},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2506.06093v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2506.06093.svg)](https://codeofpaper.com/paper/2506.06093)

Discussion