Adapt to model updates
一个实用的经验法则是从 6 个少量示例开始,并由此测试准确性。
适应模型更新
您需要密切关注模型架构变更、新增数据及功能升级。尝试使用新版模型并调整提示语以更好地利用新模型特性。像 Vertex AI Studio 这样的工具非常适合存储、测试和记录不同版本的提示语。
尝试不同的输出格式
除了提示输入格式外,还可以尝试调整输出格式。对于非创造性任务(如数据提取、选择、解析、排序、排名或分类),尝试以结构化格式(如 JSON 或 XML)返回输出结果。
从提取数据的提示中返回 JSON 对象有一些优势。在实际应用中,我不需要手动创建这种 JSON 格式,数据已经可以按预排序返回(在处理日期时间对象时非常方便),但最重要的是,通过要求 JSON 格式,可以强制模型创建结构并减少幻觉输出。
总结使用 JSON 输出的优势:
•始终以相同风格返回
- Focus on the data you want to receive
全站分卷索引 · 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