Anthropic 提示词技巧让模型重构代码成功率翻五倍
Anthropic 官方文档披露,在小型编码任务测试中,只需在提示词中声明代码库归模型“所有”,Claude Fable 5.2 合并重复代码的成功率就从不足 10% 提升到约 50%。这一发现说明,所有权归属表述会显著影响模型是保守沿用旧结构还是主动重构。
报道正文
Claude Fable 5.2 responds closely to what the prompt says about who owns the code it works on. In Anthropic’s testing on small coding tasks, when a prompt said nothing about ownership or presented the code base as someone else’s, the model tended to add to the existing structure, even when that repeated existing code. [...] If you want the model to improve the structure as it works, say that the code is its own:
This codebase is yours: what it's for and how it's built are your call, and you'll keep building on it.In Anthropic’s testing on small coding tasks, the model merged repeated code in about half of the tries with this sentence, and in under a tenth of the tries without it.
— Prompting Claude Fable 5.2, Anthropic documentation
Tags: prompt-engineering, anthropic, generative-ai, ai, llms, claude-mythos-fable