arXiv:2611.12731cs.IRNov 2026

Manuscript Offprint

arXiv:2611.12731

NIFT-SQL: Customer-Supervised Table Scoring for Enterprise Text-to-SQL Retrieval

Arjun Rao, Nishant Gopinath

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Enterprise text-to-SQL starts with finding the tables a question needs, which is hard when a schema spans several databases and hundreds of cryptic tables. We ask whether models trained separately on each customer's example questions, reading only table names, column names, and declared keys, improve table retrieval. NIFT-SQL (Necessity-Informed Fusion for Text-to-SQL) fuses hybrid search over a retriever fine-tuned on the customer's questions with a fine-tuned 560M cross-encoder that scores every table for whether the query needs it, through a logistic regression fitted on held-out questions. On BEAVER, LiveSQLBench, and LiveSQLBench-Large (244 to 971 tables; four splits, three trainings), NIFT-SQL places every reference table in the top 15 for 69.2%, 89.5%, and 85.6% of test questions, against 30.4%, 41.0%, and 21.8% for hybrid search and 61.1%, 81.7%, and 70.4% for the fine-tuned retriever with the same labels. With off-the-shelf search, the cross-encoder without fine-tuning is 21 points lower. A zero-shot 8B reranker needs no labels and, routed by database, shows no resolved complete@15 difference on two collections; adding its scores as two fusion features gives a high-accuracy mode that reaches 72.4%, 92.5%, and 88.6%, ahead of the validation-selected zero-shot reranker variant on two collections, with no resolved difference on the third. Rank fusion of the two trained parts, grouped by database, shows no resolved difference from the learned fusion. Scored once on a newer BEAVER release, NIFT-SQL beats search and leads the label-matched retriever at top 8 on the synthetic test, but trails it at top 15 on real questions.

Keywords: text-to-SQL; schema linking; table retrieval; cross-encoder; learning to rank; enterprise data

1 Introduction

A text-to-SQL system can write a correct query only if it has the right tables, and in enterprise databases, finding them is the bottleneck. On the BEAVER enterprise benchmark, state-of-the-art agentic frameworks reach 10.8% execution accuracy with GPT-5.2, and 30.1% when given oracle hints for every annotated subtask. Schema-linking hints alone, which say which tables, join keys, and columns to use, roughly double execution accuracy (for ReFoRCE averaged over seven LLMs, from 9.5% to 18.9%; Chen, Yang, et al., 2024). Finding the tables is the first step.

Enterprise schemas defeat generic retrieval for four reasons:

  • Names and keys only. Table names, column names, and declared keys are often the only information available. Descriptions, comments, and sample values are missing, restricted, or untrustworthy, so we rely only on names and keys.

  • Cryptic, local vocabulary. Names such as fclt_org_dlc_key or arcregistry encode a company's conventions that a general-purpose embedding model has never seen.

  • Size. A customer's schema can span several databases and hundreds to thousands of tables; LiveSQLBench-Large has 971 tables in 18 databases, about 54 per database.

  • Multi-table questions. A query needs every table it joins. On BEAVER, the average query uses 4.4 tables, and 31% use five or more. Finding most of them is not enough.

The usual answers are a stronger general model (a larger embedding model, a zero-shot reranker, or an LLM reading the schema) or a hand-built semantic layer. We take a different route. Many enterprise deployments have verified example questions with their SQL, and a few dozen to about ninety of them already give large gains over search. We train a small scorer per customer to answer one question for every table: is this table needed to answer the question? We combine its judgment with hybrid search, whose retriever is fine-tuned on the same questions, through a small learned fusion. We study how customer-supervised scoring complements conventional retrieval, and when database grouping or learned fusion adds value beyond the scorer alone. Our central finding is that customer-supervised scoring and retrieval complement each other. Each trained part improves over search, and on the three main collections together they outperform a retriever trained on the same labels at both cutoffs. That lead is narrower than it looks: in a frozen-method holdout on a newer BEAVER release, it holds only at complete@8 on synthetic questions, and when the models are trained only on synthetic questions, the fine-tuned retriever alone is ahead at complete@15 on real logged questions, as the trained scorer transfers poorly from synthetic to real questions (Section 6.9). A fine-tuned retriever is therefore a strong and cheaper baseline, and the scorer's value is clearest at a tight context budget. A zero-shot 8B reranker, which needs no labels, is complementary rather than a substitute: on its own it comes close to the trained pipeline on two collections, and as two extra fusion features it improves complete@8 on all three collections and complete@15 on the two LiveSQLBench collections. Of the two scorer architectures we tested, neither clearly beats the other inside the fused pipeline at the full training size, although the cross-encoder is stronger on its own and with less training data (Sections 5 and 7); training each one improves it substantially, and we use the cross-encoder because it is cheaper.

Three empirical findings organize the paper. Trained scoring and retrieval are complementary: together they complete more multi-table sets than the retriever trained on the same labels, most clearly on questions that need five or more tables (Sections 6.2 and 6.7). On collections of small databases, finding the right database matters more than ranking the tables inside it (Section 6.5). Per-customer labels reach accuracy that a zero-shot reranker reaches only at about 15 times the cost per table scored, or about 2 to 8 times per question, with the gap narrowing as schemas grow (Sections 6.5 and 8).