言語モデルをコンパイラとして:疑似コードの実行をシミュレートすることで言語モデルのアルゴリズム推論能力が向上する
Language Models as Compilers: Simulating Pseudocode Execution Improves Algorithmic Reasoning in Language Models
April 3, 2024
著者: Hyungjoo Chae, Yeonghyeon Kim, Seungone Kim, Kai Tzu-iunn Ong, Beong-woo Kwak, Moohyeon Kim, Seonghwan Kim, Taeyoon Kwon, Jiwan Chung, Youngjae Yu, Jinyoung Yeo
cs.AI
要旨
アルゴリズム的推論とは、問題の背後にある複雑なパターンを理解し、それを解決に向けた一連の推論ステップに分解する能力を指します。このようなアルゴリズム的推論の性質は、大規模言語モデル(LLM)にとって課題となります。LLMは他の推論タスクでは有望な性能を示しているものの、アルゴリズム的推論においては困難を伴います。この文脈において、最近の研究では、プログラミング言語(例えばPython)を使用して、与えられた問題インスタンス/質問を解決するために必要なロジックを表現するアプローチ(例えば、Program-of-Thought)が提案されています。これは、プログラミング言語の厳密で正確な構文に着想を得たものです。しかし、単一の推論呼び出しの中で、正しいロジックを表現する実行可能なコードをその場で作成することは容易ではありません。また、特定のインスタンスのために生成されたコードは、同じタスクからの他のインスタンスであっても、同じロジックを必要とする場合であっても、再利用することができません。本論文では、Think-and-Executeという新しいフレームワークを提案します。このフレームワークは、言語モデルの推論プロセスを2つのステップに分解します。(1) Thinkステップでは、与えられたタスクを解決するためにすべてのインスタンスで共有されるタスクレベルのロジックを発見し、そのロジックを疑似コードで表現します。(2) Executeステップでは、生成された疑似コードを各インスタンスにさらに適合させ、コードの実行をシミュレートします。7つのアルゴリズム的推論タスクにおける広範な実験を通じて、Think-and-Executeの有効性を実証します。我々のアプローチは、インスタンス固有の推論を行ういくつかの強力なベースライン(例えば、CoTやPoT)と比較して、LMの推論をより改善し、タスクレベルのロジックを発見することの有用性を示唆しています。また、自然言語と比較して、疑似コードがLMの推論をより良く導くことができることを示します。これは、LMが自然言語の指示に従うように訓練されているにもかかわらず、です。
English
Algorithmic reasoning refers to the ability to understand the complex
patterns behind the problem and decompose them into a sequence of reasoning
steps towards the solution. Such nature of algorithmic reasoning makes it a
challenge for large language models (LLMs), even though they have demonstrated
promising performance in other reasoning tasks. Within this context, some
recent studies use programming languages (e.g., Python) to express the
necessary 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 logic
on the fly within a single inference call. Also, the code generated
specifically for an instance cannot be reused for others, even if they are from
the same task and might require identical logic to solve. This paper presents
Think-and-Execute, a novel framework that decomposes the reasoning process of
language models into two steps. (1) In Think, we discover a task-level logic
that is shared across all instances for solving a given task and then express
the logic with pseudocode; (2) In Execute, we further tailor the generated
pseudocode to each instance and simulate the execution of the code. With
extensive experiments on seven algorithmic reasoning tasks, we demonstrate the
effectiveness of Think-and-Execute. Our approach better improves LMs' reasoning
compared to several strong baselines performing instance-specific reasoning
(e.g., CoT and PoT), suggesting the helpfulness of discovering task-level
logic. Also, we show that compared to natural language, pseudocode can better
guide the reasoning of LMs, even though they are trained to follow natural
language instructions.Summary
AI-Generated Summary