← 论文海报合集← Paper Notes|
STREAMING VIDEO · KV CACHE COMPRESSION

StreamMem: Query-Agnostic KV Cache Memory for Streaming Video Understanding

不知道问题、不知道视频有多长——也能把 KV cache 压缩到固定大小Without knowing the question and without knowing how long the video is — the KV cache can still be compressed to a fixed size
Yanlai Yang, Zhuokai Zhao, Satya Narayan Shukla, Aashu Singh, Shlok Kumar Mishra, Lizhu Zhang, Mengye Ren · Meta AI / New York University

多模态大模型(MLLM)处理长视频时,KV cache 会随时间线性增长,显存和计算开销都吃不消。现有压缩方法要么需要先编码完整视觉上下文,要么需要提前拿到用户的问题(query-aware),这在真实的流式、多轮对话场景里都不现实。StreamMem 用"聊天模板 token"当作通用 query 的代理,在不知道问题的情况下也能挑出最重要的视觉 token,并维持一个固定大小的 KV cache。When a multimodal large language model (MLLM) processes long videos, the KV cache grows linearly over time, and the memory and compute cost becomes unaffordable. Existing compression methods either need to encode the complete visual context first, or need the user's question in advance (query-aware), neither of which is realistic in genuine streaming, multi-turn conversational settings. StreamMem uses the "chat template token" as a proxy for a generic query, so that it can select the most important visual tokens without knowing the question, and maintain a fixed-size KV cache.

Training-freeQuery-agnostic5 benchmarks · 3 MLLM backbones 📄 arXiv:2508.15717 Project Page
StreamMemKV cache compressionstreaming video understandingquery-agnosticMLLM多模态大模型multimodal large language model长视频理解long video understandingattention saliencyYaRNframe filtering

01 Motivation

MLLM 在长视频理解上的两大瓶颈:一是视频帧编码后产生的视觉 token 数量常超出 LLM 的上下文长度;二是存储这些视觉 token 的 KV cache 并在解码时逐一 attend,带来巨大的显存和计算开销。虽然长上下文 LLM 的发展缓解了第一个问题,但显存/计算效率的问题在边缘设备等真实场景下依然突出。MLLMs face two major bottlenecks in long-video understanding: first, the number of visual tokens produced after encoding video frames often exceeds the context length of the LLM; second, storing the KV cache of these visual tokens and attending to them one by one during decoding brings enormous memory and compute overhead. Although the development of long-context LLMs has alleviated the first problem, the memory/compute efficiency problem remains prominent in real-world scenarios such as edge devices.

更棘手的是,现有的视觉压缩方法大多依赖两个假设:要么已知视频的完整长度(离线处理),要么已知用户即将提出的问题(query-aware 压缩)。论文指出:More awkwardly, most existing visual compression methods rely on two assumptions: either the full length of the video is known (offline processing), or the question the user is about to ask is known (query-aware compression). The paper points out:

"Existing visual compression methods require either encoding the entire visual context before compression or having access to the questions in advance, which is impractical for long video understanding and multi-turn conversational settings."

已有的流式方法也各有短板:ReKV(Di et al., 2025)把所有帧的 KV cache 全部存下来做 in-context retrieval,显存开销随视频变长而不可控;LiveVLM(Ning et al., 2025)虽然做了压缩,但采用 FIFO 策略直接丢弃最早的 KV,会导致视频早期信息被彻底遗忘。StreamMem 想要的是:训练无关(training-free)+ query-agnostic + 固定显存预算,三者同时满足。Existing streaming methods also have their own shortcomings: ReKV (Di et al., 2025) keeps the KV cache of all frames for in-context retrieval, so the memory cost grows uncontrollably as the video gets longer; LiveVLM (Ning et al., 2025) does perform compression, but its FIFO policy simply discards the earliest KV, which causes information from the early part of the video to be completely forgotten. What StreamMem wants is: training-free + query-agnostic + a fixed memory budget, all satisfied at the same time.

