← 返回目录

LLM output configuration

第 3 / 34 卷日期:

这些提示可用于实现各类理解与生成任务,如文本摘要、信息抽取、问答系统、文本分类、语言或代码翻译、代码生成、代码文档编写及逻辑推理等。

请随时参考谷歌的提示指南 2,3,其中包含简单高效的提示示例。

进行提示工程时,首先需选择模型。无论您使用 Vertex AI 中的 Gemini 语言模型、 GPT、 Claude,还是 Gemma 或 LLaMA 等开源模型,都可能需要针对特定模型优化提示。

除了提示词外,你还需要调整大语言模型的各种配置参数。

大语言模型输出配置

选定模型后,需进一步调试模型配置。大多数大语言模型提供多种配置选项来控制输出效果。高效的提示词工程要求根据任务需求优化这些参数设置。

输出长度

关键配置项是设定生成响应内容的令牌数量。生成更多令牌会消耗更多算力,导致能耗增加、响应延迟和成本上升。

全站分卷索引 · 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