[BidClub_]
Machine Learning Street Talk · · 81 分钟

语言模型正在“为世界建模” [Nicholas Carlini]

Nicholas Carlini

YouTube
TL;DR
  • Carlini 的基准情景不是打造完全稳健的模型,而是围绕未来可预见时期内仍“极其脆弱”的模型设计安全系统。 传统安全体系本就容忍不完美,但 ML 还没有发展到“街上随便一个人”都无法运行现成代码、迫使系统任意失效的程度。实际含义是,系统设计不能只依赖模型本身。

  • GPT-3.5 Turbo Instruct 下棋让 Carlini 相信,仅靠下一个 token 预测,也能在没有明确棋规或围棋专用自博弈强化学习的情况下,重建出异常丰富的内部状态。 仅根据着法记谱,它几乎总能走出合法棋步,而且往往质量很高,说明“内部必然存在某种准确建模世界的东西”。但离奇的棋局历史会诱发离奇的下法:基础目标是模仿数据,而不是争取胜利。

  • 围绕模型是否“推理”的争论,掩盖了一个更有助于决策的问题:哪些行为能在什么条件下保持。 怀疑论者通常把语言模型排除在外,AGI 倡导者则预测到2027年模型将取代人类工作,双方的定义都高度可预期。Carlini 转而测量输入—输出行为,并指出,棋力会在陌生记谱法下崩溃,正如分布偏移一直以来都会击穿 ML 系统一样。

  • 后训练让潜在能力更容易被诱导出来,但也可能损害投资者误以为等同于能力的属性。 Carlini 回忆,GPT-4 的一份报告显示,基础模型校准度很好——一个答案若有30%的概率为真,实际约有30%的概率正确——但后训练把这种校准“搞乱了”。指令遵循能力大幅提升,但模型可能只是看起来更聪明,并没有学到多少新东西。

  • Carlini 报告称自己的编程生产率提高了约50%,并明确将其视为一个 N=1 的结果。 对专家程序员而言,当前模型可以成为代码、API 和陌生语法之上的更高层接口。他会在任务大约有50%成功概率时先问一次,确认方向,再自行补完剩余错误:“95%的解决方案仍然只是95%的解决方案”,但修好最后5%可能带来“20倍的性能提升”。o1 甚至在2分钟内解决了一道动态规划题,代码速度是他自己版本的10倍。

  • 这种生产率提升可能会叠加安全债务,因为模型会复现常见漏洞,同时扩大能够交付软件的人群。 Carlini 见过模型生成本应直接调用 API 的加密代码,也见过容易受到 SQL 注入攻击的数据库代码。他担心未来“代码量增加10倍”,但安全专家不会同步增加10倍——只要常见路径能跑通,不安全的部署就会继续推进。

  • 披露实践仍是一个悬而未决的运营风险,因为部分 ML 缺陷是可以打补丁的软件漏洞,另一些则更像长期存在的科学性漏洞。 一项模型窃取 API 弱点适合90天的协调披露流程;对抗样本则不适合,因为研究人员已经攻击这个问题10年,再多90天也无法解决它。Carlini 预计“1到2年内”会形成更清晰的规范,但目前还没有定型框架。

  • 模型 API 无法完全保护专有架构,基准测试领先也不能可靠证明通用能力。 Carlini 的团队利用 API 输出和线性代数恢复出一个真实生产模型的最后一层及其未披露宽度,虽然没能恢复完整模型;与此同时,训练者受到激励,会直接针对 HumanEval、MMLU 及类似榜单优化。“多得多的基准测试”会让这种定向优化更难,也会让能力声明更可信。

摘要 · 为研究而整理的核心内容

1. 安全系统必须假设模型会失败

  • Carlini 不把完美安全视为目标:即便是传统系统,也可能输给足够有动机的政府。实际门槛在于普通攻击者是否能成功。如今,他说,面对 ML 系统,“普通人几乎总能成功”,往往只需使用 GitHub 上的现成代码,就能诱导系统产生任意行为。

  • 视觉领域提供了一个令人警醒的先验。研究人员已经追求稳健性约10年,也积累了大量认识,但过去4到5年,客观指标几乎没有提升。这使得可预见未来实现完美稳健性不太可能,不过持续研究最终或许能提高攻击成本。

  • 他的预测刻意保留了不确定性——“这件事发生的概率非常小”,但从某种意义上说,这又是他的中位数预测——即简单攻击会持续存在。系统必须在模型随机误分类输入时控制损害,避免一次不可靠的判断触发“一项极其误导性的行动”。

  • Carlini 强调,“5年就是机器学习中的一整个永恒”。语言模型已经经历约7年的显著进步,而严肃的攻击研究只有2到3年;再过5年,一切都可能改变。他的预测主要适用于“只要我们还处在当前范式之中”。

2. 棋局揭示了无需明确世界规则的状态追踪

  • GPT-3.5 Turbo Instruct 改变了 Carlini 的看法,因为它是通过对着法序列进行下一个 token 预测学会下棋的。它不像专门的国际象棋引擎那样,被明确告知棋盘是8×8、棋子如何移动、胜负条件是什么,也没有接受基于自博弈的棋类专用强化学习,却能生成合法且往往质量很高的着法。

  • 仅仅是合法性就很有意义:判断一着棋是否合法,本身就是复杂程序,随机字符不可能稳定地碰巧做到。Carlini 不对意识或意向性作判断,但得出结论:模型“内部必然以某种意义准确地建模了世界”。

  • 更有力的对比来自他自己。给出40步记谱、要求写出第41步时,Carlini 说,尽管自己只是水平普通的棋手,也无法在脑中重建棋盘。模型却能以某种方式追踪局面并采取行动,“从未被告知任何棋规”,甚至不知道这种规则存在。

  • 这一结果让他不再满足于纯粹的表层模型行为解释。他仍然更愿意检查输入和输出,而不是猜测隐藏认知,但棋局表明,下一个 token 预测所捕捉的统计规律,能够编码出远比他预想更深层的表示。

3. 基础目标是模仿对弈,而不是追求胜利

  • Carlini 通过一段荒谬的合成历史抵达同一棋盘:让每个棋子绕着圈走到位,然后要求模型给出下一步。模型仍然通常会走出合法着法,说明它保留了棋盘状态,但选择十分离奇,因为此前的棋局像是“2个等级约为1500分的人”在下棋。

  • 因果链条很关键:模型从未被告知“下棋的目标是获胜”。它学会的是延续类似人类棋局的数据,其中包括常见的失误和陷阱。面对低质量对弈,它推断自己的任务是“走出合法着法,看看会发生什么”。

  • 监督微调、RLHF、指令微调及相关后训练,能够减少这种错位,尤其是在聊天产品中。Carlini 认为,Instruct 系列把某些能力从“后台某处”带了出来,让它们更容易复现;相比之下,GPT-3 极难使用。后训练使模型即便面对措辞糟糕的问题,也能给出合理回答。

4. 后训练提升诱导能力,却扭曲校准度

  • 正如主持人所说,人类偏好数据奖励的可能是自信、冗长和复杂,而不是真实性。Carlini 没有完整答案,因为研究人员很少能拿到同一个模型等价的后训练前后版本,因此很难分离能力究竟发生了怎样的变化,还是只是变得更容易调用。

  • 他回忆,GPT-4 的一份报告显示,基础模型校准度很高:如果一个数学答案的 token 概率约为30%,它正确的概率也约为30%。后训练之后,“校准度被彻底搞乱了”,但指令遵循能力提升到足以让系统看起来聪明得不可思议。

  • Carlini 坦率承认,这些影响仍是“一件非常令人困惑的事”。后训练可能没有教会模型多少新知识,却能大幅改善可用性,同时改变影响用户信赖的行为属性。因此,能力、自信、校准度和服从度不应被视为同一个变量。

