







논문 개요
이 논문은 기존 Activation Patching과 Attribution Patching의 장단점을 결합하려는 논문입니다. 핵심 아이디어는 다음과 같습니다.
Attribution Patching의 gradient 항을 Layer-wise Relevance Propagation, 즉 LRP 기반 propagation coefficient로 대체하면, Activation Patching에 더 가깝게 causal effect를 근사하면서도 계산 비용은 거의 그대로 유지할 수 있다.
논문에서 제안하는 방법 이름은 Relevance Patching, RelP입니다. 저자들은 RelP가 Activation Patching보다 훨씬 빠르고, 기존 Attribution Patching보다 더 faithful하다고 주장합니다. 특히 IOI task에서 residual stream과 MLP output 분석 시 큰 차이가 나타납니다. 예를 들어 GPT-2 Large의 MLP output에서 기존 Attribution Patching은 Activation Patching과의 Pearson correlation이 0.006에 불과하지만, RelP는 0.956까지 올라갑니다.
1. 문제의식
1.1 Activation Patching의 장점과 한계
Activation Patching은 mechanistic interpretability에서 특정 component가 모델 행동에 causal하게 기여하는지 확인하는 표준 방법입니다.
예를 들어 원래 입력 x_original과 counterfactual 입력 x_patch가 있을 때, 어떤 layer/head/MLP/residual stream component n의 activation을 다음처럼 바꿉니다.
그리고 출력 metric이 얼마나 변하는지 측정합니다.
논문에서는 component n의 causal contribution을 다음과 같이 정의합니다.
여기서
- M: language model
- L: logit difference 같은 behavioral metric
- n(x): 입력 x에 대한 component n의 activation
- : causal intervention
입니다.
이 방식은 가장 직접적인 causal test이므로 faithful하지만, 문제는 모든 component에 대해 patching run을 수행해야 하므로 매우 비싸다는 점입니다. 큰 Transformer에서 layer, head, neuron, SAE feature, edge 단위로 모두 patching하면 계산량이 폭증합니다.
1.2 Attribution Patching의 장점과 한계
이를 줄이기 위해 나온 것이 Attribution Patching, AtP입니다. AtP는 activation을 실제로 하나씩 교체하지 않고, 1차 Taylor approximation으로 patching effect를 근사합니다.
논문 수식은 다음과 같습니다.
즉, 입니다.
여기서 이고,
은 original run에서 metric L이 component activation n에 얼마나 민감한지를 나타냅니다.
AtP의 장점은 매우 큽니다.
- original input forward pass
- patch input forward pass
- original input backward pass
즉, forward 2회 + backward 1회만으로 모든 component의 patching score를 한 번에 계산할 수 있습니다.
하지만 한계도 분명합니다. Transformer는 LayerNorm, residual stream, attention, MLP nonlinearity 등으로 인해 매우 비선형적입니다. 따라서 local gradient 기반 1차 근사가 불안정해질 수 있습니다. 특히 논문은 residual stream과 MLP output에서 AtP가 activation patching과 잘 맞지 않는다고 지적합니다.
2. 핵심 제안: Relevance Patching, RelP
2.1 RelP의 핵심 아이디어
RelP는 Attribution Patching의 구조는 유지하되, gradient를 그대로 쓰지 않습니다.
AtP:
RelP:
즉, gradient 대신 LRP에서 얻은 propagation coefficient 를 사용합니다.
논문 수식은 다음과 같습니다.
여기서 는 LRP가 output relevance를 backward로 전파하면서 얻는 coefficient입니다.
간단히 말하면 다음과 같습니다.
| 방법 | patching effect 근사 방식 |
|---|---|
| Activation Patching | 실제로 activation을 교체하고 forward |
| Attribution Patching | activation 차이 × local gradient |
| Relevance Patching | activation 차이 × LRP propagation coefficient |
RelP는 AtP처럼 2 forward + 1 backward만 필요하지만, gradient보다 더 구조화된 relevance propagation signal을 쓰기 때문에 더 faithful하다는 것이 논문의 핵심 주장입니다.
3. LRP: Layer-wise Relevance Propagation
RelP를 이해하려면 LRP를 먼저 이해해야 합니다.
3.1 LRP의 기본 목적
LRP는 모델 출력값 또는 특정 metric L을 각 layer의 하위 component로 다시 분배합니다. 즉, 출력 logit 또는 logit difference가 어떤 input feature, hidden unit, attention head, MLP output 등에 의해 얼마나 설명되는지를 backward 방향으로 계산합니다.
핵심 원칙은 relevance conservation입니다.
즉, layer l의 relevance 총량이 layer l-1로 보존되며 재분배됩니다.
3.2 LRP의 일반 수식
layer l-1의 activation을 라고 하고,
layer l의 output을 라고 합시다.
LRP는 local Taylor expansion을 사용해 다음처럼 근사합니다.
여기서 입니다.
그 다음 upper-layer relevance 를 lower-layer input i로 분배합니다.
논문에서는 이를 propagation coefficient 로 표현하고, lower-layer relevance를 다음처럼 씁니다.
즉, 는 단순 gradient가 아니라, 해당 component가 상위 relevance를 얼마나 받아야 하는지를 나타내는 LRP 기반 전파 계수입니다. RelP는 바로 이 를 Attribution Patching의 gradient 대신 사용합니다.
4. Transformer에서의 LRP propagation rule
논문은 Transformer 내부 구성요소마다 서로 다른 LRP rule을 적용합니다. 이는 매우 중요한 부분입니다. 단순 gradient는 모든 layer를 동일하게 미분하지만, LRP는 layer type에 맞게 relevance가 보존되거나 noise가 줄어들도록 전파 rule을 바꿉니다.
논문 Table 1의 핵심은 다음과 같습니다.
| Transformer component | Propagation rule | 직관 |
|---|---|---|
| LayerNorm / RMSNorm | LN-rule | variance term을 constant로 취급해 relevance collapse 방지 |
| GELU / SiLU | Identity-rule | nonlinear part를 constant처럼 처리 |
| Linear layer | 0-rule, ε-rule, γ-rule | 기본적으로 Gradient × Input 형태, sparsity/noise 조절 가능 |
| Attention | AH-rule | attention weights를 constant로 보고 attention head를 linearized |
| Multiplicative gate | Half-rule | gate와 input 양쪽으로 relevance를 절반씩 분배 |
4.1 LayerNorm / RMSNorm: LN-rule
LayerNorm은 다음 구조를 가집니다.
문제는 denominator인 variance term이 input 전체에 의존하기 때문에 relevance가 복잡하게 섞일 수 있다는 점입니다.
논문은 LN-rule에서 다음 부분을 constant로 취급합니다.
즉, 처럼 처리합니다.
직관적으로는 LayerNorm을 완전히 비선형적으로 다루지 않고, scale factor를 detach해서 relevance propagation을 더 안정적으로 만듭니다.
4.2 GELU / SiLU: Identity-rule
GELU나 SiLU는 nonlinear activation입니다. 예를 들어 SiLU는 대략
입니다.
이때 LRP에서는 nonlinear factor를 constant로 취급합니다.
즉, activation function을 local linear transform처럼 보이게 만들어 relevance를 전파합니다.
이는 gradient saturation 문제를 완화하는 데 도움이 됩니다.
4.3 Linear layer: 0-rule, ε-rule, γ-rule
Linear layer에서는 기본적으로 LRP-0 rule을 사용할 수 있습니다. 이는 Gradient × Input과 유사합니다.
여기서 는 상위 relevance를 weight와 activation contribution에 따라 분배하는 coefficient입니다.
논문 실험에서는 linear transformation에 대해 LRP-0 rule을 사용했습니다. Appendix Table 4에 따르면 GPT-2, Pythia, Qwen2, Gemma2 모두에서 0-rule을 적용했습니다.
4.4 Attention: AH-rule
Attention output은 대략 다음과 같습니다.
문제는 자체도 input-dependent하다는 점입니다. 즉, attention output은 input 에 직접적으로 의존하면서 동시에 attention weight 를 통해 간접적으로도 의존합니다.
AH-rule은 attention weight를 constant로 처리합니다.
이렇게 하면 attention head를 local linear layer처럼 볼 수 있어 relevance conservation이 쉬워집니다.
다만 중요한 점은, 실제 논문 실험에서는 AH-rule을 사용하지 않았습니다. Appendix Table 4에 따르면 모든 model family에서 AH-rule은 적용하지 않았습니다. 따라서 attention output에서 RelP의 개선폭이 residual stream이나 MLP output보다 작았던 이유 중 하나로 볼 수 있습니다.
4.5 Multiplicative gate: Half-rule
Qwen2나 Gemma2 같은 모델은 gated MLP 구조를 사용합니다. 예를 들어 SwiGLU 계열은 대략 다음과 같습니다.
이 경우 relevance를 한쪽으로만 몰아주면 과대평가될 수 있습니다. Half-rule은 relevance를 input branch와 gate branch에 반씩 나눕니다.
논문에서는 Half-rule을 Qwen2 family와 Gemma2-2B에만 적용했습니다. GPT-2와 Pythia에는 multiplicative gate가 없으므로 적용하지 않았습니다.
5. RelP 알고리즘 정리
RelP의 실제 계산 절차는 다음과 같이 정리할 수 있습니다.
Step 1. Original input과 patch input 준비
예를 들어 IOI task에서 다음 두 문장을 만듭니다.
Original:
Then, Bob and Alice went to the store. Bob gave a book to Alice.
Patch:
Then, Alice and Bob went to the store. Alice gave a book to Bob.
즉, subject와 indirect object를 swap합니다.
Step 2. Original forward pass
을 계산하고, 각 component activation을 저장합니다.
예를 들어 저장 대상은 다음과 같습니다.
- residual stream
- attention output
- MLP output
- SAE feature activation
- neuron activation
Step 3. Patch forward pass
를 계산하고 같은 component의 activation을 저장합니다.
그 다음 activation difference를 계산합니다.
Step 4. Original output metric 정의
IOI task에서는 metric L을 logit difference로 정의합니다.
Subject-Verb Agreement task에서는 verb inflection probability 차이를 사용합니다.
예를 들어 singular/plural verb pair에 대해
또는 같은 metric을 사용합니다.
Step 5. LRP backward relevance propagation
Gradient를 그대로 backprop하지 않고, Transformer component별 LRP rule을 적용해 output metric L의 relevance를 각 component로 전파합니다.
이 과정에서 component n에 대한 propagation coefficient를 얻습니다.
Step 6. RelP score 계산
마지막으로 다음을 계산합니다.
즉, 입니다.
Activation dimension이 여러 개라면 논문에서는 hidden dimension 방향으로 sum하여 component-level score로 aggregate합니다. IOI 실험에서는 residual stream, attention output, MLP output 각각에 대해 이 score를 구하고, Activation Patching result와 Pearson correlation을 계산했습니다.
6. Activation Patching, Attribution Patching, RelP 비교
| 항목 | Activation Patching | Attribution Patching | RelP |
|---|---|---|---|
| 핵심 방식 | 실제 activation 교체 | ||
| causal faithfulness | 높음 | 중간/낮음 | 높음 |
| 계산 비용 | 매우 큼 | 낮음 | 낮음 |
| forward/backward 비용 | component 수만큼 patch forward | 2 forward + 1 backward | 2 forward + 1 backward |
| 비선형 layer 처리 | 직접 intervention | local gradient | LRP rule 기반 propagation |
| residual stream 성능 | ground truth 역할 | 불안정 | AP와 잘 맞음 |
| MLP output 성능 | ground truth 역할 | 매우 불안정 가능 | AP와 잘 맞음 |
핵심적으로 RelP는 AtP의 계산 효율성과 AP에 가까운 faithfulness를 동시에 노립니다.
7. 실험 1: IOI task에서 Activation Patching 근사 성능
7.1 실험 목적
첫 번째 실험의 목적은 다음입니다.
RelP와 AtP가 Activation Patching의 결과를 얼마나 잘 근사하는가?
여기서 Activation Patching은 ground-truth causal effect처럼 사용됩니다.
7.2 Task: Indirect Object Identification, IOI
IOI task는 GPT-2 interpretability에서 자주 쓰이는 task입니다.
예:
Then, Bob and Alice went to the store. Bob gave a book to Alice.
모델은 마지막 위치에서 indirect object인 Alice를 예측해야 합니다.
논문에서는 총 100개 prompt pair를 사용했습니다. original prompt와 patch prompt는 subject와 indirect object만 swap하고 나머지는 동일하게 유지합니다.
논문 Table 2의 template은 다음과 같습니다.
| Template | 형태 |
|---|---|
| 1 | Then, [B] and [A] went to the [PLACE]. [B] gave a [OBJECT] to [A]. |
| 2 | When, [B] and [A] went to the [PLACE]. [B] gave a [OBJECT] to [A]. |
| 3 | After [B] and [A] went to the [PLACE], [B] gave a [OBJECT] to [A]. |
7.3 평가 대상 모델
논문은 다양한 model family를 사용했습니다.
- GPT-2 Small
- GPT-2 Medium
- GPT-2 Large
- Pythia-70M
- Pythia-410M
- Qwen2-0.5B
- Qwen2-7B
- Gemma2-2B
7.4 분석 대상 component
각 모델에서 다음 component에 대해 patching score를 계산합니다.
- Residual stream
- Attention outputs
- MLP outputs
그리고 Activation Patching score와 AtP/RelP score 사이의 Pearson correlation coefficient, PCC를 측정합니다.
PCC가 높을수록 Activation Patching과 잘 맞는다는 뜻입니다.
7.5 주요 결과
논문 Table 5의 수치를 보면 RelP가 거의 모든 설정에서 AtP보다 높습니다.
| Model | Residual AtP | Residual RelP | MLP AtP | MLP RelP |
|---|---|---|---|---|
| GPT-2 Small | 0.753 | 0.968 | 0.195 | 0.992 |
| GPT-2 Medium | 0.671 | 0.884 | 0.551 | 0.993 |
| GPT-2 Large | 0.740 | 0.853 | 0.006 | 0.956 |
| Pythia-70M | 0.728 | 0.898 | 0.507 | 0.967 |
| Pythia-410M | 0.695 | 0.874 | 0.501 | 0.948 |
| Qwen2-0.5B | 0.684 | 0.922 | 0.717 | 0.981 |
| Qwen2-7B | 0.230 | 0.549 | 0.471 | 0.622 |
| Gemma2-2B | 0.391 | 0.769 | 0.910 | 0.952 |
특히 중요한 점은 MLP output에서의 차이입니다. GPT-2 Large에서는 AtP가 거의 완전히 실패합니다.
반면 RelP는 입니다.
이는 RelP가 단순 gradient보다 훨씬 안정적인 signal을 제공한다는 강한 증거로 제시됩니다.
8. 왜 residual stream과 MLP에서 RelP가 특히 좋은가?
논문은 기존 AtP가 residual stream에서 약한 이유를 다음처럼 설명합니다.
8.1 Residual stream의 문제
Residual stream은 activation magnitude가 크고 여러 layer의 정보가 누적됩니다. 또한 LayerNorm을 거치면서 nonlinearity가 강하게 작동합니다.
AtP는 다음 local linear approximation에 의존합니다.
하지만 residual stream에서는 n이 크고 LayerNorm이 뒤따르기 때문에 이 근사가 쉽게 깨집니다.
RelP는 LN-rule을 통해 LayerNorm의 variance scaling을 constant로 취급하므로 더 안정적인 propagation을 수행합니다.
8.2 MLP0의 문제
논문은 GPT-2 Small에서 MLP0가 “extended embedding”처럼 작동한다고 설명합니다. 초기 MLP layer는 token embedding과 position information을 강하게 변환하므로, activation perturbation에 대한 local gradient가 불안정해질 수 있습니다.
Figure 2, Figure 4, Figure 5에서 RelP는 Activation Patching heatmap과 더 유사한 패턴을 보입니다. 특히 residual stream과 MLP0에서 AtP는 signal이 흐려지거나 잘못된 위치를 강조하지만, RelP는 AP와 유사한 layer-position structure를 복원합니다.
9. 실험 2: Subject-Verb Agreement sparse feature circuit discovery
두 번째 실험은 단순히 Activation Patching과의 correlation을 보는 것이 아니라, 실제로 sparse feature circuit을 찾는 데 RelP가 유용한지 평가합니다.
9.1 Task
Subject-Verb Agreement task는 주어의 수에 따라 동사의 형태가 맞는지 보는 task입니다.
예:
- singular subject → “likes”, “does”, “has”
- plural subject → “like”, “do”, “have”
논문은 세 종류의 template을 사용합니다.
| Template type | 예시 | Output metric |
|---|---|---|
| Within Relative Clause | The athlete that the managers … | |
| Across Relative Clause | The athlete that the managers like … | |
| Across Prepositional Phrase | The secretaries near the cars … |
9.2 SAE feature circuit
이 실험에서는 neuron이 아니라 SAE sparse feature를 circuit node로 사용합니다.
Sparse Autoencoder는 hidden activation을 sparse feature vector로 분해합니다.
여기서
- h: original hidden activation
- z: sparse feature activation
- : decoder dictionary
입니다.
SAE feature는 neuron보다 더 monosemantic하고 interpretable할 가능성이 높기 때문에, circuit discovery의 단위로 사용됩니다.
논문은 Marks et al.의 Pythia-70M SAE feature를 사용합니다. 그리고 RelP와 Integrated Gradients, IG 기반 circuit discovery를 비교합니다.
9.3 RelP 기반 feature scoring
각 SAE feature f에 대해 original input과 patch input의 feature activation 차이를 계산합니다.
그리고 output metric L에 대한 LRP propagation coefficient를 SAE feature level까지 전파합니다.
그 다음 feature contribution은 다음처럼 계산됩니다.
이 score가 큰 feature를 circuit node로 선택합니다.
9.4 Node threshold
논문은 node threshold 을 변화시키면서 circuit 크기를 조절합니다.
또는 contribution score 상위 feature들을 유지하는 방식입니다.
작은 이면 더 많은 feature가 포함되고, 큰 이면 더 sparse한 circuit이 됩니다.
9.5 Faithfulness metric
발견한 circuit C가 원래 모델 behavior를 얼마나 잘 보존하는지 측정합니다.
논문 수식은 다음과 같습니다.
여기서
- L(M): full model metric
- L(C): circuit만 active하게 두었을 때 metric
- : 전체를 mean-ablation한 baseline metric
입니다.
해석은 다음과 같습니다.
- Faithfulness = 1: circuit만으로 full model behavior를 거의 완전히 설명
- Faithfulness = 0: circuit이 mean-ablated baseline과 다르지 않음
9.6 Completeness metric
Completeness는 circuit의 complement가 얼마나 behavior를 설명하는지 봅니다.
즉, circuit을 제거하고 나머지만 남겼을 때도 성능이 높다면, 원래 circuit은 complete하지 않은 것입니다.
논문은 completeness를 complement circuit의 faithfulness로 정의합니다.
이상적인 circuit은 다음을 만족합니다.
즉, circuit만 있으면 behavior가 유지되고, circuit을 제거하면 behavior가 사라져야 합니다.
9.7 결과
Figure 3에 따르면 RelP는 IG와 비슷한 faithfulness를 보입니다. 중요한 차이는 계산 비용입니다.
IG는 여러 interpolation step을 사용합니다. 논문에서는 을 사용했습니다. 따라서 forward/backward 비용이 증가합니다.
반면 RelP는 AtP와 마찬가지로 만 필요합니다.
결과적으로 RelP는 IG 수준의 faithfulness를 보이면서도 훨씬 효율적입니다. 또한 neuron circuit보다 SAE feature circuit이 훨씬 적은 node로 모델 behavior를 설명합니다. 논문은 Pythia-70M에서 약 100개 feature가 대부분의 성능을 설명하는 반면, neuron circuit은 절반 정도를 설명하는 데에도 약 1,500개 neuron이 필요하다고 보고합니다.
10. 방법론의 의의
10.1 Gradient 기반 patching의 약점 보완
Attribution Patching은 efficient하지만 gradient noise에 취약합니다. 특히 깊은 Transformer에서는 다음 문제가 있습니다.
- LayerNorm으로 인한 nonlinearity
- residual stream의 large activation
- MLP nonlinearity
- gated MLP
- attention weight의 input-dependence
- local linear approximation failure
RelP는 LRP rule을 통해 이러한 component별 구조를 반영합니다. 따라서 단순 gradient보다 더 안정적인 attribution signal을 제공합니다.
10.2 Activation Patching과 Attribution Patching 사이의 중간 지점
RelP는 다음 위치에 있습니다.
즉, RelP는 circuit discovery에서 매우 실용적인 compromise입니다.
10.3 SAE feature circuit discovery와 잘 결합됨
SAE feature circuit에서는 node 수가 매우 많습니다. 따라서 Activation Patching을 feature 단위로 수행하면 계산량이 큽니다. IG도 step 수만큼 비용이 증가합니다.
RelP는 한 번의 relevance propagation으로 많은 feature의 contribution을 계산할 수 있으므로, SAE feature circuit discovery에 적합합니다.
11. 한계
논문이 제시하는 한계는 다음과 같습니다.
11.1 LRP rule 선택이 model-specific
RelP는 완전히 model-agnostic하지 않습니다. Transformer architecture에 따라 적절한 LRP rule을 골라야 합니다.
예를 들어
- GPT-2 / Pythia: LayerNorm, GELU, Linear 중심
- Qwen2 / Gemma2: RMSNorm, SiLU, gated MLP 추가
- attention-specific rule 적용 여부
등이 달라집니다.
따라서 구현 난이도는 AtP보다 높습니다.
11.2 Attention output에서는 개선폭이 작음
RelP는 residual stream과 MLP output에서 큰 개선을 보였지만, attention output에서는 AtP도 이미 높은 correlation을 보이는 경우가 많고, RelP 개선폭이 상대적으로 작습니다.
또한 논문 실험에서는 AH-rule을 실제로 사용하지 않았습니다. 따라서 attention-specific LRP rule을 더 정교하게 적용하면 개선 가능성이 있습니다.
11.3 실험 task가 제한적
논문은 주로 다음 task를 다룹니다.
- IOI
- Subject-Verb Agreement
둘 다 mechanistic interpretability benchmark로는 표준적이지만, free-form generation, multi-hop reasoning, factual recall, safety behavior, refusal behavior 같은 복잡한 LLM behavior에는 아직 적용하지 않았습니다.
12. 논문을 한 문장으로 요약하면
이 논문은 Attribution Patching의 gradient term을 LRP 기반 relevance propagation coefficient로 대체한 RelP를 제안하여, Activation Patching에 더 가까운 faithful circuit localization을 AtP 수준의 계산 비용으로 수행할 수 있음을 보인 연구입니다.
특히 residual stream과 MLP output에서 기존 Attribution Patching이 크게 실패하는 경우에도 RelP는 Activation Patching과 높은 상관을 보이며, SAE sparse feature circuit discovery에서도 Integrated Gradients와 유사한 faithfulness를 더 낮은 비용으로 달성합니다.
답글 남기기