Certified Mechanistic Interpretability: Lifting Single-Input Findings to Bounded Neighbourhoods
Organizations: School of Computation, Information and Technology Technical University of Munich, Germany
Abstract
Mechanistic interpretability reverse-engineers transformer circuits one input at a time, leaving observed mechanisms without guarantees over bounded input neighbourhoods. We address this gap with a framework based on constrained polynomial-zonotope (CPZ) propagation that lifts mechanistic-interpretability observations from a single input to certified statements over a bounded set of perturbations. Three internal-attention queries (top- stability, evidence mass, and attention entropy) are formulated as tractable programs over the simplex of attention weights, and CPZ propagation through transformer blocks is shown to preserve the softmax simplex and the LayerNorm zero-mean identity exactly. A recursive Jacobian zonotope construction extends the same certificates across layer depth by linearising the block stack at the input and avoids per-layer generator growth. We instantiate the framework on transformer attention; the resulting certificates offer a way to sharpen mechanistic statements that single-input inspection cannot resolve on its own, and to inform downstream decisions in regimes where empirical heuristics may be misleading.
Figures & tables
| Head | Clean | |||
|---|---|---|---|---|
| Setting | CPZ | MC | CROWN | IBP | sec/sample | |
|---|---|---|---|---|---|---|
| Internal Layer queries (Q1 top- attention stability) | ||||||
| Synthetic , Layer- | ||||||
| BERT-tiny ( ), Layer- | ||||||
| GPT- ( ), Layer- | ||||||
| GPT- ( ), Layer- | ||||||
| GPT- medium ( ), Layer- | ||||||
| Head | Q1 | Q2 | Q3 | Q1 | Q2 | Q3 | Q1 | Q2 | Q3 |
|---|---|---|---|---|---|---|---|---|---|
| H0 | |||||||||
| H1 | |||||||||
| Seed | 42 | 2024 | 31415 | 271828 | 11 | 23 | 67 | 101 | All-seed mean |
|---|---|---|---|---|---|---|---|---|---|
| CPZ-guided | 100 | 80 | 100 | 90 | 100 | 100 | 100 | 100 | |
| Gradient-guided | 90 | 50 | 90 | 60 | 90 | 90 | 90 | 90 | |
Appendix figures & tables33 assets
Supplementary material from the paper’s appendix.
Appendix
| Method | ||||
|---|---|---|---|---|
| IBP + softmax | 63.8 | 72.1 | 76.1 | 76.5 |
| PZ + softmax (no CPZ) | 0.88 | 7.6 | 127.5 | 2,767 |
| CPZ (ours) | 0.49 | 2.9 | 6.1 | 8.9 |
| CPZ vs. IBP | 99.2% | 95.9% | 92.0% | 88.4% |
| PZ+softmax | CPZ | |||
|---|---|---|---|---|
| Stage | Width | Width | ||
| L0 input | 0 | 0.10 | 0 | 0.10 |
| L0 attention | 8 | 0.78 | 8 | 0.78 |
| L0 LN1 | 16 | 0.37 | 16 | 0.37 |
| L0 LN2 | 80 | 0.29 | 80 | 0.29 |
| L1 attention | 120 | 6.64 | 8 | 2.92 |
| Configuration | ||||
|---|---|---|---|---|
| IBP + softmax | 63.7 | 71.7 | 76.2 | 76.6 |
| PZ + softmax (no constraints) | 1.10 | 11.5 | 196.7 | 4,481 |
| + LN constraint only | 1.10 | 7.3 | 7.7 | 8.3 |
| + Softmax LP only | 0.70 | 3.6 | 32.2 | 656 |
| CPZ (both + LP) | 0.70 | 4.5 | 7.3 | 7.6 |
| Q1 Top-1 (%) | Q2 Evidence (%) | Q3 Entropy W. | |||||
|---|---|---|---|---|---|---|---|
| Layer | CPZ | MC | CPZ | MC | CPZ | MC | |
| L0 | |||||||
| L1 | |||||||
| L2 | |||||||
| L3 | |||||||
| L0 | |||||||
| Target layer | (Prop. 7 ) | (production) | ratio | |
|---|---|---|---|---|
| Model | Layer | Sequential CPZ | Jac connector | MC+PGD | |
|---|---|---|---|---|---|
| Synthetic ( ) | L2 | ||||
| L3 | |||||
| L2 | |||||
| L3 | |||||
| GPT- small (124M) | L1 |
| CPZ % | MC % | Mean margin | Agreement | Conservative | Unsound | Time/sample | |
|---|---|---|---|---|---|---|---|
| s | |||||||
| s | |||||||
| s |
| CPZ % | MC % | Agreement | Conservative | Unsound | Time/sample | |
|---|---|---|---|---|---|---|
| s | ||||||
| s | ||||||
| s |
| -CROWN (surrogate, ) | CPZ (original, ) | |||||
| cert. (%) | time/sample | unsound | cert. (%) | time/sample | unsound | |
| s | s | |||||
| s | s | |||||
| s | s | |||||
| Model | Params | Bound Width | Time (s) | CPZ vs. IBP | |
|---|---|---|---|---|---|
| 8 | 1.2K | 2.0 | 0.4 | 99.2% tighter | |
| 16 | 4.5K | 12.8 | 0.7 | — | |
| 32 | 17K | 9.5 | 1.0 | — | |
| 64 | 67K | 105.9 | 1.8 | — | |
| 128 | 265K | 233 | 54 | 79.5% tighter |
| CPZ | IBP | Improvement | |
|---|---|---|---|
| 0.01 | 233.1 | 1,141.6 | 79.6% |
| 0.02 | 234.3 | 1,141.6 | 79.5% |
| 0.05 | 234.0 | 1,141.6 | 79.5% |
| 0.10 | 234.3 | 1,141.6 | 79.5% |
| Cert. rate (%) | Mean margin | sec/sample | |
|---|---|---|---|
| Model | MC | CPZ-marg. | C/I | MC | CPZ-marg. | C/I | MC | CPZ-marg. | C/I |
|---|---|---|---|---|---|---|---|---|---|
| 92.5 | 92.5 | 67.5 | 85.0 | 85.0 | 57.5 | 60.0 | 60.0 | 12.5 | |
| 95.0 | 95.0 | 60.0 | 82.5 | 82.5 | 32.5 | 57.5 | 57.5 | 0 5.0 | |
| 81.2 | 81.2 | 45.0 | 73.8 | 73.8 | 20.0 | 46.2 † | 45.0 | 0 0.0 | |
| 81.2 | 81.2 | 25.0 | 68.8 | 68.8 | 0 1.2 | 30.0 | 30.0 | 0 0.0 | |
| Method | Q1 Rank (%) | Q2 Evid. (%) | Q3 Ent. | |
|---|---|---|---|---|
| 0.001 | MC | 99.4 | 100.0 | 0.0040 |
| CPZ | 99.4 | 100.0 | 0.0207 | |
| IBP | 97.5 | 100.0 | 0.0277 | |
| 0.002 | MC | 99.4 | 100.0 | 0.0079 |
| CPZ | 96.2 | 100.0 | 0.0415 | |
| IBP | 94.4 | 100.0 | 0.0556 |
| Method | Q1 Rank | Q2 Evid | Q3 Ent | |
|---|---|---|---|---|
| 0.002 | MC+PGD | 95.0 | 96.2 | 0.011 |
| CPZ | 92.5 | 96.2 | 0.079 | |
| CROWN | 51.2 | 88.8 | 0.449 | |
| IBP | 3.8 | 20.0 | 1.401 |
| Method | Q1 Rank | Q2 Evid | Q3 Ent | |
|---|---|---|---|---|
| 0.001 | MC+PGD | 72.7 | 89.0 | 0.049 |
| CPZ | 70.2 | 95.4 | 0.044 | |
| IBP | 52.3 | 72.3 | 0.387 | |
| CROWN | 43.5 | 63.1 | 0.505 | |
| 0.002 | MC+PGD | 54.4 | 76.2 | 0.095 |
| CPZ | 50.2 | 94.2 | 0.089 |
| Method | Q1 Rank | Q2 Evid | Q3 Ent | |
|---|---|---|---|---|
| 0.001 | MC+PGD | 78.1 | 75.2 | 0.030 |
| CPZ | 47.9 | 55.6 | 0.398 | |
| IBP | 26.9 | 36.5 | 0.773 | |
| CROWN | 0 0.2 | 0 1.9 | 1.458 |
| Method | Q1 Rank | Q2 Evid | Q3 Ent | |
|---|---|---|---|---|
| MC+PGD | 90.9 | 89.3 | 0.023 | |
| CPZ | 41.1 | 46.9 | 0.814 | |
| IBP | 10.7 | 26.0 | 1.185 | |
| CROWN | 0 0.8 | 0 3.6 | 1.736 | |
| MC+PGD | 83.1 | 87.5 | 0.044 | |
| CPZ | 13.5 | 13.5 | 1.380 |
| Method | Q1 Rank | Q2 Evid | Q3 Ent | |
|---|---|---|---|---|
| 0.001 | MC+PGD | 62.5 | 63.5 | 0.022 |
| CPZ | 27.1 | 37.5 | 0.461 | |
| IBP | 21.9 | 29.2 | 0.756 | |
| CROWN | 0 4.2 | 16.7 | 1.247 |
| Framework | Internal Q | Simplex | exact | LLM internal | Downstream |
|---|---|---|---|---|---|
| IBP / CROWN / DeepPoly [ 5 , 26 , 21 ] | |||||
| -CROWN [ 25 ] | |||||
| Transformer verifiers [ 19 , 2 ] | |||||
| PZ for transformers [ 13 ] | |||||
| Compact proofs [ 6 ] | — | ||||
| This work (CPZ-based) |
| Head | Clean ind. | Q1 | Q2 | Q3 | Q1 | Q2 | Q3 | Q1 | Q2 | Q3 |
|---|---|---|---|---|---|---|---|---|---|---|
| CPZ-guided | Gradient-guided | Full | |||
|---|---|---|---|---|---|
| Clean | Adv | Clean | Adv | Adv | |
| Method | Q1 Rank | Q2 Evid | Q3 Ent | |
|---|---|---|---|---|
| MC+PGD | – | |||
| CPZ | ||||
| PZ | ||||
| CROWN | ||||
| IBP | ||||
| MC+PGD | – |
| Method | Q1 Rank | Q2 Evid | Q3 Ent | |
|---|---|---|---|---|
| MC+PGD | – | |||
| CPZ | ||||
| PZ | ||||
| CROWN | ||||
| IBP | ||||
| MC+PGD | – |
| MC+PGD | CPZ-margin | CROWN | |
|---|---|---|---|
| Ranking (top-1) | Cross-head circuit | ||||||
|---|---|---|---|---|---|---|---|
| Model | MC | CPZ | IBP | MC | CPZ | IBP | |
| Induction | |||||||
| Model | MC+PGD | CPZ | CROWN/IBP | |
|---|---|---|---|---|
| Induction | ||||
| Metric | Head 0 | Head 1 |
|---|---|---|
| Ablation accuracy drop | pp | pp |
| Input gradient norm | ||
| Clean attention entropy | ||
| Attention mass on key token | ||
| Cosine similarity between heads | ||
| H0 flipped | H1 flipped | Ratio | H0 entropy shift | |
|---|---|---|---|---|
| – | ||||
| Disagreement seeds at (6/20) | |||||||
|---|---|---|---|---|---|---|---|
| Seed | 42 | 2024 | 31415 | 271828 | 23 | 89 | All-seed mean |
| CPZ-guided | 100 | 90 | 100 | 100 | 100 | 100 | |
| Gradient-guided | 90 | 60 | 90 | 60 | 90 | 90 | |
| (CPZ grad) | |||||||
| Layer 0 | Layer 1 | |||
|---|---|---|---|---|
| Method | ||||
| MC+PGD | ||||
| CPZ | ||||
| PZ | ||||
| CROWN | ||||
| IBP | ||||
| Setting | Random samples | PGD restarts steps |
|---|---|---|
| Synthetic Layer- / Layer- | k corner-biased | |
| 4-layer synthetic (multi-layer) | k corner-biased | |
| BERT-tiny SST- output verification | ||
| BERT-tiny / GPT- Layer- Q1/Q2/Q3 | – corner-biased | – |
| GPT- Layer- (Jacobian-zonotope) | ||
| GPT- next-token (full vocab + tail) | targeted |
| P10 | P25 | P50 | P75 | P90 | |
| NN distance | 0.072 | 0.093 | 0.106 | 0.119 | 0.134 |