[论文解读] LLaMA-VID: An Image is Worth 2 Tokens in Large Language Models
LLaMA-VID 为每帧表示两个令牌(上下文与内容)以显著降低令牌数量,同时保持信息,使LLM能够理解长视频并在视频与图像基准上获得强结果。
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
研究动机与目标
- 解决长视频视觉-语言模型中的令牌瓶颈,通过降低每帧令牌数。
- 引入每帧的上下文引导令牌(context token)和内容聚焦令牌(content token)。
- 在现有LLM骨干上实现小时级视频处理,且计算成本不过高。
- 构建一个包含模态对齐、指令微调和长视频微调的分阶段训练管线,并采用指令数据进行训练。
提出的方法
- 每帧两令牌设计:一个由用户指令引导的上下文令牌,一个捕捉帧细节的内容令牌。
- 使用视觉变换器编码器提取帧特征,文本解码器生成文本引导查询用于上下文注意。
- 通过文本查询与视觉特征之间的跨模态注意,生成 E_t 作为上下文嵌入,然后投影为单一的上下文令牌。
- 通过对视觉嵌入进行自适应池化,产生可变长度的内容令牌 E^V_t,以适应计算预算。
- 将每帧的上下文令牌与内容令牌拼接后投射到LLM令牌空间,供下游解码使用。
- 分三阶段训练:模态对齐(冻结大部分模块),指令微调(解冻文本解码器),长视频微调(扩展到长序列),并使用指令数据。
实验结果
研究问题
- RQ1每帧双令牌表示在显著降低长视频令牌数量的同时能否维持性能?
- RQ2指令引导的上下文如何影响LLM的帧级表示质量?
- RQ3令牌预算与解码器选择对不同视频和图像基准的性能影响如何?
- RQ4在扩展 backbone LLM 时,LLaMA-VID 实现小时级视频理解的可行性如何?
主要发现
- LLaMA-VID 在视频问答基准上实现强劲的零-shot 表现,在 MSVD-QA、MSRVTT-QA 和 ActivityNet-QA 上超过此前方法,且每帧只有两个令牌。
- 在基于视频的生成基准上,LLaMA-VID 在各指标上达到最佳表现,且随着LLM规模的增大而提升。
- 在图像基准上,LLaMA-VID 在大多数数据集上超越领先方法,且跨越不同的LLM骨干。
- 双令牌设计(上下文+内容)相比单一内容令牌带来显著提升,且由更强的文本解码器(QFormer)带来进一步增益。
- 在合适的训练数据与令牌预算下,LLaMA-VID 能支持小时级视频(最长可达64K令牌上下文),且训练在8x A100 GPU 上可在2天内完成。
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。