5. “推理”不如经过测试的行为有用

  • Carlini 认为,推理之争由定义驱动。怀疑论者把推理定义为排除语言模型;那些预计模型将解决一切问题、到2027年取代人类工作的人,则把模型执行的任何过程都定义为推理。双方都能从自己的前提中得到偏好的答案。

  • 主持人主张,推理应包括知识加推断、自主性、涌现和意向性。Carlini 声明自己不具备哲学专业背景,随后回到操作性测试:模型是否解决了具有挑战性的任务?如果它总能返回正确答案,他并不特别在意它究竟是在推理,还是使用了“一张查找表”。

  • 棋局也提供了反例。把棋局用更古老的记谱法呈现时,模型会生成看起来像着法的文本,却不再追踪棋盘;人类可能也很难读懂这种记谱法,但仍能把它还原出来。是否因此剥夺模型的“推理”资格,取决于所采用的定义,而不是观察到的失败。

  • Carlini 将这种批评类比为:用 ImageNet 训练、用 CIFAR-10 测试。7年前,研究人员会说,分布偏移显然足以解释失败。如今,由于语言模型被包装成通用系统,预期已经膨胀,但它们仍然是机器学习系统:当部署数据与训练数据相似时,表现会更好。

6. Carlini 优先寻找有用的攻击,而不是道德英雄主义

  • 他的动机很坦率:“我真的很喜欢攻破东西。”他并不是通过计算哪种职业能拯救最多生命来选择安全领域;他选择的是自己能够长期投入、又能异常出色完成的工作,同时要求这项工作总体上推动世界向更好的方向发展。

  • 他的决策规则是“你有多擅长这件事,乘以这件事有多重要”。在一个方向上具有非凡贡献,可能超过在理论影响力最高、但自己几乎无法激励自己投入的领域中贡献甚微。对 Carlini 而言,攻击系统比其他选项更能最大化这个乘积。

  • 攻击者还享有结构性杠杆:他们只需要找到一个被忽略的边界情况,而防御者必须修复每一条路径。某个随机执行几乎永远不会命中的条件——例如哈希值等于 (2^{32}),导致整数溢出——可以被攻击者每次强制触发,从而把一个原本稳健的产品的有效安全性降为零。

  • ML 进一步放大了这种不对称,因为研究人员仍在不断发现全新的攻击类别。Carlini 想不起自己曾因伦理原因隐瞒已完成的漏洞,主要是因为他从一开始就把想法生成导向有益的问题;不过,他也拒绝排除未来遇到某种危害大到无法发表的情况。

7. ML 需要超越软件安全的披露规范

  • 传统安全领域已经从“全面披露”与沉默之间,收敛到协调披露:通知受影响方,留出明确修复窗口,然后公开。Google Project Zero 的常规例子是90天;若漏洞已被利用,则缩短至7天;Spectre 和 Meltdown 则因缓解异常困难,获得了约1年时间。

  • 一些 ML 发现适合这套模板。Carlini 的团队披露了一种基于 API 的模型窃取攻击,因为服务提供商可以修改接口并阻止攻击。期限既能给用户留下保护时间,也能防止一家业务在于交付产品、而不是修复不可见漏洞的公司无限期推迟整改。

  • 另一些发现无法在90天内打补丁。对抗样本暴露的是研究人员已经研究10年的问题;生物系统研究人员则把它类比为一种新型病原体,在这种情况下,短暂的保密期无法消除伤害。礼貌性通知和过滤器或许能拦住一个样本,却无法解决整个类别,这让 Carlini 不确定软件安全是否真是合适的参照模型。

  • 他预计这个领域会在“1到2年内”建立流程,但今天仍在借用其他领域的类比。他对政策边界的表述同样克制:立法者可以决定攻击 ML 系统是否违法,但前提是根据攻击实际上能做什么来推理,而不是根据“我们认为世界应该是什么样”。

8. 安全研究以速度换取穷尽细节

  • Carlini 对比了系统论文和机器学习投稿:前者通常是13或14页双栏,后者可能只有7或8页单栏。系统工作要求大量解释和严格评估;ML 则经常接受“这里有个很酷的新想法,也许有效”,因此实验推进快得多。

  • 产出差异是实质性的:在投入相近的情况下,他估计自己每年能写1篇、1.5篇或2篇系统安全论文,而 ML 论文可能有5到6篇。这种宽松对一个年轻领域有益:一篇原创论文加上2次快速改进,都可能在同一场会议上出现,而此前已经在 arXiv 上流传。

  • 成熟领域需要更强的防线,避免想法被反复提出、证据却很薄弱,因此 Carlini 看重两种文化的结合。他的系统训练为 ML 安全提供了差异化优势:最近有一项防御因为符号放错位置而失败,这类细节仅靠查看代码、从第一性原理推理,是他无法发现的。

9. LLM 通过改变抽象层级提升专家编程生产率

  • 主持人提到,Carlini 曾报告语言模型让自己的编程生产率提高约50%;Carlini 则将其限定为 N=1 的轶事。他不认同普遍性的炒作,但表示,对于理解任务、能够编程并检查生成结果的人而言,当前模型确实有用。

  • 他的类比是从汇编或 C 转向 Python。几乎任何结果都仍然可以在更底层实现,但指针、内存分配、语法和样板代码会分散对实际研究问题的注意力。模型接受模糊表达的意图,写出底层细节,让他回到真正关心的推理上。

  • 模型也像是 API 和陌生语言的压缩知识库。Carlini 可以检查一门自己不会写的语言中的代码,再修正边缘错误。在他看来,相比复制一段不确定的 Stack Overflow 代码,要求模型针对任务定制代码,严格更好。

  • 他的工作流从答案可能有50%概率可行时开始:先问一次,检查方向是否有希望,再有选择地迭代,并记住哪些问题类型容易失败。所需技能类似于学习如何写搜索引擎查询——自然语言允许你提出任何请求,但某些表达方式和任务的生产率会高得多。

10. 专家验证无法阻止安全风险随规模扩张

  • 模型有时会重新定义 Carlini 自己对可行性的边界。一道动态规划题原本花了他2到3小时;o1 发布后不久,它在约2分钟内给出正确实现,测试速度还是他版本的10倍。他根据观察到的行为更新判断,而不是固守关于规模扩展的固定预测。

  • 验证仍然是普通代码审查,而不是什么特殊仪式:“Stack Overflow 上一半答案反正就是错的。”生成的方案达到95%,就应被视为恰好95%;有经验的程序员补完最后5%,就可能把部分结果转化成“20倍的性能提升”。

  • 真正的失败模式是无法检查结果的用户。被要求写加密代码时,模型可能直接照办,而不是建议调用经过验证的 API;Carlini 还收到过使用字符串拼接、容易遭受 SQL 注入的数据库代码。他可以替换成参数化模板,但新手可能直接把缺陷部署出去。

  • 最让他担心的是数量效应。模型可能让“代码量增加10倍”,这本身很有价值,但也可能让不安全软件增加10倍,而安全专家并不会同步增加10倍来审计。就像 Rust 的借用检查器一样,有效使用工具要求调整自己的习惯,适应它特有的约束,而不是把它当成一个人类程序员。

11. 基准测试和 API 都会泄露超出所有者预期的信息

  • 旧基准测试测量的是单一窄任务,尽管这个任务——Carlini 举的例子是 ImageNet 中识别“200种不同品种的狗”——很少就是实际应用。通用模型提出了更难的主张:当开发者知道并针对这套测试集进行优化时,一组规模很小的高分无法证明广泛能力。

  • 不需要直接泄露测试集。训练者可以专门针对 HumanEval、MMLU 及约20个熟悉的评分卡调参,得到一个看起来表现出色、但在其他地方失败的模型。Carlini 希望有“多得多的基准测试”,让围绕完整评估集进行定向优化变得更难;至于量化及相关改动,他的回答只是:“祝你好运。”

  • 他的模型窃取工作追踪的也是评估与现实之间的差距。一篇2020年投稿 CRYPTO 的论文,只有在 ReLU 激活、float64 输入和输出、全连接深度不超过3层、每层最多32个单元等人为假设下,才能恢复精确模型。生产环境研究则转而追问真实 API 当下暴露了什么,即使最终只得到一个小层。

  • 这项攻击利用的是最后一层的映射:从示例性的约2,048维内部宽度,映射到约50,000维的 token 输出空间。输出位于一个低维子空间中;奇异值分解可以恢复这一嵌入,而“非零奇异值的数量会告诉你模型的规模”。这是本科线性代数,加上模型架构、API 行为和攻击者视角。

  • 团队恢复了生产模型的最后一层及宽度,包括 Carlini 所说的、首次公开确认的 GPT-3 Ada 和 Babbage 宽度。他们也恢复了 GPT-3.5 的对应数据;OpenAI 对其进行了确认,但协议禁止公开被窃取的数值。因此 Carlini 知道模型规模,却谨慎拒绝披露。

  • OpenAI 授权了这项测试,Google 在完成法律协调后也予以许可;研究运行在隔离虚拟机上,恢复的数据随后被销毁。该问题通过向 OpenAI 进行90天披露处理;Google 和另外几家未具名服务商修复了漏洞。这个漏洞已经存在约3年:“这类漏洞不是你偶然撞上的”——必须有人具备跨领域的广泛知识,并主动去寻找它们。

