arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2410.03524cs.CL
收藏

在代码执行与文本推理之间引导大型语言模型

Steering Large Language Models between Code Execution and Textual Reasoning

MIT(麻省理工学院);Harvard(哈佛大学);Microsoft(微软公司);Google DeepMind(谷歌DeepMind)

Yongchao Chen, Harsh Jhamtani, Srinagesh Sharma, Chuchu Fan, Chi Wang

AI总结:

本文研究了如何引导LLMs在代码执行与文本推理间选择,发现现有方法无法最优决策,并提出三种改进方法显著提升性能,同时探讨了成本与未来方向。

摘要:

尽管近期大量研究致力于通过优化多智能体框架或推理链来增强大型语言模型(LLMs)的文本推理能力,但有几个基准任务可以通过直接编写代码以100%的成功率解决,这种方式更具可扩展性,且避免了与文本迭代和搜索相关的计算开销。文本推理在解决涉及数学、逻辑、优化和搜索挑战的任务时存在固有的局限性,这不太可能仅通过扩大模型和数据规模来解决。最近发布的OpenAI GPT Code Interpreter以及诸如AutoGen等多智能体框架,展示了集成代码生成与执行以利用LLMs解决复杂任务的卓越能力。然而,基于我们在单轮和多轮设置下,使用14个任务和6种LLMs(包括新的O1-preview)对7种现有的引导代码/文本生成的流行方法进行的实验,目前尚无最优方法能在需要时正确引导LLMs编写代码。我们发现了关于模型何时使用代码与文本推理的一些有趣模式,这些模式随任务复杂度和模型规模的演变而变化,甚至导致了令人惊讶的逆缩放现象。我们还发现,即使任务可以通过代码解决,LLMs编写代码的结果也并不总是优于使用文本推理。为了缓解上述问题,我们提出了三种方法来更好地引导LLMs的代码/文本生成,并取得了显著改进。对所有方法的token长度和运行时间成本进行了深入讨论。我们认为,引导LLMs代码/文本生成的问题对未来研究至关重要,且有很大的进一步改进空间。项目页面、数据集和代码可在https://yongchao98.github.io/CodeSteer/获取。

英文摘要:

While a lot of recent research focuses on enhancing the textual reasoning capabilities of Large Language Models (LLMs) by optimizing the multi-agent framework or reasoning chains, several benchmark tasks can be solved with 100\% success through direct coding, which is more scalable and avoids the computational overhead associated with textual iterating and searching. Textual reasoning has inherent limitations in solving tasks with challenges in math, logics, optimization, and searching, which is unlikely to be solved by simply scaling up the model and data size. The recently released OpenAI GPT Code Interpreter and multi-agent frameworks such as AutoGen have demonstrated remarkable proficiency of integrating code generation and execution to solve complex tasks using LLMs. However, based on our experiments on 7 existing popular methods for steering code/text generation in both single- and multi-turn settings with 14 tasks and 6 types of LLMs (including the new O1-preview), currently there is no optimal method to correctly steer LLMs to write code when needed. We discover some interesting patterns on when models use code vs. textual reasoning with the evolution to task complexity and model sizes, which even result in an astonishingly inverse scaling behavior. We also discover that results from LLM written code are not always better than using textual reasoning, even if the task could be solved through code. To mitigate the above issues, we propose three methods to better steer LLM code/text generation and achieve a notable improvement. The costs of token lengths and runtime are thoroughly discussed for all the methods. We believe the problem of steering LLM code/text generation is critical for future research and has much space for further improvement. Project Page, Datasets, and Codes are available at https://yongchao98.github.io/CodeSteer/.

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

↑