Internal Causal Mechanisms Robustly Predict Language Model Out-of-Distribution Behaviors
这篇论文先在 in-distribution correct examples 上,用 interchange interventions 定位一个 task-level causal variable 在 LLM residual stream 中的实现;再到 OOD prompts 上检查这个变量是否仍按同一高层机制被正确计算,并用检查结果预测模型这次回答会不会正确。 它的核心发现是: 在五类任务、十种人为构造的 distribution shifts 中,建立在已识别 causal variables 上的 counterfactual simulation 通常比 output confidence 或随手选 activation 的 correctness probe 更稳健。 但这个结论严格属于 模型内部机制对模型行为的预测 ,不等于这些 internal variables 是外部世界的 causal ground truth。
先拆掉最容易产生的误会
误会一:任何能 probe 出正确性的 activation 都是 causal feature
不是。一个 linear probe 只证明 correctness label 能从 representation 解码。它可能读到:
- output 已经形成后的痕迹;
- prompt style;
- dataset shortcut;
- 与错误相关但不参与生成 output 的旁观 feature。
本文把这类位置启发式 features 称为 causal-agnostic。真正的 internal causal features 还要通过 interchange intervention:把 source input 的 candidate subspace 换进 base input,model output 应按 high-level causal model 的 counterfactual prediction 改变。
误会二:interchange intervention 证明找到了唯一真实算法
也不是。高 IIA 说明某个 subspace edit 能按候选 high-level model 控制 output,是很强的 causal-use evidence;但:
- high-level model 由既有研究或研究者先验提出;
- neural implementation 可能不唯一;
- subspace 可能同时携带纠缠信息;
- 相同 input-output counterfactual pattern 可能由多个 abstract algorithms 解释。
它比 decodability 强,仍不是 internal causal ground truth 的唯一识别。
误会三:论文的 OOD 就是“离预训练分布很远”
不是。Appendix A 明确说 OOD 是相对于 task mechanism定义的,因为 pretraining distribution 不可见、也难量化。
作者改变 currency symbol、name language、prompt wording、in-context demos、option symbols、passage length 等 task-irrelevant background conditions,同时保持 task function 不变,并挑选会明显降低 model accuracy 的 shifts。
这是精心设计的 mechanism-preserving stress test,不是任意真实 deployment drift。
误会四:高 AUC-ROC 就表示模型知道自己有多大概率正确
不表示。AUC-ROC 测量 ranking:
随机取一个 correct 与一个 wrong example,前者是否得到更高 score?
它不检查 probability calibration、base-rate-sensitive precision、decision threshold cost,也不告诉用户“0.8 score 就是 80% 会对”。
先给一个客观判决
| 证据层级 | 本文的证据 | 还不能推出 |
|---|---|---|
| Representation decodability | correctness probe / value probe 从 internal features 预测 label 或 variable value | feature 参与生成 output |
| Model-internal causal use | DAS interchange interventions 产生 high-level model 预测的 output,IIA 衡量 fidelity | 候选机制是唯一真实算法 |
| Task ground truth | IOI / PriceTag task function 完全已知;correctness labels 可由 task rule 检查 | internal mechanism ground truth 完全已知 |
| Partial mechanism prior | RAVEL、MMLU、UnlearnHP 有 literature-supplied partial high-level model | 开放任务的完整 causal mechanism 已恢复 |
| OOD predictive value | causal-variable methods 在所选 shifts 上多数 AUC 更高 | 任意新 task / model / deployment shift 都稳健 |
| External causal truth | 本文没有建模外部世界 SCM | internal causal feature 等于 world mechanism |
最准确的判决是:
论文把 causal interpretability 从“事后解释”推进到“行为预警器”,并提供了很有价值的 intervention-backed evidence;但它验证的是候选 internal mechanism 的功能作用与 OOD diagnostic utility,不是现实世界 causal truth。
一个直观世界
想象一座工厂里有两种灯:
- 绿色装饰灯:平时机器运转正常时常亮,所以很会预测产线是否成功;
- 关键继电器:真正控制机械臂是否走正确路径。
在训练车间里,两者都可能和“产品合格”高度相关。换到新车间后,装饰灯的线路变了,它不再可靠;继电器只要仍实现同一控制逻辑,就更可能继续预测成功。
普通 correctness probing 是:
找哪盏灯最能区分过去的合格 / 不合格产品。
本文的 causal route 是:
- 先提出机械臂应该执行的 high-level logic;
- 换入另一个样本的 relay state;
- 检查机械臂动作是否按 logic 改变;
- 再看新车间里 relay 是否仍处于正确 state。
“会亮”对应 decodability;“换它会改动作”对应 causal use;“它就是工厂唯一正确设计”则是本文没有证明的 ground-truth claim。
真实问题与实验设定
Correctness prediction object
对 task input \(x_i\),target language model \(M\) 产生 output \(M(x_i)\)。外部 task rule 给出:
dataset 是:
目标不是生成答案,而是预测:
方法还拿到一个 labeled in-distribution verified set,主要由模型已答对、且可以建立 mechanism account 的 examples 组成。
Target model 与 data split
主要 experiments 使用 Llama-3-8B-Instruct。
每个 task 有 3 folds,并把 correct / wrong examples 做成 1:1 balanced binary classification:
- IOI、PriceTag、RAVEL、MMLU:每 fold 2,048 train / 1,024 validation / 1,024 test;
- UnlearnHP:每 fold 1,024 / 512 / 512;
- official repository 的 JSON 进一步分成各一半 correct 与 wrong prompts;
- labels 是针对 Llama-3-8B-Instruct 生成的,换 target model 必须重算。
五个 task 与 mechanism status
| Task | task function | high-level mechanism status |
|---|---|---|
| IOI | 输出句中没有重复的 name | symbolic,position variable 较明确 |
| PriceTag | 判断 query price 是否在 lower / upper bounds 之间 | symbolic,left / right boundary checks 较明确 |
| RAVEL | city \(\to\) country retrieval | knowledge retrieval,只部分理解 |
| MMLU | multiple-choice answer + position / verbalization structure | 57 subjects,共享机制很不完整 |
| UnlearnHP | 对 Harry Potter 内容拒答 | instruction following,只定位 refusal-related variable |
作者明确把前两类称为 mechanism 较完整,把后三类称为 partial / approximate。
十种 OOD shifts
| Task | shift 1 | task accuracy | shift 2 | task accuracy |
|---|---|---|---|---|
| PriceTag | currency format | \(96\%\to91\%\) | add typos | \(96\%\to80\%\) |
| IOI | Chinese names | \(98\%\to83\%\) | rephrase template | \(98\%\to71\%\) |
| RAVEL | change template language | \(90\%\to86\%\) | change ICL demos | \(90\%\to78\%\) |
| MMLU | NATO-style option symbols | \(65\%\to60\%\) | add distracting option | \(65\%\to55\%\) |
| UnlearnHP | longer passage | \(97\%\to96\%\) | rephrase template | \(97\%\to92\%\) |
这些 shifts 被设计为改变 background、不改变 correct task solution。
方法或任务流程
Baseline 1:output confidence
对 output tokens 的 subset \(S\),用 temperature-scaled token log-probability:
两种 token selection:
- first \(N\) tokens;
- answer tokens。
优点是便宜;弱点是 free-form output 的 event probability 很难定义,temperature 在 ID 上调好后未必能迁移到 OOD。
Baseline 2:causal-agnostic correctness probe
从 residual stream 的一个 location \(L\) 取 feature \(h_L\),训练:
来预测 correct / wrong。
这个 method 需要 wrong examples 监督,feature location 可能只是 last prompt token 等 heuristic。高 AUC 是 prediction evidence,不是 causal-use evidence。
第一步 causal work:提出 high-level model
以 PriceTag 为例:
这里 \(P,Q\) 是候选 high-level causal variables。对 IOI 是 position variable,对 RAVEL 是 country variable,对 MMLU 是 answer-position variable,对 UnlearnHP 是 refusal variable。
第二步 causal work:用 DAS 定位 variable subspace
取 base input 与 source input 的 representation:
DAS 学一个 orthonormal basis \(Q\),只替换 candidate subspace:
再运行被 intervened 的 model:
如果 \(y_{\text{inv}}\) 与 high-level model 给出的 counterfactual label \(y_{\text{cf}}\) 一致,则这次 interchange intervention 成功。
IIA 是 candidate variable 对 output 的 causal-fidelity measure,比 probe decoding 更强。
Method 3:counterfactual simulation
对一个 OOD source input:
- 抽取其 candidate causal-variable subspace;
- 换进多个 verified ID base examples;
- 用 high-level model 计算每次应得到的 counterfactual output;
- 检查 model intervention output 是否一致;
- 对 \(k\) 个 background samples 平均。
这近似:
它问的不是“feature 是否存在”,而是:
把 OOD input 的 \(V\) 放到不同 verified backgrounds 中,它是否仍按同一个 causal relation 控制 output?
有两种 score:
- first \(N\) token loss;
- task-specific output mapping accuracy。
后者更贴近正确 concept,但需要 regex / parser 与 task knowledge。
Method 4:value probing
变量已由 DAS 定位后,用 verified correct examples 学习其离散 values 的 decision boundaries:
correctness score 取最可能 value 的 probability:
它不需要 wrong examples,inference 较便宜;但又加入 linear separability assumption,而且论文结果显示它并不稳定优于其他 methods。
自己走一遍最小例子
先算 PriceTag high-level mechanism
prompt 是:
Does the item cost between £5 and £10? Item: £7.
currency symbol 从 dollar 换成 pound,不改变 task function。
正确答案应是 Yes。
现在假设我们有 10 个 verified base prompts。把 test input 中定位到的 \(P,Q\) subspaces 分别换入这些 bases 后,8 次 model outputs 与 high-level counterfactual answer 一致,2 次不一致。
最简单的 output-mapping counterfactual score 是:
它不是“模型有 80% 概率答对”的 calibrated probability;它只是 10 个 sampled backgrounds 中有 80% intervention outcomes 支持候选 mechanism。
再手算 AUC 为什么不是 calibration
假设四个 examples 的 score:
| example | true correctness | score |
|---|---|---|
| A | correct | 0.90 |
| B | correct | 0.60 |
| C | wrong | 0.80 |
| D | wrong | 0.20 |
correct-wrong pairs 共 \(2\times2=4\) 个:
- A > C:对;
- A > D:对;
- B > C:错;
- B > D:对。
所以:
这个 0.75 只说 ranking 有 75% pairwise success,不能说 score 0.75 的回答真的有 75% correctness probability。
关键结果与证据层级
ID:causal features 很强,但不是每个 causal method 都最好
Table 2 的 counterfactual simulation / output mapping:
| Task | ID AUC-ROC |
|---|---|
| PriceTag | \(0.907\pm0.002\) |
| IOI | \(0.999\pm0.000\) |
| RAVEL | \(0.908\pm0.002\) |
| MMLU | \(0.785\pm0.009\) |
| UnlearnHP | \(0.919\pm0.010\) |
但:
- correctness probing on causal variables 在 PriceTag 为 \(0.955\pm0.007\),在 UnlearnHP 为 \(0.940\pm0.009\);
- value probing 在 RAVEL 只有 \(0.603\pm0.001\);
- confidence 对 constrained outputs 也可能很强。
所以“internal causal feature 有用”比“某一个 causal method 永远最好”更符合数据。
OOD:counterfactual simulation 在 8/10 shifts 领先
Table 3 的 output-mapping counterfactual simulation:
| Task / shift | OOD AUC-ROC |
|---|---|
| PriceTag / currency | \(0.856\pm0.024\) |
| PriceTag / typos | \(0.875\pm0.050\) |
| IOI / Chinese names | \(0.997\pm0.001\) |
| IOI / rephrase | \(0.815\pm0.004\) |
| RAVEL / language | \(0.939\pm0.022\) |
| RAVEL / ICL demos | \(0.931\pm0.029\) |
| MMLU / option symbols | \(0.765\pm0.002\) |
| MMLU / distractor | \(0.810\pm0.011\) |
| UnlearnHP / length | \(0.860\pm0.011\) |
| UnlearnHP / rephrase | \(0.772\pm0.056\) |
论文报告 counterfactual simulation 在 10 个 OOD tasks 中 8 个最好,strongest method 相对 prior baselines 的 average AUC-ROC improvement 为 13.84%。
例外很重要:
- MMLU option-symbol shift 中,prompt-last-token correctness probe 为 \(0.784\pm0.006\),高于 output-mapping counterfactual simulation 的 0.765;
- UnlearnHP longer-passage shift 中,answer-token confidence 为 \(0.931\pm0.018\),高于 counterfactual simulation 的 0.860。
这说明 causal mechanism advantage 依赖 task structure 与 mechanism completeness。
RA VEL stress curve:accuracy 越降,confidence 越弱,causal score较稳
Appendix Table 7 逐步把 two-shot demo country 从 Vietnam 换到 Suriname,task accuracy 从 89% 降到 72%:
- temperature-2 answer-token confidence 从 0.898 左右降到 \(0.504\pm0.014\);
- output-mapping counterfactual simulation 仍为 \(0.931\pm0.029\)。
这比只比较一个 OOD point 更支持“mechanism-preserving feature 对该类 shift 稳健”。
IIA 与 AUC:因果作用不是诊断价值的充分条件
Figure 4 显示 IIA 与 AUC 在低到中等区域正相关:更能模拟 counterfactual causal effect 的 localization,通常也更会预测 correctness。
但 IIA 接近 1 后关系饱和;图中还有 high IIA / low AUC points。作者解释,某些 early-layer representations 即使对 output 有强 causal effect,也可能无论最终答对答错都很容易被计算,因此不能区分 correctness。
这条结果非常关键:
三层证据分别是什么
| 层级 | 论文中的 operationalization | 最强合理结论 |
|---|---|---|
| Decodability | linear correctness probe、value classifier、AUC | feature contains predictive information |
| Causal use | DAS interchange intervention、IIA、output follows counterfactual label | subspace participates functionally in model behavior under tested interventions |
| Causal ground truth | fully specified symbolic task rule;partial literature model for open tasks | candidate high-level mechanism is task-grounded to varying degrees |
不存在的一步是:
从 internal causal use 直接跳到“它是真实世界机制”。
综合客观评价
为什么论文比普通 probing 强
它没有只在 ID train/val 上寻找“最会预测错误的 activation”。feature selection 先由候选 causal mechanism 与 interchange intervention 约束,然后才问 OOD correctness。
这个 sequencing 很重要:
它降低了只利用 transient correlation 的风险。
最强替代解释:task relevance,而不一定是“causality”本身
causal variables 本来就是 researcher 认为最 task-relevant 的 variables;OOD shifts 又被设计为只改 background、不改 task mechanism。因此更稳健的一部分优势可能来自:
这并不推翻论文,因为 task relevance 正是 causal account 的一部分;但若要证明 advantage 特别来自 causal use,而不只是 semantic relevance,需要 matched controls:
- 同 layer;
- 同 dimension;
- 同 ID decodability;
- 同 task information;
- 只有 intervention fidelity 不同。
本文没有完全做完这种 control。
高层机制是 scaffold,不是从零发现
IOI / PriceTag 的 symbolic structure 很清楚,causal story 强。MMLU / UnlearnHP 只用了 answer-position / refusal 等 partial mechanisms,结果也更 mixed。
这让论文同时展示了 method 的 promise 与当前瓶颈:
predictive use 能走多远,受我们事先知道多少机制直接限制。
主要局限性
- high-level causal model 依赖 prior knowledge。 机制由已有 interpretability literature 或研究者提出,不是端到端从 behavior 唯一发现。
- open-ended tasks 只有 partial mechanisms。 RAVEL、MMLU、UnlearnHP 的 candidate variables 不能代表完整 computation。
- DAS 假设 linear subspace localization。 非线性、distributed、polysemantic representations 可能无法被一个 orthonormal \(Q\) 准确捕捉。
- interchange intervention 不唯一识别 algorithm。 一个 subspace edit 可能同时改变纠缠 features,多个 abstractions 也可能有相似 IIA。
- OOD shifts 是 hand-designed 且 task-relative。 它们不是 pretraining-distance measure,也不覆盖 adversarial、domain、tool、temporal 或 deployment shifts。
- 作者选择了会降低 accuracy 的 perturbations。 这有助 stress testing,但会引入 evaluation selection,不能代表自然 shift frequency。
- 主要结论集中在 Llama-3-8B-Instruct。 model-size variation 只在 RAVEL ID 做了有限扩展;70B 因 compute 没有 counterfactual simulation。
- balanced 1:1 test sets 与 AUC 忽略现实 base rate。 real deployment 中错误可能很少或很多,precision / utility 会不同。
- 没有 calibration / decision-cost evaluation。 AUC 高不保证可作为 abstention threshold、risk probability 或 safety gate。
- correctness parsing 有人工与 regex 依赖。 invalid outputs 少于 10% 后被过滤,geopolitical corner cases 等还做了 manual exclusion,可能改变 target population。
- released labels 是 model-specific。 official README 明确说换 target model 必须 regenerate correctness labels。
- counterfactual simulation inference 昂贵。 每个 test example 要跨 \(k\) backgrounds 做多次 forward / decoding,不能默认适合 latency-sensitive deployment。
- correctness 不等于 safety。 五个 tasks 的 exact / parsed correctness,不能覆盖 harmfulness、helpfulness、calibrated uncertainty 或 long-horizon agent outcomes。
- causal-use evidence 仍是 model-internal。 它不说明外部事实、数据 provenance 或 operational runtime regime 的因果结构。
- current code release 不是完整书面 reproduction protocol。 repository 提供 JSON folds、source utilities、MMLU demo 与 checkpoints,但 README 没有逐项列出论文全部 experiments 的冻结命令 / environment;本导读没有运行它。
什么实验会让结论更强
- 构造 matched feature controls:同 layer / dimension / ID AUC / task decodability,只让 IIA 不同;
- 对一个 intentionally wrong high-level model 运行完整 pipeline,检查是否会产生 false causal confidence;
- 做 locality、composition 与 multi-variable interchange interventions,验证编辑一个 variable 不扰动其他 high-level states;
- 同时报告 IIA、OOD AUC、Brier score、ECE、precision-recall 与 selective-risk curves;
- 在真实错误 prevalence 下评估 abstention utility,而不是只用 balanced AUC;
- pre-register OOD shifts,并加入未由论文作者挑选的 natural deployment drift;
- 在多个 model families、sizes、instruction-tuning stages 与 random seeds 上复验;
- 把 mechanism discovery、localization 与 correctness prediction 三个 split 严格分离,防止 task prior leakage;
- 对 partial-mechanism tasks 增量加入 variables,画 mechanism completeness 与 predictive gain 的 curve;
- 比较 natural-source interchange、activation patching、ablation 与 gradient-based interventions,检验 causal conclusion 是否依赖 edit operator;
- 把 counterfactual simulation 蒸馏成便宜 predictor,同时检查蒸馏后 OOD robustness 是否保留;
- 在 tool-using agents / multi-step reasoning 中,把“单次 answer correctness”扩展成 action sequence、repair success 与 long-horizon outcome。
论文可以支持什么结论
它可以支持:
- model-internal causal analysis 可以服务 OOD correctness prediction,而不只做 post-hoc explanation;
- 在研究的 tasks / shifts 中,task-relevant causal features 通常比 output probabilities 或 causal-agnostic features 更稳健;
- counterfactual simulation 在 10 个 OOD settings 中 8 个取得最佳表现;
- DAS-style interchange intervention 提供比 probe decodability 更强的 causal-use evidence;
- IIA 与 correctness-prediction AUC 通常正相关,但高 IIA 本身不充分;
- mechanism completeness、output format、task type 与 inference budget 会改变最佳 method。
它不能支持:
- 任意能被 probe 的 feature 都是 causal;
- 候选 high-level model 是唯一 internal algorithm;
- internal causal variable 等于外部世界 causal mechanism;
- 所有 OOD / deployment shifts 都保持优势;
- AUC score 是 calibrated probability;
- Llama-3-8B labels 可直接用于其他 models;
- counterfactual simulation 已成为低成本 production safety gate;
- 论文证明 LLM 会可靠地判断自己是否正确;
- 本地已重跑 released code 并复现 tables。
为什么它与当前研究有关
对当前 portfolio,B5 给出一条非常实用的 mechanism evidence ladder:
这三步都属于 model-internal evidence;若当前研究关心 external SCM、source provenance 或 operational regime,还要再问:
| B5 object | 当前研究可能需要的额外 object |
|---|---|
| internal variable \(V\) | unit / event / tool / source state |
| model output correctness | repair success、decision quality、scientific validity |
| task-relative OOD | target-world / runtime regime shift |
| interchange intervention | real tool / policy / mechanism intervention |
| high-level task model | evidence-backed external causal model |
因此不能说 B5 已经证明 DiscoSCM,也不能说 internal mechanism 等于 agent runtime regime。
更好的使用方式是把每个 mechanism claim 强制写成:
- mechanism object 是什么;
- ground-truth / prior 从哪里来;
- 什么 evidence 只说明 decodability;
- 什么 intervention 说明 causal use;
- 它在哪个 distribution boundary 下预测了什么 behavior;
- 这项 evidence 改变了什么 decision。
如果只完成第一到第三步,就应停在“decodable representation”;如果完成 causal use 但没有 shift / decision evidence,就应停在“internal mechanism candidate”。
推荐阅读顺序
- Figure 1 + Introduction:先理解 abstraction direction 与 prediction direction 的反向关系。
- Section 2.1 / Equations DAS 与 IIA:这是区分 probe 与 causal localization 的核心。
- Section 3:锁定 verified set、correctness label 与 task-relative OOD definition。
- Figure 2 / Appendix Figure 5:逐 task 看 high-level variables 哪些完整、哪些 partial。
- Sections 4.1–4.2:先读 confidence 与 correctness probe,建立 baseline。
- Section 4.3 / Equations (4)–(8):读 counterfactual simulation 与 value probing,不要只记方法名。
- Table 1:比较 training data、wrong samples、counterfactual supervision、decoding 与 inference cost。
- Tables 2–3:先看每 task / shift,再看 overall headline;特别保留 MMLU 与 UnlearnHP 例外。
- Figure 3:看 causal vs non-causal feature 的 ID/OOD location change。
- Figure 4 / Section 6.3:读清 IIA–AUC correlation 与 saturation / lower-right exceptions。
- Appendix A / Tables 4–5:核 prompts、manual filtering、balanced splits、layers / dimensions。
- Appendix Figure 6:逐步看 interchange intervention 在五个 tasks 中到底怎么做。
- Appendix C.2 / Table 7:看 RA VEL accuracy-drop curve,而不只看一个 OOD aggregate。
- Appendix D:把 authors’ own limitations 与本文 evidence boundary 对齐。
- Official repository README / MMLU demo:准备 reproduction 时再核 model-specific labels、JSON folds 与 current checkpoints。
论文来源与相邻阅读
- Official PMLR proceedings: https://proceedings.mlr.press/v267/huang25af.html
- Official PMLR paper PDF: https://raw.githubusercontent.com/mlresearch/v267/main/assets/huang25af/huang25af.pdf
- Official code/data repository linked by PMLR: https://github.com/explanare/ood-prediction
- Official OpenReview record linked by PMLR: https://openreview.net/forum?id=Ofa1cspTrv
- Verification boundary: official paper/appendix plus current repository README, data layout, source tree, demo/checkpoint surface inspected; no model weights loaded, labels regenerated, intervention run, or AUC table reproduced; all reported experimental values are source-reported.