Reducing the cognitive load of AI changes
作者:Andrew Moffat(Python 库 sh 与 pexpect 的作者)
审阅大量 AI 生成的代码时,我常常发现 LLM 为抽象概念选的词,并不总能对上我自己的选择。比如,它叫 MutationIntent 的东西,我个人觉得叫 EditRequest 更自然。
因为 LLM 的用词不是我的理想选择,我每次看到它都得在脑子里查一次它是什么意思——这就增加了认知负荷。
这看起来像个小摩擦,但当你考虑几十个新术语在一段不熟悉的代码里如何相互作用时,认知负荷是会累积的。我脑子里能同时装住的这类语义查找是有限的,超过之后我就开始误解这些东西是怎么运作的。
为了把它降到最低,在审阅之前,我会用这个 prompt 对 AI 的改动做一次后处理:
Please review the changes and extract any unconventional or bespoke
terms used for abstract objects, processes and concepts. Create a
temporary markdown file with each term, its meaning and why it was
chosen, and some proposed alternative terms for it. I will then use
this markdown file to confirm the term choice or to provide my own
custom term. You will then incorporate any changes. The goal here is
to map your language choices to my own language choices so that I can
understand the concepts more easily.
中文大意:审阅这次改动,提取其中所有用于抽象对象、过程和概念的非常规或自造术语。建一个临时 markdown 文件,列出每个术语、它的含义、为什么选它,以及一些备选术语。然后我会用这个文件确认术语选择,或者给出我自己的术语。之后你把这些改动执行进去。这里的目标是把你的语言选择映射到我的语言选择上,好让我更容易理解这些概念。
然后我过一遍、确认术语选择。AI 会在所有地方做查找替换,包括文档。 得到的代码审阅起来容易得多,因为它写得更像出自我的脑子。
链接
原文:https://amoffat.github.io/blog/cognitive-load.html
#编码Agent #工作流 #认知负荷



