Skip to content
Preprint

Beyond the Harness: End-to-End Optimization of Context Artifacts for Enterprise Text-to-SQL

Aug 2026 · 0 citations · 31 references
Computer Science

TL;DR

In this ablation, retrieved knowledge-base context provides the largest marginal improvement when added to the full oracle graph, and a distillation procedure that turns historical query profiles into reusable SQL reference cards is optimized.

Abstract

Deploying LLMs for enterprise Text-to-SQL is bottlenecked less by the model than by what context reaches it: business logic spans thousands of tables, and no model can ingest a full catalog at once. We argue that the most effective place to intervene is therefore the \emph{knowledge-base context} the model consumes, and that this context should be \emph{constructed} from historical usage rather than tuned for as a fixed input. Using a query-DAG decomposition--the same family of intermediates that enterprise benchmarks like BEAVER annotate, here recovered from production SQL--we compare the value of oracle query graphs versus retrieved knowledge-base context. In this ablation, retrieved knowledge-base context provides the largest marginal improvement when added to the full oracle graph. Building on this, we optimize a distillation procedure that turns historical query profiles into reusable SQL reference cards. On a benchmark of 5176 production queries from a major online retailer, optimizing these context artifacts yields larger gains (${\sim}12$--$25\%$ AST similarity) than optimizing the retrieval harness (${\sim}3$--$12\%$). On the public BEAVER benchmark, which lacks the production-usage signals available in our internal setting, the picture is more mixed: table cards alone perform about the same as raw historical SQL. The best optimized variant retrieves both cards and raw SQL, scoring $9.00\%$ versus $6.33\%$ (p-value $0.12$) for the comparable baseline on a held-out $N{=}300$ subset, using retrieved context and harness changes but no agentic loop.

View source

Similar papers

ExpeSQL: An Efficient, Experience-Guided Decompositional Search Framework for Text-to-SQL

This work introduces ExpeSQL, a zero-shot, open-source–compatible, and efficient framework that combines divide-and-conquer reasoning, Best-of-N candidate selection, and self-critique with experience-guided refinement that establishes a new paradigm for deployable, self-improving Text-to-SQL systems in dynamic, real-world environments.

Unknown authors · 0 citations
Preprint Jul 2026

Finding the Right Tables and Columns: A Benchmark and Corpus-Adaptive Embeddings for SQL Schema Retrieval

This work recast five text-to-SQL datasets as retrieval tasks at both table and column granularity, covering realistic and enterprise-scale schemas under two document representations, and proposes corpus-adaptive fine-tuning, establishing schema linking as a standalone retrieval task and lightweight, label-free corpus adaptation as a practical route to deploying it at enterprise scale.

Qingcheng Zeng, Puxuan Yu, Aman Mehta et al. · 0 citations
Preprint Aug 2026

Iteration Without Elaboration: A Simple ReAct Architecture Suffices for Text-to-SQL Generation

A simple yet effective zero-shot ReAct-style framework built solely on iterative reasoning and a constrained action space defined by a typed Domain-Specific Language (DSL) of 15 relational operations, rather than free-form SQL generation.

Jian Lu, Haiwei Yu, Raymond M. Xiong et al. · 0 citations
Open access May 2026

SafeQL: Search-based Refinement for Safe and Efficient LLM-based Text-to-SQL

Large language models (LLMs) have advanced Text-to-SQL by enabling natural language interfaces to databases without task-specific fine-tuning. However, existing LLM-based systems remain unreliable, often generating SQL queries that are invalid under the database schema, referencing non-existent tables, attributes, functions, or values. Such errors persist because interactions with the database management system (DBMS) are typically limited to error messages, leaving it in a largely passive role during query refinement. This paper proposes SafeQL, a search-based refinement paradigm that redefines the role of the DBMS as an active guide in the refinement process. Instead of regenerating entire queries after execution failure, SafeQL interprets DBMS feedback to incrementally repair only the erroneous components. Each refinement step is formulated as a guided search within a safe query space , where candidate queries are progressively validated through DBMS execution, thereby converging to an executable query and preventing repeated regeneration of errors. Experiments on the Bird and Spider benchmarks show that SafeQL significantly improves execution accuracy and efficiency compared to regeneration-based methods.

Geonho Lee, Min-Soo Kim · 0 citations
#artificial intelligence Preprint Aug 2026

Are These Modules Worth Their Cost? A Paradigm-Level Accuracy-Cost Analysis of In-context Learning Text-to-SQL

This work instantiates 17 paradigm-level configurations across five recurring modules of the ICL text-to-SQL pipeline under a single controlled implementation, and reveals that execution-feedback refinement is the only paradigm whose benefit holds universally at consistently low cost, while most other modules help only under backbone-dependent conditions.

Jia-Yan Lin, Yu-Jia Liu, Zi-Jin Hong et al. · 0 citations
Preprint Aug 2026

TraceSQL: Traceable Answerability Estimation for Reference-Free Text-to-SQL Verification

Results show that SQL verification can be performed with a lightweight learned model while retaining feature-level evidence for inspecting and diagnosing its predictions, and feature attribution shows that the model relies on both semantic grounding and deterministic SQL-structure signals.

N. Shukla, Debasmita Panda, Srutanik Bhaduri et al. · 0 citations