Nicholas Carlini

The fact that it can make valid moves almost always means that it must, in some sense, have something internally that is accurately modeling the world. I don’t like to ascribe intentionality or any of those kinds of things to it, but it’s doing something that allows it to make these moves, knowing what the current board state is and understanding what it’s supposed to be doing.

Everyone means something different by reasoning, and so the answer to the question is that reasoning is entirely what you define as reasoning. You find some people who are very much in the world of, “I don’t think models are smart. I don’t think that they’re good. They can’t solve my problems.” They say, “No, it’s not reasoning,” because to them reasoning means—and then they give a definition that excludes language models.

You ask someone who is very much on the AGI side—“Language models are going to solve everything by 2027. They’re going to displace all human jobs”—what reasoning is, and they say reasoning is whatever process the model is doing.

Hi, I’m Nicholas Carlini. I’m a research scientist at Google DeepMind, and I like to try to make models do bad things and understand the security implications of the attacks that we can get on these models. I really enjoy breaking things, and I’ve been doing this for a long time. I’m just very worried that, because these systems are impressive, we’re going to have them applied in all kinds of areas where they ought not to be. As a result, the attacks that we have on these things are going to end up with bad security consequences.

MLST is sponsored by sensl, which is the compute platform specifically optimized for AI workloads. They support all of the latest open-source language models out of the box, like llama, for example. You can just choose the pricing points, choose the model that you want; it spins up, it’s elastic auto-scale. You can pay on consumption, essentially, where you can have a model which is always working or it can be freeze-dried when you’re not using it. So what are you waiting for? Go to sent ml. and sign up now.

Tab is a new AI research lab I’m starting in Z. It is funded from past ventures involving AI as well. We are hiring both chief scientists and deep-learning engineer researchers, and so we are Swiss version of deeps: a small group of people, very motivated, very hardworking, and we try to do some research starting with LLM and Owen Stein models. We want to investigate, reverse-engineer, and explore the techniques ourselves.

Speaker 1

Nicholas Carlini, welcome to MLST.

Nicholas Carlini

Thank you.

Speaker 1

Folks at home, Nicholas won’t need any introduction whatsoever. He’s definitely by far the most famous security researcher in machine learning, and he works at Google. It’s so amazing to have you here for the second time.

Nicholas Carlini

Yeah, the first time was a nice pandemic one, but it was great.

Speaker 1

Yes, MLST is one of the few projects that survived the pandemic, which is pretty cool. Why don’t we kick off, then? Do you think we’ll ever converge to a state in the future where our systems are insecure and we’re just going to learn to live with it?

Nicholas Carlini

That’s what we do right now in normal security, right? There is no perfect security for anything. If someone really wanted something bad to happen on your computer, they would win. There’s very little you could do to stop that.

We just rely on the fact that probably the government does not want you, in particular, to have something bad happen. If they decided that they wanted to, I’m sure they have something they could do that would succeed.

What we can get into is a world where the average person probably can’t succeed in most cases. This is not where we are with machine learning yet. With machine learning, the average person can succeed almost always.

I don’t think our objective should be perfection, in some sense, but we need to get to somewhere where it’s at least the case that a random person off the street can’t just very easily run some off-the-shelf GitHub code that makes some model do arbitrary bad things in arbitrary settings.

I think getting there is going to be very, very hard. We’ve tried, especially in vision, for the last 10 years or so to get models that are robust. We’ve made progress and learned a lot, but if you look at the objective metrics, they haven’t gone up by very much at all in the last 4 or 5 years. This makes it seem somewhat unlikely that we’re going to get perfect robustness in the foreseeable future.

At least we can still hope that we can do research and make things better, and eventually we’ll get there. I think we will, but it’s going to take a lot of work.

Speaker 1

Ilia asked me to ask you this question: Do you ever think in the future that it will become illegal to hack machine-learning systems?

Nicholas Carlini

I have no idea. It’s very hard to predict these kinds of things. It’s very hard to know what the Computer Fraud and Abuse Act already covers, especially in the United States, in whatever settings.

I think this is a question for the policy and legal people. My view on policy and law is that, as long as people are making these decisions from a place of what is true in the world, they can make their decisions. The only thing that I try to comment on here is that we should make sure that we’re making decisions based on what is true, and not decisions based on what we think the world should look like.

If they base their decisions around the fact that we can attack these models and various bad things could happen, they’re more expert at this than me. They can decide what they should do. But I don’t know.

Speaker 1

In the context of machine-learning security, these are really open-ended questions. Just to start with, can you predict the future? What’s going to happen with machine-learning security?

Nicholas Carlini

Let me give you a guess. I think the probability of this happening is very small, but it’s sort of the median prediction, in some sense.

I think models will remain vulnerable to fairly simple attacks for a very long time, and we’ll have to find ways of building systems so that we can rely on an unreliable model and still have a system that remains secure.

What this probably means is that we need to figure out a way to design the rest of the world—the thing that operates around the model—so that if it decides it’s going to randomly classify something completely incorrectly, even if just by random chance, the system is not going to perform a terribly misguided action.

We’re going to have to live with a world where the models remain very vulnerable for the foreseeable future, at least as far as I can see. Especially in machine learning, 5 years is an eternity. I have no idea what’s going to happen or what the world will look like.

Language models have only had about 7 years of significant progress, so predicting 5 years out is almost doubling that. I don’t know what the world will look like, but at least as long as we’re in the current paradigm, it looks like we’re in a world where things are fairly vulnerable.

Then again, language models are only 7 years old, and we’ve only really been trying to attack them for 2 or 3 years. Give it 5 years—that’s twice as long as we’ve been trying to attack these language models. Maybe we’ll figure everything out. Maybe language models are fundamentally different and things aren’t this way.

My prior just tends to be based on other vision models. We’ve been trying to study them for 10 years, and at least there, things have proven very hard. My expectation is that things will be hard, and that I’ll have to rely on building systems that end up working.

Speaker 1

I’ve been reading your blog, and everyone should read it because it’s really amazing. When you first put out this article about chess-playing, I cited it on the show about 10 times. It’s really interesting.

It’s called “Playing Chess with Large Language Models.” You said:

“Until this week, in order to be good at chess, a machine-learning model had to be explicitly designed to play games. It had to be told explicitly that there was an 8-by-8 board, that there were different pieces and how each of them moved, and what the goal of the game was. It had to be trained with reinforcement learning against itself, and then it would win.”

You said that this all changed on Monday, when OpenAI released GPT-3.5 Turbo Instruct. Can you tell me about that?

Nicholas Carlini

GPT-3.5 Turbo Instruct, and later other people with open-source models that you can verify aren’t doing something strange behind the scenes, have replicated this. Some people speculated that the models were cheating in various ways, but there are open-source models that replicate it now.

What you have is a language model that can play chess to a fairly high degree. When you first tell someone, “I have a machine-learning system that can play chess,” the immediate reaction is, “Why should I care? We had Deep Blue 30 years ago that could beat the best humans. Isn’t that some form of AI at the time? Why should I be at all surprised by the fact that I have some system like this that can play chess?”

The fundamental difference here is interesting. The model was trained on a sequence of moves. In chess, you represent moves using notation: 1. e4 means moving the king’s pawn to e4, then Black responds with e5, and then White plays Nf3. You train on these sequences of moves, and then you just say, “Language model, do your prediction task.”

It’s just a language model. It’s being trained to predict the next token, and it can play a move that is not only valid but also very high quality.

The valid part is interesting in and of itself. What is a valid chess move? That’s a complicated program. It’s not an easy thing to describe what moves are valid in a given situation. You can’t just output random characters and stumble upon valid moves.