StreamMem teaser
Figure 1:Query-agnostic 的 KV cache 压缩场景——在内存预算受限的前提下,StreamMem 让模型在流式接收视频帧的同时,不依赖具体问题也能持续压缩并保留有效的 KV cache。Figure 1: The query-agnostic KV cache compression scenario — under a constrained memory budget, StreamMem lets the model keep compressing and retaining an effective KV cache while receiving video frames in a stream, without relying on any specific question.
6K每层 KV cache 大小(对比 LLaVA-OV 原始 6K / Qwen2-VL 原始 50K)Per-layer KV cache size (versus the original 6K of LLaVA-OV / the original 50K of Qwen2-VL)
5评测基准(3 个离线 + 2 个流式长视频理解)Evaluation benchmarks (3 offline + 2 streaming long-video understanding)
3验证过的开源 MLLM backboneValidated open-source MLLM backbones
24KKV 预算下反超 Full KV(不到完整 KV 一半大小)KV budget at which it overtakes Full KV (less than half the size of the complete KV)

02 Method

StreamMem 在每个时间步接收一段新的视频片段,先做输入帧过滤去冗余,再编码为视觉 token 并生成 KV,然后把新 KV 与上一步保留下来的压缩 KV memory 合并,经过一个压缩模块(剪枝 + 合并)得到新的固定大小 KV cache,供下一时间步继续使用。At every time step StreamMem receives a new video segment, first performs input frame filtering to remove redundancy, then encodes it into visual tokens and produces their KV, next merges the new KV with the compressed KV memory retained from the previous step, and passes the result through a compression module (pruning + merging) to obtain a new fixed-size KV cache to be used at the next time step.

StreamMem architecture and KV compression module
Figure 2:(a) StreamMem 整体流程——新帧先过滤去冗余,再经视觉编码器与已有 KV memory 做交叉注意力融合,随后压缩 KV cache 以维持固定显存预算,支持后续帧的持续处理或下游问答。(b) KV 压缩模块细节:根据 key 与 proxy query 之间的注意力分数对 memory 中的旧 KV 和新帧 KV 做剪枝;同时把每个新帧的 KV 加权合并成一个帧级 prototype(图中深色方块),插入到序列中。Figure 2: (a) The overall StreamMem pipeline — new frames are first filtered for redundancy, then fused with the existing KV memory through cross-attention after the vision encoder, after which the KV cache is compressed to maintain a fixed memory budget, supporting the continued processing of subsequent frames or downstream question answering. (b) Details of the KV compression module: the old KV in memory and the KV of the new frames are pruned according to the attention scores between the keys and the proxy query; meanwhile the KV of each new frame is merged with weights into a frame-level prototype (the dark squares in the figure), which is inserted into the sequence.

输入帧过滤(Input Frame Filtering)Input Frame Filtering

在送入 MLLM 前,先用视觉编码器算出每帧的 embedding,对相邻帧计算余弦相似度;如果相似度超过阈值 δ(实验中取 δ=0.95 效果最好),就认为两帧冗余,直接取平均合并。这一步能防止静态场景或高帧率视频中大量相似帧把 KV cache "撑满"重复信息,从而保留 memory 的多样性。Before feeding frames into the MLLM, the vision encoder first computes an embedding for each frame, and the cosine similarity between adjacent frames is computed; if the similarity exceeds the threshold δ (δ=0.95 works best in the experiments), the two frames are considered redundant and are directly averaged and merged. This step prevents the large number of similar frames in static scenes or high-frame-rate videos from "stuffing" the KV cache with duplicated information, thereby preserving the diversity of the memory.

KV Cache Memory:用聊天模板 token 做 query 的代理KV Cache Memory: chat template tokens as a proxy for the query

压缩的核心难点是:query-agnostic 场景下,压缩时刻并不知道用户会问什么问题。StreamMem 的解法是用系统的聊天模板 token(<|im_end|><|im_start|>assistant\n)作为一个"通用 query"的代理 Q,与视觉 token 的 key 做交叉注意力:The core difficulty of compression is that in a query-agnostic setting the model does not know what the user will ask at the moment of compression. StreamMem's solution is to use the system's chat template tokens (<|im_end|><|im_start|>assistant\n) as a proxy Q for a "generic query", and to cross-attend it with the keys of the visual tokens:

