技术指南

人工智能可解释性中的叠加和多义性

人工智能可解释性中的叠加是神经网络将许多特征打包到共享方向的方式,这使得单个神经元看起来具有多语义性并且更难以解释。

听听这个指南AI叙述 · ~8 min

在本页阅读时间 9 分钟
  1. 主要要点
  2. 深入探讨
  3. 将三个特征压缩到两个维度中
  4. 现实世界的实施
  5. 人工智能可解释性中叠加和多义性的未来
  6. 付诸实践
  7. 资料来源与延伸阅读
  8. 不断探索
  9. 常见问题

主要要点

  1. 多义神经元会对几个不相关的输入产生触发,例如 InceptionV1 神经元 4e:55 会对猫脸、车头和猫腿作出响应。
  2. 叠加假设是指,网络通过在激活空间中为每个特征赋予稍微重叠的方向,从而使存储的特征数量多于神经元数量。
  3. Anthropic 在 2022 年的玩具模型表明,随着特征变得更加稀疏,叠加会突然出现,特征会形成五边形和四面体等形状。
  4. 稀疏自编码器将激活重写为许多学到的方向的稀疏组合,从而恢复出比神经元数量多得多的可解释特征。
  5. Anthropic 在 2024 年在 Claude 3 Sonnet 上训练了拥有多达 3400 万个特征的稀疏自编码器,并通过夹紧各个特征来引导模型行为。
  6. SAE 特征是近似值:重建会留下无法解释的方差,许多特征可能是失效的,并且特征的标签可能是错误的。

深入探讨

A neural network represents what it knows as activations, lists of numbers produced inside each layer. Interpretability researchers call the meaningful properties those numbers encode features: for example, the idea that a sentence is in French, that an image contains a curve, or that a piece of code has a security bug. The hope behind early interpretability work was that each neuron, one entry in a layer's activation list, would correspond to one feature. Sometimes that holds: vision models contain clean curve detectors. Often it does not. A polysemantic neuron is one that responds to several unrelated inputs. The 2020 Distill article Zoom In, by Chris Olah and colleagues then at OpenAI, gave a famous example: neuron 4e:55 in the image model InceptionV1 fires for cat faces, the fronts of cars and cat legs.

Superposition is the leading explanation for why this happens. The idea is that a model needs to track far more features than it has neurons, so it does not give each feature its own neuron. Instead, each feature gets a direction, a particular pattern across many neurons, and those directions are allowed to overlap a little. Two facts from mathematics make this workable. In a space with n dimensions only n directions can be exactly at right angles, but exponentially many can be almost at right angles, a result related to the Johnson-Lindenstrauss lemma. And compressed sensing shows that a vector squeezed into fewer dimensions can still be recovered if it is sparse, meaning most of its entries are zero. Real features are sparse: any given sentence mentions very few of the things a model knows about.

The cost of overlapping directions is interference. When feature A is active, a little of its signal leaks onto feature B's direction. If features rarely occur together, the leak is usually small and a nonlinearity such as ReLU, which zeros out negative values, can filter it away. Polysemanticity is what this looks like from the point of view of a single neuron: because each neuron participates in many feature directions, it lights up for all of those unrelated features. So superposition is a claim about how features are stored, and polysemanticity is the symptom seen when examining neurons one at a time.

The key evidence came from Toy Models of Superposition, published by Anthropic and Harvard researchers on 14 September 2022, with Nelson Elhage as a lead author and Olah as corresponding author. The team trained very small ReLU networks to compress synthetic inputs into fewer dimensions and reconstruct them. Each input feature had a sparsity, the probability of being zero, and an importance, a weight on its reconstruction error. With dense features, the model behaved like principal component analysis and simply kept the most important ones. As features became sparser, it switched abruptly to storing extra features in superposition, a transition the paper describes as a phase change. The stored features arranged themselves into regular geometric shapes such as pairs, triangles, pentagons and tetrahedra. The paper also showed that at least simple computation, an absolute value function, can be carried out while in superposition, and found preliminary links between superposition and adversarial examples.

