arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2410.02725cs.CLcs.AIcs.LG
收藏

自适应推理时计算:大语言模型能够预测自己是否能做得更好,甚至在生成过程中

Adaptive Inference-Time Compute: LLMs Can Predict if They Can Do Better, Even Mid-Generation

Stanford University(斯坦福大学)

Rohin Manvi, Anikait Singh, Stefano Ermon

AI总结:

本文提出一种生成式自我评估方案,使LLM能在生成过程中预测重新生成是否会更好,从而自适应减少采样数量、早期剪枝并选择最佳样本,在几乎不损失性能的情况下显著提升推理计算效率。

摘要:

推理时计算是提升大语言模型(LLMs)性能的一种强大范式,其中 Best-of-N 采样是一种被广泛使用的技术。然而,这种方法计算开销很大,既需要(1)一个外部奖励模型,也需要(2)生成多个样本。在本工作中,我们提出了一种新的生成式自我评估方案,旨在自适应地减少生成样本的数量,同时保持甚至提升性能。我们采用生成式奖励模型形式,使 LLM 能够在生成过程中预测重新开始生成是否会得到更好的响应。这些预测无需外部奖励模型即可获得,并可用于决定是否生成更多样本、尽早剪枝前景不佳的样本,或挑选最佳样本。这一能力非常廉价,因为它只涉及生成一个预定义的 token。在使用真实的、未经过滤的 LMSYS 用户提示构建的数据集上进行训练后,Llama 3.1 8B 在 AlpacaEval 上对 GPT-4 的胜率从 21% 提高到 34%(使用 16 个样本),在 GSM8K 上的数学性能从 84% 提高到 91%。通过仅在 LLM 判断采样有益时才进行采样,并自适应地调整温度退火,我们证明使用 16 个样本所带来的改进中,有 74% 可以仅用平均 1.2 个样本实现。我们进一步证明,在生成早期可以剪枝 50% 到 75% 的样本,且性能退化极小。总体而言,我们的方法能够在 LLM 推理过程中实现更高效、更具可扩展性的计算利用。

英文摘要:

Inference-time computation is a powerful paradigm to enhance the performance of large language models (LLMs), with Best-of-N sampling being a widely used technique. However, this method is computationally expensive, requiring both (1) an external reward model and (2) the generation of multiple samples. In this work, we introduce a new generative self-evaluation scheme designed to adaptively reduce the number of generated samples while maintaining or even improving performance. We use a generative reward model formulation, allowing the LLM to predict mid-generation the probability that restarting the generation will yield a better response. These predictions are obtained without an external reward model and can be used to decide whether or not to generate more samples, prune unpromising samples early on, or to pick the best sample. This capability is very inexpensive as it involves generating a single predefined token. Trained using a dataset constructed with real unfiltered LMSYS user prompts, Llama 3.1 8B's win rate against GPT-4 on AlpacaEval increases from 21% to 34% with 16 samples and math performance on GSM8K improves from 84% to 91%. By sampling only when the LLM determines that it is beneficial to do so and adaptively adjusting temperature annealing, we demonstrate that 74% of the improvement from using 16 samples can be achieved with only 1.2 samples on average. We further demonstrate that 50-75% of samples can be pruned early in generation with minimal degradation in performance. Overall, our methods enable more efficient and scalable compute utilization during inference for LLMs.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