Expert judgment in the reward function beats scaffolds on text-to-SQL
- Source
- thinkingmachines.ai
- Publisher
- Thinking Machines
- Author
- Thinking Machines
- Date

Context
This guest post, by researchers at UIUC and Bridgewater working with Thinking Machines, argues that AI lags humans at writing database queries mainly because of what training rewards, not because models lack the right multi-step pipeline. The task is text-to-: turning a business question such as "how much does this customer spend per order?" into a SQL query. On BIRD, the standard benchmark, humans score 92.96%. The usual way to raise model scores is a scaffold, a pipeline of separate model calls that narrows the relevant columns, drafts queries, repairs errors and votes. The authors instead fine-tuned Moonshot AI's Kimi-K2.6 with reinforcement learning with verifiable rewards, where the model earns a reward when its query returns the same result as a reference query. Guest post.
That reward is only as good as the reference answers, and BIRD's training set was badly wrong. Auditing 2,500 sampled examples, the authors found that 52.1% of the reference queries were incorrect and 61.1% of examples had at least one error in the query, the question or the supplied background. A wrong reference rewards the model for copying the mistake. OpenAI's o3 flagged errors with 90.6% precision but caught only 24.5% of those human experts found, and each flagged error and proposed fix was then checked by a different expert. In the technical report, training on the cleaned set, released as BIRD-Platinum, raised the base model's accuracy by 7.2 points on the cleaned Arcwise-Plat-SQL test, while training on the original BIRD Train, 3.8 times larger, lowered it by 7.0.
Two reward changes closed most of the remaining gap. First, a query can match the reference result on one database by coincidence: averaging line-item prices equals averaging order totals when every order has one item. A solver called VeriEQL checks whether two queries are equivalent on any database, and in a pilot run 32.8% of positive rewards went to queries that were not. Those rewards now carry a 0.2 penalty. Second, models tended to ignore background facts supplied with the question, such as "sodium-free refers to sodium = 0," which caused 24.2% of failures in a pilot analysis. A rule-based check now requires the model to restate each supplied fact as a query and audit its query against it. The report credits these changes with 2.8 more points on Arcwise-Plat-SQL. Reward design.
The final model scored 91.37% on Arcwise-Plat-SQL with a single answer, at $0.035 per task, 8.4 points above the strongest prior open-source pipeline at 37% lower cost. Voting among 16 sampled answers raised it to 92.97% at $0.56. The post calls this the first system to exceed the human mark, but the report frames it more carefully: 92.96% is a proxy measured on BIRD's test set, not on Arcwise-Plat-SQL, and it falls inside the model's 95% confidence interval of 90.4% to 94.9%. Parity is the supported claim. The results are the authors' own, and the post notes that real company databases can hold millions of columns, far more than these academic benchmarks. Results and confidence intervals.
- Database and SQL — Persistent structured storage queried and changed through explicit operations.
- Constraint — A requirement a setup must meet regardless of how well it performs otherwise, such as where documents may be sent or a date by which the work must be done.
- fine-tuning — Taking a trained model and training it a bit more on your own examples so it gets better at one specific job.
- Process — A running instance of a program, with its own working memory, open files and identity.
- postInkling 2 Mini gets day-0 local inference across Mac and DGX Spark
articleInkling 2 Small is free on OpenCode: 1M context, agentic-coding tuned
articleWhy temperature 0 still isn't deterministic, and how to fix it
articleTinker goes GA with Kimi K2 Thinking, vision input, OpenAI-compatible sampling

