CodeS: Towards Building Open-source Language Models for Text-to-SQL

Haoyang Li, Jing Zhang, Hanbing Liu, Ju Fan, Xiaokang Zhang +5 more
2/26/2024
cs.CLcs.DB

No official code found. Best implementation: RUCKBReasoning/codes (199 stars, Apache-2.0, last commit 2024-11-20).

Abstract

Language models have shown promising performance on the task of translating natural language questions into SQL queries (Text-to-SQL). However, most of the state-of-the-art (SOTA) approaches rely on powerful yet closed-source large language models (LLMs), such as ChatGPT and GPT-4, which may have the limitations of unclear model architectures, data privacy risks, and expensive inference overheads. To address the limitations, we introduce CodeS, a series of pre-trained language models with parameters ranging from 1B to 15B, specifically designed for the text-to-SQL task. CodeS is a fully open-source language model, which achieves superior accuracy with much smaller parameter sizes. This paper studies the research challenges in building CodeS. To enhance the SQL generation abilities of CodeS, we adopt an incremental pre-training approach using a specifically curated SQL-centric corpus. Based on this, we address the challenges of schema linking and rapid domain adaptation through strategic prompt construction and a bi-directional data augmentation technique. We conduct comprehensive evaluations on multiple datasets, including the widely used Spider benchmark, the newly released BIRD benchmark, robustness-diagnostic benchmarks such as Spider-DK, Spider-Syn, Spider-Realistic, and Dr.Spider, as well as two real-world datasets created for financial and academic applications. The experimental results show that our CodeS achieves new SOTA accuracy and robustness on nearly all challenging text-to-SQL benchmarks.

View on arXivView PDF

Code Implementations(1)

Apache-2.0

The source code of CodeS (SIGMOD 2024).

19924Shell, PythonAug 28, 20231 years agoApache-2.0

Similar Papers

Cite this paper

@article{li2024codes,
  title  = {CodeS: Towards Building Open-source Language Models for Text-to-SQL},
  author = {Haoyang Li and Jing Zhang and Hanbing Liu and Ju Fan and Xiaokang Zhang and Jun Zhu and Renjie Wei and Hongyan Pan and Cuiping Li and Hong Chen},
  year   = {2024},
  eprint = {2402.16347},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2402.16347v1}
}

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/2402.16347.svg)](https://codeofpaper.com/paper/2402.16347)

Discussion