If features are directions rather than neurons, the practical problem becomes finding those directions. The main method is dictionary learning with a sparse autoencoder (SAE): a separate small network trained to rewrite a model's activations as a sparse combination of many more learned directions than there are neurons. Anthropic's Towards Monosemanticity, published 4 October 2023, applied this to a one-layer transformer with a 512-neuron MLP layer. Trained on 8 billion activation samples, its dictionaries ranged from 512 to 131,072 features and found interpretable ones for DNA, base64, Hebrew and Arabic script. A monosemantic feature is one that responds to a single understandable concept. The paper also showed feature splitting: one feature in a small dictionary breaks into several finer features in a larger one.

The method then scaled to production models. Anthropic's Scaling Monosemanticity, published 21 May 2024, trained SAEs with about 1 million, 4 million and 34 million features on the middle layer of Claude 3 Sonnet. It found features for the Golden Gate Bridge, brain sciences and tourist attractions, as well as safety-relevant features for code backdoors, bias, deception, sycophancy and dangerous content, and showed that clamping a feature to a high value changed the model's behavior. In June 2024 OpenAI researchers reported a 16 million latent SAE trained on GPT-4 activations over 40 billion tokens, and in August 2024 Google DeepMind released Gemma Scope, open SAEs covering all layers of Gemma 2 2B and 9B.

Compared with alternatives, the superposition view explains why simply reading neurons, the approach of early feature visualization, hits a ceiling. The obvious fix, designing models that never use superposition, did not work out: the 2023 paper reports that forcing activation sparsity during training, even down to one active neuron at a time, removed superposition but still left polysemantic neurons, because a model can lower its loss by letting one neuron stand for several mutually exclusive features. Probing, training a small classifier to detect whether a known concept is present, still works but only finds concepts researchers already thought to look for. SAEs are unsupervised, so they can surface unexpected features.

The limits are real. Superposition is a hypothesis supported by toy models and indirect evidence, not a proven description of large models. SAE features are only an approximation: in Scaling Monosemanticity the reconstructions explained at least 65% of the variance of the activations, so a sizable remainder went unexplained, and about 65% of the features in the 34 million SAE were dead, meaning they never fired on a sample of 10 million tokens. The paper cautions that a feature about lying is not evidence that a model lies. Feature labels come from people or models reading examples, which can be wrong. And training SAEs is expensive: compute grows with the product of the number of features and the number of training tokens, so covering every layer of a frontier model is a large engineering project.

03工作示例

将三个特征压缩到两个维度中

  1. 假设有三个特征 A、B 和 C,以及一个只有两个神经元的层,因此仅容纳两个完全正交的方向。

  2. 为每个特征分配一个彼此相距 120 度的单位长度方向,就像三角形的顶点一样;现在任意两个方向的点积都是负 0.5。

  3. 仅激活值为 1 的特征 A:两个神经元持有 A 的方向,读回结果为 A = 1,B = 负 0.5,C = 负 0.5。

  4. 应用 ReLU,将负值转换为零:读出结果变为 A = 1,B = 0,C = 0,从而滤除了干扰。

  5. 现在同时激活 A 和 B:读回 C 得到负 1,ReLU 将其移除,但 A 和 B 各自读到的是 0.5 而不是 1,因此只能部分恢复。

  6. 单独看一个神经元:它承载了所有三个特征的一部分,因此孤立来看,它似乎对三个不相关的事务都有反应。

它显示了什么

手工构建的三个特征在两个神经元中的叠加。检查方法:单一特征在 ReLU 之后能够精确解码,重叠特征解码出现错误,每个神经元表现出多义性。这反映了为何只有在特征稀疏时叠加才有价值。

现实世界的实施

InceptionV1 神经元 4e:55,出现在 2020 年 Distill 文章《Zoom In》中,对猫脸、汽车正面和猫腿有响应,是图像分类器中典型的多义神经元。

Anthropic 的 2022 年《叠加玩具模型》在合成稀疏数据上训练了小型 ReLU 网络,观察到五个特征在二维空间中排列成正五边形。

Towards Monosemanticity(2023 年 10 月)使用稀疏自编码器从 512 神经元层中提取出数万可解释特征,如 DNA 序列、base64 文本和阿拉伯文字。

Scaling Monosemanticity(2024 年 5 月)在 Claude 3 Sonnet 上训练了拥有多达 3400 万特征的稀疏自编码器,并发现了一个金门大桥特征,在高强度夹持时能够引导模型。

