Table of Contents
Fetching ...

LitE-SQL: A Lightweight and Efficient Text-to-SQL Framework with Vector-based Schema Linking and Execution-Guided Self-Correction

Shengmin Piao, Jieun Lee, Sanghyun Park

TL;DR

LitE-SQL presents a lightweight Text-to-SQL framework that replaces heavy LLM reliance with a vector-based Schema Retriever and a two-stage SQL Generator trained via supervised fine-tuning and execution-guided refinement. By precomputing schema embeddings and using a hard-negative filtered contrastive loss, it achieves robust schema linking with a small model footprint. The approach, evaluated on BIRD and Spider 1.0, delivers competitive execution accuracy while using 2×–30× fewer parameters than many LLM-based methods, thanks to a closed-loop, execution-guided self-correction during inference. This work offers a privacy-preserving, resource-efficient path for Text-to-SQL in data-sensitive and constrained environments, with clear avenues for reducing false positives and semantic errors in future work.

Abstract

The Text-to-SQL task translates natural language questions into SQL queries, enabling intuitive database interaction for non-experts. While recent methods leveraging Large Language Models (LLMs) achieve strong performance, their reliance on proprietary models raise concerns about deployment feasibility and data privacy. In this work, we introduce LitE-SQL, a Lightweight and Efficient framework with two components: (i) a Schema Retriever that performs efficient schema linking using a vector database of pre-computed schema embeddings, and (ii) a SQL Generator fine-tuned in two stages-supervised fine-tuning followed by execution-guided reinforcement-enabling self-correction without costly multi-candidate generation. On BIRD, LitE-SQL achieves 72.10% execution accuracy, and on Spider 1.0 it reaches 88.45%, demonstrating comparable or superior performance to LLM-based methods despite using 2x to 30x fewer parameters. Our findings demonstrate that high-quality Text-to-SQL generation is feasible with lightweight models, offering a practical solution for privacy-sensitive and resource-constrained settings.

LitE-SQL: A Lightweight and Efficient Text-to-SQL Framework with Vector-based Schema Linking and Execution-Guided Self-Correction

TL;DR

LitE-SQL presents a lightweight Text-to-SQL framework that replaces heavy LLM reliance with a vector-based Schema Retriever and a two-stage SQL Generator trained via supervised fine-tuning and execution-guided refinement. By precomputing schema embeddings and using a hard-negative filtered contrastive loss, it achieves robust schema linking with a small model footprint. The approach, evaluated on BIRD and Spider 1.0, delivers competitive execution accuracy while using 2×–30× fewer parameters than many LLM-based methods, thanks to a closed-loop, execution-guided self-correction during inference. This work offers a privacy-preserving, resource-efficient path for Text-to-SQL in data-sensitive and constrained environments, with clear avenues for reducing false positives and semantic errors in future work.

Abstract

The Text-to-SQL task translates natural language questions into SQL queries, enabling intuitive database interaction for non-experts. While recent methods leveraging Large Language Models (LLMs) achieve strong performance, their reliance on proprietary models raise concerns about deployment feasibility and data privacy. In this work, we introduce LitE-SQL, a Lightweight and Efficient framework with two components: (i) a Schema Retriever that performs efficient schema linking using a vector database of pre-computed schema embeddings, and (ii) a SQL Generator fine-tuned in two stages-supervised fine-tuning followed by execution-guided reinforcement-enabling self-correction without costly multi-candidate generation. On BIRD, LitE-SQL achieves 72.10% execution accuracy, and on Spider 1.0 it reaches 88.45%, demonstrating comparable or superior performance to LLM-based methods despite using 2x to 30x fewer parameters. Our findings demonstrate that high-quality Text-to-SQL generation is feasible with lightweight models, offering a practical solution for privacy-sensitive and resource-constrained settings.

Paper Structure

This paper contains 27 sections, 10 equations, 5 figures, 14 tables.

Figures (5)

  • Figure 1: Conceptual illustration of the difference between supervised contrastive (SupCon) loss and hard-negative filtered supervised contrastive (HN-SupCon) loss.
  • Figure 2: Two-stage training strategy of SQL Generator.
  • Figure 3: The inference pipeline of LitE-SQL.
  • Figure 4: Effect of the number of self-correction iterations across different question difficulty.
  • Figure 5: The distribution of execution error types before and after self-correction for each model size. The x-axis indicates the number of errors, and the number of each bar denotes the total errors.