Ati = Softmax( Q(Kti) / √d )

由于预训练数据中视频字幕(captioning)任务大量存在,这个模板 token 会隐式地促使模型去"描述视频内容",即便没有显式问题,模型也倾向于关注真正有信息量的视觉区域。论文用消融实验证实:这个"chat template query"和一个人工写的通用问题("What is happening in the video?")效果相近,说明它确实在扮演通用 query 的角色。Because video captioning tasks are abundant in the pretraining data, this template token implicitly drives the model to "describe the video content", so that even without an explicit question the model still tends to attend to the genuinely informative visual regions. An ablation study in the paper confirms that this "chat template query" performs comparably to a hand-written generic question ("What is happening in the video?"), showing that it does play the role of a generic query.

频级 KV 合并(Frame-wise KV Merging)Frame-wise KV Merging

除了剪枝,StreamMem 还为每一帧计算一个基于归一化注意力分数的加权 prototype key/value(K̄, V̄ = Σ α·K, Σ α·V),插入到该帧被保留 token 序列的中间位置,同时保留原有的位置编号,从而实现精细 token + 全局帧摘要的双重记忆。Besides pruning, StreamMem also computes for each frame a weighted prototype key/value based on normalized attention scores (K̄, V̄ = Σ α·K, Σ α·V), inserted at the middle position of the retained token sequence of that frame while keeping the original position indices, thereby realizing a dual memory of fine-grained tokens plus a global frame summary.

位置编码:YaRN 上下文窗口扩展Positional encoding: YaRN context window extension

为解决 MLLM 在长视频上位置编码泛化差的问题,StreamMem 采用 YaRN(Peng et al., 2023)技术扩展视觉上下文窗口,而不是像 ReKV / LiveVLM / InfiniPot-V 那样简单地对保留 token 重新分配位置 ID(这会丢失原有的时空对齐信息)。消融显示 YaRN 缩放因子 λ 的选择对性能敏感,不同模型需要不同的 λ(LLaVA-OneVision 用 λ=8,Qwen2-VL 用 λ=2,Qwen2.5-VL 因默认上下文更长而 λ=1,即不缩放)。To solve the poor generalization of positional encoding of MLLMs on long videos, StreamMem adopts the YaRN technique (Peng et al., 2023) to extend the visual context window, instead of simply reassigning position IDs to the retained tokens as ReKV / LiveVLM / InfiniPot-V do (which loses the original spatio-temporal alignment information). The ablation shows that the choice of the YaRN scaling factor λ is sensitive for performance, and different models need different λ (LLaVA-OneVision uses λ=8, Qwen2-VL uses λ=2, and Qwen2.5-VL uses λ=1, i.e. no scaling, because its default context is longer).

03 Experiments

在三个离线长视频理解基准(MLVU、EgoSchema、VideoMME)和两个流式视频问答基准(RVS-Ego、RVS-Movie)上,使用 LLaVA-OneVision-7B、Qwen2-VL-7B、Qwen2.5-VL-3B 三个开源 MLLM 验证。所有实验可在单张 A100 GPU 上完成。Validation is performed on three offline long-video understanding benchmarks (MLVU, EgoSchema, VideoMME) and two streaming video question-answering benchmarks (RVS-Ego, RVS-Movie), using the three open-source MLLMs LLaVA-OneVision-7B, Qwen2-VL-7B and Qwen2.5-VL-3B. All experiments can be completed on a single A100 GPU.

离线长视频理解(Table 1,节选)Offline long-video understanding (Table 1, excerpt)

Backbone方法MethodKV SizeMLVUEgoSchemaVideoMME (All)
LLaVA-OneVision-7B+ LiveVLM-66.363.057.3
+ StreamMem6K66.963.059.4
Qwen2-VL-7B+ InfiniPot-V6K65.865.662.8
+ StreamMem6K65.967.262.1
Qwen2.5-VL-3B+ InfiniPot-V6K62.161.859.3
+ StreamMem6K62.362.259.5

论文原话总结:Summarized in the paper's own words:

