KeyMem: Time-occupancy control for robust memory in streaming VideoLLMKeyMem: Temporal Occupancy Control for Robust Streaming VideoLLM Memory
The authors propose KeyMem, which adds a temporal quota and optional keyed sampling to the KV memory of streaming VideoLLMs; the authors report raising the worst accuracy of the attention strategy from 42.2% to 79.4% on Qwen2.5-VL-7B.
The attacker inserts natural video segments into the stream (for example, pointing the screen at a body camera) to make the model forget earlier content; per Kerckhoffs's principle the attacker knows the model, base strategy, budget, quota, bucket grid and all hyperparameters, and can simulate memory offline, but cannot modify pixels after capture, query the deployed system or observe its answers.
- Streaming VideoLLMs have limited visual token memory, and score-based eviction lets content decide the memory share of each time period: a short high-score segment can take up most of the cache, crowding out old evidence needed for later questions, and an attacker can deliberately choose such natural footage.
- KeyMem is a training-free wrapper layer: it rank-normalizes any base score, divides the time axis into fixed-duration buckets and sets a hard cap on the number of tokens retained per bucket, and optionally uses a key for Gumbel-top-k sampling; the decide-once variant lets each token draw a random perturbation only once in its lifetime.
- On the 80 s coverage streams constructed from UCF101, the temporal quota raises the worst accuracy of the attention policy under the 8 s budget from 42.2% to 73.3%–76.1%, and surpasses InfiniPot-V on two models; the secret key yields gains only under the adaptive attacker, and decide-once mitigates the problem on long streams where old evidence is eroded by repeated draws.
- The authors note: the coverage evaluation has only one action question per segment, StreamingBench tests only a single budget for Qwen2.5-VL-7B, other model families and OVO-Bench are untested, the adaptive study covers only one model, and the published rules share one retained set across all layers.
- Evaluated models
- Qwen2.5-VL-3BQwen2.5-VL-7BLLaVA-OneVision-7B
- Benchmarks
- UCF101StreamingBench
- Metrics
- AccEarly AccWorst AccResExcess
The researchers propose a training-free method, KeyMem, that partitions a video stream into fixed-duration time buckets and limits the number of visual tokens that can be retained per bucket, preventing salient segments in a streaming VideoLLM's memory from crowding out the cache and displacing evidence needed later. The paper points out that score-based eviction lets the video stream decide its own temporal occupancy: on Qwen2.5-VL-7B, embedded subtitles within 20 seconds occupy 84% of the 8-second memory capacity, reducing all-segment accuracy from 79.4% to 58.3%. Across 5 natural pressure sources, 3 VideoLLMs and 2 memory budgets, temporal quotas raise the worst-case accuracy of attention-based retention strategies under smaller budgets from 42.2% to 73.3–76.1%, and exceed InfiniPot-V by 6.1–16.7% on 2 of the 3 models. Under an adaptive attacker, keys retain 4.4–9.5% more early-segment accuracy than leaked keys, but do not consistently outperform the best deterministic quota; the paper holds that temporal allocation is the primary robustness control, with secrecy used to counter adversarial predictability.
Paper analysis
What problem does this paper attempt to solve?
The authors argue that score-based eviction lets video stream content decide memory occupancy by itself, and propose KeyMem with a hard temporal quota and optional keyed sampling.
Core problem: score-based memory eviction in streaming VideoLLMs lets stream content decide the temporal occupancy of each period by itself, and a short high-scoring stretch can monopolize the cache and crowd out old evidence needed by later questions.
- Setting and importance: streaming VideoLLMs (watching a body camera, livestream, or surveillance feed and answering questions at any time) keep a bounded visual token memory in the KV cache, and evict by score on attention, value norm, or redundancy as each segment arrives. The authors state that a short but "busy" segment can take most of the memory: with Qwen2.5-VL-7B and 8 s of memory, a 20 s burned-in caption segment occupies 84% of memory, and full-segment accuracy drops from 79.4% to 58.3% (Figure 1).
- Shortcomings of existing methods: the authors state that score-based retention has no temporal occupancy control; first, the ranking of policy quality does not transfer across models (attention is strongest on Qwen2.5-VL-3B and weakest on 7B), and second, captions, fast cuts, flicker, and similar footage raise the scores of many tokens at once and crowd out old evidence.
- Core observation: the authors analogize this problem to side-channel attack and defense on processor caches—partitioned caches bound each domain's share, and randomized caches map addresses with a key—and bring these two ideas to VideoLLM token memory respectively.
- Proposed: KeyMem, a training-free wrapper layer that rank-normalizes any base score, sets a hard cap by fixed-duration buckets, and optionally applies keyed sampling; the authors prove that the hard cap bounds a segment's memory share from its first chunk.
- Threat model:
- Goal: make the model forget what happened earlier (erase evidence of earlier segments).
- Knowledge: per Kerckhoffs's principle, the attacker knows the model, base policy, budget, quota, bucket grid, and all hyperparameters, as well as the earlier footage and the question.
- Capability: insert natural footage into the stream (e.g., point a screen at the camera), and can simulate memory offline to choose segment content and insertion timing; cannot modify already-captured pixels, cannot query the deployed system, and cannot observe its answers.
- Victim system: a streaming VideoLLM with a KV cache memory eviction policy.
What related research exists?
The paper groups related work into three categories: streaming VideoLLM memory, KV cache eviction and robustness, and video model robustness, and draws on processor cache defenses.
Memory mechanisms of streaming VideoLLMs
- InfiniPot-V [32] compresses the cache using temporal redundancy and value norms; StreamMem [72] scores with generic query tokens; StreamingVLM [70] keeps attention sinks and a short window; HERMES, StreamingTOM, MuKV, LiveVLM and others improve scoring, granularity or layout.
- DeltaS [35] gives equal budgets to equal-length segments of elapsed time, but the paper points out that its unused share goes to the globally highest-score tokens, and no segment has a hard cap.
- ProtoKV [38] notes that a brief key clue may be evicted long before the question arrives.
KV cache eviction and its robustness
- Eviction in text LLMs includes sink tokens plus a recent window, accumulated attention (H2O, SnapKV), observation windows, and per-head or per-layer budget allocation; visual token reduction follows the same pattern.
- Nexus Sampling [21] replaces top-k with weighted reservoir sampling, giving every token with positive weight a chance to survive at each step; VaSE [13], Random attention [64], error certificates [69] and others also study random eviction. The paper points out that none of these works keys the randomness or limits the share occupied by a period of time.
- On the security side: RobustKV [30] evicts jailbreak content, Hossain et al. [28] corrupt the cache's keys, Dobre et al. [20] state that adversarial images can still act through the cache after leaving the context, and Song et al. [58] state that shared caches lose the provenance of entries.
Robustness of video models
- Natural perturbation benchmarks extend from ImageNet-C to action recognition, video-language models and multimodal LLMs; the paper borrows two of these corruptions (Gaussian noise and blur).
- Adversarial work treats the temporal pipeline of video models itself as an attack surface, including style perturbations, frame sampling that hides harmful content, and stress tests that induce repetitive outputs.
Processor cache defenses (source of ideas)
- Prime+Probe and Evict+Time show that controlling which lines enter a shared cache means controlling which lines are evicted; hardware-side responses are partitioned caches (limiting each domain's share) and randomized caches that map addresses with a key, and KeyMem introduces each of the two as a layer.
Baselines and benchmarks: the published retention rules compared are InfiniPot-V and Nexus Sampling, and the temporal quota baselines are equal spans (imitating DeltaS) and cap only; evaluation uses 80 s coverage streams constructed from UCF101 and StreamingBench. The authors position the paper's difference: Table 1 shows that existing rules have no hard temporal quota, no key, and have not been evaluated with content selected by a simulated eviction rule, whereas KeyMem has all three.
How does the paper address this problem?
KeyMem rank-normalizes any base score, sets a hard cap by fixed-duration buckets, optionally applies keyed Gumbel-top-k sampling, and has a decide-once variant.
The overall idea is to bring the quota of partitioned caches and the keyed eviction of randomized caches, each as one layer, to the token memory of VideoLLMs, called KeyMem: the first layer is a hard temporal cap for temporal occupancy control, and the second layer is optional keyed sampling that makes survivors unpredictable.
Problem setup
- A streaming VideoLLM receives frames by chunk, and after each chunk appends the keys and values of the new visual tokens to the KV cache; Mt is the set of visual tokens held after chunk t, B is the token budget, and system and text tokens are never deleted and are not counted in B.
- When the number of candidates nt exceeds B, the retention policy selects B surviving tokens; deleted tokens are gone permanently because the stream does not store them.
- Goal: training-free, able to wrap any score-based policy, with negligible overhead, and bounding the memory share of any short segment for any content; a secondary goal is to make retention outcomes unpredictable to an observer without the key.
Rank normalization and hard temporal cap
- Raw scores of different policies have different scales, and a few extreme scores would dominate any rule that uses scores directly, so each score is replaced by its normalized rank among the nt candidates, ui = rank(si)/(nt − 1) ∈ [0,1], with ties taking the average rank; a pile of inflated scores therefore carries no more weight than the highest rank.
- The time axis is cut into aligned buckets of W seconds, and each bucket retains at most ⌊ρB⌋ tokens (ρ is the cap ratio); buckets over the cap keep only the ⌊ρB⌋ tokens with the highest ui as candidates. This is executed after every chunk, including when memory is still under budget.
- Occupancy guarantee (Proposition 1): the number of tokens of a segment of length L seconds in Mt never exceeds (⌈L/W⌉+1)⌊ρB⌋, independent of content and random draws, and holds from the first chunk.
Keyed sampling and survival guarantee
- From the candidate set Et, mt = min(B, |Et|) are retained using the Gumbel-top-k trick: each candidate gets a perturbed score zi = ui/τ + gi, where gi is Gumbel noise and the uniform variable ξi is produced by a pseudorandom generator seeded by a hash of the key κ, the epoch ⌊t/R⌋, and the chunk index t.
- This sampling is equivalent to Plackett-Luce sampling without replacement with weights wi = e^{ui/τ}; τ directly sets the maximum advantage of any token over another, with small τ closely following the base policy and large τ approaching uniform random. The seed changes every round while the key is fixed, so someone without the key cannot predict the survivors.
- Survival guarantee (Proposition 2): when n candidates compete for m slots, the per-round eviction probability of any candidate token has an upper bound (Equation 3); under the setting B = 512, ⌊ρB⌋ = 96, W = 10 s, chunk 4 s, each candidate token survives each round with probability at least 16.1%, regardless of its score.
Decide-once variant
- Redrawing every round erodes old evidence on long streams: a token that survives this round still faces eviction next round. decide-once keeps the rank, the cap, and the perturbed score, but ξi is taken from a hash of the key and the token identifier, so each token gets only one perturbation in its lifetime.
- Proposition 3 gives its per-round eviction bound under the assumption that ranks are unchanged; the authors note that ranks of real policies do change, and the proposition only explains the mechanism. On 200 s streams this bound gives a survival probability of at least 4.1%, whereas multiplying KeyMem's per-round bounds gives less than 10⁻⁵.
Boundaries of the guarantees and comparison of rules
- The authors state explicitly: all three propositions concern only memory occupancy and do not guarantee answer accuracy; Proposition 1 fails when (⌈L/W⌉+1)⌊ρB⌋ ≥ B, and Proposition 2 covers only candidates that pass the cap and holds per round, decaying geometrically over k rounds.
- The three temporal occupancy controls make different promises: the hard cap limits the share only by segment length and holds from the first chunk; equal spans gives each old segment a floor of B/8 but segments grow longer as time passes, so a burst in a young stream can occupy most of memory; DeltaS's soft quota has no cap.
- Default hyperparameters: τ = 0.5, R = 8, W = 10 s, ρ = 0.1875, selected from 12 training-split validation streams (Appendix B); cap only sets τ = 0.01 to approximate deterministic top-k.
What experiments did the paper conduct?
Three VideoLLMs, two budgets, five natural stress segments plus an adaptive attacker; the authors claim the temporal quota eliminates concentrated failure and the key is useful only against the adaptive attacker.
Experimental setup
- Models tested: Qwen2.5-VL-3B, Qwen2.5-VL-7B, LLaVA-OneVision-7B, with chunks of 4 s; budget B corresponds to 8 s or 16 s of video (512/1024 tokens on Qwen, 3136/6272 on LLaVA-OneVision), with full memory as a reference.
- Coverage benchmark: from the UCF101 test split, the first 10 s of each of six action classes are concatenated into an 80 s stream, with a 20 s stress segment inserted after the third segment; each segment has one five-choice action question, evaluated cyclically and averaged over five option orders, for 30 test streams in total.
- Stress segments: calm (the calmest tenth), motion (the busiest tenth), cuts (20 1 s shots), text (burned-in captions), flicker, shake; two corruptions, Gaussian noise and blur, are reported separately. None of the stress segments was optimized against a model or policy.
- Policies: three base policies, attention, value, merge, each combined with equal spans, cap only, KeyMem, decide-once; the published rules InfiniPot-V and Nexus Sampling, plus sliding window and uniform random as references.
- Metrics: Acc (full-segment accuracy), Early Acc (accuracy on the first three segments of the stress segment), Res (segment token retention rate), Worst Acc (the minimum across models or stress types), Excess (the drop in Early Acc under attack for a defense minus the drop for full memory); parentheses give 95% paired bootstrap intervals (10,000 resamples).
- Adaptive attacker: Qwen2.5-VL-7B, B = 512, all 30 streams; 16 natural candidate segments × 2 start times, 32 choices in total, using memory scores from offline simulation; the token objective is the surviving tokens of the first three segments, and the answer objective sums the margin of the correct option; the key defense uses 3 defender keys, and the attacker simulates with its own 3 keys.
Main results
Table 2 (8 s budget, Worst Acc is the minimum over the five stress segments, in %):
Swipe horizontally to read the table
Model Base policy Base Worst Acc +Equal spans +Cap only +KeyMem Qwen2.5-VL-3B Attention 70.6 73.3 77.8 76.1 Qwen2.5-VL-3B Value 53.3 53.3 55.6 52.8 Qwen2.5-VL-3B Merge 69.4 73.3 68.3 72.8 Qwen2.5-VL-7B Attention 42.2 80.0 78.3 79.4 Qwen2.5-VL-7B Value 58.3 79.4 75.0 77.2 Qwen2.5-VL-7B Merge 79.4 81.7 83.9 82.2 LLaVA-OneVision-7B Attention 43.3 74.4 76.1 75.6 LLaVA-OneVision-7B Merge 75.0 74.4 74.4 70.6 (According to Table 2; the value row for LLaVA-OneVision-7B is omitted, and its Worst Acc is 65.0/70.0/71.1/71.1.)
- The authors state that the ranking of base policies does not transfer across models: attention is 75.0% on calm streams for Qwen2.5-VL-3B and drops to 45.6% on 7B, close to sliding window.
- The authors state that limiting temporal occupancy eliminates concentrated failure, regardless of which quota is used: averaged over the nine model×base-policy combinations, Worst Acc is 73.3% for equal spans, 73.4% for cap only, and 73.1% for KeyMem, versus 61.8% for the base policies; all 18 paired intervals comparing KeyMem with the two deterministic quotas contain zero (Appendix H).
- Exceptions: quotas do not fix policies that are weak in themselves—value remains at 52.8%–55.6% under every quota on Qwen2.5-VL-3B; KeyMem lowers the Worst Acc of merge on LLaVA-OneVision from 75.0% to 70.6%.
Comparison with published rules (Table 3)
- Under the 8 s budget, InfiniPot-V's Worst Acc is 60.0% (3B), 67.2% (7B), 63.9% (LLaVA); on Qwen2.5-VL-7B it trails all nine quota×base-policy combinations by 7.8%–16.7% (all intervals above zero), and on LLaVA-OneVision-7B it trails by 6.1%–12.2% (six of the nine intervals above zero, three ending at zero).
- Counterexample: on Qwen2.5-VL-3B, InfiniPot-V leads the value-based quotas by 4.4%–7.2% (Appendix K Table 15).
- Nexus Sampling's Worst Acc is only 32.8%–43.3%; the authors explain that it weights blocks by attention mass, and in video attention mostly falls on the newest chunk. Under the 16 s budget, InfiniPot-V is 70.0%–72.8% and Nexus is 50.6%–63.3%, both below KeyMem+attention's 77.8%–80.6%.
Cost of burst position and the cap (Table 4, Figure 4)
- Moving the 20 s caption segment to different positions in the stream: the peak share of rules with a cap does not exceed the bound of Proposition 1 (37.5%), while equal spans lets that segment occupy 68.5% after the first segment and 27.1% after the fifth, with base policies reaching 74.3%–95.3%.
- Cost: the cap retains no more old evidence than equal spans—cap only and KeyMem trail equal spans in Early Acc at all seven positions (by 3.3%–15.6% and 1.1%–15.6% respectively, with 11 of the 14 paired intervals below zero); the authors state that limiting concentration and retaining old evidence are two independent properties.
Adaptive attacker (Table 5, Figure 3)
- Most of the harm from the answer attack does not require eviction: full memory's Early Acc drops from 86.7% to 64.4%, and the change in Res of the early segments under each quota is no more than 1.0%; the only Excess intervals above zero are for the base value policy, cap only+attention, and KeyMem with a leaked key, while the intervals for the secret key all contain zero.
- Keeping the key secret helps: across the nine key pairs, with KeyMem combined with attention/value/merge, the secret key retains 8.4% [4.3, 13.2], 9.5% [5.2, 14.1], and 4.4% [1.4, 7.8] more Early Acc than the leaked key, respectively; for decide-once it is 2.2%–4.3%. Figure 3 shows that this gap for KeyMem+attention grows from 0.2% with 1 choice to 8.4% with 32 and 13.3% with 64, but all curves still decline—the authors state that the key only slows the harm.
- The secret key is not stronger than the deterministic quotas: KeyMem+attention trails equal spans by 19.4% [12.8, 26.2] and differs from cap only by 0.6% [-4.3, 5.9]; decide-once with the secret key leads equal spans by 8.4% [1.9, 15.3] with value and trails by 14.4% [8.3, 21.0] with attention, and the authors state that the strongest rule depends on the base policy.
Long streams and decide-once (Table 6, Appendix N)
- 200 s streams (18 segments, B = 512 covering only 4%), 15 Qwen2.5-VL-7B streams: after more than 25 rounds of redrawing, KeyMem answers correctly 27.5%, 22.5%, and 17.5% less often than equal spans on old segments of 100 s or more (attention/value/merge).
- decide-once eliminates most of the erosion: on the oldest segments it answers correctly 19.2%, 23.3%, and 12.5% more often than KeyMem; replicated on Qwen2.5-VL-3B 200 s streams and 7B 400 s streams (value, merge).
- Failure case: a 60 s caption segment spans seven buckets, Proposition 1 allows 672 tokens to exceed the budget, and cap only+value drops to 24.1% while equal spans stays at 52.2% (Appendix N Table 23); full-stream caption coverage defeats all temporal rules.
Other ablations and analyses
- StreamingBench (Appendix P): 150 videos, 721 questions, Qwen2.5-VL-7B, B = 2048; full memory 69.3%, sliding window 64.5%; KeyMem raises value by 3.2% [0.6, 5.9], and decide-once shows no clear gain over the base policies.
- Ablation (Appendix I Table 13): removing the cap and keeping only keyed sampling (ρ = 1) drops Early Acc to 26.7% (attention), i.e., without the cap the key does not protect old evidence.
- Sensitivity (Appendix M Table 21): ρ and W have the largest effect—with ρ = 0.5, attention's calm accuracy drops to 57.8%, and with W = 20 s about a quarter of the budget sits idle; varying τ in 0.1–1.5 and R in 1–32 changes results by no more than 6.7%.
- Overhead (Appendix R): for a single retention decision on a single-core CPU, 0.3 ms for Qwen2.5-VL, B = 512, and 13.3 ms for LLaVA-OneVision, B = 3136; the authors state that it adds no visible latency.
- Key-to-key variation (Appendix H Table 12): the three secret keys change Calm and Worst Acc by no more than 3.9%.
What are some points that can be further explored?
In Limitations, the authors list the boundaries of coverage and adaptive research; the experiments cover three models, two budgets and a single attacker setting.
Limitations and future directions noted by the authors
- The coverage benchmark uses only one action question per UCF101 segment, and StreamingBench covers only a single budget for Qwen2.5-VL-7B (Limitations).
- Other model families and OVO-Bench remain untested (Limitations).
- The adaptive study covers only one model (Limitations).
- The published rules (InfiniPot-V, Nexus Sampling) keep only one retained set across all layers of the language model in the comparison (Limitations; Appendix Q explains that ReST-KV's per-layer reconstruction cannot be expressed with a single retained set, so it was not included in the comparison).
Scope of the experiments
- Models tested: Qwen2.5-VL-3B, Qwen2.5-VL-7B, LLaVA-OneVision-7B, 3 in total; the coverage benchmark is 30 80 s test streams, the long-stream experiments are 15 200 s streams (plus 3B 200 s and 7B 400 s), and StreamingBench is 150 videos and 721 questions.
- Stress segments are five natural stresses (calm, motion, cuts, text, flicker, shake) plus two corruptions, Gaussian noise and blur; adversarial pixel perturbations are outside the threat model because an attacker cannot modify pixels after capture (Appendix Q).
- The adaptive attacker searches 32 natural candidate segments on Qwen2.5-VL-7B with B = 512 (64 in some settings, 15 streams), and the key defense uses 3 defender keys × 3 attacker keys; the B = 1024 replication uses only 15 streams and one key pair (Appendix L).
- Statistical tests are 95% intervals from 10,000 paired bootstrap resamples; the paper does not report repeated runs under multiple independent trainings or different random seeds (key-to-key variation from key draws is reported in Appendix H with three keys).
- Hyperparameters τ and ρ were selected from 12 training-split validation streams, and W and R were fixed before the experiments (Appendix B); the paper does not report evaluation on video content outside the UCF101 action classes.
Summarize the main content of the paper
KeyMem uses a hard temporal quota to limit the memory share of any video segment; keyed sampling yields gains only against adaptive attackers that can simulate memory.
A defense paper on the memory robustness of streaming VideoLLMs. The authors argue that score-based KV eviction lets streaming content decide for itself how much memory each time period occupies, so a short high-score segment can monopolize the cache: with Qwen2.5-VL-7B and 8 s memory, a 20 s burned-in subtitle segment occupies 84% of memory, and full-clip accuracy drops from 79.4% to 58.3% (Figure 1).
- Method: KeyMem is a training-free wrapper layer that rank-normalizes any base score, sets a hard cap of ⌊ρB⌋ per 10 s bucket (default ρ = 0.1875), and optionally uses a key for Gumbel-top-k sampling; the authors prove that the hard cap limits a segment's memory share from its first chunk (Proposition 1), and give a per-round survival lower bound for candidate tokens (Proposition 2). The decide-once variant lets each token draw a perturbation only once in its lifetime.
- Natural stress: on 80 s coverage streams constructed from UCF101, with three base strategies and two budgets, the temporal quota raises the Worst Acc of the attention strategy under the 8 s budget from 42.2% to 73.3%–76.1% (Table 2); averaged over nine combinations the three quotas are nearly identical, and the authors state that the protection comes from the occupancy cap rather than keyed sampling.
- Comparison with published rules: under the 8 s budget, the quota combinations exceed InfiniPot-V by 7.8%–16.7% on Qwen2.5-VL-7B and by 6.1%–12.2% on LLaVA-OneVision-7B (Table 3); a counterexample is that on Qwen2.5-VL-3B the value-based quota trails InfiniPot-V by 4.4%–7.2%.
- Adaptive attacks: an attacker who knows the quota and can simulate memory offline can cause harm using natural footage; a secret key retains 4.4%–9.5% more Early Acc than a leaked key (Table 5), but does not consistently outperform the best deterministic quota, and the authors state that the key only slows harm and cannot prevent it.
- Long streams: on 200 s streams, KeyMem answers 17.5%–27.5% fewer correctly than equal spans for old segments over 100 s, and decide-once recovers most of this (Table 6).
- The authors' conclusions: temporal allocation is the primary robustness control, equal spans is the accuracy-oriented default choice, the hard cap suits scenarios that must limit burst share from the first chunk, and the key is reserved for deployments that need to counter attackers able to simulate memory; the authors also emphasize that these guarantees cover only memory occupancy and do not guarantee answer accuracy.