Prompt engineering
当您与 Gemini 聊天机器人对话时,本质上是在编写提示词。本白皮书重点介绍如何为 Ve ex AI 平台内或通过 API 调用的 Gemini 模型编写提示词,因为直接对模型进行提示时,您将能访问温度等配置参数。
本白皮书详细探讨提示工程技术。我们将分析多种提示技巧以帮助您快速入门,并分享成为提示专家的实用建议与最佳实践,同时讨论编写提示时可能遇到的一些挑战。
提示工程
记住大语言模型( LLM)的工作原理:它是一个预测引擎。模型接收序列文本作为输入,然后根据其训练数据预测下一个标记应该是什么。LLM 通过不断重复这一过程运作,将先前预测的标记添加到序列文本末尾以预测后续标记。下一个标记的预测基于先前标记内容与 LLM 训练期间所见模式之间的关系。
编写提示词时,你实际上是在引导 LLM 预测正确的标记序列。提示工程就是设计高质量提示的过程,这些提示能指导大语言模型生成准确输出。该过程包括调试寻找最佳提示、优化提示长度,以及根据任务需求评估提示的写作风格和结构。在自然语言处理和 LLM 领域,提示是指为生成响应或预测而提供给模型的输入内容。
全站分卷索引 · 34 卷
- 1Introduction
- 2Prompt engineering
- 3LLM output configuration
- 4Sampling controls
- 5Top-K and top-P
- 6Putting it all together
- 7Prompting techniques
- 8One-shot & few-shot
- 9System, contextual and role prompting
- 10System prompting
- 11Role prompting
- 12Contextual prompting
- 13Step-back prompting
- 14Chain of Thought (CoT)
- 15Self-consistency
- 16Tree of Thoughts (ToT)
- 17ReAct (reason & act)
- 18Automatic Prompt Engineering
- 19Code prompting
- 20Prompts for explaining code
- 21Prompts for translating code
- 22Prompts for debugging and reviewing code
- 23What about multimodal prompting?
- 24Design with simplicity
- 25Be specific about the output
- 26Control the max token length
- 27Experiment with input formats and writing styles
- 28Adapt to model updates
- 29JSON Repair
- 30Working with Schemas
- 31Experiment together with other prompt engineers
- 32CoT Best practices
- 33Summary
- 34Endnotes