Abstract
Natural Language to SQL (NL2SQL) has seen significant advancements with large language models (LLMs). However, these models often depend on closed-source systems and high computational resources, posing challenges in data privacy and deployment. In contrast, small language models (SLMs) struggle with NL2SQL tasks, exhibiting poor performance and incompatibility with existing frameworks. To address these issues, we introduce Feather-SQL, a new lightweight framework tailored for SLMs. Feather-SQL improves SQL executability and accuracy through 1) schema pruning and linking, 2) multi-path and multi-candidate generation. Additionally, we introduce the 1+1 Model Collaboration Paradigm, which pairs a strong general-purpose chat model with a fine-tuned SQL specialist, combining strong analytical reasoning with high-precision SQL generation. Experimental results on BIRD demonstrate that Feather-SQL improves NL2SQL performance on SLMs, with around 10% boost for models without fine-tuning. The proposed paradigm raises the accuracy ceiling of SLMs to 54.76%, highlighting its effectiveness.
Introduction
Natural Language to SQL (NL2SQL) is a critical technology for making databases accessible to non-technical users. While Large Language Models (LLMs) like GPT-4 excel at these tasks, their high cost, computational requirements, and data privacy risks make them unsuitable for many sensitive or edge-based applications. Small Language Models (SLMs)—those with 4 billion parameters or fewer—offer a private, on-device alternative. However, SLMs historically struggle with low executability due to complex schemas and a tendency to fail when faced with the rigid instruction-following requirements (such as JSON formatting) typical of modern NL2SQL frameworks.
The Feather-SQL Framework
Feather-SQL is designed specifically to accommodate the limitations of SLMs through a streamlined six-stage pipeline. Key components include:
- Schema Pruning & Linking: By identifying and retaining only relevant tables and columns, the framework reduces the noise that often overwhelms smaller models.
- Multi-Path & Multi-Candidate Generation: The system utilizes various prompting strategies and beam search to generate multiple SQL candidates, increasing the probability of producing a correct query.
- 1+1 Model Collaboration Paradigm: This novel approach pairs a general-purpose chat model, which handles reasoning and schema linking, with a fine-tuned SQL specialist focused on syntax. This division of labor prevents "catastrophic forgetting" and leverages the unique strengths of different model types.
One of the most significant findings is that SLMs struggle with rigid output constraints. As shown in the figure above, while LLMs like GPT-4o maintain near-perfect compliance with JSON formatting and column constraints, SLMs often drop to 0% compliance. Feather-SQL addresses this by using an "Extraction" strategy that allows models to generate text freely before matching valid schema elements.
Experimental Evaluation
The framework was evaluated on the BIRD (Big Bench for Intelligent REasoning in Databases) and Spider benchmarks. BIRD is particularly challenging, featuring large-scale databases across 37 professional domains.
As illustrated in the performance comparison, Feather-SQL (represented by the striped bars) significantly outperforms existing frameworks like CHESS and MAC-SQL when applied to SLMs such as Qwen2.5-1.5B and Yi-Coder-1.5B. On the BIRD dataset, Feather-SQL raised the accuracy ceiling for SLMs to 54.76%, demonstrating that these models can be highly effective when supported by a framework tailored to their capabilities.
Key Insights and Discussion
- Efficiency of Pruning: Ablation studies identified schema pruning as the most critical module, providing the single largest jump in execution accuracy. For SLMs, reducing the input context is vital for performance.
- Prompt Optimization: Unlike LLM-based systems that use prompts thousands of words long, Feather-SQL maintains prompts under 300 words, drastically reducing latency and computational overhead.
- The Selection Gap: A remaining challenge is the "Selection Gap." While the framework often generates the correct query within its top 3 candidates, the final selection logic does not always pick the correct one. Closing this 10% gap between Top-3 and Top-1 accuracy is a primary goal for future work.
Conclusion
Feather-SQL proves that with the right architectural support, SLMs can "punch above their weight class" in complex tasks like NL2SQL. By moving away from rigid LLM-centric frameworks and adopting a dual-model collaboration paradigm, Feather-SQL provides a viable path for high-performance, private, and efficient database interaction on the edge.
Summary updated