Abstract
Vision Transformers achieve impressive accuracy across a range of visual recognition tasks. Unfortunately, their accuracy frequently comes with high computational costs. This is a particular issue in video recognition, where models are often applied repeatedly across frames or temporal chunks. In this work, we exploit temporal redundancy between subsequent inputs to reduce the cost of Transformers for video processing. We describe a method for identifying and re-processing only those tokens that have changed significantly over time. Our proposed family of models, Eventful Transformers, can be converted from existing Transformers (often without any re-training) and give adaptive control over the compute cost at runtime. We evaluate our method on large-scale datasets for video object detection (ImageNet VID) and action recognition (EPIC-Kitchens 100). Our approach leads to significant computational savings (on the order of 2-4x) with only minor reductions in accuracy.
Introduction
Vision Transformers (ViTs) have revolutionized computer vision, setting new benchmarks for accuracy. However, their computational demands are substantial—often requiring hundreds of GFlops per image compared to tens for traditional convolutional neural networks (CNNs). This burden is exacerbated in video processing, where the model must process a continuous stream of frames.
Despite this cost, video data is inherently redundant; consecutive frames often exhibit minimal changes. While CNNs have long leveraged this redundancy, Transformers present a unique challenge due to the self-attention mechanism. Because every token interacts with every other token, a change in a single image patch can theoretically affect the entire output. Eventful Transformers address this by making these global interactions sparse and event-driven, updating only the tokens that have changed significantly.
Methodology
The core of the Eventful Transformer is a modified block that tracks temporal changes through two primary mechanisms: Token Gating and Redundancy-Aware Self-Attention.
Token Gating and Buffering
A Gate module maintains a reference version of each token. For each incoming frame, it computes the L2-norm difference between the new tokens and their reference counterparts. Only the $M$ tokens with the largest changes—termed "events"—are selected for re-computation. These updated tokens are then merged back into the full feature set by a Buffer module.
Redundancy-Aware Self-Attention
Re-computing the full attention matrix for a handful of updated tokens is inefficient. Eventful Transformers utilize sparse update rules for the two most expensive components of attention:
- Query-Key Product ($qk^T$): Only the rows and columns corresponding to the updated tokens are re-calculated.
- Attention-Value Product ($Av$): A delta-based strategy is employed. Instead of a full matrix multiplication, the model computes the change (delta) in the output based on the changes in the attention and value tensors.
Runtime Adaptivity
A key feature of this approach is the Top-r Selection Policy. By adjusting the number of tokens ($r$) selected for update, the system can dynamically scale its computational budget at runtime. This allows for immediate response to hardware constraints or scene complexity without requiring model retraining. To prevent error accumulation over long sequences, the system periodically "flushes" by updating all tokens.
Experimental Results
The authors evaluated Eventful Transformers across several large-scale video benchmarks, including ImageNet VID for object detection and EPIC-Kitchens 100 for action recognition.
- Efficiency and Accuracy: On ImageNet VID, the method achieved a 3.8x reduction in GFlops (from 467 to 122) with a marginal mAP drop of 1.68%. On EPIC-Kitchens, a 2.4x reduction was achieved with only a 1.62% drop in top-1 accuracy.
- Hardware Speedups: Using standard PyTorch, the researchers observed wall-clock speedups of up to 1.74x on GPUs and 2.48x on CPUs.
- Synergy with Spatial Methods: When combined with spatial redundancy techniques like token pooling, the "Spatiotemporal" variant reduced GFlops for ViTDet by over 10x while maintaining competitive accuracy.
Conclusion
Eventful Transformers provide a practical and efficient framework for deploying Vision Transformers in video tasks. By identifying and updating only significant temporal changes, the method achieves substantial computational savings. Furthermore, its compatibility with pre-trained models and its support for runtime budget adjustment make it a versatile tool for real-world video analysis.
Summary updated