"we observe that StreamMem outperforms the baselines on all benchmarks except the 'long' subset of VideoMME for Qwen2-VL-7B."
也就是说 Qwen2-VL-7B 在 VideoMME 的"long"子集上没有超过 baseline——论文并未回避这一点。In other words, Qwen2-VL-7B does not surpass the baseline on the "long" subset of VideoMME — a point the paper does not avoid.

不同 KV 预算下的对比(Table 3,Qwen2-VL-7B,MLVU)Comparison under different KV budgets (Table 3, Qwen2-VL-7B, MLVU)

方法MethodKV SizeHolisticS.D.M.D.All
Full KV50K76.373.943.365.9
InfiniPot-V6K77.272.344.865.8
StreamMem6K77.572.744.465.9
InfiniPot-V24K76.974.042.265.7
StreamMem24K77.673.444.566.3

在 24K token 预算(不到 Full KV 一半大小)下,StreamMem 的 All 指标(66.3)已经超过 Full KV(65.9)。Under a 24K token budget (less than half the size of Full KV), the All metric of StreamMem (66.3) already exceeds that of Full KV (65.9).

流式视频问答(Table 2,LLaVA-OneVision-7B)Streaming video question answering (Table 2, LLaVA-OneVision-7B)

方法MethodRVS-Ego AccRVS-Ego ScoreRVS-Movie AccRVS-Movie Score
ReKV63.74.054.43.6
ReKV w/o offloading55.83.350.83.4
Flash-VStream57.04.053.13.3
InfiniPot-V57.93.551.43.5
StreamMem57.63.852.73.4

StreamMem 在这两个基准上并未全面超过所有 baseline(例如 InfiniPot-V 在 RVS-Ego Acc 上略高),但与"卸载全部 KV cache"的 ReKV oracle 相比具有很强竞争力,同时显存占用远低于 ReKV。StreamMem does not surpass every baseline across the board on these two benchmarks (InfiniPot-V is slightly higher on RVS-Ego Acc, for example), but it is strongly competitive against the ReKV oracle that "offloads the entire KV cache", while its memory footprint is far lower than that of ReKV.

attention visualization for different queries
Figure 3:不同文本 query 所关注的视觉 token 可视化(红色代表更高的注意力分数)。尽管存在细微差异,"通用问题"(What is happening in the video?)和"具体问题"(What occurs just before reading the magazines?)关注的图像区域高度重合,这正是 chat-template query 能够近似替代真实 query 的实验支撑。Figure 3: Visualization of the visual tokens attended to by different text queries (red denotes a higher attention score). Despite subtle differences, the image regions attended to by the "generic question" (What is happening in the video?) and by the "specific question" (What occurs just before reading the magazines?) overlap to a high degree, which is precisely the experimental support for a chat-template query being an approximate substitute for the real query.

消融研究Ablation studies

Proxy query 类型(Table 4):真实用户 query 明显优于 query-agnostic 方法(尤其在 multi-detail 任务上),说明在不知道问题的情况下保留所有细节确实更难;而"chat template query"与人工设计的"generic text query"表现相近(66.9 vs 66.7,All 指标),验证了 chat template token 隐式承担了通用 query 的作用。Type of proxy query (Table 4): a real user query is clearly better than query-agnostic methods (especially on multi-detail tasks), showing that retaining every detail without knowing the question is indeed harder; meanwhile the "chat template query" performs comparably to a hand-designed "generic text query" (66.9 vs 66.7 on the All metric), verifying that the chat template token implicitly takes on the role of a generic query.

KV 合并策略(Table 5):任何形式的帧级合并都优于不合并(No Merging All=65.6);StreamMem 的加权合并(66.9)优于 LiveVLM 式的简单平均合并(66.3)。KV merging strategy (Table 5): any form of frame-level merging is better than no merging (No Merging All=65.6); the weighted merging of StreamMem (66.9) is better than LiveVLM-style plain average merging (66.3).

输入帧过滤阈值(Table 6):δ=0.95 是效果最好的"sweet spot"(All=66.9),过滤本身相比不过滤(65.4)稳定带来提升。Input frame filtering threshold (Table 6): δ=0.95 is the best-performing "sweet spot" (All=66.9), and filtering itself brings a stable improvement over no filtering (65.4).

