SCOPE-SQL: Structured Semantic Credit for Reinforcement Learning of Interactive SQL Repair Agent

Hong Qi, Junyi Zhao, Boyan Li, Juyong Jiang, Yuyu Luo


Abstract
Text-to-SQL deployment is moving from one-shot query generation to interactive repair of executable but semantically incorrect SQL. In this setting, a model must revise an erroneous query under public tool feedback while preserving correct input structures. Existing reinforcement-learning signals are ill matched: outcome rewards reveal only whether the final SQL passes, whereas unconstrained process supervision may reward steps not grounded in SQL semantics. We propose SCOPE-SQL, a reinforcement-learning framework that treats SQL structure as an auditable credit space for interactive repair. It maps candidate queries and public feedback into F0–F6 modules—schema/runtime, table/join, projection, predicate, aggregation/grouping, order/limit, and nesting—and assigns action-level credit for repairing target modules, preserving stable modules, gathering evidence, and submitting when ready. Persistent low-credit regions then drive semantic refresh, generating validator-filtered frontier repair tasks. On BIRD-CRITIC-SQLite, SCOPE-SQL with semantic refresh reaches 48.8% success using a Qwen2.5-Coder-7B backbone, improving over current sota RL baselines by 4.4 and 4.2 points. Ablations attribute 4.4 and 1.8 points to process credit and semantic refresh. Trajectory analysis further shows better repair behavior: Repair+Preserve paths rise from 38.8% to 77.5%, while damage-and-recover paths fall from 43.8% to 1.2%. These results suggest that SQL-structured credit is an interpretable training signal for both policy learning and data expansion in interactive SQL repair.
Anthology ID:
2026.findings-emnlp.951
Volume:
Findings of the Association for Computational Linguistics: EMNLP 2026
Month:
October
Year:
2026
Address:
Budapest, Hungary
Editors:
Hung-Yi Lee, Sunipa Dev, Jessy Li, Desmond Elliott
Venue:
Findings
SIG:
SIGDAT
Publisher:
Association for Computational Linguistics
Note:
Pages:
20037–20058
Language:
URL:
https://aclanthology.org/2026.findings-emnlp.951/
DOI:
Bibkey:
Cite (ACL):
Hong Qi, Junyi Zhao, Boyan Li, Juyong Jiang, and Yuyu Luo. 2026. SCOPE-SQL: Structured Semantic Credit for Reinforcement Learning of Interactive SQL Repair Agent. In Findings of the Association for Computational Linguistics: EMNLP 2026, pages 20037–20058, Budapest, Hungary. Association for Computational Linguistics.
Cite (Informal):
SCOPE-SQL: Structured Semantic Credit for Reinforcement Learning of Interactive SQL Repair Agent (Qi et al., Findings 2026)
Copy Citation:
PDF:
https://aclanthology.org/2026.findings-emnlp.951.pdf