↓ メインコンテンツへスキップ

Least-to-Most プロンプティング完全ガイド:複雑な推論を段階的に分解する

Rafael Yu
著者
Rafael Yu
ソフトウェア開発者 & AI 愛好家
目次

Least-to-Most プロンプティングとは?
#

Least-to-Most プロンプティングは、基本的に次の 2 ステップで複雑な問題を解く手法です(単一プロンプトにまとめることもできます)。

  • ステップ 1:複雑な問題を、より単純なサブ問題へと分解する
  • ステップ 2:分解したサブ問題を順番に解き、前の結果を次の文脈に引き継ぐ

単一プロンプトの例
#

Q: ジョンは積み木のタワーを作るのに 3 分、崩すのに 2 分かかります。遊び時間はあと 20 分です。時間内に何回タワーを作って崩せるでしょうか? A: この問題を解くには、次の手順が必要です。

  • 1 サイクル(作る+崩す)にかかる合計時間を求める。
  • 20 分間に何回フルサイクルを実行できるか計算する。

Q: エイミーはウォータースライダーを登るのに 4 分、滑り降りるのに 1 分かかります。スライダーは 15 分後に閉まります。閉まるまでに何回滑れるでしょうか? A:

通常の Chain-of-Thought よりも私がこの手法を好む理由は、課題を明示的に扱いやすい小ステップへ分解できるため、あらゆるタスクに応用しやすいからです。実際の比較実験でも、さまざまな推論タスクで CoT を安定して上回る結果が報告されています。

そのまま使える 3 段階プロンプトテンプレート
#

テンプレート 1:問題分解の Few-Shot 例を生成する
#

Your job is to generate few-shot examples for the following task: {{ task }}

Your few-shot examples should contain two parts: A problem, and the decomposed subproblems. It should follow the structure below:

"""
Problem: Problem description

Decomposed subproblems:
- Subproblem 1
- Subproblem 2
- Subproblem 3
"""

Your output should contain only the examples, no preamble.

テンプレート 2:対象タスクをサブ問題へ分解する
#

{{ task }}

List only the decomposed subproblems that must be solved before solving the task listed above. Your output should contain only the decomposed subproblems, no preamble.

Here are a few examples of problems and their respective decomposed subproblems: {{ few-shot-examples }}

テンプレート 3:サブ問題を順番に解いて最終回答を得る
#

Solve the following task by addressing the subproblems listed below.

Task: {{ task }}
Subproblems: {{ sub-problems }}

関連する推論テクニック
#