技巧7:零样本思维链
专业人士提出了一个名为 Chain of Thought(思维链) 的解决策略。
这个方法的用法非常简单,只需要在提问的结尾加上一句话:“Let’s think step by step”(让我们一步步思考),就能显著提升模型在复杂问题上的准确率。
这一技巧源自 Kojima 等人 2022 年的论文《Large Language Models are Zero-Shot Reasoners》。在实验中,研究人员发现,面对同一道逻辑题,若未添加引导语,模型的回答往往不正确;而加入“Let’s think step by step”后,模型便能给出正确结果。

这项研究指出了大型语言模型的一个重要特性:它们本质是概率语言模型,其输出依赖于对语言模式的预测。因此,当问题涉及推理时,添加这类引导语能促使模型按照逻辑链条逐步计算,从而避免在中间步骤跳跃,导致错误结果。
换句话说,“思维链”机制有助于模型在推理过程中保持完整的逻辑路径(比如从 A → B → C),而不是跳过关键中间环节。
此外,这一技巧不仅适用于数学或逻辑题,也可扩展至写作、剧本构思等需要结构性内容的任务。
不过它也有一定局限。例如,如果某个步骤推理错误,错误信息会随着步骤传播,最终影响整体结果。而且研究还表明,这种技巧主要在参数量超过 100B 的大模型上才有效,对于小模型则不一定见效。

新提示语推荐:
网友在使用提出了一个效果更佳的提示方式:
“Let’s work this out in a step by step way to be sure we have the right answer.”
“让我们一步一步来解决这个问题,以确保我们得到正确的答案。”
这个改良版本能进一步提高准确率。
扩展应用:任务分解 + 指定格式输出
在吴恩达的 Prompt Engineering 课程中,还介绍了 Chain of Thought 的另一个高级用法:不仅让模型逐步推理,还能指示它在每一步要完成特定操作,并按照指定格式返回结果。下面是一个案例(伪代码格式):
prompt_2 = f"""
Your task is to perform the following actions:
1 - Summarize the following text delimited by <> with 1 sentence.
2 - Translate the summary into French.
3 - List each name in the French summary.
4 - Output a JSON object that contains the following keys: french_summary, num_names.
Use the following format:
Text: <text to summarize>
Summary: <summary>
Translation: <summary translation>
Names: <list of names in French summary>
Output JSON: <json with summary and num_names>
Text: <{text}>
"""
这个提示通过明确的结构,指导模型按步骤执行任务,并输出结构化信息(如 JSON),使结果更容易进行后续处理或自动化集成。
应用于错误判断任务:确保模型“先做题再对比”
另一个 思维链 的实用示例是在评估学生答案是否正确的场景下。研究发现,如果直接问模型“这个答案对吗?”,它可能会草率作答。但若提示模型“先自己解题,再与学生答案进行对比”,准确率会大幅提高。
如下 prompt 展示了如何引导模型:
Your task is to determine if the student's solution is correct or not.
To solve the problem do the following:
- First, work out your own solution to the problem.
- Then compare your solution to the student's solution and evaluate if the student's solution is correct or not.
Don't decide if the student's solution is correct until you have done the problem yourself.
Use the following format:
Question:
###
[原题目内容]
###
Student's solution:
###
[学生答案]
###
Actual solution:
###
[模型解题步骤]
###
Is the student's solution the same as actual solution just calculated:
###
yes or no
###
Student grade:
###
correct or incorrect
###
通过将判断过程明确拆分为“解题 → 对比 → 结论”三步,模型的判断结果更可靠,避免了“凭印象判断”的误差。
总的来说,思维链 不只是简单的提示语技巧,更是一种利用语言模型思维路径的引导机制。配合任务拆解、结构化输出等方式,它能显著增强模型在复杂任务中的表现,是构建高质量 AI 应用不可或缺的关键工具之一。