CAPER: Clause-Aligned Process Supervision for Text-to-SQL
Abstract
Text-to-SQL systems are typically evaluated by query-level execution correctness, but this terminal signal provides little guidance about which intermediate SQL decision caused success or failure. Token-level dense supervision is also ill-suited: SQL tokens do not align with complete semantic decisions, can penalize execution-equivalent queries, and are difficult to label reliably at scale. We therefore propose CAPER, which automatically derives clause-level supervision via counterfactual intervention on the SQL abstract syntax tree, enabling root-cause error localization for reward modeling; the resulting data is used to train CAPER-9B, a lightweight Clause-PRM that provides clause-boundary feedback for policy optimization and candidate verification. Experiments on BIRD and Spider show that clause-aligned supervision improves BIRD MV@8 execution accuracy by 7.42 percentage points over the backbone-matched GRPO-Sparse baseline, while reaching 84.53\% failure-localization accuracy and 90.60\% MRR on held-out failures. Our project page is at https://github.com/banrichard/RL-NL2SQL.