Abstract
The efficiency of long-video inference remains a critical bottleneck, mainly due to the dense computation in the prefill stage of Large Multimodal Models (LMMs). Existing methods either compress visual embeddings or apply sparse attention on a single GPU, yielding limited acceleration or degraded performance and restricting LMMs from handling longer, more complex videos. To overcome these issues, we propose Spava, a sequence-parallel framework with optimized attention that accelerates long-video inference across multiple GPUs. By distributing approximate attention, Spava reduces computation and increases parallelism, enabling efficient processing of more visual embeddings without compression and thereby improving task performance. System-level optimizations, such as load balancing and fused forward passes, further unleash the potential of Spava, delivering speedups of 12.72x, 1.70x, and 1.18x over FlashAttn, ZigZagRing, and APB, without notable performance loss. Code available at https://github.com/thunlp/APB
Introduction
Large Multimodal Models (LMMs) have demonstrated remarkable capabilities in understanding complex video content. However, as video length and resolution increase, these models encounter a significant computational barrier during the prefill stage. The underlying Large Language Model (LLM) backbones typically utilize attention mechanisms with quadratic complexity relative to the sequence length. Consequently, the explosion of visual embeddings in long-video contexts leads to prohibitive latency and memory demands.
Current attempts to mitigate this bottleneck generally follow two strategies: explicit input reduction and intrinsic attention optimization. Input reduction methods, such as token pruning or pooling (e.g., SLOWFAST), discard visual information to gain speed, which often results in "blind spots" and degraded performance on tasks requiring fine-grained detail. Intrinsic optimizations, such as sparse attention or KV cache compression, are often confined to a single GPU, limiting their scalability for ultra-long sequences.
SPAVA (Sequence-Parallelism-aware Approximate Attention) introduces a "third scaling dimension": multi-GPU sequence parallelism. By distributing the computational load across a cluster while employing an approximate attention mechanism, SPAVA breaks the traditional efficiency-performance trade-off.
The SPAVA Framework
SPAVA is designed to accelerate long-video understanding by combining algorithmic approximations with rigorous system-level optimizations. The core idea is to avoid the heavy communication overhead typically associated with standard sequence parallelism (like Ring Attention) while maintaining the global context necessary for accurate video reasoning.
Approximate Attention Mechanism
Instead of performing dense attention across the entire sequence on every GPU, SPAVA partitions embeddings into distinct functional blocks:
- Anchor Blocks ($B_a$): These represent the initial part of the sequence. They are kept globally visible to all hosts to preserve essential global context and maintain the performance of decoder-only models.
- Query Blocks ($B_{qr}$): These contain the user's prompt or question.
- Context Blocks ($B^{(i)}$): The bulk of the video embeddings are distributed across GPUs. SPAVA identifies and "passes" only the most critical Key-Value (KV) pairs between GPUs using a compressed communication strategy, capturing long-range dependencies without the cost of full dense computation.
System-Level Optimizations
To fully realize the benefits of distributed attention, SPAVA implements several system optimizations:
- Visual Load Balancing: Video frames are evenly distributed across GPUs during the encoding phase to prevent any single host from becoming a bottleneck.
- Fused Context and Query Forward: By combining video processing and query processing into a single fused pass, SPAVA avoids memory-bound bottlenecks associated with sequential execution.
- ZigZag Load Balancing: This scheduling strategy ensures that computational workloads are balanced across all GPUs throughout the attention calculation, minimizing idle time.
- Overlapped Communication: The framework structures operations to overlap data transfer between GPUs with local computation, effectively hiding communication latency.
Experimental Evaluation
The authors evaluated SPAVA using challenging long-video benchmarks, including VNBench (synthetic tasks like retrieval and counting) and LongVideoBench (real-world videos up to one hour). The framework was tested on state-of-the-art models such as InternVL3-2B and Qwen2.5VL-3B/7B.
Performance and Accuracy
SPAVA achieves a superior balance between speed and performance compared to existing baselines. As shown in Figure 1, SPAVA occupies the optimal region of the trade-off curve, providing high request-per-second (req/s) throughput while maintaining high performance metrics.
Key results include:
- Speedups: SPAVA achieved a 12.72× speedup over FlashAttention and a 1.70× speedup over ZigZagRing when processing 64-frame 1440p videos.
- Task Accuracy: On VNBench, SPAVA outperformed other approximate attention baselines and avoided the significant accuracy drops characteristic of token-pruning methods like SLOWFAST.
- Scalability: The framework demonstrates robust scalability, with performance remaining stable as the number of GPUs increases.
- Generalization: Beyond video, SPAVA showed a 13.99× speedup on the RULER text-only benchmark, indicating its potential as a general-purpose long-context accelerator.
Discussion and Conclusion
The success of SPAVA highlights two critical insights for the future of LMMs. First, preserving detail is superior to deleting data; approximating attention across a cluster is more effective than pruning tokens on a single device. Second, in multi-GPU environments, communication efficiency is as vital as raw compute power.
While SPAVA is currently optimized for decoder-only transformer architectures and requires multi-GPU setups, it represents a significant step toward real-time, high-resolution understanding of hour-long video streams. Future work will explore more sophisticated KV selection methods and broader architectural compatibility.
For more details, visit the project repository at https://github.com/thunlp/APB.
Summary updated