AI智能总结
提示工程提示工程 作者:LeeBoonstra作者:LeeBoonstra Author: Lee BoonstraAuthor: Lee Boonstra 致谢致谢 设计师MichaelLanning设计师MichaelLanning 目录目录 Table of contentsTableofcontents Introduction6Prompt engineering7LLM output configuration8Output length8Sampling controls9Temperature9Top-K and top-P10Putting it all together11Prompting techniques13General prompting / zero shot13One-shot & few-shot15System, contextual and role prompting18System prompting19Role prompting21Contextual prompting23IntroductionPrompt engineering.LLM output configuration.Output length.Sampling controls.Temperature.Top-K and top-P10Putting it all together.11Prompting techniques.,13General prompting / zero shot,13One-shot & few-shot..15System, contextual and role prompting..18System prompting..19Role prompting..21Contextual prompting. 引言6提示工程7LLM输出配置8输出长度8采样控制9温度9Top‑K和top‑P10将所有内容整合在一起11提示技术13通用提示/零样本13单样本和少样本15系统、上下文和角色提示18系统提示19角色提示21上下文提示23引言6提示工程Z.LLM.输出配算.8.输出长度8采样控制.9.温度.9.ToP-K.和.tOP-P.10.将所有内容整合在一起11提示技术13通用提示/零样本13单样本和少样本15系统、上下文和角色提示18系统提示19角色提示2Y上下叉提示23 Step-back prompting25Chain of Thought (CoT)29Self-consistency32Tree of Thoughts (ToT)36ReAct (reason & act)37Automatic Prompt Engineering40Code prompting42Prompts for writing code42Prompts for explaining code44Prompts for translating code46Prompts for debugging and reviewing code48What about multimodal prompting?54Step-back prompting..25Chain of Thought (CoT),.29Self-consistency.32Tree of Thoughts (ToT).36ReAct (reason & act).37Automatic Prompt Engineering.40Code prompting..42Prompts for writing code..42Prompts for explaining code..44Prompts for translating code.46Prompts for debugging and reviewing code.48What about multimodal prompting?..54 后退提示25思维链(CoT)29自洽性32思维树(ToT)36ReAct(推理与行动)37自动提示工程40代码提示42编写代码的提示42解释代码的提示44翻译代码的提示46调试和审查代码的提示48多模态提示怎么办?54最佳实践54提供示例54简洁设计55明确输出内容56使用指令而非约束56控制最大token长度58在提示中使用变量58尝试不同的输入格式和写作风格59对于分类任务的少样本提示,混合类别59适应模型更新60尝试不同的输出格式60后退提示25思维链(CoT)29.息洽性.32.思维树(ToT2.36.ReAct.(推理与行动).37.息动提示工程40代码提示42编写代码的提示42解释代码的提示44翻译代码的提示46调试和审查代码的提示48多模态提示怎么苏?"54最佳实践54提供示例54简洁设评55明确输出内容56使用指令而非约束56控制最大token长度-58-在提示中使用变量-58尝试不同的输入格式和写作风格59对于分类任务的少样本提示,混合类别59适应模型更新60尝试不同的输出格式60 Best Practices54Best Practices..54 Provide examples54Design with simplicity55Be specific about the output56Use Instructions over Constraints56Control the max token length58Use variables in prompts58Experiment with input formats and writing styles59For few-shot prompting with classification tasks, mix up the classes59Adapt to model updates60Experiment with output formats60Provide examples..54Design with simplicity.,55Be specific about the output..56Use Instructions over Constraints..56Control the max token length..58Use variables in prompts..58Experiment with input formats and writing styles..59For fewshot prompting with classification tasks, mix up the classes..59Adapt to model updates.60Experiment with output formats..60 JSON Repair61Working with Schemas62Experiment together with other prompt engineers63CoT Best practices64Document the various prompt attempts64Summary66Endnotes68.61JSON Repair.Working with Schemas..62Experiment together with other prompt engineer.63CoT Best practices..64Document the various prompt attempts..64Summary..66Endnotes..68 JSON修复61与架构一起工作62与其他提示工程师一起实验63CoT最佳实践64记录各种提示尝试64总结66注释68JSON修复61与架构一起工作.62.与其他提示工程师起实验.63.CoT.最焦实践64.记录各种提示尝试64总结66注释68 你不需要是数据科学家或机器学习工程师–每个人都可以写一个提示。你不需要是数据科学家或机器学习工程师-每个人都可以写一个提示。 You don’t need to be a datascientist or a machine learningengineer – everyone can writea prompt.You don't need to be a datascientist or a machine learningengineer- everyone can writea prompt. IntroductionIntroduction 引言引言 当思考大型语言模型的输入和输出时,文本提示(有时伴随其他模态,如图像提示)是模型用于预测特定输出的输入。你不需要是数据科学家或机器学习工程师——每个人都可以编写提示。然而,制作最有效的提示可能很复杂。你的提示的许多方面会影响其有效性:你使用的模型、模型的当思考大型语言模型的输入和输出时,文本提示(有时伴随其他模态,如图像提示)是模型用于预测特定输出的输入。你不需要是数据科学家或机器学习工程师一一每个人都可以编写提示。然而,制作最有效的提示可能很复杂。你的提示的许多方面会影响其有效性:你使用的模型、模型的 When thinking about a large language model input and output, a text prompt (sometimesaccompanied by other modalities such as image prompts) is the input the model usesto predict a specific output. You don’t need to be a data scientist or a machine learningengineer – everyone can write a prompt. However, crafting the most effective prompt can becomplicated. Many aspects of your prompt affect its efficacy: the model you use, the model’straining data, the model configurations, your word-choice, style and tone, structure, andcontext all matter. Therefore, prompt engineering is an iterative process. Inadequate promptscan lead to ambiguous, inaccurate responses, and can hinder the model’s ability to providemeaningful output.When thinking about a large language model input and output, a text prompt (sometimesaccompanied by other modalities such as image prompts) is the input the model usesto predict a specific output. You don't need to be a data scientist or a machine learningcomplicated. Many aspects of you