Enhancing SQL Table Acquisition with Reverse Engineering for Text-to- SQL (2025)

Abstract: Text-to-SQL oriented table acquisition suffers from heterogeneous semantic gap. To address the issue, we propose a Reverse Engineering (RE) based optimization approach. Instead of forward table search using questions as queries, RE reversely generates potentially-matched question conditioned on table schemas, and promotes semantic consistency verification between homogeneous questions. We experiment on two benchmarks, including SpiderUnion and BirdUnion. The test results show that our approach yields substantial improvements compared to the Retrieval-Reranker (2R) baseline, and achieves competitive performance in both table acquisition and Text-to-SQL tasks.

## introduction we study sql table acquisition for text-to-sql. text-to-sql is a task of generating the executable sql query given a certain question @xcite @xcite @xcite . table acquisition is a crucial subtask of text-to-sql, which acquires the question-related sql tables to support source-aware reasoning of sql queries @xcite . figure 1 shows an example, where "✓" denotes the relevant table needs to be acquired from the sql database. the core of sql table acquisition is relevancecentered text matching at the semantic level. current studies struggle with the bottleneck of heterogeneous semantic gap. specifically, a sql table appears as the semi-structured data, whose schema is constituted with relation-unaware fragmented names (e.g., field names). by contrast, the question is a free text. therefore, for a pair of mutuallyaligned table and question, it is difficult to facilitate their semantics to exactly coincide with each other. this limits the implementation of anti-distraction relevance measurement. to address the issue, we propose a reverse engineering (re) based optimization approach. it leverages large language model (llm) to reversely generate potentially-matched question for every sql table. on this basis, we conduct text matching between homogeneous data, i.e., the input question and the reversely-generated question. in our experiments, we use re to strengthen retrieval-reranker (2r) based table acquisition model. experiments on spiderunion @xcite and bir-dunion @xcite demonstrate that re enables both the bge-m3 (0.5b) based table acquisition and text-to-sql models to perform better. in addition, it achieves competitive performance compared to the strong models crush @xcite and murre @xcite ) that use a larger baseline sgpt (5.8b). ## approach in general, sql-table acquisition is performed in a retriever-reranker (2r) framework @xcite , i.e., retrieving candidate sql tables and re-ranking them according to question-oriented relevance. top-k candidates will be adopted as the results. the 2r framework is formalized as follows. in the subsections, we first present the 2r-based baseline, and further detail our reverse engineering based approach. ## conclusion we propose a reverse engineering based approach to relieve the semantic gaps between heterogeneous questions and sql tables. experiments show that our approach achieves substantial improvements. more importantly, it enables a light-weight table acquisition model to effectively support text-to-sql using a smaller number of search results. concrete sql contents (i.e., values), as demonstrated previously, contribute to table acquisition. however, the utilization of sql contents still encounters heterogeneity problem. therefore, we will generate hybrid groups of sql schemas and values in the future, and study graph-based reverse engineering for table acquisition and text-to-sql.