DAC : Decomposed Automation Correction for Text-to- SQL (2025)

Abstract: Text-to-SQL is an important task that helps access databases by generating SQL queries. Currently, correcting the generated SQL based on large language models (LLMs) automatically is an effective method to enhance the quality of the generated SQL. However, previous research shows that it is hard for LLMs to detect mistakes in SQL directly, leading to poor performance. Therefore, in this paper, we propose to employ the decomposed correction to enhance text-to-SQL performance. We first demonstrate that detecting and fixing mistakes based on the decomposed sub-tasks is easier than using SQL directly. Then, we introduce Decomposed Automation Correction (DAC), which first generates the entities and skeleton corresponding to the question, and then compares the differences between the initial SQL and the generated entities and skeleton as feedback for correction. Experimental results show that, compared with the previous automation correction method, DAC improves performance by 1.4% of Spider, Bird, and KaggleDBQA on average, demonstrating the effectiveness of DAC.

## introduction text-to-sql is an important task, significantly reducing the overhead of obtaining information from the database by generating corresponding sql based on user questions @xcite . specifically, about the text-to-sql task, users provide the question and the related database, and then the model generates the corresponding sql. currently, the methods based on large language models (llms) have become the mainstream for textto-sql because llms can achieve higher performance than fine-tuned models, without fine-tuning @xcite @xcite . therefore, in this paper, we mainly focus on how to enhance the text-to-sql performance based on llms. recent research shows that automated correction is an effective method to improve text-to-sql performance @xcite @xcite , where llms first generate an initial sql and then detect mistakes of the sql as correction feedback @xcite . for instance, sql-craft @xcite assesses whether the sql execution results on databases satisfy the user question and corrects the sql accordingly. epi-sql @xcite builds an example library of error cases and then retrieves similar cases from the library to guide each correction. however, previous studies indicate that it is hard for llms to directly detect and correct all mistakes in the generated sql @xcite @xcite . previous works @xcite @xcite show that correction with the decomposed reasoning process has better performance than directly correcting because detecting the mistakes in the reasoning process is easier than in the final answer. therefore, in this paper, we discuss that: (i) experimentally, we present that correction with decomposed subtasks is more effective than direct correction; (ii) methodologically, we propose correcting the textto-sql results based on the decomposed tasks of entity linking and skeleton parsing to enhance the performance of the automation correction. first, we discuss that correction with the decomposed sub-tasks can bring better correction performance than the direct correction, as shown in figure 1 . we present that decomposing into sub-tasks can lower the difficulty of detecting and correcting errors. based on the above analysis, we propose decomposed automation correction (dac), which corrects the generated sql with the mistakes of entity linking and skeleton parsing as feedback, which are the two most crucial capabilities for addressing the text-to-sql task @xcite @xcite . schema linking denotes detecting the table and column names related to the question, where we directly generate relevant entities based on the user question and the database, following @xcite . skeleton parsing denotes generating the sql skeleton corresponding to the user question, where we generate the skeleton by parsing the user question without databases @xcite . after generating the entities and skeleton, we take their inconsistencies with the initial sql as feedback for the correction, as shown in figure 1 . to validate dac, we conduct experiments on three mainstream text-to-sql datasets: spider @xcite , bird @xcite , and kaggled-bqa @xcite . the experiments show that dac achieves an average improvement of 1.4% compared to the previous correction method, showing the effectiveness of dac. further analysis shows that dac indeed improves the performance by improving the entity and the skeleton accuracy. our contributions are as follows: • we experimentally discuss that decomposed correction has better performance than direct correction, shedding light on future research; • we present dac, which improves text-to-sql automated correction performance by decomposing text-to-sql into sub-tasks of entity linking and skeleton parsing; • experiments show that dac improves performance by 1.4% on average compared to the pre- decompose into sub-tasks direct correction initial sql: select idx from stock order by earning decomposed correction linked entities: stock.idx, stock.earning parsed skeleton: select _ from _ order by _ • • • figure 2 : the illustration of our discussion, taking the question "order the stock idx with earnings more than 5,000" as an example. about the direct correction (left), it is challenging for llms to pinpoint specific mistakes. after decomposing the sql into sub-tasks (right), it is easier for llms to identify that the linked entities are correct, while the parsed skeleton is incorrect. ## preliminaries in this section, we discuss that decomposing textto-sql into sub-tasks can effectively enhance sql correction performance. first, we demonstrate that correction by decomposing into subtasks is more effective than direct correction since sub-tasks are easier to satisfy than the original task, making it less difficult to detect and correct errors. then, we adapt the above conclusion to the text-to-sql task by decomposing the task into two subtasks: entity linking and skeleton parsing, thereby enhancing the sql correction performance. ## methodology following the discussion above, in this section, we present dac, which generates automated correction feedback by decomposing the text-to-sql task into the sub-tasks of entity linking and skeleton parsing. the illustration of dac is shown in figure 3 , and the prompts we used for dac are present in appendix a. we further discuss the efficiency of dac in appendix c. ## conclusion in this paper, we try to alleviate the problem of llms performing poorly when directly correcting generated sql for the text-to-sql task. we first propose that correcting by decomposing the original task into sub-tasks is more effective than directly correcting the generated results. based on this discussion, we propose dac that decomposes the text-to-sql task into two sub-tasks: entity linking and skeleton parsing. we ask llms to generate entity and skeleton information, identify inconsistencies with the initial sql as feedback, and use this feedback for correction. experimental results show that our method brings a 1.4% performance improvement on three mainstream text-to-sql datasets compared with the previous correction method, showing the effectiveness of dac.