Search papers, labs, and topics across Lattice.
This paper addresses the critical challenge of SQL schema retrieval, which involves identifying relevant tables and columns from extensive databases in response to natural-language queries. By recasting existing text-to-SQL datasets as retrieval tasks and employing corpus-adaptive fine-tuning techniques, the authors significantly enhance the performance of a 305M-parameter embedder, achieving a recall@10 improvement from 60.4 to 75.6. The findings not only position this model as the strongest retriever under one billion parameters but also demonstrate that the proposed method can enhance larger models, indicating a robust and transferable schema-retrieval capability.
Schema retrieval can be effectively optimized with lightweight, corpus-adaptive fine-tuning, achieving performance on par with much larger models.
Retrieval in the SQL setting has largely been studied as the task of finding, within a large collection of SQL statements, the statement that answers a natural-language question. At scale, however, a more fundamental retrieval problem precedes generation: schema retrieval, identifying the tables and columns a question requires in a database that may contain thousands of them, far more than fit in a model's context. We argue that this step warrants first-class evaluation. To this end, we recast five text-to-SQL datasets (Spider, BIRD, BEAVER, and two LiveSQLBench variants) as retrieval tasks at both table and column granularity, covering realistic and enterprise-scale schemas under two document representations, and we show that off-the-shelf text and code embedders transfer poorly to this setting. We then propose corpus-adaptive fine-tuning: natural-language queries are synthesized directly from the target schema corpus, granularity-aware hard negatives are mined, and a 305M-parameter embedder is fine-tuned contrastively. This procedure raises average recall@10 from 60.4 to 75.6 (nDCG@10 from 51.9 to 68.0), making the 305M model the strongest retriever under one billion parameters and competitive with state-of-the-art embedders of 4-8B parameters, more than an order of magnitude larger. The same recipe improves an 8B state-of-the-art embedder from 77.8 to 78.4 recall@10, matching the best result on the benchmark and indicating that the adaptation is backbone-agnostic. Leave-one-corpus-out experiments and a leakage audit show that these gains reflect a transferable schema-retrieval ability rather than memorization of the evaluation data. Our results establish schema linking as a standalone retrieval task and lightweight, label-free corpus adaptation as a practical route to deploying it at enterprise scale.