04 Limitations

说明:论文正文没有单独的 "Limitations" 小节;以下第 1、3 条基于实验结果和方法设计中的讨论直接归纳(论文中有明确讨论/数据支撑),第 2 条为根据方法设计推断。Note: the body of the paper has no separate "Limitations" section; items 1 and 3 below are summarized directly from the experimental results and from the discussion within the method design (with explicit discussion/data support in the paper), while item 2 is inferred from the method design.
Query-agnostic 方法在细节类任务上仍明显弱于 query-aware(stated,基于 Table 4)Query-agnostic methods remain clearly weaker than query-aware ones on detail-oriented tasks (stated, based on Table 4)

消融实验显示,使用真实用户 query 做 KV 压缩的效果显著优于任何 query-agnostic 方案,"especially in 'multi-detail' tasks, showing the challenge for query-agnostic methods to retain all the details required to answer the question without knowing the question during video processing." 这说明 StreamMem 在需要精确细节(如动作计数、顺序)的任务上仍有明显天花板。The ablation study shows that using a real user query for KV compression is significantly better than any query-agnostic scheme, "especially in 'multi-detail' tasks, showing the challenge for query-agnostic methods to retain all the details required to answer the question without knowing the question during video processing." This means that StreamMem still has a clear ceiling on tasks that require precise details (such as action counting and ordering).

并非在所有 benchmark/子集上都是最优(stated)Not optimal on every benchmark/subset (stated)

论文明确指出 "StreamMem outperforms the baselines on all benchmarks except the 'long' subset of VideoMME for Qwen2-VL-7B.";在 RVS-Ego/RVS-Movie 上,InfiniPot-V 在部分指标(如 RVS-Ego Acc)也优于 StreamMem。The paper states explicitly that "StreamMem outperforms the baselines on all benchmarks except the 'long' subset of VideoMME for Qwen2-VL-7B."; on RVS-Ego/RVS-Movie, InfiniPot-V is also better than StreamMem on some metrics (such as RVS-Ego Acc).

YaRN 缩放因子需要针对每个 MLLM 手动调参(stated,基于 Table 7 与超参附录)The YaRN scaling factor has to be tuned manually for each MLLM (stated, based on Table 7 and the hyperparameter appendix)

不同 backbone 需要不同的 YaRN λ(LLaVA-OneVision λ=8,Qwen2-VL λ=2,Qwen2.5-VL λ=1),论文的附加实验(Table 7)也显示"the performance can be sensitive to different values of the YaRN scaling factor",λ=4 和 λ=8 在不同子任务(holistic vs. single/multi-detail)上互有胜负,说明该超参并非一次性设定即可迁移,需要针对模型的默认上下文长度重新调试。Different backbones need different YaRN λ (LLaVA-OneVision λ=8, Qwen2-VL λ=2, Qwen2.5-VL λ=1), and the additional experiment of the paper (Table 7) also shows that "the performance can be sensitive to different values of the YaRN scaling factor": λ=4 and λ=8 trade wins across different sub-tasks (holistic vs. single/multi-detail), showing that this hyperparameter cannot be set once and transferred, but has to be re-tuned against the default context length of the model.

依赖轻量输入过滤与固定的每层 KV 预算分配(inferred)Depends on lightweight input filtering and a fixed per-layer KV budget allocation (inferred)

输入帧过滤基于视觉编码器 embedding 的余弦相似度阈值 δ,论文并未讨论该阈值在不同视频类型/编码器上的普适性;同时 "memory budget is even distributed across all layers",这一均分策略是否对所有网络深度都最优,论文也未做进一步分析,属于方法设计上可推断的局限。Input frame filtering is based on a cosine-similarity threshold δ over vision-encoder embeddings, and the paper does not discuss how universal that threshold is across different video types/encoders; at the same time, "memory budget is even distributed across all layers", and whether this even-split strategy is optimal for all network depths is not analyzed further either, which makes it an inferable limitation of the method design.