Flash-VStream: Memory-Based Real-Time Understanding for Long Video Streams

Haoji Zhang, Yiqin Wang, Yansong Tang, Yong Liu, Jiashi Feng, Jifeng Dai, Xiaojie JinarXiv 2024

Abstract

Benefiting from the advancements in large language models and cross-modal alignment, existing multi-modal video understanding methods have achieved prominent performance in offline scenario. However, online video streams, as one of the most common media forms in the real world, have seldom received attention. Compared to offline videos, the 'dynamic' nature of online video streams poses challenges for the direct application of existing models and introduces new problems, such as the storage of extremely long-term information, interaction between continuous visual content and 'asynchronous' user questions. Therefore, in this paper we present Flash-VStream, a video-language model that simulates the memory mechanism of human. Our model is able to process extremely long video streams in real-time and respond to user queries simultaneously. Compared to existing models, Flash-VStream achieves significant reductions in inference latency and VRAM consumption, which is intimately related to performing understanding of online streaming video. In addition, given that existing video understanding benchmarks predominantly concentrate on offline scenario, we propose VStream-QA, a novel question answering benchmark specifically designed for online video streaming understanding. Comparisons with popular existing methods on the proposed benchmark demonstrate the superiority of our method for such challenging setting. To verify the generalizability of our approach, we further evaluate it on existing video understanding benchmarks and achieves state-of-the-art performance in offline scenarios as well.

Introduction

Most current Large Video-Language Models (Video LLMs) operate in an "offline" mode, requiring the entire video to be available as a static file before processing begins. This creates significant bottlenecks for real-world applications like robotics, live surveillance, or interactive assistants. Specifically, long videos lead to a "memory explosion" where storing all visual tokens in VRAM becomes impossible. Furthermore, inference latency typically scales linearly with video length; if a model must re-process the entire video for every new query, response times quickly become unacceptable.

Flash-VStream addresses these challenges by mimicking the human memory mechanism. It bridges the gap between static offline understanding and the dynamic nature of online streaming, where a system must continuously perceive its environment while remaining ready to answer asynchronous questions about the past.

The STAR Memory Architecture

The core innovation of Flash-VStream is its "4-step, 2-process" design philosophy, which effectively decouples perception from reasoning. Unlike conventional models that process frames and questions sequentially in a single process, Flash-VStream utilizes an asynchronous architecture.

Comparison between conventional offline inference and the proposed online streaming inference process.

Asynchronous Processing

As shown in the architecture overview, the model runs two parallel processes:

  1. Frame Handler: This process continuously encodes incoming video frames and updates a shared memory system. It functions like "non-stop eye perceiving."
  2. Question Handler: This process remains idle until a user submits a question. It then retrieves relevant information from the shared memory to generate an answer without needing to re-encode the video stream.

STAR Memory Mechanism

To handle long-term information without VRAM bloat, the authors developed the STAR (Spatial-Temporal-Abstract-Retrieved) memory system:

  • Spatial Memory: A FIFO queue storing high-detail features of the most recent frames.
  • Temporal Memory: Uses a Weighted K-means Clustering algorithm to condense long-term visual data into a fixed number of "key event" centroids, simulating how humans remember significant moments.
  • Abstract Memory: A Semantic Attention layer that maintains a running high-level synopsis of the entire video.
  • Retrieved Memory: A mechanism that recalls precise spatial details from a feature buffer based on the most important temporal clusters identified by the system.

VStream-QA and Experimental Results

To evaluate Flash-VStream, the authors introduced VStream-QA, a benchmark specifically designed for online streaming. It consists of 3,500 question-answer pairs derived from 32 videos (Ego4D and MovieNet) ranging from 30 to 60 minutes. Unlike traditional datasets with short clips, VStream-QA requires the model to understand the context of the video up to the exact timestamp a question is asked.

Performance and Efficiency

Flash-VStream demonstrates remarkable efficiency compared to existing state-of-the-art models. While models like LLaMA-VID and MovieChat experience exponential or linear growth in latency as frame counts increase, Flash-VStream maintains a sub-second response time.

Inference latency comparison: Flash-VStream maintains near-constant sub-second latency regardless of the number of frames processed.

Key results include:

  • Real-Time Latency: Maintains under 1 second of latency even as video length grows to thousands of frames.
  • Memory Stability: Consumes a nearly constant 16.03 GB of VRAM, whereas competitive models like Chat-UniVi can spike to over 77 GB.
  • Accuracy: Outperformed LLaMA-VID by nearly 4% on ego-centric video QA and achieved state-of-the-art results on traditional benchmarks like ActivityNet-QA (51.9% accuracy).

Conclusion and Future Work

Flash-VStream represents a significant step toward real-time, long-term video understanding. By decoupling perception from reasoning and implementing a human-like memory system, it achieves high efficiency without sacrificing accuracy.

Future work will focus on moving beyond coarse-grained QA toward more complex reasoning and multi-step task planning. Additionally, the authors aim to scale benchmarks to "infinitely" long streams (days or weeks) and refine automated evaluation metrics to better handle the nuances of long-form video dialogue.

Summary updated

BibTeX
@misc{zhang2024flash,
  author = {Haoji Zhang and Yiqin Wang and Yansong Tang and Yong Liu and Jiashi Feng and Jifeng Dai and Xiaojie Jin},
  title = {{Flash-VStream: Memory-Based Real-Time Understanding for Long Video Streams}},
  year = {2024},
  eprint = {2406.08085},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2406.08085},
}
Figure