cs.CLNov 27, 2026

KwaiSQL: Preference-Optimized Selection for Enhanced Text-to-SQL Generation

Authors: Danyang Zhao, Wenbo Zhang, Yan Li, Xiaohui Li, Fei Chen, Song Gao, Penghui Chen, Ruining Wang

Organizations: Kuaishou Technology

Abstract

Text-to-SQL systems increasingly combine candidate generation with query selection. When these two roles share a model, can learning to select better queries also improve generation? Both tasks require judging how faithfully SQL operations express a natural-language question, making candidate comparison a potential source of supervision for generation. We investigate this connection by training a shared model for SQL generation and selection. Starting from a tool-using generator trained with execution rewards, we apply preference learning to candidate selection and use the resulting checkpoint for both roles. We analyze how selection updates can benefit generation through shared parameters and evaluate the generated candidate pools before selection, using the same tools and sampling settings. On BIRD Dev, selection preference training raises generation-only pass@16 from 81.79% to 82.83%, increasing the coverage of questions with at least one correct candidate. The resulting model achieves 74.67% execution accuracy when used for both generation and selection. These findings show that learning to compare SQL candidates provides a training signal that improves candidate generation and raises the ceiling for final query selection.Our model is publicly available at https://huggingface.co/Kwai-AutoSQL/Kwai-AutoSQL-27B.

Figures & tables

Explore similar work

CardsList
  1. Replacing Training with Memory: Listwise Selection for Text-to-SQL

    Sep 1, 2026Yeonseok Jeong, Soyoung Yoon, Seongjun Lee +1Memory-Augmented Language ModelsLearning to Rank

  2. ACE-SQL: Adaptive Co-Optimization via Empirical Credit Assignment for Text-to-SQL

    Jun 4, 2026Xiaobing Chen, Ai Jian, Eryu Guo +1Execution-Guided Code GenerationSchema Linking

  3. R3^3-SQL: Ranking Reward and Resampling for Text-to-SQL

    Apr 28, 2026Hojae Han, Yeonseok Jeong, Seung-won Hwang +2Learning to RankText-to-SQL