提示工程 Prompt Engineering 技巧总结
基础版
基础类的prompt基本都是一些小技巧,比如包含一些关键词、prompt的写法套路等。
Few-shot Prompt
Role-play Prompt
比如文字工作人员:
I want you to act as an English translator, spelling corrector and improver. I will speak to you in any language and you will detect the language, translate it and answer in the corrected and improved version of my text, in English. I want you to replace my simplified A0-level words and sentences with more beautiful and elegant, upper level English words and sentences. Keep the meaning same, but make them more literary. I want you to only reply the correction, the improvements and nothing else, do not write explanations. My first sentence is "istanbulu cok seviyom burada olmak cok guzel"
Personality-added Prompt
需要多样的情感表达时使用
Write a witty 500-blog post on why AI will not replace humans. Write in the style of an expert in artificial intelligence with 10+ years of experience. Explain using funny examples
Multi-rounded Prompt
比如:第一轮对话要求ChatGPT给出一些知识,第二轮要他基于以上知识写一篇总结。
Chain-of-Thought Prompt
引导其给出推理过程提高答案的正确率。
Let’s think step by step.
Ref: chain of thought
Let's work this out in a step-by-step way to be sure we have the correct answer.
Ref: https://sites.google.com/view/automatic-prompt-engineer
Self-Reflection Prompt
Ref: Constitutional AI: Harmlessness from AI Feedback
进阶版
进阶版结合了人类分析、解决问题的方法论以及基础版的技巧,能够进一步提升LLM的准确率。
Task break-down Prompt
Ref: Recursive Reprompting and Revision
Discuss-between-LLMs
Ref: DERA: Enhancing Large Language Model Completions with Dialog-Enabled Resolving Agents
ReAct
Reason + Act
拿到任务,首先思考需要什么(thought1),再搜索相关信息(act1)得到结果(observation1),基于结果再思考现在需要什么(thought2)(thought2不仅是对下一步action的规划,同时也是对之前步骤的总结)……多次迭代以上步骤,将更大概率得到正确答案。
用Few-shot引导LLM遵循ReAct行为框架。
Ref: ReAct: Synergizing Reasoning and Acting in Language Models
Reflexion
通过让LLM失败后进行反思(总结之前尝试失败的经验),结合ReAct可以进一步提升的正确率。
Ref: Reflexion: Language Agents with Verbal Reinforcement Learning
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)