You have this model that makes valid moves almost every time. I don’t like talking a lot about what the model is doing internally, because I don’t think that’s all that helpful. I think looking at the input-output behavior of the system is the way to understand these things.

But the fact that it can make valid moves almost always means that it must, in some sense, have something internally that is accurately modeling the world. I don’t like to ascribe intentionality or any of those kinds of things to it, but it’s doing something that allows it to make these moves, knowing what the current board state is and understanding what it’s supposed to be doing.

That, by itself, is interesting. Not only can it do this, but it can actually play high-quality moves. Taken together, it tells me that the model has a relatively good understanding of what the actual position looks like.

I play chess at a modest level. I’m not terrible, and I understand more or less what I should be doing. But if you gave me a sequence of 40 moves in a row and then said, “At move 41, what’s the next move?” I could not reconstruct in my mind what the board looked like at that point.

Somehow, the model has figured out a way to do this, having never been told anything about the rules or even that they exist. It has reconstructed all of that and can put the pieces on the board correctly, in whatever way it does that internally. Who knows how that happens? Then it can produce a valid move. That’s very interesting to me.

It changed the way I think about what models can and can’t do, in terms of surface-level statistics or deeper statistics about what’s actually going on. That’s mainly why I think this is an interesting fact about the world.

Speaker 1

We have this weird form of human chauvinism around the abstractness of our understanding. These artifacts have a surface level of understanding, but it’s at such a great scale that, at some point, it becomes a weird distinction without a difference.

You said something very interesting in the article: the model was not playing to win. You were talking about how the models are a reflection of you. You play like a good chess player, and it responds like a good chess player. It’s the same whether you’re coding or doing something else.

It might even explain some of the differential experiences people have. You go on LinkedIn and those people clearly aren’t getting very good responses out of language models. Then there are people like yourself, using language models at the galaxy-brain level, pushing the frontier, while people don’t even know you’re using one.

Nicholas Carlini

Let me explain what I meant when I said that the model wasn’t playing to win.

Given a particular chess board, you can find multiple ways of reaching that position. You could take a board that resulted from a normal game between 2 chess grandmasters and find a sequence of absurd moves that no one would ever play, but that brings you to the same board state.

You can construct such a sequence piece by piece. If the knight is on g3, you first move the white knight to some random spot and eventually put it on g3. If the bishop is on h2, you find a way to move the pawn out of the way and then put the bishop on h2. You can come up with a sequence of absurd moves that ends up at the correct board state.

Then you can ask the model to play a move. It plays a valid move most of the time. It still knows what the board state looks like, but the move it plays is very bizarre. It’s a very weird move.

Why? What has the model been trained to do? It was never told that the goal of chess is to win. It was told to produce things that look like what it saw before. It saw a sequence of moves that looked like 2 people rated around 1500 playing a game of chess, and it concluded that the game is to make valid moves and see what happens.

It’s very good at doing this. You can do it synthetically, and you can also find explicit cases where you get models to make terrible move decisions because that’s what people commonly do when they’re playing. Most people fall for these traps, and the model was trained to play like whatever the training data looked like, so it falls for them too.

That’s one of the problems with these models: they’re not initially trained to play to win. As far as how this applies to the language models we use, we almost always post-train them with reinforcement learning from human feedback, supervised fine-tuning, instruction fine-tuning, and related techniques.

A big part of why we do that is so that we don’t have to deal with the mismatch between what the model was initially trained on and what we actually want to use it for. This is why GPT-3 was exceptionally hard to use, and why the sequence of InstructGPT papers was important.

Post-training takes the capabilities that the model has somewhere behind the scenes and makes them much easier to reproduce. When you’re using chat models today, most of the time you don’t have to worry nearly as much about exactly how you frame the question. They were designed to give you the right answer, even when you ask a silly question.

I think they still have some of this behavior, but less than if you just have the raw base model trained on whatever data it happened to be trained on.

Speaker 1

I’d love to do a tiny digression on reinforcement learning from human feedback. I was speaking with Max from Cohere yesterday. They’ve done amazing research on how preference steering works, and they say that humans are actually really bad at distinguishing one good thing from another.

We like confidence, verbosity, and complexity. I really hate the ChatGPT model because of its style. I can’t stand the style. Even though it’s right, I think it’s wrong.

When we do that kind of post-training on language models, how does that affect competence?

Nicholas Carlini

I feel like it’s very hard to answer some of these questions, because often you don’t have access to the models before they’ve been post-trained.

You can look at numbers from the papers. The GPT-4 technical report has some numbers showing that the model before post-training—the raw base model—is very well calibrated. This means that when it gives an answer with some probability, it’s right about that fraction of the time.

If you ask a math question and it says the answer is 5 with a token probability of 30%, it’s right about 30% of the time. But when you do the post-training process, the calibration gets completely messed up and it no longer has this behavior.

Some things change. The models can become fantastically better when you do post-training because they follow instructions much better. You haven’t necessarily taught them much new, but they look much smarter.

This is all very confusing. I don’t have a good understanding of how all these things fit together.

Speaker 1

Given that these models make valid moves and appear to be competent, but sometimes have these catastrophic, weird failure modes, do we call that process reasoning or not?

Nicholas Carlini

Everyone means something different by reasoning, and so the answer is that reasoning is entirely what you define as reasoning.

You find some people who are very much in the world of, “I don’t think models are smart. I don’t think they’re good. They can’t solve my problems.” They say, “No, it’s not reasoning,” because to them reasoning means something that excludes language models.

Then you ask someone who is very much on the AGI side—“Language models are going to solve everything by 2027. They’re going to displace all human jobs”—what reasoning is, and they say reasoning is whatever process the model is doing. They tell you that, yes, the model is reasoning.

It’s very hard to talk about whether it’s actually reasoning or not. The thing we can talk about is the input-output behavior. Does the model do the thing that answers the question or solves the task? Was it challenging in some way? Did it get it right?

That’s an easier way to try to answer these questions than to ascribe intentionality to something. It’s hard to have these debates when you start without having the same definitions.

Speaker 1

I’m torn on this. The deflationary methodology says it’s an input-output mapping. You could go one step up: Yoshua Bengio said reasoning is basically knowledge plus inference, in some probabilistic sense. I think it’s about knowledge acquisition or the recombination of knowledge.

It’s the same thing with agency. The simplistic form is that it’s just an automaton: you have an environment, some computation, and an action space. But it feels necessary to me to have things like autonomy, emergence, and intentionality in the definition.

You could just argue, “Why are you saying all of these words? If it does the thing, then it does the thing.”

Nicholas Carlini

I feel that way too. I think it’s interesting to consider whether it’s reasoning if you have a background in philosophy and that’s what you’re studying. I don’t have that background, so I don’t feel qualified to tell you whether or not the model is reasoning.

The thing I can do is say, “Here is how you’re using the model. You want it to perform this behavior. Did it perform the behavior, yes or no?” If it’s doing the right thing in all of the cases, I don’t know that I care too much about whether the model reasoned its way there or used a lookup table.

If it gives me the right answer every time, I tend not to focus too much on how it got there.

Speaker 1

We have this entrenched sense that we have parsimony and robustness. For example, in this chess notation, if you change the syntax of the notation, it would probably break.

Nicholas Carlini

Yes. There are multiple chess notations. Before the current notation we use, old chess books used a notation like “king’s bishop moves to queen’s 3.” The squares were represented differently.

If you ask a model to use that notation, it has no idea what’s happening. It will write something that looks superficially like a sequence of moves, but has nothing to do with the correct board state.

Of course, a human wouldn’t do this. If you asked me to produce a sequence of moves in that notation, it would take me a long time to remember which square was which and how to write everything down. I would have to think harder, but I understand what the board is and can get that correct. The model doesn’t do that right now.

Maybe that’s your definition of reasoning, and you would say that reasoning doesn’t happen. Someone else could ask why you expect the model to generalize to something it has never seen before.

It’s interesting to me that we’ve gone from a world where we wrote papers about the fact that if you trained a model on ImageNet, its accuracy would go down when you corrupted the images, to a world where this would seem obvious. If I trained a model on ImageNet and tested it on CIFAR-10, people would laugh and say, “Of course it didn’t work. You trained it on one distribution and tested it on another. You never asked it to generalize.”

