TL;DR
NIFT-SQL improves table retrieval for enterprise text-to-SQL by training small, customer-specific models on existing example questions. By fusing fine-tuned hybrid search with a cross-encoder scorer that evaluates every table in a schema, it achieves massive gains over generic zero-shot methods, especially for complex queries requiring multiple tables.
What Problem Does This Paper Address?
In the world of enterprise text-to-SQL, the biggest bottleneck isn't writing the SQL code—it's finding the right tables in the first place. Enterprise databases are often a "data swamp": schemas span dozens of databases, contain thousands of tables, and use cryptic naming conventions (like fclt_org_dlc_key) that generic embedding models have never seen.
Furthermore, enterprise questions are rarely simple. They often require joining four or five tables. If a retrieval system misses even one "bridge" table, the downstream LLM cannot generate a correct query. Standard retrieval methods struggle because they lack "local" knowledge of a specific company's data and often fail to find all necessary tables within a small enough context window for an LLM.
Methods
The authors introduce NIFT-SQL (Necessity-Informed Fusion for Text-to-SQL), a retrieval pipeline designed to be trained separately for each customer using their existing verified question-SQL pairs.
The system consists of three main components:
- Fine-tuned Hybrid Search: Combines BM25 (keyword search) with a BGE embedding model that has been fine-tuned on the customer's specific data.
- Per-Customer Scorer: A 560M parameter cross-encoder (BGE-reranker-large) fine-tuned to answer a binary question: "Is this table needed for this query?" Crucially, it scores every table in the schema, not just a shortlist.
- Learned Fusion: A logistic regression model that combines scores from the search and the scorer. It uses features like ranks, raw scores, and—importantly—database-level grouping to produce a final ranking.
For users who prioritize performance over compute cost, an Optional High-Accuracy Mode adds features from a zero-shot 8B reranker (Qwen3-Reranker-8B).
Datasets
The researchers evaluated NIFT-SQL on three challenging benchmarks derived from real-world and enterprise-style data:
- BEAVER: Based on real enterprise data warehouses; it is the most difficult due to its cryptic names and the fact that 90% of queries require 3+ tables.
- LiveSQLBench & LiveSQLBench-Large: Enterprise-style schemas. The "Large" version is particularly daunting, featuring 971 tables across 18 different databases.
Key Insights and Ideas
- Supervision is the "Active Ingredient": The biggest performance jumps came from fine-tuning on customer-specific labels. A small 560M model with local training can outperform much larger general-purpose models.
- Scoring the Whole Catalog: Unlike most systems that only rerank a "top 100" shortlist, NIFT-SQL's scorer looks at every table. This allows it to find "bridge" tables that might have zero keyword overlap with the question but are essential for joins.
- Database Grouping is a Cheat Code: In large enterprise environments, tables are organized into databases. The authors found that teaching the fusion model to recognize which database is relevant is often more important than ranking individual tables within that database.
- Efficiency Matters: NIFT-SQL is designed to be "cheaper and better." The fine-tuned 560M scorer can evaluate an entire 971-table schema in about 2 seconds—roughly the same time a large 8B reranker takes to score just 100 tables.
Key Results
The primary metric used is complete@K: the percentage of questions where all required tables are found within the top K results.
- Massive Gains over Search: On the 971-table
LiveSQLBench-Largeset, NIFT-SQL reached 85.6% complete@15, compared to a dismal 21.8% for standard hybrid search. - Beating the Giants: NIFT-SQL outperformed a zero-shot 8B reranker by a wide margin on the largest schemas.
- Multi-Table Mastery: NIFT-SQL's advantage is most pronounced on complex queries. For questions requiring 5 or more tables, it outperformed the next best baseline by over 20 percentage points.
Limitations and Future Work
- Retrieval vs. Execution: The paper focuses on finding the tables (coverage), not the final SQL accuracy. While good retrieval is a prerequisite for good SQL, it doesn't guarantee it.
- Synthetic-to-Real Gap: When trained only on synthetic questions, the scorer's performance dropped when faced with real-world user logs. This suggests that high-quality, human-verified training data is still vital.
- Independent Scoring: Currently, the model scores each table independently. It doesn't "reason" about the join path as a whole. Future work could involve joint table selection to ensure the retrieved set forms a valid, connected graph.
- Metadata Constraints: The study intentionally limited itself to table names and keys. Incorporating column descriptions or sample rows (when available and trustworthy) could further boost accuracy.
Summary updated