Paper deep dive
Test-Time Verification for Text-to-SQL via Outcome Reward Models
Mattia Tritto, Giuseppe Farano, Dario Di Palma, Gaetano Rossiello, Fedelucio Narducci, Dharmashankar Subramanian, Tommaso Di Noia
Intelligence
Status: succeeded | Model: Gemma-4-26B-A4B | Prompt: intel-v1 | Confidence: 97%
Last extracted: 7/5/2026, 4:50:34 AM
Summary
The paper introduces GradeSQL, a scalable framework for training task-specific Outcome Reward Models (ORMs) to improve the reliability of Text-to-SQL generation during test-time inference. Unlike heuristic-based strategies like Best-of-N or Majority Voting, ORMs act as learned semantic scoring functions. The framework involves three stages: candidate generation via an LLM, automated data labeling through execution equivalence, and supervised fine-tuning using LoRA. Evaluation on BIRD and Spider benchmarks shows that ORM-based selection consistently outperforms traditional heuristics, providing significant gains in execution accuracy and demonstrating effective scaling with larger candidate sets and cross-model compatibility.
Entities (8)
Relation Signals (5)
GradeSQL → evaluatedon → BIRD
confidence 100% · evaluate our approach on the BIRD and Spider benchmarks
GradeSQL → evaluatedon → Spider
confidence 100% · evaluate our approach on the BIRD and Spider benchmarks
GradeSQL → implements → Outcome Reward Model
confidence 100% · We introduce GradeSQL, a scalable framework for training task-specific ORMs
OmniSQL-7B → usedasgeneratorin → GradeSQL
confidence 100% · We use OmniSQL-7B (Li et al., 2025a) as the generator.
Outcome Reward Model → improves → Text-to-SQL
confidence 95% · ORM-based selection consistently outperforms execution-based Best-of-N and Majority Voting... for Text-to-SQL
Cypher Suggestions (0)
No Cypher suggestions yet.
Abstract
Abstract:Improving the reliability of large language models (LLMs) at inference time is a central challenge in structured reasoning tasks such as Text-to-SQL. Common test-time inference strategies, including Best-of-N sampling and Majority Voting, rely on heuristic signals such as execution success or output frequency, which provide limited semantic discrimination across candidate outputs. In this work, we study Outcome Reward Models (ORMs) as learned semantic scoring functions for test-time verification in Text-to-SQL. While ORMs have been previously explored for test-time scaling and alignment, their application to structured query generation remains underexplored. We introduce GradeSQL, a scalable framework for training task-specific ORMs via automated candidate generation and execution-based labeling, enabling verifier training without manual annotation. We integrate ORMs into a verification-driven Best-of-N pipeline and evaluate our approach on the BIRD and Spider benchmarks across multiple open-source LLM families. ORM-based selection consistently outperforms execution-based Best-of-N and Majority Voting, with gains of up to +4.33% on BIRD and +2.10% on Spider. We further show that ORMs scale effectively with larger candidate sets and yield stronger improvements on complex queries. Overall, our results demonstrate that ORM-based verification provides a simple, effective, and scalable alternative to heuristic test-time selection strategies for Text-to-SQL. Code datasets and models are publicly available.
Tags
Links
- Source: https://arxiv.org/abs/2606.30851v1
- Canonical: https://arxiv.org/abs/2606.30851v1
Trouble viewing inline? Open PDF directly →
Full Text
43,822 characters extracted from source content.
Expand or collapse full text
Test-Time Verification for Text-to-SQL via Outcome Reward Models Mattia Tritto 1 , Giuseppe Farano 1 , Dario Di Palma 1 , Gaetano Rossiello 2 , Fedelucio Narducci 1 , Dharmashankar Subramanian 2 , Tommaso Di Noia 1 1 Polytechnic University of Bari, Bari, Italy 2 IBM T.J. Watson Research Center, Yorktown Heights, NY, USA Abstract Improving the reliability of large language mod- els (LLMs) at inference time is a central chal- lenge in structured reasoning tasks such as Text- to-SQL. Common test-time inference strate- gies, including Best-of-Nsampling and Ma- jority Voting, rely on heuristic signals such as execution success or output frequency, which provide limited semantic discrimination across candidate outputs. In this work, we study Outcome Reward Models (ORMs) as learned semantic scoring functions for test-time ver- ification in Text-to-SQL. While ORMs have been previously explored for test-time scaling and alignment, their application to structured query generation remains underexplored. We introduce GradeSQL, a scalable framework for training task-specific ORMs via automated can- didate generation and execution-based label- ing, enabling verifier training without man- ual annotation. We integrate ORMs into a verification-driven Best-of-Npipeline and eval- uate our approach on the BIRD and Spider benchmarks across multiple open-source LLM families. ORM-based selection consistently outperforms execution-based Best-of-Nand Majority Voting, with gains of up to +4.33% on BIRD and +2.10% on Spider. We further show that ORMs scale effectively with larger candi- date sets and yield stronger improvements on complex queries. Overall, our results demon- strate that ORM-based verification provides a simple, effective, and scalable alternative to heuristic test-time selection strategies for Text- to-SQL. Code 1 , datasets 2 , and models 3 are pub- licly available. 1 Introduction As large language models (LLMs) are increasingly deployed in structured reasoning tasks, improving reliability at inference time has become a central 1 GradeSQL Framework 2 GradeSQL Training Datasets 3 Pretrained GradeSQL ORMs challenge. While scaling model size and training data has driven substantial progress, further gains increasingly depend on post-training techniques that leverage verification, feedback, and candidate selection mechanisms. In this setting, test-time in- ference plays a critical role: rather than producing a single output, models generate multiple candidates and rely on selection strategies to identify the most accurate solution. Text-to-SQL, the task of translating natural lan- guage questions into executable SQL queries, pro- vides a natural testbed for studying test-time veri- fication. It enables intuitive access to structured databases (Nascimento et al., 2024; Kim et al., 2020), but requires strict semantic correctness: small errors in query structure can lead to incorrect results. Despite strong progress with LLMs (Ku- mar, 2024; Pourreza and Rafiei, 2023), perfor- mance remains limited on complex queries involv- ing multi-table joins, nested subqueries, and subtle constraints (Ma et al., 2024). This makes robust verification mechanisms essential. A common approach to improving performance is to increase test-time compute via strategies such as Best-of-N(BoN) sampling and Majority Vot- ing (Cobbe et al., 2021; Sheng and Xu, 2025). These methods exploit generation diversity, but rely on heuristic signals such as execution success or output frequency, which provide only coarse proxies for semantic correctness. As candidate sets grow, these heuristics often saturate and fail to dis- criminate between semantically valid and invalid queries. Reward models offer a principled alternative by learning to score outputs according to task-specific correctness. In particular, Outcome Reward Mod- els (ORMs) assign scalar scores to complete out- puts and have been successfully used for test-time scaling and alignment in prior work (Cobbe et al., 2021). However, their application to structured reasoning tasks such as Text-to-SQL remains un- arXiv:2606.30851v1 [cs.CL] 29 Jun 2026 derexplored, especially in terms of scalable data curation, task-specific training, and integration into practical inference pipelines. In this work, we investigate how ORMs can be effectively adapted and deployed as verifiers for Text-to-SQL. Our goal is not to introduce a new class of reward models, but to demonstrate how existing ORM paradigms can be trained and ap- plied in a scalable way for structured query genera- tion. A key challenge is data availability: training ORMs requires labeled candidate outputs, which are scarce for structured tasks. To address this, we introduce GradeSQL, a framework for scalable ORM training based on automated data synthesis. Given a natural language question and database schema, we generate diverse candidate SQL queries, label them via execution equivalence, and fine-tune a verifier to predict se- mantic correctness. At inference time, the trained ORM is used to re-rank candidates within a Best- of-Npipeline, replacing heuristic selection with learned scoring. We evaluate our approach on the BIRD and Spi- der benchmarks using multiple open-source LLM families. Results show that ORM-based verifica- tion consistently improves execution accuracy over heuristic baselines, with gains of up to +4.33% on BIRD and +2.10% on Spider. While absolute improvements are moderate, they are consistent across models and datasets, and are obtained with- out modifying the generator or requiring additional environment interaction at inference time. We fur- ther show that ORM-based selection scales more effectively with larger candidate budgets and yields stronger gains on complex queries. In summary, our contributions are: • ORM-based Verification for Text-to-SQL: We study Outcome Reward Models as learned semantic scorers for test-time candidate selec- tion in structured query generation. •Scalable Data Curation Pipeline: We pro- pose an automated framework for generating and labeling candidate SQL queries, enabling ORM training without manual annotation. • Empirical Analysis of Test-Time Verifica- tion: We provide a systematic evaluation of ORM-based selection across models, datasets, and inference regimes, showing consistent im- provements over heuristic baselines. 2 Related Work 2.1 Text-to-SQL with LLMs Text-to-SQL translates natural language questions into executable SQL queries, enabling natural lan- guage access to structured databases. The field has evolved from rule-based and logic-driven sys- tems (Woods, 1972; Warren and Pereira, 1982) to neural semantic parsing approaches (Tang and Mooney, 2000; Xiao et al., 2016). The introduc- tion of large-scale benchmarks such as Spider (Yu et al., 2018) enabled the development of schema- aware models based on pre-trained language mod- els (PLMs) such as BERT and T5 (Devlin et al., 2019; Raffel et al., 2020), with architectures like RAT-SQL highlighting the importance of schema encoding (Wang et al., 2020). Recent advances with large language mod- els (LLMs) have further improved performance through zero- and few-shot prompting, task decom- position, and retrieval-augmented generation (Ku- mar, 2024; Pourreza and Rafiei, 2023; Li et al., 2023). Despite these advances, Text-to-SQL re- mains challenging for complex queries involving multi-step reasoning and strict semantic correct- ness, motivating stronger verification mechanisms at inference time. 2.2 Test-Time Inference and Verification Test-time inference (TTI) improves model outputs by allocating additional computation at inference without modifying model parameters (Snell et al., 2025). A common approach is to generate multiple candidate outputs and select among them. Best-of- Nsampling and related strategies have been widely studied, including in mathematical reasoning where learned verifiers are used to select correct solutions from multiple candidates (Cobbe et al., 2021). Ma- jority Voting further aggregates multiple outputs based on answer consistency. While these approaches are effective, many prac- tical implementations rely on heuristic signals such as execution success, output agreement, or fre- quency, which may fail to capture semantic cor- rectness in structured tasks. This has motivated the use of learned verification models that score candidate outputs based on task-specific criteria. 2.3 Reward Models and Learned Verifiers Reward models provide a principled framework for scoring model outputs. Process Reward Mod- els (PRMs) evaluate intermediate reasoning steps, Prompt: question database_schema Generate SQL. # Step by step solution: ## Select all the columns... ## From the tables... ## Final solution is: SELECT * FROM pilots GeneratedCoTs SELECT * FROM pilots Candidate QueriesLabel SELECT * FROM pilotsIncorrect SELECT ID FROM pilotsCorrect ...... SELECT name FROM pilotsIncorrect Stage 1: Candidatesgeneration Final ORM Base LLM LLM Generator FinalNSQL candidates Stage 2: Data labeling LoRA finetuning Stage 3: SFT Figure 1: Overview of the GradeSQL framework for training an ORM. The framework consists of three stages: (i) Candidate Generation, (i) Data Labeling, and (i) Supervised Fine-Tuning (SFT). while Outcome Reward Models (ORMs) assign scalar scores to final outputs (Cobbe et al., 2021). ORMs have been successfully used for test-time scaling and alignment, particularly in reasoning tasks where multiple candidate solutions can be generated and ranked. More recent work explores generative verifiers (Zhang et al., 2025), where ver- ification is framed as next-token prediction rather than explicit reward modeling, enabling scalable training without separate reward heads. These ap- proaches further highlight the flexibility of learned verification mechanisms in post-training pipelines. In Text-to-SQL, learned verification remains rel- atively underexplored. Prior work has focused pri- marily on improving generation through prompt design, retrieval, or fine-tuning, rather than explic- itly training verifiers. This leaves open the question of how to effectively train and deploy task-specific reward models for structured query verification. 2.4 Data Curation for Verifier Training A key challenge in training reward models is the availability of labeled data. Existing Text-to-SQL datasets are designed for generation rather than ver- ification, typically providing a single gold query per input. Synthetic data generation approaches have been proposed to scale training data (Li et al., 2025a; Yang et al., 2024), but are not tailored to the needs of verifier training, which requires diverse candidate outputs and fine-grained correctness sig- nals. In this work, we address this gap by introduc- ing a scalable pipeline for generating and labeling candidate SQL queries, enabling the training of task-specific Outcome Reward Models for test-time verification. 3 Methodology 3.1 Problem Formulation Given a natural language questionq i ∈ Qand its associated database schemaΣ i , the Text-to- SQL task aims to generate a correct SQL query y gold i ∈ Y gold (Baek et al., 2025; Dai et al., 2025). Under a test-time inference setting, the goal ex- tends from producing a single query to selecting the best query from a set of candidates generated by a large language model (LLM). Specifically, for a given questionq i , an LLM produces a candidate set Y candidate =c 1 ,c 2 ,...,c N , from which a verifier selects the most semantically faithful query. In this work, the verifier is an Out- come Reward Model (ORM), formalized as a scor- ing function φ(q i ,c j )∈ [0, 1], which estimates the likelihood that candidatec j cor- rectly captures the intent ofq i . The final prediction is obtained via: c ∗ = arg max c j ∈Y candidate φ(q i ,c j ). Training such a verifier poses two challenges: (i) constructing datasets with labeled candidate cor- rectness, and (i) assigning scores that reflect se- mantic alignment rather than surface heuristics. To address this, we leverage the LLM’s self-evaluation capabilities (Liu et al., 2024; Huang et al., 2024; Li et al., 2024), prompting it to assess candidate correctness and using the resulting logits as super- vision signals. We implement this approach in the GradeSQL framework, illustrated in Figure 1. 3.2 GradeSQL Framework Given a datasetD =(q i ,y gold i ) n i=1 , GradeSQL trains an ORM through three stages. Stage 1: Candidate Generation For each question q i and schemaΣ i , a generator LLMGproduces a set of N candidate SQL queries: Y candidate =G(q i , Σ i ) =c 1 ,...,c N . Prompt: question database_schema Generate SQL. # Step by step solution: ## Select all the columns... ## From the tables... ## Final solution is: SELECT * FROM pilots SELECT * FROM pilots Final N SQL candidates Generated CoTs with Solution LLM Generator Stage 1: Candidates generation RemovingCoTs traces Candidate QueriesScores SELECT ID FROM pilots0.9 SELECT * FROM pilots0.4 ...... SELECT name FROM pilots 0.1 Prompt: question database_schema sql Is the SQL correct? SELECT ID FROM pilots Scoring candidates Final ORM Stage 2: Query selection Figure 2: ORM-based inference pipeline: candidate SQL queries are generated by an LLM and ranked by the ORM, with the highest-scoring query selected. To promote diversity in the candidate set, genera- tion is performed using stochastic decoding strate- gies, allowing the model to explore multiple plau- sible query formulations. This diversity is essential for effective verification, as it exposes the ORM to a broader range of correct and incorrect candi- dates, including semantically equivalent queries with different syntactic structures as well as near- miss errors. Stage 2: Data Labeling Each candidate is exe- cuted on the database. LetR(c j )denote the re- sult set of queryc j . A candidate is labeled as cor- rect ifR(c j ) = R(y gold i ) and incorrect otherwise. Queries that raise execution errors are discarded. The labeling function is: ℓ(c j ) = Yesif R(c j ) = R(y gold i ), Noif R(c j )̸= R(y gold i ), discarded if execution fails. Stage 3: Supervised Fine-Tuning The labeled datasetD label =(c j ,ℓ(c j ))is used to fine-tune a verifier LLM as a binary autoregressive classifier. Each input is constructed as x = Prompt(Σ,q,c), with target labell ∈ Yes, No. We fine-tune the model using LoRA (Hu et al., 2022) under the causal language modeling objective (Radford et al., 2019): L(θ) =− |s| X t=1 logP θ (s t | s <t ), where s = [x;l]. 3.3ORM Inference and Probabilistic Scoring At inference time, the ORM assigns a probabilistic score to each candidate SQL query. Given a prompt x = Prompt(Σ,q,c), the verifier defines: P (y | x;θ), y ∈Yes, No, and uses the probability of the “Yes” token as the candidate score: Score(c) = P (y yes | x;θ). Rather than making a hard classification deci- sion, this formulation yields a continuous confi- dence score that enables robust ranking of can- didates (Figure 2). Probabilistic scoring offers fine-grained calibration across syntactically valid queries and avoids the brittleness of binary thresh- olding, making it well-suited for test-time verifica- tion. Interpretation as a Learned VerifierThe ORM can be interpreted as a learned verifier that ap- proximates semantic correctness beyond simple execution-based heuristics. While execution sig- nals provide a binary notion of correctness, the ORM learns a softer scoring function that captures patterns across candidate queries, such as structural consistency, alignment with schema elements, and robustness to spurious matches. In particular, by training on diverse candidate sets that include both correct and incorrect queries, the ORM is exposed to fine-grained distinctions between semantically valid and invalid formulations. This allows it to as- sign higher confidence to candidates that are more likely to generalize beyond execution equivalence alone, especially in cases where multiple queries execute successfully but differ in semantic fidelity. As a result, the ORM complements heuristic selec- tion by providing a more discriminative ranking signal over the candidate pool. 4 Experimental Setup Datasets We evaluate on two cross-domain Text- to-SQL benchmarks: Spider (Yu et al., 2018) and BIRD (Li et al., 2023). Both use disjoint databases across splits. For Spider, we train ORMs on the training set and evaluate on dev and test. For BIRD, we train on the training set and evaluate on the dev set due to the hidden test split. Metrics We use Execution Accuracy (EX), which measures whether predicted and gold queries return identical results, and Pass@N, which measures Table 1: Reproducibility results of OmniSQL-7B. Maj = Majority Voting (temperatureT =0.8,N =8); Gre = Greedy decoding (N =1). The table compares our reproduction (Our) with the original results (Origin) on the BIRD dev, Spider dev, and Spider test benchmarks. BIRD devSpider devSpider test MajGreMajGreMajGre Our66.9564.4183.9582.1185.6184.49 Origin66.1063.9081.6081.2088.9087.90 whether at least one of theNgenerated candidates is correct. Baselines We compare against two test-time infer- ence strategies: Majority Voting and execution- based Best-of-N, both selecting a single query from a candidate pool without using gold refer- ences. Majority Voting Candidates are executed and grouped by identical result sets. The largest group is selected and a query is sampled uniformly from it (Sheng and Xu, 2025). Execution-based Best-of-NCandidates are ranked using a simple execution heuristic that fa- vors queries that execute successfully and return non-empty results (Chen et al., 2023). ORMs and Evaluation Setup We use OmniSQL- 7B (Li et al., 2025a) as the generator. For each question, the same set ofNcandidates is produced and shared across all methods. We compare Major- ity Voting, execution-based Best-of-N , and ORM- based Best-of-N over this fixed pool. This setup isolates the effect of the selection mechanism from generation quality. All methods operate on identical candidates and are evaluated under the same metric. ORM-based selection re- quires an additional offline training phase, so re- sults reflect differences in selection quality rather than fully compute-matched end-to-end systems. To validate the generator, we reproduce Om- niSQL results on Spider and BIRD. Table 1 shows deviations within 1% on BIRD dev and within 3% on Spider dev. Compute Considerations Heuristic baselines re- quire no additional training, whereas ORM-based selection incurs offline verifier training. At infer- ence time, all methods operate on the same candi- date pool. The trade-off is between upfront training cost and improved semantic discrimination dur- ing selection. In our setting, training is amortized across queries and requires no additional environ- ment interaction beyond candidate generation and Table 2: Execution accuracy (%) of OmniSQL-7B on BIRD dev, Spider dev, and Spider test.∆indicates the gain over the baseline (N =1). Best and runner-up re- sults are in bold andunderlined, respectively. Values marked with†are not McNemar significant (p < 0.05), and those with * lose significance after Bonferroni cor- rection. Method BIRD devSpider devSpider test EX∆EX∆EX∆ Baseline (N=1)63.89–82.40–84.02– Majority Voting (N=32) 66.95+3.0683.75∗+1.35 85.47+1.45 Best-of-N (N=32) Execution-based66.04 +2.15 82.79†∗ +0.39 85.14 +1.12 ORM-based68.90 +5.0184.53∗+2.13 87.47 +3.45 execution. Reproducibility Details Experiments were run on nodes with Intel Xeon 8358 CPUs, 512 GB RAM, and 4 NVIDIA A100 GPUs (64 GB). Candidates were generated usingvLLM, and ORM inference used Hugging Facetransformers. All runs use seed 42. 5 Results and Discussion We evaluate our framework across seven open- source LLMs: Qwen2.5-1.5B/7B-Instruct, Granite- 3.3-2B/8B-Instruct, Llama-3.2-1B, Llama-3.1-8B- Instruct, and OmniSQL-7B. Experiments are con- ducted on BIRD dev (1,534 samples), Spider dev (1,034 samples), and Spider test (2,147 samples). ORM training data is constructed from the original training splits (9,428 queries for BIRD and 9,000 for Spider), yielding 9,411 and 8,960 queries after light preprocessing. For each question, OmniSQL-7B generatesN = 32SQL candidates, following prior work (Li et al., 2025b) as a trade-off between performance and computational cost (Wang et al., 2023; Lewkowycz et al., 2022). Invalid queries are discarded, and remaining candidates are labeled based on execu- tion equivalence with the gold query, resulting in 82,640 labeled samples for BIRD and 50,073 for Spider. ORM vs. Test-Time Baselines Table 2 compares ORM-based Best-of-Nwith execution-based Best- of-N(ex-BoN) and Majority Voting (Maj), using OmniSQL-7B as the generator. Statistical signifi- cance is assessed using the McNemar test with Bon- ferroni correction (Dror et al., 2018). ORM-based selection achieves the highest execution accuracy across all datasets. Except for Spider dev (likely due to smaller sample size), improvements remain statistically significant. On BIRD dev, ORM reaches 68.90%, outper- Table 3: Dataset statistics for BIRD and Spider (training splits). We report (i) the number of questions before and after de-duplication (with removals∆), and (i) the final size of the labeled sets generated by samplingN = 32 candidates per question. Percentages indicate the class distribution (Incorrect / Correct) in the imbalanced set; the balanced set is 50/50. BIRD (train)Spider (train) Questions # (pre)9,4289,000 # (post)9,4118,960 Removed ∆ (%)17 (0.18%)40 (0.44%) Labeled sets Imbalanced size82,64050,073 Class split (% inc / cor)41.37 / 58.6330.60 / 69.40 Balanced size (50/50)30,68617,834 Table 4: ORM performance on BIRD and Spider with the unbalanced dataset, reporting Execution Accuracy (%) on dev and test sets. ORM ModelBird devSpider devSpider test Granite-3.3-2B-Instruct66.8882.7985.14 Granite-3.3-8B-Instruct68.2584.4286.91 Llama-3.2-1B-Instruct67.6784.0486.31 Llama-3.1-8B-Instruct68.3282.3085.89 Qwen2.5-1.5B-Instruct68.1284.3386.17 Qwen2.5-7B-Instruct68.5884.3386.91 OmniSQL-7B68.6484.4286.63 forming Maj (66.95%) and ex-BoN (66.04%), with a +5.01 gain over theN =1baseline. On Spider dev, ORM achieves 84.53% (+2.13 over Maj), and on Spider test 87.47%, exceeding both Maj (85.47%) and ex-BoN (85.14%) by a wide margin. Dataset Imbalance The resulting datasets ex- hibit class imbalance: Spider contains 69.4% cor- rect candidates, while BIRD is more balanced (58.63% correct). To study its impact, we construct balanced datasets by downsampling to a 50/50 split per question. Statistics are summarized in Table 3. Using these datasets, we address three research questions: (i) cross-family ORM trainability, (i) the effect of dataset balancing, and (i) ORM ef- fectiveness relative to test-time baselines. Cross-Family Trainability Table 4 reports ORM performance trained on unbalanced data across all backbones. Results are tightly clustered: BIRD dev ranges from 66.88–68.64, Spider dev from 82.30–84.42, and Spider test from 85.14–86.91. Performance differences across model families and scales are modest, indicating that ORMs train re- liably across heterogeneous architectures. Larger models yield only minor gains, suggesting ORM effectiveness is not strongly dependent on param- eter count. Rankings are stable across datasets Table 5: Execution accuracy (%) of ORM models on BIRD dev, Spider dev, and Spider test. Each cell shows results on Unbalanced and Balanced sets with∆(green ↑= gain, red↓= drop). Ordered by BIRD Unbalanced; best in bold, runner-up underlined. ORM Model BIRD dev Unbalanced→ Balanced Spider dev Unbalanced→ Balanced Spider test Unbalanced→ Balanced Granite-3.3-2B-Instruct 66.88→ 66.17 (-0.71↓) 82.79→ 82.79 (0.00) 85.14→ 85.14 (0.00) Llama-3.2-1B-Instruct 67.67→ 67.21 (-0.46↓) 84.04→ 83.56 (-0.48↓) 86.31→ 86.54 (+0.23↑) Qwen2.5-1.5B-Instruct 68.12→ 67.28 (-0.84↓) 84.33→ 83.56 (-0.77↓) 86.17→ 86.31 (+0.14↑) Granite-3.3-8B-Instruct 68.25→ 68.38 (+0.13↑) 84.42→ 83.85 (-0.57↓) 86.91→ 87.00 (+0.09↑) Llama-3.1-8B-Instruct 68.32→ 67.86 (-0.46↓) 82.30→ 84.11 (+1.81↑) 85.89→ 86.96 (+1.07↑) Qwen2.5-7B-Instruct 68.58→ 68.19 (-0.39↓) 84.33→ 84.14 (-0.19↓) 86.91→ 86.68 (-0.23↓) OmniSQL-7B 68.64→ 68.90 (+0.26↑) 84.42→ 84.53 (+0.11↑) 86.63→ 87.47 (+0.84↑) and splits, demonstrating robustness and family- agnostic generalization. Effect of Dataset Balancing Table 5 compares ORMs trained on unbalanced versus balanced data. Balancing produces mixed effects on dev sets but yields more consistent improvements on Spider test, particularly for Llama-3.1-8B (+1.07) and OmniSQL-7B (+0.84). Overall changes remain small (within±1.2), indicating ORM stability un- der skewed label distributions. Importantly, balanced datasets substantially re- duce training size (from 80k→30k for BIRD and 50k→18k for Spider), lowering training cost with- out degrading performance. In several cases, bal- anced training even improves accuracy. We there- fore adopt the balanced configuration for subse- quent comparisons. Summary ORMs (i) train reliably across model families, (i) remain stable under label imbalance while benefiting from balanced data, and (i) con- sistently outperform widely used test-time heuris- tics. These results establish ORM-based selection as a stronger and more principled alternative to Ma- jority Voting and execution-based Best-of-Nfor test-time inference in Text-to-SQL. 6 Ablation Studies We conduct ablations to better understand the be- havior of Outcome Reward Models (ORMs) under different design and scaling choices. In particular, we study: (i) the effect of candidate pool sizeN, (i) ORM performance with larger generators, (i) sensitivity to training prompts, (iv) scaling ORMs beyond 7B parameters, and (v) the impact of fine- tuning objectives. Table 6: Execution accuracy (%) and Pass@Nof test-time strategies (execution-based BoN, Majority Voting, ORM-based BoN) across varyingNvalues on the BIRD dev, Spider dev, and Spider test benchmarks. Columns are color-coded from light yellow (lowest) to dark orange (highest) performance. N Execution-based BoNMajority VotingORM-based BoNPass@N BIRD devSpider devSpider testBIRD devSpider devSpider testBIRD devSpider devSpider testBIRD devSpider devSpider test 3266.0482.7985.1466.9583.7585.4768.9084.5387.4780.5791.6893.29 31 66.0482.7985.1467.0883.7585.4768.5884.5387.4780.2591.6893.20 30 66.0482.8885.1467.0183.6685.4268.5884.6287.4780.2591.6893.15 2965.9782.8885.1466.9583.5685.4268.5184.6287.4280.1291.6893.11 2865.9782.8885.1467.0183.7585.4768.5884.6287.3880.0591.6893.01 2765.9782.8885.1467.1483.8585.4768.5884.6287.3879.9291.5993.01 2665.9782.8885.1466.7583.7585.3368.6484.6287.3879.9291.5992.87 2565.9782.8885.1466.7583.8585.5168.7184.6287.3879.7991.5992.87 2465.9782.8885.1467.0183.9585.5668.7784.6287.3379.5391.5992.78 2365.9782.8885.1467.0884.1485.4768.7184.6287.3379.4791.4992.78 2265.9782.8885.1466.8883.9585.4268.9084.6287.3379.3391.3992.73 2165.9182.8885.1466.7583.8585.4768.8484.6287.2879.1491.2092.73 2065.9182.8885.1467.0183.7585.5668.7784.6287.3379.0791.0192.69 1965.9182.8885.1467.0883.8585.3768.7784.6287.3378.8890.9192.59 1865.9182.8885.1467.0183.7685.6568.8484.6287.3878.8890.8192.55 1765.9182.8885.1467.0883.9585.6168.7784.7287.3378.6890.8192.50 1665.9182.8885.1466.9583.6685.6168.7784.5387.3378.4990.7292.40 1565.8482.8885.1467.1483.8585.4268.7184.5387.2878.2390.5292.27 14 65.8482.8885.1067.0183.8585.6168.6484.5387.1977.9090.5292.13 1365.8482.8885.1067.1483.6685.5668.6484.5387.1977.8490.4392.08 1265.8482.8885.0566.8883.8585.5168.7184.4486.9677.7190.4391.94 1165.8482.8885.0566.8283.6685.1968.6484.3386.8777.2590.2391.71 10 65.7182.8885.0566.6984.1485.5668.6484.3386.9176.9990.0491.66 965.7182.8885.0566.4984.0485.6568.5184.2486.9176.6089.8591.62 8 65.7182.8885.0566.9583.9585.6168.5184.3386.8276.1489.6591.48 765.5882.7985.0566.6284.0485.7068.3884.3386.7775.3689.2691.06 665.4582.7985.0066.4383.6685.7567.8684.2486.5474.5889.1790.82 565.3882.7985.0065.9783.9585.6567.4784.1486.4973.7988.5990.54 465.3282.8885.0065.3283.6685.4767.3484.0486.4972.8288.3090.13 365.1282.8884.9165.1983.5685.3366.7584.0486.1770.8687.4389.10 264.8682.7984.6364.4183.0884.4466.0483.6685.7568.8486.0787.66 163.8982.4084.0263.8982.4084.0263.8982.4084.0263.8982.4084.02 Table 7: Execution accuracy (%) and Pass@32 on the BIRD dev, Spider dev, and Spider test. Candidate queries are generated by OmniSQL models with 7B, 14B, and 32B parameters, while the ORM is imple- mented using OmniSQL-7B. Best scores per column are shown in bold. ModelBaselineEx-BoNMajority VotingORM-BoNPass@32 BIRD dev OmniSQL-7B63.8966.0466.9568.9080.57 OmniSQL-14B64.2866.7567.0169.0480.90 OmniSQL-32B64.0266.1063.9569.3082.20 Spider dev OmniSQL-7B82.4082.7983.7584.3391.68 OmniSQL-14B82.0182.2083.5684.6292.75 OmniSQL-32B83.1783.3783.0884.4392.84 Spider test OmniSQL-7B84.0285.1485.4787.3393.29 OmniSQL-14B84.9185.2884.8687.4293.53 OmniSQL-32B84.3084.7286.0787.1994.08 Effect of Candidate Pool SizeNTable 6 shows that ORM-based selection consistently outperforms execution-based Best-of-Nand Majority Voting across all values ofNon BIRD and Spider. While heuristic methods saturate early, ORM perfor- mance continues to improve asNincreases and more closely approaches the oracle upper bound de- fined by Pass@N. Gains are largest on challenging queries (Figure 3), where semantic discrimination is most critical. These results indicate that ORMs more effectively leverage increased test-time com- pute. Table 8: Ablation study on verification prompt de- sign for ORM on BIRD dev. Execution accuracy (%) by query difficulty. Generator: OmniSQL-7B; ORM: Qwen2.5-7B-Instruct. Best scores in bold. Prompt VariantSimpleModerateChallengingTotal Instruction72.6559.7051.3266.72 Data-Only72.7659.4851.7266.75 SQL-Only72.8663.3653.7968.19 Data + SQL73.0862.5050.3467.73 ORMs with Larger Generators Table 7 evalu- ates ORM-based selection with increasingly large OmniSQL generators (7B, 14B, 32B). Across BIRD and Spider, ORMs consistently outperform heuristic baselines and maintain stable improve- ments as generator size increases. While larger generators improve absolute performance, the rel- ative gains from ORM-based selection persist, in- dicating that ORM benefits are complementary to generator scaling. Impact of Training Prompt Table 8 studies prompt design for ORM training. Differences are negligible for simple queries but become pro- nounced for moderate and challenging ones. The SQL-only prompt consistently yields the best over- 048121620242832 Number of Generations 70.5 71.0 71.5 72.0 72.5 73.0 73.5 74.0 74.5 Execution Accuracy (%) Strategies ex-BoN Maj ORM-BoN (a) Simple 048121620242832 Number of Generations 56 57 58 59 60 61 62 63 Execution Accuracy (%) Strategies ex-BoN Maj ORM-BoN (b) Moderate 048121620242832 Number of Generations 48 49 50 51 52 53 54 Execution Accuracy (%) Strategies ex-BoN Maj ORM-BoN (c) Challenging 048121620242832 Number of Generations 64 65 66 67 68 69 Execution Accuracy (%) Strategies ex-BoN Maj ORM-BoN (d) Overall Figure 3: Execution accuracy on BIRD dev as a function ofN, comparing execution-based Best-of-N, Majority Voting, and ORM-based Best-of-N, stratified by query difficulty. Table 9: Impact of ORM model size with the generator fixed to OmniSQL-7B. Execution Accuracy (EX, %) and Pass@32 are reported on BIRD dev, Spider dev, and Spider test. Best results per metric and dataset are shown in bold. ORM BIRD devSpider devSpider test EXPass@32EXPass@32EXPass@32 OmniSQL-7B68.9080.5784.5391.6887.4793.29 OmniSQL-14B69.2380.5785.0191.6887.8493.29 OmniSQL-32B68.1980.5784.2391.6886.9193.29 all accuracy, outperforming instruction-style and data-only variants. This suggests that exposing the verifier directly to SQL structure provides the most effective signal for semantic verification. Scaling ORMs Beyond 7B Table 9 shows that increasing ORM size beyond 7B parameters yields only marginal and inconsistent improvements. While a 14B ORM occasionally improves over 7B, a 32B ORM often underperforms, indicating dimin- ishing returns. Overall, lightweight ORMs achieve a favorable balance between performance and effi- ciency, and larger verifiers cannot compensate for generator limitations. Fine-Tuning Objective Table 10 compares au- toregressive fine-tuning with Binary Cross-Entropy (BCE). Autoregressive training consistently out- performs BCE and Majority Voting, with the largest gains observed on moderate and challenging queries. These results indicate that modeling verifi- cation as an autoregressive generation task better Table 10: Ablation study comparing autoregressive and Binary Cross-Entropy (BCE) loss fine-tuning on BIRD dev across query difficulty levels. Both the generator and ORM model are OmniSQL-7B. Reported metric is Execution Accuracy (%). Best results are in bold. MethodSimpleModerateChallengingTotal Majority Voting72,8659,7052,4166,95 BCE FT72,8659,9151,7266,95 Autoregressive FT74.1562.9354.4868.90 captures semantic correctness than direct classifi- cation. Summary Across all ablations, ORMs demon- strate stable behavior under varying candidate bud- gets, generator scales, prompts, and training ob- jectives. Performance is primarily driven by the quality of feedback and verification signal rather than verifier size, reinforcing the effectiveness of lightweight, autoregressive ORMs for test-time ver- ification. 7 Conclusion In this work, we studied the use of Outcome Reward Models (ORMs) as learned verification mechanisms for test-time inference in Text-to-SQL. Rather than introducing new reward modeling tech- niques, our goal was to investigate how existing ORM paradigms can be effectively adapted to struc- tured query generation, where semantic correctness is critical. We introduced GradeSQL, a scalable pipeline for training task-specific ORMs through automated candidate generation and execution- based labeling, enabling verifier training without manual annotation and supporting deployment in standard Best-of-Ninference pipelines. Across the BIRD and Spider benchmarks, ORM-based se- lection consistently improves execution accuracy over heuristic baselines such as execution-based Best-of-Nand Majority Voting. While absolute gains are moderate, they are stable across mod- els and datasets, and become more pronounced in challenging queries and larger candidate regimes, where heuristic methods tend to saturate. Overall, our findings suggest that learned verification pro- vides a simple and effective complement to heuris- tic test-time selection strategies in Text-to-SQL, highlighting the importance of data curation and task-specific training for scalable verifier-based in- ference in structured reasoning tasks. We release our code, datasets, and trained models to support reproducibility. Limitations ORM-based selection requires an additional offline training phase, unlike heuristic baselines such as Majority Voting and execution-based Best-of-N. While this cost is amortized across queries, our comparison is not fully compute-matched end-to- end. Moreover, the observed gains, although con- sistent, are moderate (2–5%) and mainly arise in challenging queries and larger candidate regimes, indicating improvements in selection rather than in the underlying generation capability. Our approach relies on execution equivalence as a proxy for se- mantic correctness, which may fail to distinguish semantically equivalent queries or may reward spu- rious matches. In addition, evaluation is limited to clean benchmark datasets (Spider and BIRD), and performance in real-world settings with noisy schemas or ambiguous queries remains unclear. Fi- nally, we focus on binary Outcome Reward Models; richer verification signals, such as fine-grained or process-level feedback, are not explored. Ethical Considerations This work focuses on improving the reliability of LLM-based systems for structured data access through Text-to-SQL, with potential benefits for accessibility and decision support. However, in- correct or misleading SQL generation may lead to faulty data retrieval and downstream decisions, particularly in high-stakes domains. While ORM- based verification improves selection quality, it re- lies on execution-based supervision, which may in- herit biases or errors present in underlying data or schemas. Our approach does not introduce new per- sonal data or sensitive information, but care should be taken when deploying such systems on propri- etary or privacy-sensitive databases. Finally, in- creased use of test-time compute and model-based verification may have environmental and cost im- plications. We encourage future work on robust evaluation in real-world settings and on develop- ing more transparent and accountable verification mechanisms. References Jinheon Baek, Horst Samulowitz, Oktie Hassanzadeh, Dharmashankar Subramanian, Sola Shirai, Alfio Gliozzo, and Debarun Bhattacharjya. 2025. Knowl- edge base construction for knowledge-augmented text-to-sql. In ACL (Findings), pages 26569–26583. Association for Computational Linguistics. Bei Chen, Fengji Zhang, Anh Nguyen, Daoguang Zan, Zeqi Lin, Jian-Guang Lou, and Weizhu Chen. 2023. Codet: Code generation with generated tests. In ICLR. OpenReview.net. Karl Cobbe, Vineet Kosaraju, Mohammad Bavarian, Mark Chen, Heewoo Jun, Lukasz Kaiser, Matthias Plappert, Jerry Tworek, Jacob Hilton, Reiichiro Nakano, Christopher Hesse, and John Schulman. 2021. Training verifiers to solve math word prob- lems. CoRR, abs/2110.14168. Yaxun Dai, Haiqin Yang, Hao Mou, and Pingfu Chao. 2025. PARSQL: enhancing text-to-sql through SQL parsing and reasoning. In ACL (Findings), pages 661–681. Association for Computational Linguistics. Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: pre-training of deep bidirectional transformers for language under- standing. In NAACL-HLT (1), pages 4171–4186. As- sociation for Computational Linguistics. Rotem Dror, Gili Baumer, Segev Shlomov, and Roi Reichart. 2018. The hitchhiker’s guide to testing statistical significance in natural language process- ing. In ACL (1), pages 1383–1392. Association for Computational Linguistics. Edward J. Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, Lu Wang, and Weizhu Chen. 2022. Lora: Low-rank adaptation of large language models. In ICLR. OpenReview.net. Hui Huang, Yingqi Qu, Jing Liu, Muyun Yang, Bing Xu, Tiejun Zhao, and Wenpeng Lu. 2024. Self-evaluation of large language model based on glass-box features. In EMNLP (Findings), pages 5813–5820. Associa- tion for Computational Linguistics. Hyeonji Kim, Byeong-Hoon So, Wook-Shin Han, and Hongrae Lee. 2020. Natural language to SQL: where are we today? Proc. VLDB Endow., 13(10):1737– 1750. Pranjal Kumar. 2024. Large language models (llms): survey, technical frameworks, and future challenges. Artif. Intell. Rev., 57(9):260. Aitor Lewkowycz, Anders Andreassen, David Dohan, Ethan Dyer, Henryk Michalewski, Vinay V. Ra- masesh, Ambrose Slone, Cem Anil, Imanol Schlag, Theo Gutman-Solo, Yuhuai Wu, Behnam Neyshabur, Guy Gur-Ari, and Vedant Misra. 2022. Solving quan- titative reasoning problems with language models. In NeurIPS. Haoyang Li, Shang Wu, Xiaokang Zhang, Xinmei Huang, Jing Zhang, Fuxin Jiang, Shuai Wang, Tiey- ing Zhang, Jianjun Chen, Rui Shi, Hong Chen, and Cuiping Li. 2025a. Omnisql: Synthesizing high- quality text-to-sql data at scale. Proc. VLDB Endow., 18(11):4695–4709. Jinyang Li, Binyuan Hui, Ge Qu, Jiaxi Yang, Binhua Li, Bowen Li, Bailin Wang, Bowen Qin, Ruiying Geng, Nan Huo, Xuanhe Zhou, Chenhao Ma, Guoliang Li, Kevin Chen-Chuan Chang, Fei Huang, Reynold Cheng, and Yongbin Li. 2023. Can LLM already serve as A database interface? A big bench for large- scale database grounded text-to-sqls. In NeurIPS. Moxin Li, Wenjie Wang, Fuli Feng, Fengbin Zhu, Qi- fan Wang, and Tat-Seng Chua. 2024. Think twice before trusting: Self-detection for large language models through comprehensive answer reflection. In EMNLP (Findings), pages 11858–11875. Association for Computational Linguistics. Yanyang Li, Michael R. Lyu, and Liwei Wang. 2025b. Learning to reason from feedback at test-time. In ACL (1), pages 5241–5253. Association for Compu- tational Linguistics. Weize Liu, Guocong Li, Kai Zhang, Bang Du, Qiyuan Chen, Xuming Hu, Hongxia Xu, Jintai Chen, and Jian Wu. 2024. Mind’s mirror: Distilling self-evaluation capability and comprehensive thinking from large language models. In NAACL-HLT, pages 6748–6763. Association for Computational Linguistics. Limin Ma, Ken Q. Pu, and Ying Zhu. 2024. Evaluating llms for text-to-sql generation with complex SQL workload. CoRR, abs/2407.19517. Eduardo Nascimento, Grettel M. García, Lucas Feijó, Wendy Victorio, Yenier Torres Izquierdo, Aiko R. de Oliveira, Gustavo M. C. Coelho, Melissa Lemos, Robinson Luiz Souza Garcia, Luiz André P. Paes Leme, and Marco A. Casanova. 2024. Text-to-sql meets the real-world. In ICEIS (1), pages 61–72. SCITEPRESS. Mohammadreza Pourreza and Davood Rafiei. 2023. DIN-SQL: decomposed in-context learning of text- to-sql with self-correction. In NeurIPS. Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. 2019. Language models are unsupervised multitask learners. OpenAI Blog. Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. 2020. Exploring the limits of transfer learning with a unified text-to-text trans- former. J. Mach. Learn. Res., 21:140:1–140:67. Lei Sheng and Shuai-Shuai Xu. 2025. CSC-SQL: cor- rective self-consistency in text-to-sql via reinforce- ment learning. CoRR, abs/2505.13271. Charlie Victor Snell, Jaehoon Lee, Kelvin Xu, and Avi- ral Kumar. 2025. Scaling LLM test-time compute optimally can be more effective than scaling parame- ters for reasoning. In ICLR. OpenReview.net. Lappoon R. Tang and Raymond J. Mooney. 2000. Au- tomated construction of database interfaces: Inter- grating statistical and relational learning for semantic parsing. In EMNLP, pages 133–141. Association for Computational Linguistics. Bailin Wang, Richard Shin, Xiaodong Liu, Oleksandr Polozov, and Matthew Richardson. 2020. RAT-SQL: relation-aware schema encoding and linking for text- to-sql parsers. In ACL, pages 7567–7578. Associa- tion for Computational Linguistics. Xuezhi Wang, Jason Wei, Dale Schuurmans, Quoc V. Le, Ed H. Chi, Sharan Narang, Aakanksha Chowd- hery, and Denny Zhou. 2023. Self-consistency im- proves chain of thought reasoning in language mod- els. In ICLR. OpenReview.net. David H. D. Warren and Fernando C. N. Pereira. 1982. An efficient easily adaptable system for interpreting natural language queries. Am. J. Comput. Linguistics, 8(3-4):110–122. William Woods. 1972. The lunar sciences natural lan- guage information system. BBN report. Chunyang Xiao, Marc Dymetman, and Claire Gardent. 2016. Sequence-based structured prediction for se- mantic parsing. In ACL (1). The Association for Computer Linguistics. Jiaxi Yang, Binyuan Hui, Min Yang, Jian Yang, Junyang Lin, and Chang Zhou. 2024. Synthesizing text-to- sql data from weak and strong llms. In ACL (1), pages 7864–7875. Association for Computational Linguistics. Tao Yu, Rui Zhang, Kai Yang, Michihiro Yasunaga, Dongxu Wang, Zifan Li, James Ma, Irene Li, Qingning Yao, Shanelle Roman, Zilin Zhang, and Dragomir R. Radev. 2018. Spider: A large-scale human-labeled dataset for complex and cross-domain semantic parsing and text-to-sql task. In EMNLP, pages 3911–3921. Association for Computational Linguistics. Lunjun Zhang, Arian Hosseini, Hritik Bansal, Mehran Kazemi, Aviral Kumar, and Rishabh Agarwal. 2025. Generative verifiers: Reward modeling as next-token prediction. In ICLR. OpenReview.net.