But with language models, we train them on one distribution, test them on a different distribution they weren’t trained on, and then laugh at the model for being dumb. You didn’t train it on the thing you want to test it on. Maybe some future model will magically generalize across domains, but we’re still using machine learning. You need to train it on the kind of data you want to test it on, and then it will behave much better than if you don’t.

Speaker 1

In an email correspondence with me, you said—you didn’t use these exact words—that there have been many instances where you felt a bit annoyed because you made a statement, your intuition was skeptical, you said “stochastic parrots,” and then you were proven wrong a bunch of times. It’s the same for me.

One school of thought is Rich Sutton’s: throw more data and compute at the thing. The other school of thought is that we need completely different methods. Are you still amenable to the idea that scaling these things up will produce the kinds of reasoning we’re talking about?

Nicholas Carlini

Possibly. There are some people who have good visions of what the future might look like, and then there are people like me, who look at what the world looks like and try to do interesting work here.

This works for me because, for security in particular, it only matters if people are doing the thing to attack the thing. I’m fine saying, “Let’s look at what is true about the world and write security papers.” If the world significantly changes, we can try to change and do things differently.

We can try to be a couple of years ahead by looking at where things are going, so that we can do security research ahead of when we need it. But I tend not to spend a lot of time trying to think about where things will be in the far future.

A lot of people try to do this. Some are good at it and some are not, and I have no evidence that I’m good at it. I mostly try to reason based on what I can observe right now. If what I can observe changes, then I ought to change what I’m thinking about and do things differently.

That’s the best I can hope for.

Speaker 1

On this chess thing, has anyone studied whether the Elo rating in the headers corresponds to a change in performance? What would happen if you said the Elo was 4,000?

Nicholas Carlini

We’ve actually trained some models trying to do this, and it doesn’t work very well. You can’t trivially change the number and get the desired behavior.

We trained some models ourselves on headers that we expected would give them an even better chance of doing this, but that didn’t immediately work. When we trained it and tested GPT-3.5 Turbo Instruct, there might have been a statistically significant difference in the outcome, but it’s nowhere near the case that you tell the model it’s playing like a 1,000-rated player and it suddenly becomes 1,000-rated.

People have worked very hard to train models that let you match the skill to an arbitrary level. That’s a research-paper-level thing, not just changing 3 numbers in the header and hoping for the best.

Speaker 1

You wrote another article called “Why I Attack,” and you said that you enjoy attacking systems for the fun of solving puzzles rather than for altruistic reasons. Can you tell me more about that? Also, why did you write the article?

Nicholas Carlini

Let me answer those in the opposite order.

Some people were angry at me for breaking defenses. They said that I didn’t care about humanity and just wanted to make people look bad or something. Half of that statement is true.

I don’t do security because I’m driven by wanting to do maximum good. I’m not thinking, “What are all the careers I could do, and which one is most likely to save the most lives?” If I had done that, I might be a doctor or researching cancer—something where you could directly measure the good you were doing.

I don’t find those things fun. I can’t motivate myself to do them. If I were a different person, maybe I could do that. Maybe I could be someone who meaningfully solved challenging problems in biology because I woke up every morning knowing that I was saving lives. But that’s not how I work.

I feel that it’s not how many people work. There are lots of people in computer science, or even quantitative fields, who are clearly brilliant and could be doing something better with their lives. Some of them would probably have zero productivity if they were doing something they didn’t enjoy.

I try to find the set of things that I can motivate myself to do and will do a really good job at, then solve those as well as possible, subject to the constraint that I’m actually net positive and moving things forward.

For whatever reason, I’ve always enjoyed attacking things, and I’m much better at that than at most other things. I feel that I’m pretty good at machine learning, but I have no evidence that I would be good at the other 90% of things that exist in the world that might do more good.

The way I think about this in one sentence is: how good you are at the thing multiplied by how much the thing matters. You’re trying to maximize that product.

If there’s something you’re really good at that at least directionally moves things in the right direction, you can have a higher impact than by taking whatever field happens to be maximally good and moving things forward by a very small amount.

That’s why I do attacks. I feel that they generally move things forward, and I’m better at them than at most other things I could be doing.

Speaker 1

You also said that attacking is often easier than defending. Certainly, tell me more.

Nicholas Carlini

That’s the standard thing in security. You need to find 1 attack that works, whereas if you’re defending, you need to fix all of the attacks.

If you’re attacking something, the only thing you have to do is find 1 place where someone has forgotten to handle a corner case. Then you can arrange for the adversary to hit that corner case as many times as needed until they succeed.

In normal software security, you can have a perfect program everywhere except for 1 line of code where you forgot to check the bounds exactly once. The attacker makes that happen every time, and the security of your product is essentially zero.

Under random conditions, this is never going to happen. The hash of a file is not randomly going to be exactly a power of 2—for example, equal to 2³²—which overflows an integer and causes something bad to happen. That won’t happen by random chance. But the attacker can arrange for it to happen every time, which makes the attacker’s job much easier than the defender’s. The defender has to fix everything.

In machine learning, it gets even worse. In normal software security, we understand the classes of attacks. In machine learning, we constantly discover new categories of bad things that could happen.

Not only do you have to be robust to the things we know about; you also have to be robust to someone coming up with a new, clever type of attack that we hadn’t even thought of before. That’s not happening yet, partly because this is a very new field, so attacks are much easier than defenses.

Speaker 1

Let’s talk about disclosure norms. How should they change now that we’re in the machine-learning world?

Nicholas Carlini

In standard software security, we’ve basically figured out how things should go. For a very long time—20 years or so—there was a big debate about what someone should do when they found a bug in software that could be exploited.

In the late 1990s and early 2000s, there were people who supported full disclosure. They thought, “If I find a bug in a program, I should tell everyone so that we can make sure people don’t make a similar mistake. We can put pressure on the responsible party to fix it.”

Then there were people who thought you shouldn’t disclose anything. You should report the bug to the responsible person, wait until they fix it, and then tell no one about it, because you don’t want to give anyone else ideas for exploiting it.

In software security, we landed on what was called responsible disclosure and is now called coordinated disclosure. The idea is that you should give the responsible party a reasonable amount of time to fix the issue.

Google Project Zero has a 90-day policy, for example. You have that many days to fix the problem, and then, after that—or once it’s fixed—it gets published for everyone.

The idea is that you give the person time to protect their users. You don’t want to immediately disclose a new attack that allows people to cause a lot of harm, but you put a deadline on it and stick to the deadline to pressure the company to fix the thing.

If you don’t say that you’re going to release it publicly, no one else knows about it. You’re the only person who knows about the exploit, and the company may simply not fix it because they’re in the business of making a product, not fixing bugs. Why would they fix it if no one else knows about it?

When you say, “This will go live in 90 days,” they had better fix it before then. They have the time, and if they don’t do it, that’s on them because they didn’t put in the work.

There are exceptions. Spectre and Meltdown were 2 of the biggest attacks of the last 10 or 20 years in software security. The researchers gave Intel and the related companies a year to fix them because they were important bugs, difficult to fix, and there were legitimate reasons for taking that long. There was also good evidence that the bugs probably wouldn’t be independently discovered by malicious actors for a long time.

Google Project Zero similarly says that if it finds evidence that a bug is being actively exploited, it will give the company 7 days. If someone is actively exploiting it, the harm is already being done, so there’s little reason to delay telling everyone about it.

Speaker 1

Given that long preamble, how should things change for machine learning?

Nicholas Carlini

The short answer is that I don’t know.

On the one hand, I want to say that this is how things work in software security. Sometimes there’s a bug in software and there’s a way to patch it and fix the problem.

We’ve written papers recently showing model-stealing attacks. OpenAI has a model, and we could query its services in a way that allowed us to steal part of the model. It was only a small part, but we could steal part of it. We disclosed this to them because there was a way they could change the API to prevent the attack from working. Then we wrote the paper and put it online.

That feels very much like software security.

On the other hand, there are problems that aren’t things you can patch. Consider adversarial examples. If I disclose an adversarial example for your image classifier, what is the point of having a responsible-disclosure period? There’s nothing you can do to fix the underlying problem in the short term. We’ve been trying to solve it for 10 years, and another 90 days isn’t going to help.

