LLMs are widely used for code generation and mathematical reasoning tasks where they are required to generate structured output. They either need to reason about code, generate code for a given specification, or reason using programs of thought. The typical approach to code generation is to prompt the model and generate samples until an appropriate program is obtained. Within this process, sampling $n$ programs from the language model requires $n$ GPU compute-intensive generations which becomes prohibitively expensive for larger values of $n$. In this work, we address this limitation by exposing the LLM's distribution within the generated programs themselves. We propose a novel test-time framework we dub probabilistic programs of thought to obtain more samples from the model with fewer LLM generations. Given a program generated by a model and the associated next-token probabilities, we build a probabilistic program that compactly represents exponentially many deterministic programs. Since performing probabilistic reasoning in this probabilistic program is much cheaper, our approach allows sampling new programs without any additional GPU compute and little CPU overhead. We instantiate our approach on benchmarks for code generation, code understanding and mathematical reasoning and report improvements in performance with fewer generations from the LLM.


翻译:大语言模型广泛应用于代码生成和数学推理任务,这类任务要求模型生成结构化输出。模型需要完成代码推理、根据规范生成代码,或通过思维程序进行推理。典型的代码生成方法是提示模型并生成样本,直至获得合适的程序。在此过程中,从语言模型中采样$n$个程序需要耗费大量GPU计算资源,随着$n$增大成本急剧上升。本研究通过将大语言模型的概率分布显式嵌入生成的程序本身来解决此限制。我们提出一种新颖的测试时框架——概率思维程序,能够以更少的大语言模型生成次数获取更多样本。基于模型生成的程序及其关联的下一词元概率,我们构建可紧凑表征指数级数量确定性程序的概率程序。由于在该概率程序中进行概率推理的成本显著降低,我们的方法无需额外GPU计算且仅需少量CPU开销即可采样新程序。我们在代码生成、代码理解和数学推理基准上实施该方法,实验表明,在减少大语言模型生成次数的前提下,模型性能仍获得提升。

0
下载
关闭预览

相关内容

本话题关于日常用语「概率」,用于讨论生活中的运气、机会,及赌博、彩票、游戏中的「技巧」。关于抽象数学概念「概率」的讨论,请转 概率(数学)话题。
大模型数学推理数据合成相关方法
专知会员服务
36+阅读 · 2025年1月19日
增强大模型智能:数学推理能力的提升策略与实践
专知会员服务
25+阅读 · 2024年8月25日
【斯坦福博士论文】大模型时代的概率推理,137页pdf
专知会员服务
70+阅读 · 2024年3月31日
RecInterpreter:架起大语言模型与传统推荐模型的桥梁
专知会员服务
54+阅读 · 2023年11月9日
「因果推理」概述论文,13页pdf
专知
16+阅读 · 2021年3月20日
绝对干货!NLP预训练模型:从transformer到albert
新智元
13+阅读 · 2019年11月10日
118页概率思维教程——基础、技巧与算法
专知
13+阅读 · 2018年9月5日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
10+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
16+阅读 · 2013年12月31日
国家自然科学基金
18+阅读 · 2012年12月31日
国家自然科学基金
26+阅读 · 2011年12月31日
Arxiv
0+阅读 · 4月2日
Arxiv
0+阅读 · 3月31日
VIP会员
最新内容
综述 | 世界动作模型:少做梦,多行动
专知会员服务
2+阅读 · 6月23日
美以伊冲突:无人机与人工智能的运用
专知会员服务
4+阅读 · 6月23日
《特种部队在透明战场中的生存力》最新报告
专知会员服务
3+阅读 · 6月23日
综述 | 3D场景图:开放挑战与未来方向
专知会员服务
8+阅读 · 6月22日
21世纪的无人机战争
专知会员服务
4+阅读 · 6月22日
《量子技术的军事任务技术适配与利用》
专知会员服务
5+阅读 · 6月22日
相关VIP内容
大模型数学推理数据合成相关方法
专知会员服务
36+阅读 · 2025年1月19日
增强大模型智能:数学推理能力的提升策略与实践
专知会员服务
25+阅读 · 2024年8月25日
【斯坦福博士论文】大模型时代的概率推理,137页pdf
专知会员服务
70+阅读 · 2024年3月31日
RecInterpreter:架起大语言模型与传统推荐模型的桥梁
专知会员服务
54+阅读 · 2023年11月9日
相关基金
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
10+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
16+阅读 · 2013年12月31日
国家自然科学基金
18+阅读 · 2012年12月31日
国家自然科学基金
26+阅读 · 2011年12月31日
Top
微信扫码咨询专知VIP会员