arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2405.16337cs.CLcs.AI
收藏

通过程序生成、仿真与搜索学习推理

Learning to Reason via Program Generation, Emulation, and Search

Johns Hopkins University(约翰斯·霍普金斯大学);Allen Institute for AI(艾伦人工智能研究所);University of Michigan(密歇根大学);MIT(麻省理工学院)

Nathaniel Weir, Muhammad Khalifa, Linlu Qiu, Orion Weller, Peter Clark

AI总结:

针对部分推理任务难以转化为代码的问题,提出CoGEX框架,通过生成伪程序、仿真执行及程序搜索拓展代码合成的适用范围,在多类任务上性能优于标准上下文学习方法。

摘要:

基于语言模型(LM)的程序合成已解锁了大量推理能力;经过代码调优的LM已被证明擅长生成可解决各类算法符号操作任务(例如单词拼接)的程序。然而,并非所有推理任务都能轻松转化为代码形式,例如涉及常识推理、道德决策和反讽理解的任务。我们的目标是将LM的程序合成技能拓展到此类任务中,并通过伪程序(即部分叶函数调用未被定义的Python程序)评估结果。为此,我们提出了Code Generation and Emulated EXecution(CoGEX,代码生成与仿真执行)框架。CoGEX的工作流程包括三个步骤:(1)训练LM生成伪程序;(2)教它们仿真所生成程序的执行过程,包括那些叶函数,让LM的知识填补执行空白;(3)用它们在大量程序中搜索,找到最优程序。为使CoGEX模型适配新任务,我们提出了一种程序搜索方法,可找到单个伪程序,当将其应用于给定数据集的所有实例时,伪执行能产生最优性能。我们在一系列任务(包括算法任务和软推理任务)上的实验表明,与标准的上下文学习方法相比,我们的方法带来了大幅提升。这一结果证明,代码合成可应用的问题类别比之前认为的要广泛得多。我们发布的数据集、微调模型和实现代码可在https://github.com/nweir127/CoGEX 获取。

英文摘要:

Program synthesis with language models (LMs) has unlocked a large set of reasoning abilities; code-tuned LMs have proven adept at generating programs that solve a wide variety of algorithmic symbolic manipulation tasks (e.g. word concatenation). However, not all reasoning tasks are easily expressible as code, e.g. tasks involving commonsense reasoning, moral decision-making, and sarcasm understanding. Our goal is to extend an LM's program synthesis skills to such tasks and evaluate the results via pseudo-programs, namely Python programs where some leaf function calls are left undefined. To that end, we propose, Code Generation and Emulated EXecution (CoGEX). CoGEX works by (1) training LMs to generate pseudo-programs, (2) teaching them to emulate their generated program's execution, including those leaf functions, allowing the LM's knowledge to fill in the execution gaps; and (3) using them to search over many programs to find an optimal one. To adapt the CoGEX model to a new task, we introduce a method for performing program search to find a single program whose pseudo-execution yields optimal performance when applied to all the instances of a given dataset. We show that our approach yields large improvements compared to standard in-context learning approaches on a battery of tasks, both algorithmic and soft reasoning. This result thus demonstrates that code synthesis can be applied to a much broader class of problems than previously considered. Our released dataset, fine-tuned models, and implementation can be found at \url{https://github.com/nweir127/CoGEX}.

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

↑