Maybe I’ll tell you as a courtesy: “This is the attack I’m going to use, and this is how I’m going to describe it in the paper. Do you want to put a couple of filters in place to make this particular attack not work?” But you’re not going to solve the underlying problem.

When I talk to people who work on biological systems, they make the argument that if someone came up with a way to create a novel pathogen, a disclosure period wouldn’t help. So is machine-learning security more like that, or more like software security?

I don’t know. I’m biased toward software security because that’s where I came from, but it’s hard to say exactly which one we should model things after.

We probably do need to come up with new norms for how we handle this. A lot of people are talking about this and trying to write these norms down. In a year or 2, if you ask me again, we’ll probably have processes and established norms for handling these things.

Right now, this is still very early. We’re looking for analogies in other areas and trying to come up with what sounds most likely to be good. I don’t have a good answer.

Speaker 1

Are there any vulnerabilities that you’ve decided not to pursue for ethical reasons?

Nicholas Carlini

No, none that I can think of. Mostly, that’s because I tend to think only about exploits that would be ethical to pursue in the first place.

Research ideas happen by random inspiration a very small fraction of the time. Most of the time, a research idea is not something that just happens. You spend conscious effort trying to figure out what new thing you’re going to try.

It’s pretty easy not to think about things that seem morally fraught and to focus on the ones that seem as though they could actually be good and useful. It may happen at some point that I stumble upon something like this, but I can’t think of any examples of attacks we’ve found and decided not to publish because of the harm they would cause.

I can imagine that it might happen. I can’t rule it out. But I tend to bias my search toward problems that I think are beneficial.

Going back to why I attack things, you want the product of how good you are and how much good it does for humanity to be maximally positive. You can choose problems that aren’t negative.

I don’t have much respect for people whose contribution to the direction of the world is just a negative number, because you can make that zero by doing nothing. I try to pick problems that are generally positive and then do as well as possible on them.

Speaker 1

You work on traditional security and machine-learning security. What are the significant differences?

Nicholas Carlini

I don’t work on traditional security very much anymore. I started my PhD in computer security. I did very low-level return-oriented programming, and I spent a summer at Intel working on hardware-level defenses. Then I started working on machine learning shortly afterward.

I haven’t worked on very traditional security in the last 7 or 8 years, but I still follow it very closely and go to systems-security conferences because it’s a great community.

One of the similarities and differences is that systems-security people are very good at making sure that what they’re doing is rigorous and evaluated thoroughly. You see this even in the length of the papers. A systems-security paper is 13 or 14 pages in 2 columns. A paper submitted to ICLR is 7 or 8 pages in 1 column.

Systems-security papers start with a long explanation of exactly what’s happening, and the results are expected to be very rigorous. A machine-learning paper is often, “Here’s a new cool idea. Maybe it works.” That’s good for moving fast and breaking things, but it’s not good for systematic studies.

When I was doing systems-security papers, I would get 1, 1.5, or 2 papers a year. Now I could probably produce 5 or 6 machine-learning papers at a similar level of rigor.

This is a conscious decision by the communities, and I think it has worked empirically in machine learning. It wouldn’t be good if every machine-learning result needed the rigor expected of a systems-security paper, because we would have had about 5 iteration cycles in total.

At machine-learning conferences, you often see a paper, a paper that improved upon it, and another paper that improved upon that paper, all at the same conference. The first person put it on arXiv, the next person found a tweak that made it better, and the third person found another tweak that made it even better.

That’s good. When a field is very new, you want to allow people to propose ideas without having full evidence that everything works. When the field becomes more mature, you want to make sure that people aren’t proposing wild things that have already been proposed 30 times.

Having some balance between the 2 is useful. If I have a differential advantage in machine learning, some of it comes from this. In systems security, you’re trained very heavily in rigorous thinking, doing attacks thoroughly, and looking at all the details.

That training has been beneficial to me when writing machine-learning papers and thinking about the small details. I recently had a paper where I broke a defense because there was a negative sign in the wrong place.

That’s not the kind of thing I could have reasoned about from first principles by inspecting the code. If I had been advising someone, I wouldn’t have known to tell them, “Check all the negative signs.” You have to understand everything that’s happening and find the one place where the mistake was made, so that you can break the system by doing exactly the right thing.

That’s perhaps the biggest difference I see between these communities.

Speaker 1

Your next article was called “Why I Use AI.” A couple of months ago, you wrote that you’ve been using language models, find them very useful, and that they improve your programming productivity by about 50%. I can say the same thing myself. Can you break down the tasks where they’ve really increased your productivity?

Nicholas Carlini

I’m not someone who believes these things easily. There are people whose job is to hype things up, get attention, and promote these technologies.

The annoying thing is that the same people who said Bitcoin was going to change the world immediately started saying that language models were going to change the world. If you’re looking at this from afar, it seems that the grifters are just finding the new thing. These people have no understanding of what’s going on in the world.

They may be right that these people are finding whatever the new thing is that gets them clicks, but at the same time, I think the models we have now are actually useful. They’re not useful for nearly as many things as people say, but for a particular kind of person—the person who understands what’s happening in these models, knows how to code, and can review the output—they’re useful.

What I wanted to say was, “I’m not going to argue that they’re good for everyone. Here’s an N-of-1 anecdote showing that they’re useful for me. If you have a background similar to mine, maybe they’re useful for you too.”

I’ve had a number of security-oriented people contact me and say that they found them useful. The question is whether my experience generalizes to anyone else. I don’t know. It’s not my job to understand that. I just wanted to say that they’re useful for people who behave as I do.

Why are they useful? The current models are good enough for the kinds of things where I want an answer. Maybe I want them to write a function or implement something. I know how to check the answer, and I know I could produce it myself; I just don’t want to.

The most useful analogy is to imagine that you had to write all your programs in C or assembly. Would that mean you couldn’t do anything you can do now? Probably not. You could do the same research in C instead of Python if you really had to. It would take a lot longer.

You have an idea in your mind—you want to implement a binary search, for example—and in C you have to reason about pointers, memory allocation, and all these little details that are at a much lower level than the problem you want to solve.

The thing that’s useful about language models is that, if you know the problem you want to solve and can check that the answer is correct, you can ask the model to implement it. You can describe what you want in words, even if those words aren’t terribly well-defined, and it will give you an answer.

You can check that it’s correct, put it in your code, and continue solving the problem you actually wanted to solve rather than the problem of typing out all the details.

The other class of things I find useful is when I can rely on the model having enormous knowledge about the world and all kinds of things. If I understand the fundamentals but don’t know the API for something, I can ask the model to make it work with that API and check the result easily.

If I don’t know how to write something in a particular language, I can ask for the code. If you give me code in any language, even one I’ve never seen before, I can generally reason about what it’s doing. I may make mistakes at the edges, but I could never have typed it because I didn’t know the syntax.

The models are very good at giving you the correct syntax and getting everything else out of the way. Then I can figure out the rest.

If I couldn’t ask a model, I’d have to learn the syntax of the language or do what people did 5 years ago: copy and paste someone else’s code from Stack Overflow and make annotations. That’s a strictly worse version of asking the model, because then I’m relying on myself, without knowing much, to copy and paste correctly.

For these kinds of problems, they’re currently plenty useful if you already understand the problem. By “understand,” I mean having an abstract understanding. In that case, they’re a superpower.

Speaker 1

That explains why the smarter you are, the more you can get out of a language model. How has your usage evolved over time, and what’s your methodology?

Speaking personally, I know that specificity is important. Going to source material, constructing the prompt, and embedding my understanding and reasoning process into the prompt all matter. How do you think about that?

Nicholas Carlini

I try to ask questions that have a reasonable probability of working. I don’t ask questions if I think the process will slow me down, but if I think there’s a 50% chance of success, I’ll ask the model first.

Then I look at the output and ask whether it seems directionally correct. If it seems as though it’s approaching the right kind of solution, I might iterate a little more. If it gives me a perfect solution the first time, great—I accept it.

I also learn from the interaction. If the models aren’t good at a particular kind of problem, I may not ask that question again in the future.

Some people say they can’t get models to do anything useful. It may be that the models are bad at their particular kind of problem. It may also be that they don’t yet understand what the models can do.

Most people have forgotten how much they had to learn about using Google Search. If I tell you to look something up, you implicitly know that you should use the words that appear in the answer. You don’t ask it as a question. There’s a way to type things into search engines to get the right answer, and that requires some skill and understanding.

