Abstract
Video sequences offer valuable temporal information, but existing large multimodal models (LMMs) fall short in understanding extremely long videos. Many works address this by reducing the number of visual tokens using visual resamplers. Alternatively, in this paper, we approach this problem from the perspective of the language model. By simply extrapolating the context length of the language backbone, we enable LMMs to comprehend orders of magnitude more visual tokens without any video training. We call this phenomenon long context transfer and carefully ablate its properties. To effectively measure LMMs' ability to generalize to long contexts in the vision modality, we develop V-NIAH (Visual Needle-In-A-Haystack), a purely synthetic long vision benchmark inspired by the language model's NIAH test. Our proposed Long Video Assistant (LongVA) can process 2000 frames or over 200K visual tokens without additional complexities. With its extended context length, LongVA achieves state-of-the-art performance on Video-MME and MLVU among 7B-scale models by densely sampling more input frames.
Introduction
While Large Language Models (LLMs) have achieved remarkable success in processing long-form text, their multimodal counterparts—Large Multimodal Models (LMMs)—remain constrained when processing video. The primary bottleneck is the "short-sightedness" of current architectures: videos longer than a minute generate a volume of visual tokens that quickly exceeds the model's context window.
To circumvent this, traditional solutions often rely on visual resamplers or compression modules to reduce token counts, which inevitably leads to the loss of fine-grained temporal and spatial details. Furthermore, the scarcity of high-quality, long-video datasets makes supervised fine-tuning for long-context video understanding difficult. This research explores a different path: can the long-context capabilities of a language model be directly transferred to the vision modality?
Methodology: Long Context Transfer and LongVA
The core contribution of this work is the discovery of Long Context Transfer. The researchers hypothesize that if a language model's "brain" is trained to handle long sequences of text, it can inherently manage long sequences of visual tokens, provided the visual modality is properly aligned.
The LongVA (Long Video Assistant) model is developed through a three-stage process:
- Text-Based Context Expansion: The base LLM (Qwen2-7B) undergoes continued pretraining on long-form text (e.g., SlimPajama) to extend its context window to 224,000 tokens.
- Short-Vision Alignment: The model is aligned with the vision modality using only short image-text pairs (LLaVA-1.6 dataset). Crucially, no long-video data is required. Once the model learns to map visual features into the LLM's token space, it can utilize its existing long-context machinery to process thousands of these "image tokens" in sequence.
- UniRes Encoding: To maintain consistency across images and videos, the authors introduce UniRes. This unified encoding scheme treats a video as a single, vertically extended image. By applying 2x2 average pooling, each frame is reduced to 144 tokens, allowing the model to fit over 2,000 frames into its context window while preserving sufficient visual detail.
Benchmarking Long Vision: V-NIAH
To rigorously test the limits of long-context vision, the authors introduced the Visual Needle-In-A-Haystack (V-NIAH) benchmark. Inspired by the text-based NIAH test, V-NIAH hides a specific visual "needle"—a single frame containing a unique detail like a specific color or number—within hours of "haystack" video footage. This benchmark evaluates whether a model can accurately retrieve a single piece of information from a massive sequence of visual tokens.
Key Results and Insights
LongVA demonstrates that long-video understanding is largely a property of the underlying language backbone. If the LLM can process 200k tokens of text, it can process 200k tokens of video frames, even if it was only trained on single images.
- State-of-the-Art Performance: LongVA achieves SOTA results on major long-video benchmarks, including Video-MME and MLVU, among 7B-scale models. By sampling frames more densely (up to 2,000 frames), it rivals the performance of much larger models (34B+).
- Contextual Robustness: In V-NIAH tests, LongVA showed near-perfect retrieval accuracy for up to 1,500 frames and maintained high performance up to 3,000 frames (approximately 432,000 tokens), significantly exceeding its 224k training limit.
- Density Advantage: Unlike models forced to sub-sample video to fit small context windows, LongVA benefits from "looking closer." Performance on complex temporal tasks improves as the sampling density increases.
Conclusion
LongVA proves that explicit long-video training is not a prerequisite for long-video understanding. By extending the context window of the language backbone and performing simple modality alignment, LMMs can inherit the ability to process hours of video. While challenges remain—such as the high computational cost of KV caches and the lack of precise timestamping—Long Context Transfer represents a significant shift in how we approach multimodal scaling.
Summary updated