English

SQLong: Enhanced NL2SQL for Longer Contexts with LLMs

Computation and Language 2025-05-21 v2 Artificial Intelligence Machine Learning Software Engineering

Abstract

Open-weight large language models (LLMs) have significantly advanced performance in the Natural Language to SQL (NL2SQL) task. However, their effectiveness diminishes when dealing with large database schemas, as the context length increases. To address this limitation, we present SQLong, a novel and efficient data augmentation framework designed to enhance LLM performance in long-context scenarios for the NL2SQL task. SQLong generates augmented datasets by extending existing database schemas with additional synthetic CREATE TABLE commands and corresponding data rows, sampled from diverse schemas in the training data. This approach effectively simulates long-context scenarios during finetuning and evaluation. Through experiments on the Spider and BIRD datasets, we demonstrate that LLMs finetuned with SQLong-augmented data significantly outperform those trained on standard datasets. These imply SQLong's practical implementation and its impact on improving NL2SQL capabilities in real-world settings with complex database schemas.

Keywords

Cite

@article{arxiv.2502.16747,
  title  = {SQLong: Enhanced NL2SQL for Longer Contexts with LLMs},
  author = {Dai Quoc Nguyen and Cong Duy Vu Hoang and Duy Vu and Gioacchino Tangari and Thanh Tien Vu and Don Dharmasiri and Yuan-Fang Li and Long Duong},
  journal= {arXiv preprint arXiv:2502.16747},
  year   = {2025}
}

Comments

Accepted to Table Representation Learning Workshop at ACL 2025

R2 v1 2026-06-28T21:54:50.403Z