Eventful Transformers: Leveraging Temporal Redundancy in Vision Transformers

Matthew Dutson, Yin Li, Mohit Gupta

TL;DR

Eventful Transformers significantly reduce the computational burden of processing video with Vision Transformers by exploiting temporal redundancy. By identifying and updating only the "active" tokens that change significantly between frames, the method achieves 2-4x computational savings with minimal impact on accuracy and provides fine-grained, runtime control over the compute budget.

What Problem Does This Paper Address?

Vision Transformers (ViTs) have set new state-of-the-art benchmarks in computer vision, but their high computational cost—often an order of magnitude higher than traditional CNNs—remains a major barrier to deployment. This is especially true in video processing, where models are typically applied frame-by-frame, redundantly recomputing features for static background elements and slowly changing objects.

While previous work has explored "adaptive" models that skip entire frames or regions, these often require extensive re-training or struggle to translate theoretical sparsity into actual wall-clock speedups. The authors identify a unique opportunity: because Transformers operate on discrete token vectors, they are naturally suited for fine-grained, token-level updates that can directly reduce runtime using standard operators.

Methods

The core contribution is the Eventful Transformer block, a modified version of the standard Transformer block designed to be "redundancy-aware."

Token Gating

The authors introduce a Gate module (Figure 2) that maintains a set of "reference tokens" in memory. For each new frame, the gate compares incoming tokens to these references. Only tokens that have changed beyond a certain threshold (or the top-$r$ most changed tokens) are selected for re-computation.

Figure 2. Token Gating. A gating module compares incoming tokens against a stored reference. If the difference between a token and its reference is large, then the token is selected to be updated. See Section 4.3 for details on selection policies. Images are from the VID [57] dataset.

Sparse Updates

Once tokens are selected, the model avoids full re-computation in two ways:

  1. Token-wise operations: For layers like the MLP or linear projections, the model simply "gathers" the active tokens, processes them, and "scatters" the results back into a buffer (Figure 3).
  2. Sparse Self-Attention: This is the most complex part. The authors develop strategies to update the self-attention mechanism without recomputing the full $N \times N$ attention matrix.
  3. For the Query-Key product, they only recompute the rows and columns corresponding to updated tokens (Figure 5).
  4. For the Attention-Value product, they use a "delta-based" update strategy, where the new output is calculated by adding the changes (deltas) to the previous frame's output (Figure 6).
Figure 4. An Eventful Transformer block. To exploit temporal redundancy, we strategically apply token gating throughout the block and compute a modified, sparse self-attention update. Rectangles are standard Transformer components (see Section 3). For clarity, we have omitted some minor operations (e.g., scaling after the first matrix multiplication) from this figure.

Adaptivity

Because the number of updated tokens ($r$) is a hyperparameter that can be changed at runtime, the model offers an "efficiency knob." A system can dynamically reduce the budget if battery is low or increase it if the scene becomes highly dynamic (Figure 1).

Datasets

The authors evaluated their method across several demanding video tasks:

  • ImageNet VID: For video object detection.
  • EPIC-Kitchens 100: For action recognition in egocentric (first-person) videos.
  • Kinetics-400: A large-scale action recognition benchmark used for additional validation.

Key Insights and Ideas

  • Off-the-shelf Compatibility: One of the most powerful aspects of this method is that it can often be applied to existing, pre-trained Transformers without any re-training, particularly for tasks like object detection.
  • Transformers vs. CNNs: The authors argue that Transformers are actually better suited for exploiting temporal redundancy than CNNs. In CNNs, spatial sparsity is difficult to turn into speedups without specialized hardware or kernels. In Transformers, tokens are independent vectors, making "gather/scatter" operations highly effective.
  • Complementary Redundancy: Temporal redundancy (skipping tokens that don't change over time) and spatial redundancy (skipping tokens that aren't important in a single frame) are complementary. The authors showed that combining their method with spatial pooling leads to even greater savings.

Key Results

  • Efficiency: On the ViTDet model for object detection, the method reduced GFlops by 3.8x with only a 1.68% drop in mAP.
  • Action Recognition: For the ViViT model on EPIC-Kitchens, they achieved a 2.4x cost reduction with a 1.62% accuracy drop.
  • Wall-clock Speedups: Unlike many theoretical papers, the authors demonstrated real-world speedups: up to 2.48x on CPU and 1.74x on GPU using a standard PyTorch implementation.
Figure 1. Eventful Transformers. Our method exploits temporal redundancy between subsequent model inputs. (Top) Within each Transformer block, we identify and update only those tokens with significant changes over time. Image: [5]. (Bottom) In addition to improving efficiency, our method gives fine-grained control over the compute cost at runtime. “Budget” refers to parameter r as described in Section 4.3. “Flush” refers to the initialization of all tokens on the first time step. This example shows the ViTDet [38] object detection model on a video from the VID [57] dataset.

Limitations and Future Work

  • Memory Overhead: Reusing computations requires storing reference tensors and attention matrices in memory. For very large models or high-resolution inputs, this memory footprint can be significant (e.g., hundreds of MBs for the attention matrix).
  • Implementation Efficiency: The current implementation uses "vanilla" PyTorch operators. The authors believe that custom CUDA kernels for the gating logic could further improve the speedup ratios.
  • Distribution Shifts: In action recognition tasks, the authors found that the "temporal head" of the model was sensitive to the sparse update patterns, requiring a small amount of fine-tuning to maintain peak accuracy.

Summary updated

BibTeX
@misc{dutson2023eventful,
  author = {Matthew Dutson and Yin Li and Mohit Gupta},
  title = {{Eventful Transformers: Leveraging Temporal Redundancy in Vision Transformers}},
  year = {2023},
  eprint = {2308.13494},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2308.13494},
}
Figure