Beam Search, Self-Consistency, and the Limits of Inference-Time Scaling for Grammar-Constrained Text-to-SQL in Small Language Models

📄 arXiv: 2608.25761v1 📥 PDF

作者: Ty Chermsirivatana, John MacCormick

分类: cs.CL, cs.AI

发布日期: 2026-08-26

备注: 7 pages, 2 figures


💡 一句话要点

提出基于束搜索和自一致性的文本到SQL转换方法以优化小型语言模型

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 文本到SQL 束搜索 样本投票 小型语言模型 推理优化 自然语言处理 数据库查询

📋 核心要点

  1. 现有方法在推理时面临模型大小与计算量之间的权衡,尤其是在语法约束下表现不佳。
  2. 论文提出通过束搜索和样本投票两种方法来优化小型语言模型的推理过程,提升文本到SQL的转换准确性。
  3. 实验结果表明,束搜索在相同推理预算下优于样本投票,且增大模型大小通常能获得更高的准确性。

📝 摘要(中文)

本文探讨了在推理时受限于严格语法的情况下,大型语言模型的模型大小与推理计算之间的权衡。研究表明,在将自然语言查询转换为SQL查询的任务中,束搜索和样本投票方法均能提高准确性,尤其是在小型模型上。实验结果显示,增大模型大小通常比增加推理计算更能提升准确性,而在相同推理预算下,束搜索的表现优于样本投票。这些发现与无约束情况下的结果形成对比。

🔬 方法详解

问题定义:本文旨在解决在严格语法约束下,小型语言模型在文本到SQL转换任务中的推理效率和准确性问题。现有方法在推理计算与模型大小之间的权衡未能充分考虑语法约束的影响。

核心思路:论文提出通过束搜索和样本投票两种方法来优化推理过程,特别关注在小型模型上如何提高准确性。束搜索通过增加束的数量来探索更多可能的输出,而样本投票则通过对多个输出结果进行投票来选择最佳结果。

技术框架:整体架构包括模型训练和推理两个阶段。在推理阶段,采用束搜索和样本投票方法,分别对输出进行优化。实验使用Spider文本到SQL基准进行评估,模型范围从0.5B到7B参数,均采用4位精度。

关键创新:最重要的创新在于揭示了在语法约束下,模型大小与推理计算的权衡与无约束情况下的显著不同,强调了束搜索在相同推理预算下的优势。

关键设计:在实验中,束搜索的束数和样本投票的样本数量是关键参数,研究表明在小型模型上增加推理计算并不总是能带来更高的准确性。

🖼️ 关键图片

img_0
img_1
img_2

📊 实验亮点

实验结果显示,在1034个示例的开发集上,束搜索和样本投票均提高了准确性,尤其是在小型模型上。增大模型大小通常比增加推理计算更能提升准确性,而在相同推理预算下,束搜索的表现优于样本投票,显示出显著的性能提升。

🎯 应用场景

该研究的潜在应用领域包括数据库查询生成、自然语言处理和智能助手等。通过优化小型语言模型的推理过程,可以在资源受限的环境中实现高效的SQL查询生成,具有重要的实际价值和广泛的应用前景。

📄 摘要(原文)

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.