Schema on the Inside: A Two-Phase Fine-Tuning Method for High-Efficiency Text-to-SQL at Scale
Chinmay Soni, Shivam Chourasia, Gaurav Kumar, Hitesh Kapoor

TL;DR
This paper introduces a two-phase fine-tuning method for a self-hosted 8B-parameter language model that internalizes database schemas, drastically reducing prompt size and enabling efficient, high-accuracy text-to-SQL in large-scale applications.
Contribution
The paper presents a novel two-phase supervised fine-tuning approach that allows models to internalize schemas, eliminating long-context prompts and reducing API costs for text-to-SQL tasks.
Findings
Achieves 98.4% execution success rate
Replaces external API calls with local inference
Reduces input tokens by over 99%
Abstract
Applying large, proprietary API-based language models to text-to-SQL tasks poses a significant industry challenge: reliance on massive, schema-heavy prompts results in prohibitive per-token API costs and high latency, hindering scalable production deployment. We present a specialized, self-hosted 8B-parameter model designed for a conversational bot in CriQ, a sister app to Dream11, India's largest fantasy sports platform with over 250 million users, that answers user queries about cricket statistics. Our novel two-phase supervised fine-tuning approach enables the model to internalize the entire database schema, eliminating the need for long-context prompts. This reduces input tokens by over 99%, from a 17k-token baseline to fewer than 100, and replaces costly external API calls with efficient local inference. The resulting system achieves 98.4% execution success and 92.5% semantic…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
Taxonomy
TopicsAdvanced Database Systems and Queries · Natural Language Processing Techniques · Logic, programming, and type systems
