Single-Database Rewards Are Hackable: Counterfactual Execution for Trustworthy Text-to-SQL RL A counterfactual-database (CF) reward that also runs a text-to-SQL agent's final query on a few hidden databases closes a reward-hacking gap in reinforcement learning for text-to-SQL, according to the research. The single-database reward used in standard RL pays a query when its result matches the reference on one database, but a wrong query can match by luck when the data lack the rows that expose its bug. Reinforcement learning RL for text-to-SQL agents pays a query when its result matches the reference on one database. However, a wrong query can match by luck when the data lack the rows that expose its bug. We study a counterfactual-database CF reward that also runs the final query on a few hidd