[Paper Review] LLaMA-VID: An Image is Worth 2 Tokens in Large Language Models
LLaMA-VID represents each video frame with two tokens (context and content) to dramatically reduce token load while preserving information, enabling long-video understanding with LLMs and achieving strong results on video and image benchmarks.
In this work, we present a novel method to tackle the token generation challenge in Vision Language Models (VLMs) for video and image understanding, called LLaMA-VID. Current VLMs, while proficient in tasks like image captioning and visual question answering, face computational burdens when processing long videos due to the excessive visual tokens. LLaMA-VID addresses this issue by representing each frame with two distinct tokens, namely context token and content token. The context token encodes the overall image context based on user input, whereas the content token encapsulates visual cues in each frame. This dual-token strategy significantly reduces the overload of long videos while preserving critical information. Generally, LLaMA-VID empowers existing frameworks to support hour-long videos and pushes their upper limit with an extra context token. It is proved to surpass previous methods on most of video- or image-based benchmarks. Code is available https://github.com/dvlab-research/LLaMA-VID}{https://github.com/dvlab-research/LLaMA-VID
Motivation & Objective
- Address the token bottleneck in vision-language models for long videos by reducing per-frame tokens.
- Introduce a context-guided token (context token) and a content-focused token (content token) per frame.
- Enable hour-long video processing with existing LLM backbones without excessive computational cost.
- Build an instruction-tuned, multi-stage training pipeline including modality alignment, instruction tuning, and long-video tuning.
Proposed method
- Two-token per frame design: a context token guided by user instruction and a content token capturing frame details.
- Use a vision transformer encoder to extract frame features and a text decoder to generate text-guided queries for context attention.
- Generate E_t as a context embedding via a cross-modal attention between text queries and visual features, then project to a single context token.
- Produce a variable-length content token E^V_t via adaptive pooling of visual embeddings to fit computational budgets.
- Concatenate context and content tokens per frame and project into LLM token space for downstream decoding.
- Train in three stages: modality alignment (freeze most modules), instruction tuning (unfreeze text decoder), long-video tuning (scale to long sequences) with instruction data.
Experimental results
Research questions
- RQ1Can a dual-token representation per frame maintain performance while dramatically reducing token counts for long videos?
- RQ2How does instruction-guided context influence the quality of frame-level representations for LLMs?
- RQ3What are the effects of token budget and decoder choices on performance across video and image benchmarks?
- RQ4How feasible is hour-long video understanding with LLaMA-VID when scaling the backbone LLM?
Key findings
- LLaMA-VID achieves strong zero-shot performance on video QA benchmarks, surpassing prior methods on MSVD-QA, MSRVTT-QA, and ActivityNet-QA with two tokens per frame.
- On a video-based generative benchmark, LLaMA-VID attains the best performance across metrics and improves as the LLM scales.
- For image-based benchmarks, LLaMA-VID outperforms leading methods on most datasets across varying LLM backbones.
- The dual-token design (context + content) yields significant gains over using a single content token, with further gains from a stronger text decoder (QFormer).
- LLaMA-VID can support hour-long videos (up to 64K tokens context) with suitable training data and token budgeting, and training can complete within 2 days on 8x A100 GPUs.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.