It’s the same with language models. They have a natural-language interface, so technically you can type anything you want, but some ways of doing it are much more useful than others.

I don’t know how to teach this as a skill other than saying, “Try it.” Maybe it turns out the models aren’t good at your task, in which case you shouldn’t use them. But if you can make them useful, it seems like a free productivity gain.

The caveat is that you need to understand what’s happening with these systems. There are people who don’t, and I worry about whether they’ll learn anything or catch the bugs when they appear.

For a practitioner who wants to get work done, I feel that using language models is analogous to using Python rather than C. I wouldn’t say that you need to use C instead of Python, and I wouldn’t say that you need to use Python alone instead of Python plus language models.

Speaker 1

I agree that laziness and acquiescence are problems. Vibes and intuition are really important. I consider myself a Jedi at using language models, and sometimes it frustrates me because I tell people to use one, but I seem to get so much more out of them than other people.

I’m not entirely sure why that is. Maybe it’s because I understand the thing I’m prompting. It seems to be something we need to learn.

Nicholas Carlini

Every time a new tool appears, you have to spend time learning how to use it.

I remember when people said, “Real programmers write code in C. They don’t use a high-level language. Why would you trust a garbage collector? Real programmers manage their own memory. Real programmers write their own Python. Why would you trust a language model to output correct code? Why would you trust it to recall an API?”

You can draw the same analogies here. When tools change and make you more productive in certain settings, you should be willing to examine the new tools.

Speaker 1

I’m always trying to rationalize this. It comes down to the notion of whether the intelligence is in the eye of the prompter.

Nicholas Carlini

Does it matter? Maybe the difference between how I use these systems and how other people use them is that the system makes me more productive and solves the task for me.

Did I put the intelligence there? In many cases, I think the answer is no. In some cases, I think the answer is yes. But I’m not going to look at it that way. I’m going to ask whether it solves the questions I have in a way that’s useful for me. Here, the answer is definitely yes.

Speaker 1

Obviously, as a security researcher, how does that influence the way you use language models?

Nicholas Carlini

This is why I’m scared about people who use them without understanding things. You can ask a model to write an encryption function, and the correct answer should be, “You shouldn’t do that. You should call this API.”

Often, the model will say, “Sure, here’s an encryption function,” and it will have all the bugs that people normally write. That’s terrible.

I was writing some code that made calls to a database. What did the model do? It wrote code vulnerable to SQL injection. If someone wasn’t careful, they wouldn’t have caught it, and they would have introduced all kinds of bad bugs.

Because I’m reasonably competent at programming, I can read the model’s output and correct its mistakes. It’s not hard to fix the SQL injection and replace string concatenation with templates. The model just didn’t do it correctly.

I’m very worried about people who won’t do this. There have been papers showing that people write very insecure code when using language models if they aren’t careful. It looks as though code may be differentially more vulnerable when people use language models than when they don’t.

This is one reason I think about the utility question. The security of the things people use actually matters, and I want to know what people are going to do so that we can study it.

It’s important to separate whether the model can solve the problem from whether it’s secure. For language models, the answer is often yes: they give you the right answer in the common case.

Most people don’t care about the security question, so they’ll use the system because it gave them the ability to do something new, without understanding the security implications. That means we should study the security of the things we know people are going to use and make sure they can use them correctly.

I try to use systems at the frontier of what people are going to do next, to put myself in their frame of mind and understand the risks. This worries me quite a lot, because things could go very badly.

Speaker 1

How and when do you verify the outputs of language models?

Nicholas Carlini

I verify them the same way I verify any code output.

People say, “The model might be wrong,” but half the answers on Stack Overflow are wrong too. If you’ve been programming for a long time, you’re used to reading code that’s wrong.

I’m not going to copy and paste a function from Stack Overflow and assume it’s correct. The person may have asked a different question from the one I’m asking. I don’t feel I’m doing anything fundamentally different when verifying code from a language model compared with verifying code someone else wrote online.

Maybe the only difference is that I’m using the models more often. If you use something twice as often, you’ll encounter twice as many bugs, so you have to be more careful. But I’m not doing anything different in quality.

Don’t trust the system to give you the right answer, and understand that a 95% solution is still a 95% solution. If it does almost everything you want, its capabilities may have reached their limit. You’re an intelligent person; finish the last 5%, fix the problem, and then you can have a 20-times performance increase.

Speaker 1

You’ve touched on something very interesting. Most of us are wrong most of the time, which is why it’s good to have at least 1 very smart friend who constantly points out all the ways your work is wrong.

Most code is wrong. It’s your job to point out how it’s wrong. I guess we’re always unknowingly on the boundary of wrongness, and that’s just the way the world works.

Nicholas Carlini

There’s the potential for a massive increase in the quantity of wrongness. Previously, the amount of bad code that could be written was limited by the number of humans who could write bad code. There were only so many people who could write software, and they needed at least some training.

Now, if language models allow anyone in the world to write whatever software they need to solve a particular problem, that’s fantastic from one perspective. But as a security person, I’m scared because there may be 10 times as much software that is probably insecure.

We’re not going to have 10 times as many security experts to study all of it. There could be a massive increase in insecure software, and that’s one of the many things I’m worried about.

I try to use these systems to understand whether something seems like what people will actually do. Right now, the answer seems to be yes, and that worries me.

Speaker 1

I spoke with some Google people yesterday, and they’ve been studying some of the failure modes of language models—really strange things that people don’t know about. They can’t copy, they can’t count, and there are issues caused by the softmax and token-level representation squashing in particular layers.

In your experience, have you noticed tasks that language models really struggle with?

Nicholas Carlini

I’m sure there are many. I’ve learned to just not ask those questions, so I have a hard time coming up with examples.

It’s like asking what search engines are bad at. I’m sure there are a million things for which a search engine is completely the wrong answer, but if you pressed me for an example right now, I might have trouble because I use search engines for the things they’re good at.

Whenever you want correctness in some sense, the model may not be the right tool. In terms of specific tasks they’re particularly bad at, you could say anything that requires an amount of work that would take you more than 20 minutes to write a program for. The model probably can’t solve that—but this is changing.

There are things I thought would be hard that are becoming easier. I had a problem that, for unrelated reasons, was a difficult dynamic-programming problem. It took me 2 or 3 hours to solve it the first time.

OpenAI o1 had just launched a couple of days earlier, so I gave the problem to o1. It gave me an implementation that was 10 times faster than mine in about 2 minutes. I could test it because I had a reference solution, and it was correct.

I learned that this was a problem I previously would never have asked a model to solve because it was challenging enough that I thought the model had no hope. Now I can ask it.

There are other things that seem trivial to me but that models get wrong. I mostly just don’t ask them those questions.

This goes back to what worries me: people may not have the experience to check when answers are right or wrong. They’ll apply a wrong answer as many times as they can, and that seems concerning.

Speaker 1

This is part of the anthropomorphization process. We have vibes and intuitions, and we know how to skirt around the long tail of failure modes. We smooth it over in our supervised use of language models, and the amazing thing is that we don’t seem consciously aware of it.

Nicholas Carlini

Programmers do this all the time. A programming language has some model of how memory works. Rust has a very unusual memory model. If you go to someone who’s good at Rust, they’ll structure their program differently so that they don’t encounter all of the problems caused by that memory model.

I’m not very good at Rust. I try to write code in it, and the borrow checker yells at me endlessly. I look at Rust and think, “This could be very good, but I don’t know how to get my code right because I haven’t used it enough.”

If I weren’t being charitable, I might ask why anyone would use a language that makes it impossible to write my C code. But you have to change the way you write your code to work with the language, and then the problems go away.

You can do the useful things if you accept the paradigm you’re supposed to operate in. I see the same analogy here. The models aren’t very good in certain ways, and you’re trying to imagine that they’re human and ask them the things you would ask another person.

They aren’t human. You need to ask them in the right way and ask the right kinds of questions. Then you can get value from them. If you don’t, you’ll be disappointed because they’re not superhuman.

Speaker 1

What are your thoughts on benchmarks?

Nicholas Carlini

This is one of the problems with language models. We used to live in a world where benchmarking was easy because we wanted models to solve exactly 1 task. You measured performance on that task, and if the model solved it, you were done.

