2.2.3 Chain-of-Thought
Chain-Of-Thought 是指通过给出中间推理或计算步骤,引导 LLM 完成任务。这种提示方式可以帮助 LLM 理解问题的解决过程,从而提高 LLM 解决复杂推理或计算任务的能力。
示例 1: Few-Shot COT Prompting
- 输入提示
Which is a faster way to get home?
Option 1: Take an 10 minutes bus, then an 40 minute bus, and finally a 10 minute train.
Option 2: Take a 90 minutes train, then a 45 minute bike ride, and finally a 10 minute bus.
Option 1 will take 10+40+10 = 60 minutes.
Option 2 will take 90+45+10=145 minutes.
Since Option 1 takes 60 minutes and Option 2 takes 145 minutes, Option 1 is faster.
Which is a faster way to get to work?
Option 1: Take a 1000 minute bus, then a half hour train, and finally a 10 minute bike ride.
Option 2: Take an 800 minute bus, then an hour train, and finally a 30 minute bike ride.
- 输出结果
Based on the provided information, Option 2 is faster for getting to work.
Option 1 takes a total of 1000 + 30 + 10 = 1040 minutes.
Option 2 takes a total of 800 + 60 + 30 = 890 minutes.
Therefore, Option 2, which takes 890 minutes, is faster than Option 1, which takes 1040 minutes.
在示例 1 中,LLM 通过给出计算过程示例,来引导 LLM 逐步计算推理,从而完成任务。相当于是结合了 Few-Shot Prompting 和 COT Prompting 的方式。
示例 2: Zero-Shot COT Prompting
- 输入提示
Which is a faster way to get to work?
Option 1: Take a 1000 minute bus, then a half hour train, and finally a 10 minute bike ride.
Option 2: Take an 800 minute bus, then an hour train, and finally a 30 minute bike ride.
let's think step by step.
- 输出结果
Let's break down the two options step by step and calculate the total time for each option:
Option 1:
Bus: 1000 minutes
Train: 30 minutes
Bike ride: 10 minutes
Total time for Option 1: 1000 + 30 + 10 = 1040 minutes
Option 2:
Bus: 800 minutes
Train: 60 minutes
Bike ride: 30 minutes
Total time for Option 2: 800 + 60 + 30 = 890 minutes
Comparing the two options, Option 2 has a shorter total time of 890 minutes, while Option 1 takes 1040 minutes. Therefore, Option 2 is the faster way to get to work in terms of total travel time.
在示例 2 中,LLM 仅通过提示 let's think step by step.
来引导 LLM 逐步计算推理,从而完成任务。这在大部分情况下是较为简单有效的 COT Prompting 手段。
最后更新于