TL;DR
Long video understanding in Multimodal Large Language Models (MLLMs) is severely bottlenecked by memory overhead and context length limits. This paper introduces FlexMem (Flexible Memory), a training-free, plug-and-play mechanism that mimics human video-watching behavior by iteratively compressing and recalling visual Key-Value (KV) caches. FlexMem enables standard MLLMs to process thousands of video frames on a single commodity GPU (like an RTX 3090) while achieving state-of-the-art performance.
What Problem Does This Paper Address?
When we watch a movie, we don't hold every single pixel in our working memory simultaneously; instead, we continuously process the narrative and recall specific details when asked a question. Current MLLMs, however, try to ingest everything at once. For a long video, this creates a massive "token explosion"—processing 1,024 frames can generate over 200,000 visual tokens, easily exceeding model context windows and crashing GPU memory.
Existing workarounds fall into two camps, both with major drawbacks:
- Retrieval-Augmented Generation (RAG): Selects keyframes based on a query. While memory-efficient, it struggles with global context and temporal continuity.
- Visual Feature Compression: Shrinks the visual tokens but still forces the model to look at all compressed features during the final answering phase, eventually hitting a computational ceiling.
The authors bridge this gap by introducing a visual memory mechanism that allows continuous video streaming with a constant memory footprint, followed by a flexible recall phase.
Methods
FlexMem processes videos iteratively, clip by clip, using a Dual-Pathway Compression (DPC) design that splits visual representations based on how they will be used:
- Context Memory ($C_i$): Used during the prefilling stage. It retains visual tokens that excel at aggregating historical context and propagating information forward to subsequent clips, ensuring temporal continuity.
- Local Memory ($M_i$): Used during the decoding stage. It filters out intra-clip redundancy, keeping only the most distinctive visual evidence. These compressed tokens are written into a permanent
Visual Memory Bank.
To read from this memory bank when a question is asked, FlexMem offers two strategies:
- Question Encoding-based Reading: Uses full cross-modal attention between the video clips and the question to recall the most relevant fragments.
- Fast Memory Indexing (MemIndex): For streaming or multi-question scenarios where full cross-attention is too slow, MemIndex uses a lightweight linear regression model to predict relevance scores using a highly compact index tensor, bypassing repeated heavy MLLM inferences.
Datasets
The authors evaluated FlexMem across five demanding long-video QA benchmarks and one streaming benchmark:
- Video-MME & LongVideoBench: For diverse form content and precise multimodal reasoning.
- MLVU & LVBench: For long-term memory retention and complex temporal understanding (videos up to 2 hours).
- TimeScope: Probing extreme limits with videos ranging from 1 minute to 8 hours.
- OVOBench: Used specifically to test streaming QA and backward information tracing.
Key Insights and Ideas
- Memory Roles are Asymmetric: A key insight is that visual memory needs differ between understanding the flow of a video (prefilling) and answering a specific question (decoding). Separating these into Context and Local pathways prevents the loss of long-range dependencies.
- Constant Footprint, Infinite Length: Because context memory is propagated iteratively and local memory is offloaded to a bank, the model's active context window remains bounded, theoretically allowing it to process infinitely long videos.
- Statistical Alignment Beats Heavy Compute: The success of
MemIndexproves that full cross-modal attention can be closely approximated by statistically fitting a compact index tensor, making real-time streaming video dialogue computationally viable.
Key Results
The authors integrated FlexMem into LLaVA-Video (7B) and LLaVA-OneVision (7B). All efficiency benchmarks were run on a single, consumer-grade RTX 3090 GPU (24GB VRAM).
- Massive Baseline Boosts: FlexMem improved LLaVA-Video's performance by 32.2% on TimeScope and 19.7% on LVBench compared to standard uniform sampling.
- Hardware Efficiency: Under strict 24GB memory constraints, competing methods like AdaRETAKE suffered severe performance degradation because they had to drop frame counts. FlexMem maintained 99.5% of its unrestricted performance, outperforming SOTA methods by 3.9% to 5.2% on average.
- Competing with Giants: Powered by FlexMem on a single 3090, the open-source LLaVA-Video achieved results comparable to proprietary models like GPT-4o and Gemini-1.5 Pro on long-video benchmarks, notably outperforming Gemini-1.5 Pro by 54.1% on LVBench.
Limitations and Future Work
While a dedicated limitations section is not included, the text highlights an inherent semantic gap between offline visual memory caches and question tokens, which requires empirical tuning (such as selecting specific layers and tokens for the index feature). Additionally, because FlexMem is training-free, its ultimate performance remains bounded by the cross-modal alignment capabilities of the underlying base MLLM. Future work could explore fine-tuning strategies to optimize the dual-pathway compression thresholds end-to-end.
Summary updated