Step-back prompting
回退式提示
回退式提示是一种通过先让大语言模型思考与当前具体任务相关的普遍性问题,再将普遍性问题的答案作为后续具体任务提示的输入,从而提升性能的技术。这种 ‘ 回退 ’ 步骤能让大语言模型在尝试解决具体问题前,先激活相关的背景知识和推理过程。
通过考量更广泛和根本的原则,大语言模型能生成更准确且富有洞察力的回答。回退式提示鼓励大语言模型进行批判性思考,并以新颖创造性方式应用知识。该技术通过调用模型参数中更多潜在知识来修改最终执行任务的提示,相比直接提示能激发更深层的知识运用。
通过关注通用原则而非具体细节,回退式提示( step‑back prompting)有助于减轻大语言模型回答中的偏见。
让我们通过以下示例来理解回退式提示如何提升结果质量。首先查看传统提示案例(表 8),再对比回退式提示案例(表 9):
| Goal | 为第一人称射击游戏的一个关卡撰写剧情。 |
|---|---|
| 模型 | gemini-pro |
| 温度 | 1 令牌限制 1024 |
Top‑P 采样
Top-K40n`x0nà 提示词Write a one paragraph storyline for a new level of a firstperson shooter video game that is challenging and engaging.
输出关卡开始时,玩家小队在密集的城区遭遇伏击面对一个 relentless 的敌对势力,玩家必须穿过如同迷宫般的后巷和破败的建筑,利用潜行和精准射击来消灭敌方部队并避免被发现。玩家必须充分利用周围环境, ° ~ 设置陷阱、利用掩体、精心计算每一步以求生存。途中,他们发现情报显示敌人正在策划一场毁灭性的 x0~
一声确认,玩家必须争分夺秒地收集证据并将其传递回 ~ 他们的总部,以防敌人实施他们的计划。
表 8. 传统提示与退步提示对比前的示例
当温度设为 1 时,你可能会得到各种富有创意的故事情节,但同时也相当随机且泛泛。因此让我们退一步思考:
提示Based on popular first-person shooter action games, what are 5 fictional key settings that contribute to a challenging and engaging level storyline in a first-person shooter video game?
输出1. ** 废弃军事基地 **:一座后末日风格的庞大军事建筑群遍布变异士兵和失控机器人,适合进行高难度近战对抗。
- ** 赛博朋克都市 **:霓虹闪烁的未来主义城市景观,耸立着
摩天大楼与幽深巷弄,充斥着经过机械强化的敌人以及黑客机制。
- ** 外星飞船 **:一艘搁浅在地球上的庞大外星飞船,内部有诡异的
走廊、零重力区域以及可遭遇的外星生物。
- ** 丧尸围城的小镇 **:一个被成群凶猛丧尸占据的荒凉小镇,
包含激烈的近身战斗和解谜元素以寻找安全通道。
安全通道。
- ** 水下研究设施 **:一座被洪水淹没的深海实验室,
充斥着变异水生生物,需要潜行和水下探索技能才能生存。
表 9. 自洽性提示的示例
这些主题确实很适合第一人称视频游戏。让我们回到最初的提示,但这次我们将后退步骤的答案作为上下文包含进去,看看会返回什么结果。
提示Context: 5 engaging themes for a first person shooter video game:
- **Abandoned Military Base**: A sprawling, post-apocalyptic
military complex crawling with mutated soldiers and rogue robots, ideal for challenging firearm combat.
- **Cyberpunk City**: A neon-lit, futuristic urban environment
with towering skyscrapers and dense alleyways, featuring cybernetically enhanced enemies and hacking mechanics.
- **Alien Spaceship**: A vast alien vessel stranded on
Earth, with eerie corridors, zero-gravity sections, and extraterrestrial creatures to encounter.
- **Zombie-Infested Town**: A desolate town overrun by hordes of
aggressive zombies, featuring intense close-quarters combat and puzzle-solving to find safe passage.
- **Underwater Research Facility**: A deep-sea laboratory flooded
with water, filled with mutated aquatic creatures, and requiring stealth and underwater exploration skills to survive.
Take one of the themes and write a one paragraph storyline for a new level of a first-person shooter video game that is challenging and engaging.
输出在幽暗深渊的中心,矗立着一座破败的水下研究设施,它既是人类野心的见证,也是其灾难性后果的证明。
笼罩在黑暗中,伴随着故障机械的嗡鸣声,被溺亡灵魂的回响所萦绕,这座设施如今已成为深海孕育的噩梦滋生之地。玩家扮演一名精英海军陆战队员,配备着先进潜水装备与实验性武器系统,奉命潜入这片充满恐怖的水域。凭借坚韧与机智,他们必须穿越险恶走廊,破解晦涩谜题,直面狰狞海洋潜伏在深渊中的恐怖怪物。从对抗深海的重压到智胜狡猾的水生掠食者,在这片未被探索的水下世界,每一刻都在考验人类耐力与勇气的极限。
Table 10. An example of prompting for self consistency
这看起来像是个有趣的游戏!通过使用回推提示技巧,你可以提高提示的准确性。
全站分卷索引 · 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