Language Models As Compilers: Simulating Pseudocode Execution Improves Algorithmic Reasoning in Language Models
Conference on Empirical Methods in Natural Language Processing(2024)
摘要
Algorithmic reasoning refers to the ability to understand the complexpatterns behind the problem and decompose them into a sequence of reasoningsteps towards the solution. Such nature of algorithmic reasoning makes it achallenge for large language models (LLMs), even though they have demonstratedpromising performance in other reasoning tasks. Within this context, somerecent studies use programming languages (e.g., Python) to express thenecessary logic for solving a given instance/question (e.g.,Program-of-Thought) as inspired by their strict and precise syntaxes. However,it is non-trivial to write an executable code that expresses the correct logicon the fly within a single inference call. Also, the code generatedspecifically for an instance cannot be reused for others, even if they are fromthe same task and might require identical logic to solve. This paper presentsThink-and-Execute, a novel framework that decomposes the reasoning process oflanguage models into two steps. (1) In Think, we discover a task-level logicthat is shared across all instances for solving a given task and then expressthe logic with pseudocode; (2) In Execute, we further tailor the generatedpseudocode to each instance and simulate the execution of the code. Withextensive experiments on seven algorithmic reasoning tasks, we demonstrate theeffectiveness of Think-and-Execute. Our approach better improves LMs' reasoningcompared to several strong baselines performing instance-specific reasoning(e.g., CoT and PoT), suggesting the helpfulness of discovering task-levellogic. Also, we show that compared to natural language, pseudocode can betterguide the reasoning of LMs, even though they are trained to follow naturallanguage instructions.
更多查看译文
AI 理解论文
溯源树
样例
生成溯源树,研究论文发展脉络
数据免责声明
页面数据均来自互联网公开来源、合作出版商和通过AI技术自动分析结果,我们不对页面数据的有效性、准确性、正确性、可靠性、完整性和及时性做出任何承诺和保证。若有疑问,可以通过电子邮件方式联系我们:report@aminer.cn