Beam Search, Self-Consistency, and the Limits of Inference-Time Scaling for Grammar-Constrained Text-to-SQL in Small Language Models
Organizations: Deep Network Understanding Lab Dickinson College
Abstract
One common trade-off in the use of large language models involves reducing the size of the model while increasing the amount of computation at inference time, for example by using a wider beam search. In this paper, we examine the constrained case of this "model size vs. inference compute" trade-off, in which the model outputs are constrained by a strict grammar at inference time. Our results demonstrate that the constrained trade-off behaves differently from the unconstrained trade-off. We investigate the task of converting a prose query into an equivalent SQL query (text-to-SQL). Performance is evaluated on the Spider text-to-SQL benchmark, using the Qwen2.5-Instruct model family ranging in size from 0.5B to 7B parameters, all at 4-bit precision. We experiment with two approaches to varying inference compute: (i) beam search with a variable number of beams; and (ii) sample+vote, i.e., sampling several constrained outputs and then voting on their execution results, where the number of samples is varied. On the 1034-example development set, we find that: (a) both beam search and sample+vote improve accuracy, especially on smaller model sizes; (b) the "model size vs.\ inference compute" trade-off is not advantageous in this experiment, because moving to a larger model size typically results in higher accuracy than increasing inference compute on the same model size; (c) beam search outperforms sample+vote at a matched inference budget. This latter result is of particular interest since it contrasts with the findings of the unconstrained trade-off.
Figures & tables
| Model | No-grammar greedy | Method | Budget 1 | Budget 2 | Budget 4 | Budget 8 |
|---|---|---|---|---|---|---|
| Qwen2.5-0.5B | 0.135 | Beam | 0.139 | 0.203 | 0.238 | 0.245 |
| Sample+vote | 0.113 | 0.159 | 0.201 | 0.248 | ||
| Qwen2.5-1.5B | 0.326 | Beam | 0.351 | 0.482 | 0.502 | 0.505 |
| Sample+vote | 0.299 | 0.348 | 0.403 | 0.450 | ||
| Qwen2.5-3B | 0.477 | Beam | 0.445 | 0.516 | 0.549 | 0.562 |
| Sample+vote | 0.441 | 0.469 | 0.489 | 0.513 |
| Accuracy | Correct examples | ||||||
|---|---|---|---|---|---|---|---|
| Model | Beam | Sampling | Beam only | Sampling only | Agree | ||
| Qwen2.5-0.5B | 1 | 0.139 | 0.113 | 73 | 46 | 915 | |
| 2 | 0.203 | 0.159 | 103 | 57 | 874 | ||
| 4 | 0.238 | 0.201 | 115 | 77 | 842 | ||
| 8 | 0.245 | 0.248 | 95 | 98 | 841 | ||
| Qwen2.5-1.5B | 1 | 0.351 | 0.299 | 116 | 62 | 856 | |
Inference-Time Scaling
Inference-time scaling studies how extra computation during deployment can improve model performance through search, sampling, verification, or adaptive reasoning.
See all 115 papers