RCStat: A Statistical Framework for using Relative Contextualization in Transformers
Organizations: Adobe Research, India
Abstract
Identifying which tokens and activations truly influence model predictions is critical for both the efficiency and interpretability of large auto-regressive language models. Yet in practice, token importance is typically inferred from attention distributions that entangle contextual relevance with softmax-normalization effects, obscuring relative influence across tokens and heads. We propose , a statistical framework for quantifying contextual influence in attention mechanisms. At its core is a random variable that measures how strongly one subset of tokens contributes to another under the model's internal scoring scheme. RCStat admits computationally efficient bounds on expected influence that can be estimated at inference time. No retraining is required. We apply RCStat to two tasks. For , attention heads with high expected RC accurately identify the prompt spans that drive generation, enabling reliable span-level explanations. For , RC-based adaptive thresholding selectively evicts low-impact KV entries, substantially reducing cache size while preserving generation quality. Across question answering, summarization, and attribution benchmarks, RCStat achieves consistent gains, improving generation quality by 15-40% with upto 36% error reduction for KV eviction, and attribution accuracy by 2-16%. These results demonstrate that explicitly modeling contextual influence provides a principled and practical alternative to attention-based heuristics.
Figures & tables
Appendix figures & tables21 assets
Supplementary material from the paper’s appendix.
Appendix
| Model | Method | 50% | 60% | 70% |
|---|---|---|---|---|
| 3B | TOVA | 0.2408 | 0.3103 | 0.3905 |
| RCStat (IOT) | 0.1956 | 0.2648 | 0.3402 | |
| RCStat (Non-IID) | 0.1571 | 0.2295 | 0.3066 | |
| 8B | TOVA | 0.2177 | 0.2859 | 0.3639 |
| RCStat (IOT) | 0.1615 | 0.2290 | 0.3007 | |
| RCStat (Non-IID) | 0.1043 | 0.2034 | 0.2836 |
| QMSum | 2Wiki | SQuAD v2 | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Method CR | 0.40 | 0.50 | 0.60 | 0.70 | 0.80 | 0.40 | 0.50 | 0.60 | 0.70 | 0.80 | 0.40 | 0.50 | 0.60 | 0.70 | 0.80 |
| RCStat ( ) | 0.12 | 0.16 | 0.22 | 0.31 | 0.47 | 0.13 | 0.18 | 0.24 | 0.32 | 0.46 | 0.09 | 0.13 | 0.18 | 0.26 | 0.39 |
| RCStat ( ) | 0.13 | 0.16 | 0.21 | 0.29 | 0.45 | 0.14 | 0.19 | 0.25 | 0.33 | 0.48 | 0.10 | 0.14 | 0.19 | 0.27 | 0.41 |
| TOVA | 0.19 | 0.21 | 0.25 | 0.33 | 0.49 | 0.20 | 0.24 | 0.29 | 0.37 | 0.53 | 0.16 | 0.19 | 0.23 | 0.30 | 0.46 |
| KNorm | 0.39 | 0.41 | 0.48 | 0.61 | 0.80 | 0.40 | 0.45 | 0.52 | 0.65 | 0.85 | 0.32 | 0.37 | 0.44 | 0.58 | 0.77 |
| SnapKV | 0.45 | 0.55 | 0.72 | 1.34 | 2.33 | 0.47 | 0.58 | 0.75 | 1.30 | 2.25 | 0.41 | 0.52 | 0.69 | 1.20 | 2.10 |
| QMSum | SQuAD v2 | 2WikiMultiHopQA | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0.4 | 0.5 | 0.6 | 0.7 | 0.8 | 0.9 | 0.4 | 0.5 | 0.6 | 0.7 | 0.8 | 0.9 | 0.4 | 0.5 | 0.6 | 0.7 | 0.8 | 0.9 | |
| 1 | - | - | - | - | - | 0.74 | - | - | - | - | - | 1.00 | - | - | - | - | - | 0.92 |
| 2 | - | - | - | - | 0.60 | 0.63 | - | - | - | - | 0.51 | 0.63 | - | - | - | - | - | 0.48 |
| 4 | - | - | 0.27 | 0.36 | 0.42 | 0.52 | - | - | 0.25 | 0.29 | 0.44 | 0.60 | - | - | 0.14 | 0.19 | 0.24 | 0.36 |
| 8 | 0.12 | 0.15 | 0.20 | 0.28 | 0.40 | 0.51 | - | 0.13 | 0.19 | 0.28 | 0.42 | 0.59 | 0.05 | 0.07 | 0.11 | 0.14 | 0.20 | 0.35 |
| 16 | 0.11 | 0.16 | 0.22 | 0.28 | 0.42 | 0.54 | 0.10 | 0.15 | 0.22 | 0.33 | 0.45 | 0.61 | 0.04 | 0.08 | 0.12 | 0.17 | 0.27 | 0.42 |
| Model | QuoteSum | Veri-Gran |
|---|---|---|
| L3.1-8B (all heads) | 90.54 | 77.91 |
| L3.1-8B (post-softmax least RC, ) | 35.72 | 4.69 |
| L3.1-8B (pre-softmax least RC, ) | 29.49 | 2.81 |
| L3.1-8B (post-softmax most RC, ) | 90.03 | 71.25 |
| L3.1-8B ( pre-softmax most RC , ) | 93.91 | 79.37 |
Attention Mechanisms
Attention mechanisms let neural networks weight information from other tokens or regions according to relevance, enabling context-dependent processing.
See all 512 papers