The problem is that the task was never the task we actually cared about. This is why ImageNet models never made it into the real world to solve actual problems. We don’t care about classifying 200 breeds of dogs. The model may be good at that, but it isn’t the thing we actually want.

The claim people make about language models is that they’re general-purpose models that can solve arbitrary tasks. Then they test them on a small number of tasks and say, “See? It’s good because it solves these tasks very well.”

The challenge is that if I trained a model specifically to solve any one of those tasks, I could probably get a very good score. You don’t want the person who trained the model to have done that. You want them to train a good general model and then evaluate it on a task that’s independent of the training objective.

That gives you an unbiased view of how well the model performs. But people who train models are incentivized to make them perform well on benchmarks.

In the old world, I trusted researchers not to cheat. If I wanted maximum ImageNet test accuracy, I could train on the test set, but that would be cheating. I trust people not to do that.

With language models, you might not train directly on the test set of a benchmark such as HumanEval, MMLU, or MMMU, but you might train the model specifically to perform well on those benchmarks.

You could have a model that isn’t very capable in general but is fantastic on the 20 benchmarks everyone uses. That’s what everyone is incentivized to do, because you want your model to have maximum benchmark scores.

I’d like to live in a world with many more benchmarks, so that it isn’t easy to optimize for a small set of them. Then we could more easily trust that the models give the right answers and that their scores accurately reflect their skill level, rather than reflecting what the model trainer designed them to maximize.

Speaker 1

The hyperscalers put incredible amounts of work into benchmarking. Now we’re moving to a world with test-time inference, test-time active fine-tuning, fine-tuning, quantization, fragmentation, and so on. People doing this in practice can’t really benchmark in the same way. How do you see that playing out?

Nicholas Carlini

I don’t know. If you’re doing quantization and related things, good luck. It seems very hard.

You can use the average benchmarks and hope for the best, but I don’t think that’s the main issue. I’m more worried about people actively fine-tuning models to show that they can make them better on particular tasks.

There are many fine-tunes of Llama, for example, that are claimed to be better. They show all the benchmark numbers, but it turns out they trained the models specifically to perform well on those tasks. If you ask them anything else, they’re very bad.

That’s what I’m most worried about. For the other cases, I agree that benchmarking is hard, but I don’t have any great solutions.

Speaker 1

We can’t let you go before talking about one of your actual papers. This has been amazing, but I picked “Stealing Part of a Production Language Model,” from July. Could you give us an elevated picture of that?

Nicholas Carlini

For a long time, security researchers thought about how a model might be used in some hypothetical future and then asked whether certain kinds of attacks were possible in a theoretical setting.

There’s a line of work called model stealing, which asks whether someone can take a model and, by making standard queries to its API, steal a copy of it.

This began with Florian Tramèr and others in 2016, when they studied very simple linear models exposed through APIs. It then became a field of study involving deep neural networks. There were several papers in a row by a bunch of other people.

In 2020, we wrote a paper that we submitted to CRYPTO showing how to steal an exact copy of a model. Whatever model you had, we could recover an exact copy, as long as a long list of assumptions held: the model used only ReLU activations, everything was evaluated in 64-bit floating point, we could send and receive 64-bit floating-point values, the model was fully connected, its depth was no greater than 3, and each layer had no more than 32 units.

It was a theoretical result with assumptions that are never true in practice. There are other papers showing how to do this kind of exact model stealing, but they work only in contrived settings.

The question I wanted to answer was: Now that we have language models, and all of those assumptions are false, what’s the best attack we can implement against a real API?

It’s not just that the model uses something other than ReLU activations or isn’t fully connected. I can’t send 64-bit floating-point inputs or view 64-bit floating-point outputs. The models have billions of neurons, not 500.

We wanted to develop the best attack that worked against a real API. We looked at the OpenAI API and at APIs from other companies, including Google. Because of how the APIs were set up, they gave us some control over the outputs that allowed us to do mathematical operations and steal 1 layer of a model.

Among the layers in the model, it’s probably the least interesting one. It’s a small amount of data, but we could actually recover 1 layer of the model. It’s real in the sense that we could do it, and it’s real in the sense that we recovered the layer correctly, but it isn’t the whole model.

What I wanted to advocate for in the paper is pursuing both directions of research at the same time. One direction is writing papers that are true in a theoretical sense but aren’t the kinds of results you can implement in real systems, and probably won’t be for the foreseeable future.

At the same time, security researchers should look at systems as they’re deployed and ask what kinds of attacks can actually make the model do something bad. We should write papers about real pieces of these systems.

I don’t know what you can do with the last layer of a model, but there are some things. For example, the attack tells you the width of the model, which isn’t information companies generally disclose.

In our paper, we had what I believe was the first public confirmation of the width of the GPT-3 Ada and Babbage models. OpenAI had disclosed the widths of some models in the GPT-3 paper, but never directly stated the sizes of Ada and Babbage. People speculated about them, but we were able to confirm them.

We also ran the attack on GPT-3.5 and correctly stole the last layer. I know the size of the model, and it’s correct.

For responsible disclosure, we agreed with OpenAI in advance that we were going to do this. It’s a fun conversation to have with Google lawyers and OpenAI lawyers: “Hi, I would like to steal your model. May I please do this?”

The OpenAI people were very nice and said yes. Google’s lawyers were initially more cautious. They said that I couldn’t steal OpenAI’s data, but when I explained that OpenAI’s general counsel had agreed, they said it was fine. We put everything on an isolated virtual machine, ran the attack, and destroyed the data.

Part of the agreement was that they would confirm that we had recovered the correct information, but they asked us not to release the actual stolen data. That makes sense: you want to demonstrate that the attack works without releasing the stolen material.

If you wrote down a list of everyone in the world who knows how large GPT-3.5 is, it would include all current and former OpenAI employees and me.

This is a real attack. The other ways to learn this information would be to hack OpenAI’s servers or blackmail one of its employees. Instead, you can perform an actual adversarial machine-learning attack and recover the size of the model and its last layer.

That was the motivation for writing the paper: to provide examples and encourage other people to find attacks that, even if they don’t solve all the problems, make these attacks increasingly real. We’ll need to see more of this as systems are deployed in more and more settings.

Speaker 1

Do you want to talk about the technical methods behind it?

Nicholas Carlini

For the next two minutes, let’s assume some level of linear-algebra knowledge. If that isn’t you, I apologize; I’ll try to explain it in a way that makes sense.

The models work as a sequence of layers, and each layer is a transformation of the previous layer. The layers have some size or width. The last layer of a model goes from a small dimension to a large dimension.

The internal dimension of these models might be 2,048, while the output dimension is the number of tokens in the vocabulary, which is around 50,000. This means that if you look at the vectors that are outputs of the model, they appear to be in a large, 50,000-dimensional space, but because they were produced by a linear transformation, the vectors actually lie in a 2,048-dimensional subspace.

If you look at this space, you can compute what’s called a singular value decomposition to recover how the smaller space was embedded into the larger one. The number of nonzero singular values tells you the size of the model.

This isn’t challenging mathematics. The last time I used it was as an undergraduate in mathematics. If you work through the details, it works out.

I like this because it’s a nice application of mathematics to these systems. It doesn’t require an expert in one particular area. It requires undergraduate-level linear algebra, an understanding of how language models work, an understanding of security, and an understanding of the actual API the model provides.

You have to think about all of those pieces. That’s what a security researcher does. It isn’t usually the case that we’re looking at something deeper than any one field. More often, exploits happen because you have broad knowledge and understand how the details of an API interact with the architecture of a language model, using techniques from linear algebra.

If you were missing any one of those pieces, you wouldn’t see that the attack was possible. That’s why OpenAI had this vulnerability for 3 years and no one found it first. People weren’t looking for this kind of thing. You don’t stumble upon vulnerabilities like these; you need someone to go looking for them.

For responsible disclosure, we gave OpenAI 90 days to fix it. Google patched it, and a couple of other companies that we won’t name because they asked us not to also patched it.

Speaker 1

Nicholas Carlini, thank you so much for joining us today. It’s been an honor having you on.

Nicholas Carlini

Thank you.

语言模型正在“为世界建模” [Nicholas Carlini] — 文字稿与摘要 | BidClub