17.提示词通用技巧以及提示词工程框架介绍
提示词
提示词有一下几个要素构成:
给模型下达指令,或者描述要执行的任务
给模型提供额外的上下文信息,引导模型更好的响应
用户输入的内容或数据
指定输出的类型和格式
提示词工程
提示词工程是一门实践性很强的学科,需要针对不同的任务采用不同的技巧,不断尝试和探索,才能达到理想的效果.
提示词框架
1.CRISPE 框架
你希望 ChatGPT 扮演怎样的角色。
背景信息和上下文。
你希望 ChatGPT 做什么。
你希望 ChatGPT 以什么风格或方式回答你。
要求 ChatGPT 为你提供多个答案。
2.结构化提示词
提示词工程技术
1.零样本提示(Zero-shot Prompting) 与 少样本提示(Few-shot Prompting) 是最基础的提示技术
2.思维链(CoT)
在此基础上又有了零样本思维链(Zero-Shot-CoT) 技术,零样本思维链不需要在提示词中给出解决问题的推理过程,而是直接在提示词中加上一句 让我们逐步思考(Let's think step by step.) 这样的话即可.
3.自我一致性(Self-Consistency)
1.构造 CoT 示例数据;
2.通过大模型生成多个不同的推理路径(reasoning path);
3.使用多数投票(majority vote)的方法选出最一致的答案
4.最少到最多提示(Least-to-Most Prompting LtM)
2.子问题有序解答(Sequentially Solve Subquestions):第二步自下而上的依次解决问题,逐一回答子问题,并把子问题的回答作为下一个子问题回答的上下文,循序渐进地解决问题,直到给出最终答案;在这个依次回答问题的过程中,问题由少变多,这也是 Least-to-Most 一词的来源。
5.思维树 (ToT)
ToT 会根据问题属性去设计和分解中间的想法过程,每个想法应该足够小,使得语言模型可以生成有潜力跟多样的样本,同时又应该足够大,使得语言模型可以评估该想法解决问题的潜力;
文中提供了 Sample 和 Propose 两个想法生成策略,前者利用 CoT prompt 多次采样,这种方式能保证多样性, 在想法空间更宽泛时效果更佳,后者依据 "propose prompt" 依次生成想法,可以避免同一个上下文生成重复的想法,更适用于思维空间受限的场景;
给定不同的当前状态,让状态评估器评估它们对于解决问题的帮助,以确定哪些状态值得继续探索,以及以何种方式探索;
Imagine three different experts are answering this question.
All experts will write down 1 step of their thinking,
then share it with the group.
Then all experts will go on to the next step, etc.
If any expert realises they're wrong at any point then they leave.
The question is...
Three experts with exceptional logical thinking skills are
collaboratively answering a question using the tree of thoughts method.
Each expert will share their thought process in detail,
taking into account the previous thoughts of others and admitting any errors.
They will iteratively refine and expand upon each other's ideas, giving credit where it's due.
The process continues until a conclusive answer is found.
Organize the entire response in a markdown table format.
The task is:
修改于 2025-03-20 05:09:37