Enhancing Temporal Understanding in Video-LLMs through Stacked Temporal Attention in Vision Encoders

Ali Rasekh, Erfan Bagheri Soula, Omid Daliran, Simon Gottschalk, Mohsen Fayyaz

TL;DR

Current Video Large Language Models (Video-LLMs) are surprisingly bad at understanding the arrow of time, often failing to distinguish between an action and its exact reverse. To fix this, the authors introduce STAVEQ2, an architecture that embeds parameter-efficient, stacked temporal attention modules directly inside the vision encoder. This allows the model to master fine-grained temporal dynamics before passing visual tokens to the LLM, yielding state-of-the-art results on major video understanding benchmarks.

What Problem Does This Paper Address?

While Multimodal Large Language Models (MLLMs) have become incredibly adept at answering questions about static images or spatially grounded video queries (e.g., "What color is the bicycle?"), they suffer from a severe blind spot: fine-grained temporal dynamics.

Many state-of-the-art Video-LLMs (like Qwen2-VL) process video frames individually within their vision encoders, effectively treating a video as a collection of independent images and delegating all temporal reasoning to the language model. The authors demonstrate that this approach fails fundamentally when tasks require precise comprehension of action sequences or directionality—such as distinguishing between pulling an object from left to right versus right to left. Even models that attempt joint spatiotemporal fusion struggle to reliably capture these subtle, time-dependent patterns.

Figure 1: Responses from Qwen2-VL and our STAVEQ2. Left: For a temporally simple action (Bik- ing), both models answer correctly. Right: For a temporally challenging action (pulling something from right to left), Qwen2-VL provides an incorrect answer, while our STAVEQ2 succeeds.

Methods

The authors propose STAVEQ2 (Stacked Temporal Attention in Visual Encoders for Qwen2-VL). Instead of relying on the LLM to piece together time, STAVEQ2 bakes temporal awareness directly into the vision encoder using a Stacked Temporal Attention (STA) mechanism.

[Input Video Frames] 
       │
       ▼
┌──────────────────────────────┐
│  Spatial Attention Block     │  <-- Learns "what" is in each frame
└──────────────┬───────────────┘
               │
               ▼
┌──────────────────────────────┐
│  Temporal Attention Block    │  <-- Learns "how" patches move over time
└──────────────┬───────────────┘
               │
               ▼
   [To Large Language Model]

Key methodological innovations include:

  • Divided Space-Time Attention: Within each transformer block of the vision encoder, a dedicated temporal self-attention module is injected immediately after the standard spatial attention module. Spatial attention operates across patches within a single frame, while temporal attention operates across the same patch position across all frames.
  • Parameter Efficiency: To minimize computational overhead, the temporal attention blocks use up to four times fewer attention heads than the spatial blocks while maintaining the same head dimension.
  • 1D Rotary Position Embeddings (RoPE): Applied specifically within the temporal blocks to explicitly encode the chronological order of frames.
  • Two-Stage Training: To avoid corrupting the vision encoder's pretrained spatial representations, the output projection of the new temporal blocks is initialized to zero. Stage 1 trains only the temporal blocks and layer normalizations. Stage 2 introduces low-rank adaptation (LoRA) to jointly fine-tune the linear layers of both the vision encoder and the LLM.

Datasets

The model was trained and evaluated using several key datasets:

  • SSv2-T10 (New): A specialized 14,462-video subset of the Something-Something v2 (SSv2) dataset curated by the authors. It features 10 action classes consisting of pairwise temporal opposites (e.g., "moving something closer" vs. "moving something away") to strictly benchmark fine-grained temporal reasoning.
  • SSv2-VSM (New): A Visual Similarity Matching dataset containing 8,471 samples designed to test if a model can match a query video to a temporally similar reference video.
  • WebVid-QA: A curated subset of the WebVid video-caption dataset, transformed into multi-turn question-answer pairs using Qwen2-7B for instruction tuning.
  • Standard Benchmarks: Full SSv2 (action recognition), VITATECS (temporal concept understanding), MVBench (20 challenging video tasks), and Video-MME (comprehensive multi-domain video analysis).

Key Insights and Ideas

  • In-Context Learning Can Hinder Temporal Tasks: Surprisingly, adding few-shot examples in the prompt degraded the performance of baseline models on the SSv2-T10 dataset. This indicates that fine-grained temporal weakness is an architectural limitation, not a data scarcity issue.
  • Space Before Time: Ablation studies revealed that placing spatial attention before temporal attention yields significantly higher accuracy than the reverse. A model must understand the spatial context of a frame before it can effectively track how that context changes over time.
  • Fewer Temporal Heads Act as a Regularizer: Reducing the number of temporal attention heads (a head scaling factor of 0.25 compared to spatial attention) actually improved performance. The authors suggest this provides beneficial regularization, helping the model focus purely on critical temporal features.

Key Results

  • State-of-the-Art Action Recognition: Applying the STA mechanism to the InternVideo2 1B foundation model achieved 78.0% accuracy on the full SSv2 dataset, outperforming the much larger InternVideo2 6B baseline by 0.5%.
  • Benchmark Superiority: STAVEQ2 consistently outperformed its base models (Qwen2-VL and Qwen2.5-VL) across all major benchmarks, showing improvements of up to +5.5% on Video-MME and MVBench.
  • Resolving Temporal Confusion: As shown in the confusion matrices, adding stacked temporal attention drastically reduced the misclassification rate between mirrored actions, allowing the model to accurately distinguish directional motion.
Figure 2: Confusion matrices of InternVideo2-Chat performing action recognition on SSv2-T10 showing results on the following classes: (1) Pulling [something] from left to right; (2) Pulling [something] from right to left; (3) Throwing [something] in the air and catching it; (4) Throwing [something] in the air and letting it fall; (5) [Something] falling like a rock.

Limitations and Future Work

Due to compute constraints, the authors could not pretrain the vision encoder from scratch, relying instead on inserting blocks into existing models via fine-tuning. Additionally, their evaluations were capped at models with up to 72 billion parameters. The authors note that exploring full-scale pretraining from scratch and scaling beyond 72B parameters remain promising directions to fully uncover the architecture's potential.

Summary updated

BibTeX
@inproceedings{rasekh2025enhancing,
  author = {Ali Rasekh and Erfan Bagheri Soula and Omid Daliran and Simon Gottschalk and Mohsen Fayyaz},
  title = {{Enhancing Temporal Understanding in Video-LLMs through Stacked Temporal Attention in Vision Encoders}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=2EJrs3gUO6},
}
Figure