Learning When to Reason for Text-to-SQL via SFT and DPO
The paper proposes AutoThinkSQL, a framework that integrates an auto-thinking mechanism into both Supervised Fine-Tuning (SFT) and Direct Preference Optimization (DPO) for Text-to-SQL tasks. This approach allows the model to dynamically bypass reasoning for simple queries while invoking deep Chain-of-Thought (CoT) for complex queries, improving efficiency without sacrificing performance. On Qwen3-Coder-30B-A3B, the method achieves consistent gains on Spider and BIRD benchmarks, reducing average
Analysis
TL;DR
- The paper proposes AutoThinkSQL, a framework that integrates an auto-thinking mechanism into both Supervised Fine-Tuning (SFT) and Direct Preference Optimization (DPO) for Text-to-SQL tasks.
- This approach allows the model to dynamically bypass reasoning for simple queries while invoking deep Chain-of-Thought (CoT) for complex queries, improving efficiency without sacrificing performance.
- On Qwen3-Coder-30B-A3B, the method achieves consistent gains on Spider and BIRD benchmarks, reducing average output tokens by 24.6% and 18.3%, and latency by 17.1% and 11.5% compared to CoT-only generation.
- The model learns to align its reasoning decisions with query difficulty, demonstrating adaptive behavior tailored to the complexity of input queries.
Why It Matters
This work is highly relevant to AI practitioners and researchers working on natural language processing and database interaction systems, as it addresses the trade-off between accuracy and computational efficiency in Text-to-SQL models. By enabling dynamic reasoning based on query complexity, AutoThinkSQL offers a practical solution for real-world applications where low-latency responses are critical without compromising performance on challenging queries.
Technical Details
- The core innovation lies in integrating an auto-thinking mechanism into SFT and DPO pipelines, allowing the model to decide whether to engage in multi-step reasoning or directly generate SQL based on query simplicity.
- Experiments were conducted using Qwen3-Coder-30B-A3B as the base model, evaluated on two prominent Text-to-SQL benchmarks: Spider and BIRD.
- Performance metrics include accuracy improvements over baselines alongside significant reductions in token count and inference time, highlighting both efficacy and efficiency gains.
- Analysis shows that the model effectively learns to match its reasoning strategy with varying levels of query difficulty, indicating successful adaptation during training phases involving preference optimization techniques like DPO.
Industry Insight
Adopting frameworks like AutoThinkSQL could lead to more efficient deployment of AI-driven database querying tools in enterprise settings, particularly where quick response times are essential for user satisfaction or operational continuity. Additionally, this adaptive reasoning paradigm may inspire similar approaches across other domains requiring conditional depth-of-processing strategies, potentially revolutionizing how large-scale language models interact with structured data sources under diverse workload conditions.
Disclaimer: The above content is generated by AI and is for reference only.