← 返回目录

Adapt to model updates

第 28 / 34 卷日期:

一个实用的经验法则是从 6 个少量示例开始,并由此测试准确性。

适应模型更新

您需要密切关注模型架构变更、新增数据及功能升级。尝试使用新版模型并调整提示语以更好地利用新模型特性。像 Vertex AI Studio 这样的工具非常适合存储、测试和记录不同版本的提示语。

尝试不同的输出格式

除了提示输入格式外,还可以尝试调整输出格式。对于非创造性任务(如数据提取、选择、解析、排序、排名或分类),尝试以结构化格式(如 JSON 或 XML)返回输出结果。

从提取数据的提示中返回 JSON 对象有一些优势。在实际应用中,我不需要手动创建这种 JSON 格式,数据已经可以按预排序返回(在处理日期时间对象时非常方便),但最重要的是,通过要求 JSON 格式,可以强制模型创建结构并减少幻觉输出。

总结使用 JSON 输出的优势:

•始终以相同风格返回

  • Focus on the data you want to receive
全站分卷索引 · 34 卷
  1. 1Introduction
  2. 2Prompt engineering
  3. 3LLM output configuration
  4. 4Sampling controls
  5. 5Top-K and top-P
  6. 6Putting it all together
  7. 7Prompting techniques
  8. 8One-shot & few-shot
  9. 9System, contextual and role prompting
  10. 10System prompting
  11. 11Role prompting
  12. 12Contextual prompting
  13. 13Step-back prompting
  14. 14Chain of Thought (CoT)
  15. 15Self-consistency
  16. 16Tree of Thoughts (ToT)
  17. 17ReAct (reason & act)
  18. 18Automatic Prompt Engineering
  19. 19Code prompting
  20. 20Prompts for explaining code
  21. 21Prompts for translating code
  22. 22Prompts for debugging and reviewing code
  23. 23What about multimodal prompting?
  24. 24Design with simplicity
  25. 25Be specific about the output
  26. 26Control the max token length
  27. 27Experiment with input formats and writing styles
  28. 28Adapt to model updates
  29. 29JSON Repair
  30. 30Working with Schemas
  31. 31Experiment together with other prompt engineers
  32. 32CoT Best practices
  33. 33Summary
  34. 34Endnotes