告诉 AI 为什么 而不是怎么做
前沿模型出错,常常是猜错了目标和取舍。把为什么做、最终结果、约束和可以让步的地方讲清楚,模型才能帮你找到更合适的实现路径。
给前沿 AI Agent 提需求时,别只当指挥官规定每一步怎么做。把最终目标、背景原因和优先级取舍交代清楚,模型才有机会发现更合适的路径。软件工程师 Sean Goedecke 用自己和模型共同开发 Deckard 的经历,解释了这套方法为什么有效。
核心转变:AI 不再是“傻小子”,它缺的是全局背景
- 过去的 AI(热情的笨蛋):必须把要做的事交代得极其具体,比如「类 B 上有方法 A,请给类 C 到 F 各加一个等价的方法」,否则就会彻底做错。
- 现在的顶尖模型:跑偏通常不是因为没看懂,而是对你的意图做了错误假设。比如 GPT-6-Astra 以为代码是写给自己看的,就会写出省掉空格和格式的压缩代码(minified code)。Flask 作者 Armin Ronacher 推测,这是因为模型调用工具时为了省 token,练出了越短越好的写法,结果漏进了要提交的代码里:他测算,这样写的单元测试比格式化后省约 10% 的 token。他还发现,越像没人在看的环节(比如子 Agent 的工作、测试代码),越容易冒出这种写法,不过他也说不确定模型是不是真以为没人看。反过来,只要告诉它代码有人要读,它就能写出人读得懂的代码:Sean 用它写 Go,得到了几千行「可以接受」的代码(他只在 Go 上试过)。在人类写的代码库里,连这句都不用说,它会自己跟随周围代码的风格。
关键操作法则:告诉它“为什么”与“权衡取舍”
- 明确宏观目标,而非过早固化实现路径:先说清你最终想解决什么,而不是直接丢一份具体的技术规格。做法写死了,模型就只能照着做,没法按你的目标帮你找更合适的方案。Sean 启动 Deckard 项目时,提示词里约一半篇幅在讲背景:想做一个自动藏起网页 AI 内容的本地程序或浏览器扩展,短期要找一个不让 MacBook 发烫、不耗光电池的检测模型,而且这是给自己用的。
- 留出发挥空间,避免错失最优解:自己的技术设想可以写,但要写成讨论的起点,而不是命令。Sean 在提示词里把 EditLens 和 RoBERTa 只写成「我的猜测」,结尾还加了一句:如果你看到实现我目标的更好办法,告诉我,我们商量。他的判断是,当初如果写成一份明确的技术规格,就会错过后来用上的 native messaging 和 Gradient 模型。这个项目是 Sean 和 Astra 一起做的:他负责拍板一批大方向,还能选自己不熟但更合适的语言(推理用 C++ 而不是 Python);模型则提醒了他自己想不到的做法,比如用 native messaging 代替本地 HTTP。
- 明确“相对优先级”:工作里提技术需求,别把少出 bug、可观测性、优雅融入现有代码、性能全列上,说它们都重要。Sean 的做法是专门写一段话,讲清这几项谁先谁后,并明说哪几项他没那么在乎、可以拿去换别的。这样几个目标冲突时,模型才知道该让哪一项。示意写法(本站示例):「这次最重要的是别引入 bug,其次是自然融入现有代码;可观测性保持现有水平即可;性能不是重点,为了前两项可以让出一些性能。」
- 警惕“XY 问题”:XY 问题是指,你真正想解决 X,却自以为答案是 Y,于是只问 Y。经典例子是有人问「怎么输出文件名的最后三个字符」,追问才知道他要的是扩展名,而扩展名不一定是三个字母(比如
.jpeg)。现在的模型已经聪明到能对你的整体目标给出有用的意见;只给它具体技术规格、不给背景,就像去看病只问某种药怎么吃,医生也就没法帮你找更合适的治法。
完整例子:Sean 给 Deckard 写的提示词
Deckard 是 Sean 和 Astra 一起做的 Chrome 扩展,调用 Mac 上本地运行的小模型,自动标出网页里疑似 AI 写的文字。提示词里的 Pangram 是商业 AI 文本检测服务,EditLens 是它的模型;Runpod 是 Sean 通过 MCP 接给模型用的远程算力,用来跑本地太热、太久、太慢的实验。项目开头,他发了这样一段提示词:
英文原文
Hello. You should have Runpod access via MCP (if not, tell me and I’ll fix it).
I have the long-term goal of building a local program or browser extension to automatically scan pages I load for AI content and hide it. I have the short-term goal of figuring out the best AI detection model I can run on my macbook without killing my battery or making it hot, and (relatedly) figuring out how to run the model most efficiently. My guess is that Pangram’s EditLens 3B or the smaller Roberta model might be a good place to start, though they might require quantizing and will definitely require some work to make them run as efficiently as possible on my macbook.
I would like you to use my Runpod account to start answering these questions. Eventually we’ll move to doing things on this macbook pro, but my hope is that Runpod can help with some experiments that are too hot/long/slow to run locally. You are a smart model; if you can see a better way to achieve my goals, please let me know and we’ll talk about it. Good luck.
中文翻译
你好。你应该可以通过 MCP 访问 Runpod(如果不行,告诉我,我去修)。
我的长期目标是开发一个本地程序或浏览器扩展,自动扫描我加载的网页中的 AI 生成内容并将其隐藏。我的短期目标是找出最适合在我这台 MacBook 上运行的 AI 检测模型,要求不能让笔记本发烫或迅速耗尽电池,并且(与此相关地)搞清楚如何以最高效的方式运行该模型。我的猜测是,Pangram 的 EditLens 3B 或更小一些的 RoBERTa 模型可能是一个不错的切入点,不过它们可能需要量化,而且肯定需要做一些工作才能尽可能高效地在我的 MacBook 上跑起来。
我希望你使用我的 Runpod 账户开始探寻这些问题的答案。我们最终会把工作迁移到这台 MacBook Pro 上完成,但我希望 Runpod 能协助做一些在本地跑起来太热、太耗时或太慢的实验。你是一个聪明的模型;如果你看到了实现我目标的更好途径,请告诉我,我们一起讨论。祝好运。
细看这段提示词,约一半篇幅在交代背景:项目的整体目标、这是给自己用而不是工作,以及笔记本不能发烫、不能耗光电池。
- 目标与约束 91 词
- 起点猜测 41 词
- 具体安排 30 词
- 邀请提意见 27 词
-
具体安排
You should have Runpod access via MCP
先确认远程算力已经接好,接不上就说一声,他来修。
-
目标与约束
long-term goal … scan pages I load for AI content and hide it
长期要做成什么:一个自动藏起 AI 内容的本地程序或浏览器扩展。
-
目标与约束
without killing my battery or making it hot
眼下的目标,以及笔记本不能耗电、不能发热的约束。
-
起点猜测
My guess is that Pangram’s EditLens 3B or the smaller Roberta model
给了起点,但明说只是猜测。
后来:最终选的是 Gradient 模型,不是 EditLens。
-
具体安排
use my Runpod account to start answering these questions
这次要做的事,只有这一句。
-
目标与约束
experiments that are too hot/long/slow to run locally
为什么先用远程算力,以及最后要回到这台 MacBook 上跑。
-
邀请提意见
if you can see a better way to achieve my goals, please let me know
允许模型推翻上面的安排和猜测。
后来:模型提出用 native messaging 代替本地 HTTP。
原提示词共 9 句,这里把开头的问候和结尾的「Good luck」并入相邻句,拆成 7 部分;色条长度按每部分的英文词数,分类是本站的解读标注。「后来」两条出自 Sean 的 Deckard 文章。
这段提示词问了两件事:选哪个模型,怎么在 MacBook 上跑得不发热、不耗电。Deckard 最后给出的答案是:
- 怎么跑:用模型提醒的 native messaging,让 Chrome 扩展直接调用电脑上的模型程序,不用另开一个本地网页服务。用的时候才启动,5 分钟不用就自动关掉;运行时占 400MB–1.2GB 内存,大约相当于多开五六个浏览器标签页。Sean 没发现 MacBook Pro 发热或掉电,但他也说换台机器可能不一样。
- 选哪个模型:没用最初猜的 EditLens,选了 Gradient 的 MLX 4-bit 版(压缩过、能在苹果电脑上跑的版本)。它能抓出约 52% 的 AI 文字,把人写的误判成 AI 约 2.7%;商业服务 Pangram 自称能抓出 99.66%,误判只有 0.004%,差距很大。Sean 觉得够用:一篇文章不用每句都抓到,标出几处就足够让人起疑;只是误判约 2%,单个标记不能当证据。
向 AI Agent 提需求:讲清 Why,而不只是 How
软件工程师 Sean Goedecke 在博客文章里讲了一个观点:给前沿 AI Agent 提需求时,别只当指挥官抠具体步骤,要把你的最终目标、背景原因和优先级取舍交代清楚。
过去的 AI 像一个“热情的笨蛋”,必须把要做的事交代得极其具体,比如「类 B 上有方法 A,请给类 C 到 F 各加一个等价的方法」,否则就会彻底做错。但现在的顶尖模型跑偏通常不是因为没看懂,而是对你的意图做了错误假设。
典型例证:GPT-6-Astra 以为代码是写给自己看的,就会写出省掉空格和格式的压缩代码(minified code)。Flask 作者 Armin Ronacher 推测,这是因为模型调用工具时为了省 token,练出了越短越好的写法,结果漏进了要提交的代码里(单元测试可省约 10% token)。但只要明确告诉它“代码有人要读”,它就能写出人读得懂的代码(Sean 只在 Go 上试过)。
为了让 AI Agent 真正发挥前沿模型的推导潜力,提需求时需要遵循以下几项关键操作法则:
1. 明确宏观目标,而非过早固化实现路径:先说清最终想解决的问题。自己的技术设想可以写,但要写成讨论的起点,而不是命令。Sean 在结尾加了一句「看到更好的办法就告诉我」,他认为如果写成明确的技术规格,就会错过后来用上的 native messaging 和 Gradient 模型。
2. 明确“相对优先级”与牺牲位:工作里提技术需求,别把少出 bug、可观测性、优雅融入现有代码、性能全列上,说它们都重要。必须讲清先后顺位,明说哪几项可以拿去换别的。
3. 警惕“XY 问题”:XY 问题是指你真正想解决 X,却自以为答案是 Y,于是只问 Y(比如想取文件后缀名,却只问怎么截取最后三个字符)。给模型塞满局部规格而不给背景,就像去看病只问某种药怎么吃,医生就无法开出对症良方。
实战检验:Sean 给 Deckard 项目写的提示词。Deckard 是 Sean 和 Astra 一起做的 Chrome 扩展,用来自动识别并隐藏网页上的 AI 生成内容。Sean 的提示词结构极具启发性:
这段提示词留出了解题空间,最终方案用上了两处初始提示里没有写的做法:
下次向 Agent 提需求前,自问三件事:① 我是否说清了终极目的 X,还是只丢出了自以为是的方案 Y?② 是否明确了代码给谁看、在什么机器上跑、有哪些物理与算力边界?③ 出现多重冲突时,哪一项可以毫不犹豫地被牺牲?
Tell agents the why, not just the how
Early AI agents were basically enthusiastic idiots. Working with them required you to tell them precisely what you wanted them to do (for instance, “method A exists on class B, please add an equivalent method to classes C through F”). Otherwise they’d go off and do entirely the wrong thing. But as AI agents have improved, this has changed.
When frontier models go off and do the wrong thing today, they don’t do it because they’re confused, they do it because they make an incorrect assumption about your goals or priorities. For instance, when GPT-6-Astra thinks it’s writing code for itself, it will produce minified code. It’s perfectly capable of writing human-readable code — at least in Golang, where I’ve produced several thousand lines of acceptable code with the model — but you have to tell it that humans will be reading the code1.
This is the main piece of advice I want to give most people I see prompting agents: give the agent context on your priorities, not just on the specific task you want them to do. Here’s a prompt I recently used as the starting point for Deckard.
Hello. You should have Runpod access via MCP (if not, tell me and I’ll fix it).
I have the long-term goal of building a local program or browser extension to automatically scan pages I load for AI content and hide it. I have the short-term goal of figuring out the best AI detection model I can run on my macbook without killing my battery or making it hot, and (relatedly) figuring out how to run the model most efficiently. My guess is that Pangram’s EditLens 3B or the smaller Roberta model might be a good place to start, though they might require quantizing and will definitely require some work to make them run as efficiently as possible on my macbook.
I would like you to use my Runpod account to start answering these questions. Eventually we’ll move to doing things on this macbook pro, but my hope is that Runpod can help with some experiments that are too hot/long/slow to run locally. You are a smart model; if you can see a better way to achieve my goals, please let me know and we’ll talk about it. Good luck.
About half of this prompt is sharing broad context, such as the overall project I’m aiming for, the fact that it’s for me personally and not for work, and my priorities (e.g. keeping the laptop cold). If I had written an explicit spec, I would have missed a bunch of improvements: for instance, using native messaging for the local model, or choosing the Gradient model instead of EditLens.
I do the same thing for work, but typically with a stronger emphasis on my technical values. I often write a paragraph spiel explaining the relative priorities of avoiding bugs, observability, fitting elegantly into the current code, performance, and so on. Note that I said “relative” priorities: I don’t simply list all of these things and say they’re important, I explicitly tell the model which of those I care less about and can therefore be traded off to better achieve the others.
Models are now smart enough to have meaningful input on your broader goals. If you’re just prompting them with a concrete technical spec, you are committing the same mistake as in the XY problem: asking expert advice without giving the expert the context it needs.
- Incidentally, you don’t have to tell it to write human code if it’s working in a human-authored codebase. It’s smart enough to pick up the style of the surrounding code. ↩
Here's a preview of a related post that shares tags with this one.
