Bridge-SQL: Bridging Single- and Multi-Turn Text-to-SQL via Preference-Aligned Question Rewriting
摘要
Multi-turn text-to-SQL aims to translate context-dependent natural language questions into corresponding SQL queries. The two-stage rewrite-then-parse paradigm has emerged as a promising solution that first decontextualizes conversational queries into self-contained questions and then employs powerful off-the-shelf single-turn text-to-SQL parsers for SQL generation. Existing methods mainly optimize the rewriter in isolation, overlooking parser feedback and causing misalignment between the two modules, which undermines effective collaboration. In this paper, we propose Bridge-SQL, which seamlessly adapts single-turn text-to-SQL parsers to conversational scenarios through a question rewriter aligned with parser preferences. Our approach begins by training a base rewriter on synthetic rewrites generated through a bidirectional data synthesis strategy. Following this, the rewriter self-samples multiple candidate rewrites for each question, which are scored by a parser consensus mechanism to construct preference pairs for further alignment. Finally, direct preference optimization is applied to the rewriter under a curriculum learning strategy that progresses from easy to hard examples, ensuring a stable and effective alignment process. Extensive experiments on real-world datasets demonstrate the effectiveness and broad applicability of our proposed method.