返回 Papers
AI 底层逻辑 / 经典论文

Mechanistic Interpretability:Transformer Circuits 与 SAE

Mechanistic interpretability 不等于“模型完全透明”。更准确地说,它尝试把神经网络内部的部分计算机制转成可理解的特征和电路。

329ai-foundations/papers/22-mechanistic-interpretability-transformer-circuits-sae.md

Mechanistic Interpretability / Transformer Circuits / Sparse Autoencoders 解读

面向对象: AI PM / AI BA / AI Architect / Model Risk / AI Governance。 核心问题: 大模型为什么会产生某些行为?能否从神经网络内部找到可解释的特征、回路和风险信号? 学习目标: 理解 mechanistic interpretability 的基本方向,以及它对模型风险、AI assurance、产品边界和企业治理的现实意义。


Source Anchors

SourceLink用途
Transformer Circuitshttps://transformer-circuits.pub/理解 Anthropic mechanistic interpretability 研究路线
A Mathematical Framework for Transformer Circuitshttps://transformer-circuits.pub/2021/framework/index.html理解 attention heads、MLP、residual stream 和 circuit 分析
Towards Monosemanticity: Decomposing Language Models With Dictionary Learninghttps://transformer-circuits.pub/2023/monosemantic-features/index.html理解 sparse autoencoder / dictionary learning 用于解释内部特征
Scaling Monosemanticityhttps://transformer-circuits.pub/2024/scaling-monosemanticity/index.html理解将 SAE 扩展到更大模型的解释性研究
Model Cards for Model Reportinghttps://arxiv.org/abs/1810.03993将解释性证据转成模型文档和边界说明

Mechanistic interpretability 不等于“模型完全透明”。更准确地说,它尝试把神经网络内部的部分计算机制转成可理解的特征和电路。


1. 为什么要学 Mechanistic Interpretability

对 AI PM/BA/架构师来说,它不是日常写代码技能,但能提高你对模型风险的判断。

它帮助回答:

问题价值
模型内部是否存在可理解特征?解释行为来源
某些输出是否由特定 circuit 驱动?分析风险和 failure mode
模型是否学到了欺骗、偏见、敏感属性代理?风险发现
能否监控内部激活作为安全信号?未来安全控制
解释性证据能否支持 assurance case?治理和审计

但要保持清醒:

现阶段 mechanistic interpretability 是重要研究方向,不是企业上线时可独立依赖的控制。它可以补充 model risk evidence,但不能替代 eval、monitoring、human oversight 和 policy controls。


2. Transformer Circuits 的基本心智模型

Transformer 可以从内部看成多个组件对 residual stream 读写。

Token embedding
  -> residual stream
  -> attention heads read/write
  -> MLP layers read/write
  -> later layers compose features
  -> logits

Attention Head

attention head 可以学习某种模式,例如:

  • 复制前文 token。
  • 连接实体和属性。
  • 查找括号/引号匹配。
  • 聚焦前一句中的主语。

MLP

MLP 常被理解为存储和组合特征的地方之一。

Circuit

circuit 是多个 head / neuron / feature 组合起来完成某种功能。

例子:

  • induction circuit。
  • name mover head。
  • factual association circuit。
  • refusal / safety relevant features。

3. Monosemanticity 和 Polysemanticity

神经元常常是 polysemantic 的:

一个神经元可能同时响应多个看似无关的概念。

这让解释很难。

Sparse Autoencoder 的思路:

  1. 从模型内部某层收集激活。
  2. 训练一个稀疏 autoencoder。
  3. 把复杂激活分解成更多、更稀疏、更可解释的 features。
  4. 分析 feature 代表什么概念。

为什么稀疏有用

概念含义
Dense activation很多方向同时混合信息
Sparse feature少数特征被激活
Dictionary learning学一组可组合特征
Monosemantic feature尽量对应单一概念

4. 企业 AI 能从中学到什么

4.1 模型不是规则系统

模型内部不是一组人写的 if/else。

PM/BA 不能说:

只要 prompt 写清楚,模型就一定按规则执行。

更准确:

prompt、RLHF、system policy、tool constraints 和 eval 只是影响行为的外部控制。模型内部可能仍有难以预测的关联和激活模式。

4.2 可解释性是多层的

解释层例子成熟度
Product explanation为什么给用户这个建议可做
Evidence grounding哪些来源支持回答可做
Behavioral eval哪类输入会失败可做
Feature/circuit analysis内部机制为什么触发研究中
Formal guarantee证明不会出错高难度

企业上线主要依赖前三层,但需要理解第四层的发展方向。

4.3 Interpretability Evidence 可进入 Safety Case

在高风险系统中,未来可能把解释性证据作为 supporting evidence:

  • 某类危险特征是否可检测。
  • 某次模型升级是否改变关键 feature activation。
  • 某个 refusal behavior 是否来自稳定机制。
  • 某类 jailbreak 是否激活异常路径。

但这类证据必须和外部 eval 结合。


5. Model Risk 视角

Mechanistic interpretability 对模型风险的启发:

Model risk questionInterpretability angle
模型是否对敏感属性有代理变量?分析 feature / activation correlation
模型是否在特定语境下绕过安全?找 triggered features / circuits
模型升级是否改变行为机制?compare activation / feature patterns
某类 hallucination 是否有内部信号?activation anomaly / uncertainty proxies
是否可解释给监管?只能作为辅助证据,不应过度承诺

SR 11-7 类模型风险管理强调 conceptual soundness、validation、ongoing monitoring。Mechanistic interpretability 可能增强 conceptual understanding,但仍不能替代 empirical validation。