Google DeepMind 的 Gemma Scope(2024 年 8 月)为 Gemma 2 2B 和 9B 的每一层发布了开源稀疏自编码器,使外部研究者无需自行训练即可研究特征。

人工智能可解释性中叠加和多义性的未来

开放问题主要在于 SAE 特征是否是真正的基本单元。Anthropic 的 2024 年论文指出跨层叠加——特征跨多个层分布——是其在残差流上有效的原因之一,并且指出模型方差的大部分仍未被其字典解释。2023 年报告的特征拆分意味着特征数量取决于字典规模,可能不存在唯一的真实特征列表可供恢复。研究者还在致力于更廉价且行为更稳健的训练,如 OpenAI 的 2024 年 k‑稀疏自编码器和 DeepMind 在 Gemma Scope 中的 JumpReLU SAE,并尝试从孤立特征转向展示特征如何组合产生答案的电路。这些工具是否能够在大规模上可靠地检测前沿模型中的欺骗或其他风险行为仍未得到验证。2022 年玩具模型论文也留下了未解之问,即叠加是否能够解释对抗样本等现象,文中仅提供了初步证据。

付诸实践

为什么这很重要

  • 成本与预算. 多年来,架构决策决定着性能和运营成本。
  • 更清晰的判决. 技术教育帮助团队选择正确的堆栈,而不仅仅是最新的堆栈。
  • 质量控制. 更好的工程选择可以减少生产中的可靠性事故。

留意

  • 优化一项基准测试可以隐藏更广泛的系统弱点。
  • 基础设施和维护成本常常被低估。
  • 随着系统变得更加复杂,安全性和可观察性差距可能会扩大。

后续步骤

  1. 在实施之前定义延迟、质量和成本目标。
  2. 在实际负载和数据条件下进行基准测试。
  3. 仪器监控错误、漂移和用户影响。
  4. 在扩展之前准备回滚和事件响应路径。

资料来源与延伸阅读

  1. Transformer Circuits Thread (Anthropic)叠加玩具模型
  2. Transformer Circuits Thread (Anthropic)Towards Monosemanticity:使用字典学习分解语言模型
  3. Transformer Circuits Thread (Anthropic)Scaling Monosemanticity:从 Claude 3 Sonnet 中提取可解释特征
  4. DistillZoom In:电路入门
  5. arXiv (OpenAI)稀疏自编码器的规模化与评估
  6. arXiv (Google DeepMind)Gemma Scope:在 Gemma 2 上一次性开放所有稀疏自编码器

不断探索

免费通讯

获取每日AI简报

每个工作日早晨提供三条经过验证的AI故事,使用简明英文撰写。永久免费,无广告。

每个工作日发送一封邮件。一键退订。我们永不出售或分享您的地址。

测试一下自己

参加 AI 可解释性中的叠加与多义性测验

每个答案即时反馈,课程通过后可获得可验证ID的可分享证书。

开始测验

支持免费AI教育。AI Understanding是一家501(c)(3)非营利组织——无广告,无付费墙,永不收费。 捐款

常见问题

什么是 AI 可解释性中的叠加与多义性?

人工智能可解释性中的叠加是神经网络将许多特征打包到共享方向的方式,这使得单个神经元看起来具有多语义性并且更难以解释。

神经网络中的“叠加”指的是什么?

叠加是通过在激活空间中使用近正交、重叠的方向来编码比维度更独特的特征的策略。

尽管存在特征干扰,什么条件才能使叠加正常工作?

由于大多数功能很少同时处于活动状态,因此冲突很少发生,因此干扰成本保持较低。

什么是“多语义”神经元?

多语义神经元会激发多个不相关的特征,这是叠加的可观察结果。

哪篇 Anthropic 论文介绍了 2022 年这一现象的对照研究?

“叠加玩具模型”使用小型可控网络来演示特征何时以及如何组合在一起。

如果一个层必须存储比其尺寸更多的特征,那么在几何上什么是不可避免的?

您无法拟合比维度更多的相互正交向量,因此特征最终会出现尽可能多的几乎正交的方向,并有一些重叠。