RCStat: A Statistical Framework for using Relative Contextualization in Transformers
cs.CL, cs.AI, cs.LG
Submitted: 2025-06-24
Updated: 2026-10-13
Comments: Accepted to NeuirIPS 2026
Code: https://github.com/NVIDIA/kvpress
License: http://creativecommons.org/licenses/by-nc-sa/4.0/
The gist: Identifying which tokens and activations truly influence model predictions is critical for both the efficiency and interpretability of large auto-regressive language models.
Terminology
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 RCStat, a statistical framework for quantifying contextual influence in attention mechanisms. At its core Relative Contextualization (RC) 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 attribution, attention heads with high expected RC accurately identify the prompt spans that drive generation, enabling reliable span-level explanations. For key-value cache eviction, 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.
Sources
- Quantifying Attention Flow in Transformers
- Cache-Craft: Managing Chunk-Caches for Efficient Retrieval-Augmented Generation
- PyramidKV: Dynamic KV Cache Compression based on Pyramidal Information Funneling
- Palu: Compressing KV-Cache with Low-Rank Projection
- Identifying Linear Relational Concepts in Large Language Models
- Lookback Lens: Detecting and Mitigating Contextual Hallucinations in Large Language Models Using Only Attention Maps
- Learning to Attribute with Attention
- A Simple and Effective $L_2$ Norm-Based Strategy for KV Cache Compression
- Get More with LESS: Synthesizing Recurrence with KV Cache Compression for Efficient LLM Inference
- How GPT learns layer by layer
- Transcoders Find Interpretable LLM Feature Circuits
- Trapping LLM Hallucinations Using Tagged Context Prompts
- Ada-KV: Optimizing KV Cache Eviction by Adaptive Budget Allocation for Efficient LLM Inference
- Q-Filters: Leveraging QK Geometry for Efficient KV Cache Compression
- The Llama 3 Herd of Models
- When Attention Sink Emerges in Language Models: An Empirical View
- A Survey on Large Language Model Acceleration based on KV Cache Management
- MatryoshkaKV: Adaptive KV Compression via Trainable Orthogonal Projection
- Copy Suppression: Comprehensively Understanding an Attention Head
- Using Captum to Explain Generative Language Models
Related papers
- Exploring Solution Divergence and Its Effect on Large Language Model Problem Solving
- Ishigaki-IDS-Bench: A Benchmark for Generating Information Delivery Specification from BIM Information Requirements
- Subliminal Steering: Stronger Encoding of Hidden Signals
- MedStruct-S: A Benchmark for Key Discovery, Key-Conditioned QA and Semi-Structured Extraction from OCR Clinical Reports
- The End of Transformers? On Challenging Attention and the Rise of Sub-Quadratic Architectures
- Untangling the Mechanisms of Misleading Context in Medical Question Answering