6. PM 视角: 产品承诺边界

AI PM 学这部分,是为了避免两种错误:

错误说明
过度神秘化觉得模型完全不可理解,所以无法治理
过度承诺觉得有解释性研究就能保证安全

合理产品表达:

  • 我们能解释系统使用了哪些证据。
  • 我们能测量哪些场景表现好/差。
  • 我们能定义哪些场景必须人工复核。
  • 我们不能声称完全理解模型内部所有机制。
  • 对高风险自动化决策,要用外部控制和审计证据。

7. BA 视角: 可解释需求怎么写

BA 不应该写:

系统必须可解释。

应该拆成:

RequirementAcceptance
系统应显示关键证据来源每个 material claim 有 citation
系统应说明置信和限制输出 confidence factors and limitations
系统应记录决策路径trace includes prompt, sources, tools, policy gates
系统应支持审核reviewer can inspect evidence and override
系统应记录模型版本model/prompt/index/eval version linked
高风险建议必须可挑战human can reject and label reason

Mechanistic interpretability 可以作为研究性附加证据,而不是业务验收的唯一条件。


8. 架构师视角: 解释性证据架构

当前可落地架构

User task
  -> RAG / tools / model
  -> Answer
  -> Evidence citations
  -> Eval scores
  -> Policy gate result
  -> Human review
  -> Trace store
  -> Audit evidence binder

未来可扩展架构

Model activation telemetry
  -> feature detector / SAE probe
  -> risk signal
  -> monitoring dashboard
  -> investigation workflow

注意:

  • 不要把内部激活直接暴露给普通用户。
  • 不要把研究性 feature 当成稳定业务字段。
  • 要有版本管理和漂移监控。
  • 要防止解释性结果被误读。

9. 金融零售案例

9.1 Credit Assistant

可解释性层级:

Layer应做
Evidence引用收入、DTI、policy、documentation
Product说明只是辅助 underwriter
Risk记录 fairness / adverse action eval
Interpretability research分析模型是否对敏感代理变量响应

9.2 AML Copilot

可解释性层级:

Layer应做
Evidence交易、KYC、typology、case history
Workflowinvestigator review and override
Riskfalse positive / false negative eval
Interpretability研究是否对某些客户语言或地区异常敏感

9.3 Customer Service Copilot

可解释性层级:

Layer应做
Evidenceproduct policy / fee schedule
Safetyprohibited claims and escalation
Monitoringcomplaint / correction / citation failure
Interpretability研究 persuasion / unsafe compliance features

10. 与其他能力的连接

Existing asset连接
08-llm-as-judge-evaluation.md外部行为评测仍是主控制
17-helm-holistic-evaluation-models.mdholistic eval 管理多场景多指标
18-model-cards-datasheets-ai-documentation.md解释性结果可进入 model/system card
AI_ASSURANCE_SAFETY_CASE_PLAYBOOK.mdinterpretability 是 safety case 的 supporting evidence
AI_MODEL_RISK_MANAGEMENT_PLAYBOOK.md增强 conceptual soundness,但不替代 validation
AI_AUDIT_EVIDENCE_BINDER_PLAYBOOK.md解释性证据需要版本化、owner、review cadence

11. 作品集输出

Artifact内容
Explainability Layer Map区分 evidence、behavioral、mechanistic、formal explanation
Model Risk Memo说明 interpretability 能支持什么,不能承诺什么
Safety Case Evidence Note将 mechanistic evidence 放入 supporting evidence
BA Explainability Requirements把“可解释”拆成验收标准
Interview One-pager用金融案例解释模型不可完全透明但可治理

12. 面试表达

30 秒版本

Mechanistic interpretability 尝试理解模型内部的特征和电路,例如 attention head、MLP feature、sparse autoencoder 分解出的可解释 feature。它很重要,但目前更适合作为模型风险和 safety case 的辅助证据,不能替代外部 eval、human oversight 和 audit controls。

2 分钟版本

Transformer Circuits 研究把模型看成 attention heads、MLP 和 residual stream 的计算组合,试图找出完成某类行为的 circuit。Sparse autoencoders 进一步尝试把内部激活分解成更稀疏、更可解释的 features。对企业 AI 来说,这提醒我们模型不是规则系统,prompt 不能保证行为。但也不是完全不可治理。实际落地时,我会区分四层解释: 产品解释、证据 grounding、行为评测、内部机制解释。金融高风险场景主要依赖前三层,mechanistic interpretability 可作为模型风险和 safety case 的补充证据。

CTO 深挖

如果未来要引入 activation-level monitoring,我会把它作为隔离的 telemetry pipeline,不直接影响生产决策,先做 offline analysis 和 incident investigation。任何 feature detector 都要版本化、校准和漂移监控。

Risk 深挖

对 model risk,我不会把 interpretability 当成安全保证。它可以帮助 conceptual soundness 和 failure investigation,但上线仍要靠独立验证、challenge set、ongoing monitoring、change control 和 human oversight。


13. 复习问题

  1. Mechanistic interpretability 和普通 explainability 有什么差异?
  2. 什么是 residual stream、attention head、MLP feature?
  3. Sparse autoencoder 为什么可能提升可解释性?
  4. 为什么企业不能把 mechanistic interpretability 当成唯一控制?
  5. 如何把解释性需求写成 BA 可验收标准?
  6. 解释性证据如何进入 model card、safety case 和 audit binder?
  7. 在金融零售 AI 中,哪些解释层是当前必须落地的?