Track- SQL : Enhancing Generative Language Models with Dual-Extractive Modules for Schema and Context Tracking in Multi-turn Text-to- SQL (2025)

Abstract: Generative language models have shown significant potential in single-turn Text-to-SQL. However, their performance does not extend equivalently to multi-turn Text-to-SQL. This is primarily due to generative language models’ inadequacy in handling the complexities of context information and dynamic schema linking in multi-turn interactions. In this paper, we propose a framework named Track-SQL, which enhances generative language models with dual-extractive modules designed to track schema and contextual changes in multi-turn Text-to-SQL. Specifically, Track-SQL incorporates a Semantic-enhanced Schema Extractor and a Schema-aware Context Extractor . Experimental results demonstrate that Track-SQL achieves state-of-the-art performance on the SparC and CoSQL datasets. Furthermore, detailed ablation studies reveal that Track-SQL significantly improves execution accuracy in multi-turn interactions by 7.1% and 9.55% on these datasets, respectively. Our implementation will be open-sourced at https://github.com/DMIRLAB-Group/Track-SQL .

## introduction text-to-sql @xcite is a critical semantic parsing task that converts natural language queries into corresponding sql statements based on a given database schema. while generative language models have demonstrated significant potential in single-turn text-to-sql tasks, their performance diminishes in multi-turn scenarios. the challenges in these settings primarily stem from the models' difficulties in handling the complexities of context information and dynamic schema linking across multiple turns of interaction. however, extractive model to solving these two challenges-schema linking and context uti-* corresponding author, hpakyim@gmail.com lization-have limitations when directly applied to the generative language model paradigm. the primary limitation in multi-turn text-to-sql is the ability to maintain effective schema linking as the dialogue progresses. although many studies have confirmed that proper schema linking significantly enhances sql generation, existing approaches struggle to handle the increasing complexity in multi-turn settings. in recent research, rasat @xcite leverages relational selfattention mechanisms to capture the relationships between text and schemas. however, in multi-turn dialogue scenarios, as the number of interactions between the user and the system increases along with the expansion of the database schemas, the scale of the schema linking graph grows, inevitably leading to the issue of redundant links. cqr-sql @xcite rewrites multi-turn dialogues and simplifies schema linking information, which might also result in the loss of critical schema linking details due to over-simplification. tp-link @xcite integrates schema linking prediction into multi-task pre-training to reduce redundant relationships between questions and schemas, but overlooks the problem of semantic inconsistencies between questions and schemas. moreover, existing schema linking methods are predominantly static, lacking mechanisms to incorporate linking results from prior turns. the key idea to overcome this limitation is to introduce a dynamic updating mechanism that adapts to the evolving dialogue contexts in multi-turn interactions. the secondary limitation in multi-turn text-to-sql is their difficulty in managing continuous interactions where users reference or omit prior information, relying on the system to track the evolving context. in recent research, editsql @xcite uses prior turn sql queries for predicting current turn queries, but loses effectiveness when dialogue lacks coherence. star @xcite and coe-sql @xcite track depen-dencies via sql similarity and changes, but lack source record verification, which can lead to error buildup. the key idea to overcome this limitation is to design effective retrieval and verification mechanisms for improving the accuracy and reliability of multi-turn text-to-sql. to address these issues, we propose a track-sql framework, aimed at solving the problems of dynamic schema linking and context information filtering in multi-turn text-to-sql dialogues. first, in the schema extraction phase, we developed a semantic-enhanced schema extractor (sese) that identifies the user's current focus schemas by combining changes in user interests with previously extracted signals. at the same time, we introduce a semantic enhancement module to reduce the semantic gap between user questions and schemas, thereby improving the precision of schema linking. second, in the sql generation phase, we design a schema-aware context extractor (sace) module to identify key sqls from historical records. then, we combine these with past questions and extracted schemas as input, and fine-tune the text-to-sql generation model in a supervised manner, with the target output being normalized sql queries. this approach reduces the difficulty for the generation model to learn schema linking and context information filtering, thus enhancing the accuracy of sql generation. additionally, the results from the aforementioned extractors make the basis for the model's sql generation more transparent, increasing the explainability of the system. our contributions are summarized as follows: ## methodology in the multi-turn text-to-sql task, the goal is to address the problem of mapping a sequence of multi-turn questions @xmath0, c i,n i ) to the target sql query s m , where t i represents the i th table in the database, and c i,n i denotes the n th i column within t i . this section will provide an overview of the framework designed to solve this problem and delve into its design details. ## related work schema linking schema linking effectively reduces errors caused by schema misinterpretation, thereby enhancing the performance of text-to-sql conversion. currently, various methods focus on improving schema linking. for instance, din-sql @xcite utilizes gpt to identify relevant database elements, while dts-sql @xcite ) employs a specialized model for efficient schema extraction. resdsql @xcite and codes @xcite adopt strategies that assess the relevance between schemas and queries for sorting and filtering. other methods, such as c3 @xcite , chess @xcite , and mcs-sql @xcite , adopt a step-by-step linking approach, first filtering out relevant tables and then selecting match-ing columns. existing methods perform well in single-turn text-to-sql tasks, but they are inadequate in handling multi-turn dialogues and schema name ambiguities. this paper focuses on dynamic schema linking in multi-turn text-to-sql, with a particular emphasis on resolving schema name ambiguities. our proposed method reduces redundant links and improves system performance. multi-turn text-to-sql multi-turn text-to-sql tasks more closely resemble real-world applications, allowing users to progressively refine their questions and adjust their requirements through dialogue. research in this field includes istsql @xcite , which improves accuracy by tracking the states of database schemas and sql keywords; miga @xcite utilizes multitask learning to integrate information on reference relationships and schema links; coe-sql @xcite tracks user intent by serializing changes in sql queries. inspired by copying mechanisms, methods like editsql @xcite , refer to previous-turn sql information. r2sql @xcite introduces a memory decay mechanism to simulate changes in the database schema. tp-link @xcite models word-level coreference to resolve complex coreference and ellipsis issues. these studies aim to support the track-sql framework by capturing dependencies between multi-turn text-to-sql interactions. the framework improves the handling of multi-turn co-reference issues and enhances system performance and adaptability by integrating dynamic schema element awareness with question semantic information. ## conclusion in this paper, we proposed the track-sql framework to address the challenges of multi-turn textto-sql tasks, focusing on dynamic schema linking and effective utilization of historical context. track-sql integrates a semantic-enhanced schema extractor and a schema-aware context extractor to precisely capture schema and contextual changes, improving the system's ability to adapt to evolving user interactions. the core idea lies in establishing the association model between user intent, schemas, and contextual information in advance, thereby reducing the difficulty of recognizing changing intents during the sql generation process. experimental results indicate that the track-sql possesses significant advantages and effectiveness.