Zing Forum

Reading

Rose-SQL: A Structured Reasoning Framework for Multi-turn Text-to-SQL Based on Role State Evolution

This article introduces Rose-SQL, an innovative framework for multi-turn Text-to-SQL tasks that enables small-scale reasoning models to perform without training. By incorporating the "role state" representation and structural isomorphism check mechanism, this framework outperforms traditional fine-tuned models on the SParC and CoSQL benchmarks.

Text-to-SQL多轮对话大型推理模型上下文学习角色状态结构化推理数据库查询自然语言处理
Published 2026-05-05 21:06Recent activity 2026-05-06 11:17Estimated read 7 min
Rose-SQL: A Structured Reasoning Framework for Multi-turn Text-to-SQL Based on Role State Evolution
1

Section 01

[Introduction] Rose-SQL: Core Introduction to the Training-Free Structured Reasoning Framework for Multi-turn Text-to-SQL

This article introduces Rose-SQL, an innovative framework for multi-turn Text-to-SQL tasks that enables small-scale reasoning models to perform without training. By incorporating the "role state" representation and structural isomorphism check mechanism, this framework outperforms traditional fine-tuned models on the SParC and CoSQL benchmarks. Rose-SQL adopts an in-context learning approach without parameter updates, addressing the limitations of existing solutions (high cost of API services, large resource requirements for fine-tuning) and providing an efficient solution for resource-constrained scenarios.

2

Section 02

Research Background: Existing Challenges and Limitations of Multi-turn Text-to-SQL Tasks

Large Reasoning Models (LRMs) have shown excellent performance in code generation and mathematical reasoning, but their potential in multi-turn Text-to-SQL tasks has not been fully explored. Multi-turn tasks require understanding dialogue history and contextual dependencies to generate accurate SQL, which is more challenging than single-turn tasks. Existing solutions fall into two categories: relying on unstable API reasoning services (high cost and poor controllability); performing expensive fine-tuning on small-scale models (requiring large amounts of labeled data and computing resources, which is unfriendly to academic teams and resource-constrained scenarios).

3

Section 03

Core Innovations: Role State and Structural Isomorphism Check Mechanism

The core innovations of Rose-SQL lie in the "role state" representation and structural isomorphism check mechanism. The role state serves as a bridge between schema linking and SQL generation, accurately describing the role, function, relationship, constraints, and evolution trajectory of database elements in the dialogue, filling the gap between the two disconnected stages. The structural isomorphism check is used to track the evolution of role states, analyze the structural similarity between the current problem and historical dialogue, reuse or update historical states, ensure dialogue continuity, and correctly handle contextual dependencies.

4

Section 04

Technical Implementation: Four-Step Workflow of Rose-SQL

The workflow of Rose-SQL includes: 1. Schema Parsing and Role Initialization: Parse the database schema and create initial role states for elements such as tables, columns, and foreign keys; 2. Dialogue History Analysis: Traverse historical rounds, extract database elements and relationships, and construct the evolution trajectory of role states; 3. Role Mapping for Current Problem: Analyze the current problem, identify database elements, and match historical states through structural isomorphism check; 4. SQL Compositional Reasoning: Guide the model to generate the final SQL based on the interaction trajectory. No parameter updates or domain training data are required throughout the process.

5

Section 05

Experimental Results: Outperforming Fine-Tuned Models on Authoritative Benchmarks

The research team evaluated Rose-SQL on the SParC (4298 dialogues, 12726 queries, 138 databases) and CoSQL (3007 dialogues, 7918 queries, 200 databases) benchmarks. On the Qwen3 series models: the 4B scale outperforms all in-context learning baselines; the 8B/14B scales outperform traditional in-context learning methods and even surpass fine-tuned models that require extensive training; it has good cross-model consistency and strong generalization ability. Compared with existing methods: it has lower cost and stronger controllability than API solutions; it eliminates data collection and training overhead compared to fine-tuning solutions and achieves better performance.

6

Section 06

Research Significance and Outlook: AI Democratization and Task Expansion Directions

The significance of Rose-SQL lies in: through structured design and prompt engineering, small-scale models can match large-scale general models, providing possibilities for AI democratization (no expensive resources required, academic teams can also develop competitive applications); it provides new ideas for multi-turn dialogue system architecture, and the role state can be extended to scenarios such as multi-turn question answering and task-oriented dialogue. Future directions: expand to complex scenarios such as graph databases and document databases; integrate multimodal inputs (natural language + visual interface); add error diagnosis and repair mechanisms.