Circuit Tracing / On the Biology of a LLM — 可解释性新方法
Circuit Tracing: Revealing Computational Graphs in Language Models / On the Biology of a Large Language Model
Section titled “Circuit Tracing: Revealing Computational Graphs in Language Models / On the Biology of a Large Language Model”发布日期: 2025-03-27
来源: transformer-circuits.pub/2025/attribution-graphs/methods.html, transformer-circuits.pub/2025/attribution-graphs/biology.html
工程范式: 可解释性 — 从特征发现到电路追踪
这两篇论文是 Anthropic 可解释性研究的里程碑。核心问题:如果语言模型是训练出来的而非编程出来的,我们如何理解它们”思考”的过程?
研究团队将 LLM 的内部机制类比为生物学——“Living organisms are complex systems which have been sculpted by billions of years of evolution. Likewise, while language models are generated by simple, human-designed training algorithms, the mechanisms born of these algorithms appear to be quite complex.”
关键放弃:Attribution graphs 只提供关于机制的**假说(hypotheses)**而非证明。该方法仅对约 25% 的 prompt 成功——不是通用解决方案。团队明确承认这一限制。
方法概述 — Cross-Layer Transcoder (CLT)
Section titled “方法概述 — Cross-Layer Transcoder (CLT)”- Cross-Layer Transcoder(跨层转录器):替换模型中的 MLP 层,用约 3000 万(30M)个可解释特征来近似 MLP 的输出。
- 与传统 SAE 的区别:Transcoder 允许特征之间的直接交互(feature-feature interactions),而稀疏自编码器(SAE)只能独立重构。
- Error Nodes:捕获重建差距的节点——虽然不可解释,但确保了计算图的完整性。
归因图(Attribution Graphs)的构建
Section titled “归因图(Attribution Graphs)的构建”- 替换模型:对于固定 prompt,用 CLT 替换 MLP,使用原模型的 attention 模式和归一化分母。
- 线性归因:特征之间的边(edges)是线性效应——因为 attention 模式和归一化分母被冻结,transcoder 桥接了 MLP 的非线性。
- 剪枝:两步算法——计算间接影响矩阵 → 保留累积影响 > 阈值的节点(~10× 减少)→ 剪枝边(~500× 减少),只丢失约 20% 的 logit 影响。
通过**约束补丁干预(constrained patching interventions)**在原始模型上验证——抑制或注入特定特征,观察输出变化是否与归因图的预测一致。
生物学论文(On the Biology of a Large Language Model)——案例研究
Section titled “生物学论文(On the Biology of a Large Language Model)——案例研究”1. 多步推理(State Capitals)
Section titled “1. 多步推理(State Capitals)”Prompt:
Fact: the capital of the state containing Dallas is→ 输出Austin
发现:模型执行了真正的两跳推理(Dallas → Texas → Austin),同时存在一条从 Dallas 直达 Austin 的 shortcut edge。
验证:将 Texas features 替换为 California features → 输出变为 Sacramento。
工程意义:模型同时使用多步推理和 shortcut——两种机制并行,而非单一逻辑链。这是第一个在大规模语言模型中找到的因果确认的两跳推理电路。
2. 诗词中的规划(Planning in Poems)
Section titled “2. 诗词中的规划(Planning in Poems)”Prompt:
A rhyming couplet:\n\nHe saw a carrot and had to grab it,\nHis hunger was like a starving rabbit
发现:
- 模型在第二行开始前的 newline token 上激活了”计划中的词”(rabbit, habit)features。
- 这些 features 影响了整行的构造(intermediate words 如 “like”、句子结构)。
- 模型并行持有多个候选项。
- 规划是双向的:前向(根据约束选择候选)和后向(从目标反向构建自然句子)。
验证:抑制 rabbit/habit features → 改变结尾词和行结构。注入新计划词(如 green)→ 70% 的测试诗中模型以该词结尾。
关键发现:模型虽然逐 token 生成,但可以在更长的时间跨度上思考。用于计划词的 features 就是该词的”普通”features,而非规划专用 features——规划和执行共享同一表征空间。
3. 多语言电路(Multilingual Circuits)
Section titled “3. 多语言电路(Multilingual Circuits)”Prompt: 英语
The opposite of "small" is "、法语Le contraire de "petit" est "、中文"小"的反义词是"
发现:三部分计算——操作(反义词)、操作数(small)、语言。中间层包含语言无关的 features(如反义词特征、“say large”特征)。
验证:
- 抑制反义词 features + 注入同义词 features → 输出语言适当的同义词。
- 抑制 small features + 注入 hot features → 输出 language-appropriate antonyms of “hot”。
- 替换早期语言检测 features → 输出语言改变,但操作和操作数保持不变。
关键发现:英语在机制上享有特权——是默认输出语言。中间层真正多语言(feature 的 intersection-over-union 显示高度重叠),但早期和晚期层是语言特定的。
4. 加法(Addition)
Section titled “4. 加法(Addition)”Prompt:
calc: 36+59=→ 输出95
发现:模型使用并行通路——低精度通路(sum near 92)和高精度通路(精确进位计算)。这种”双轨验证”机制与传统计算中的冗余校验类似。
5. 间接宾语标记(Indirect Object Identification, IOI)
Section titled “5. 间接宾语标记(Indirect Object Identification, IOI)”Prompt:
Then, Alice and Bob went to the store. Alice gave a gift to→ 输出Bob
发现:在 IOI 任务上找到了与文献中报告的相同电路结构——使用 S-inhibition 机制来实现语法角色分配。这验证了归因图方法能复现已知结果。
6. 越狱(Jailbreak)——高级别研究
Section titled “6. 越狱(Jailbreak)——高级别研究”论文还探索了越狱 prompt 如何破坏模型的安全训练——通过追踪邪恶 token features 如何绕过安全 circuits。这一研究发现具有直接的安全工程价值,但论文在公开版本中做了精简。
方法论文的关键技术细节
Section titled “方法论文的关键技术细节”18L 模型和 Claude 3.5 Haiku 上的训练
Section titled “18L 模型和 Claude 3.5 Haiku 上的训练”- CLT 在 18 层(18L)模型和 Claude 3.5 Haiku 上训练。
- 总 features: 300K 到 30M 不等。
- 最大的 18L CLT 在多样 prompt 集上匹配了原模型的 next-token 输出约 50%。
全局权重(Global Weights)
Section titled “全局权重(Global Weights)”- 上下文无关的虚拟权重可以揭示通用算法结构。
- 但干扰(interference)经常掩盖它们——这是 engineering 上的根本限制。
| 维度 | Circuit Tracing (Anthropic) | 传统 SAE 方法 | Activation Patching |
|---|---|---|---|
| 粒度 | 特征级(30M features) | 特征级 | 组件级(head/MLP) |
| 因果关系 | 归因图(边可干预验证) | 无显式因果边 | 直接 patching |
| 可扩展性 | 验证 ~25% prompt | 广泛适用 | 人工设计 |
| 覆盖率 | ~50% next-token 匹配 | 独立重构 | 完全准确 |
| 工具 | 交互式归因图可视化 | 特征可视化 | Logit diff |
与 Anthropic 之前的可解释性工作的关系
Section titled “与 Anthropic 之前的可解释性工作的关系”| 时间 | 工作 | 关键进展 |
|---|---|---|
| 2023-10 | Towards Monosemanticity | 在单层 SAE 中首次发现可解释 features |
| 2024-05 | Scaling Monosemanticity | 将 SAE 扩展到完整模型 |
| 2024-06 | Golden Gate Claude | 通过操控 features 控制模型行为 |
| 2025-03 | Circuit Tracing + Biology | 从 features 到 circuits——追踪特征间的因果关系 |
Circuit Tracing 从”找到特征”跨越到”追踪特征间的因果路径”——这是从静态描述到动态机制理解的关键跃进。
可复用工程经验
Section titled “可复用工程经验”-
Cross-Layer Transcoder 的设计:每个 feature 从一个层读取 but 写入所有后续层——简化了跨层放大效应,使电路更可读。这是架构设计的巧妙权衡:牺牲独立特征的解释性来换取电路的可追踪性。
-
线性归因技术:冻结 attention 模式和归一化分母,使特征间的交互线性化——这牺牲了动态性但获得了可分析性。工程上的经典”简化以理解”策略。
-
验证先于发布:约束补丁干预是方法的基石——任何归因图假说都必须通过原始模型上的干预验证。这种”先验证再主张”的 discipline 在 AI 研究领域稀有但关键。
-
交互式可视化工具:研究中构建的交互式归因图界面不仅仅是 publication 的装饰品——它是探索和理解复杂电路的必要工程基础设施。
-
生物学隐喻作为工程框架:将模型机制类比为生物系统(parallel pathways、redundancy、shortcuts)提供了超越”神经网络=黑箱”的研究范式。
- 覆盖率有限:仅对约 25% 的 prompt 成功。对复杂推理任务的覆盖远低于简单任务。
- CLT 近似误差:即使最大 CLT 也只匹配原模型 50% 的 next-token 输出——存在^v大的未解释空间。
- 可扩展性挑战:30M features 已经很大,但更强大的模型需要更多 features——计算成本随模型规模快速增长。
- 自动化瓶颈:目前电路分析仍高度依赖人工检查——手动将 features 分组为 supernodes。远未实现完全自动化的电路分解。
- 全局 vs 局部张力:归因图是 prompt-specific 的,跨 prompt 的通用电路特征仍难以提取(仅 10/27 features 在三个 prompt 间共享)。