Editable Video Context: Mid-Context KV-Cache Reuse for Context-Managing Video LLMs
Dayu Wang, Shasha Xu
cs.CV, cs.AI
2026-11-09
Suffix Cache Reuse extended to video LLMs: one M-RoPE rotation reuses surviving KV, rebuild latency down 41%, 97.4% answer agreement; the model's own segment picks don't help.
Long videos do not fit a VLM's context at useful frame rates. Uniform sparse sampling is the default and a few-second event in an hour of footage is easily missed. Agentic systems retrieve frames through external tool loops; streaming systems keep or retrieve KV as video arrives. Context Language Models proposed a simpler interface: the model edits its own context like a file, and Suffix Cache Reuse (SCR) makes mid-context edits cheap for text by re-rotating the cached keys of surviving tokens instead of recomputing them. This paper asks whether the recipe survives the jump to video VLMs, where visual tokens dominate the context, positions are three-dimensional (M-RoPE), and a vision encoder adds a second large cost to every recomputation.
A video becomes 32 timestamped segments, each first sampled at 8 frames (23,549 tokens, about 72% of a 32K budget). Round 1, localize: the model names up to 3 segments likely to contain the answer (pre-filling the reply with "[" raises the parse rate from 81.4% to 99.6%). The edit: selected segments are re-decoded at 32 frames (4x frame rate), unselected even-numbered segments are deleted. The rule is deliberately mid-context, segment 2 is deleted unless selected, so every survivor after s1 shifts position and prefix caching saves nothing. Round 2: answer on the edited context.
The key observation is that Qwen2.5-VL's M-RoPE assigns each token a (temporal, height, width) triple, and when a whole segment moves, all three components shift by the same integer Δ. Rotations compose, so a cached, already-rotated key needs only one more multiplication by R(Δ) to land at its new position; values are untouched and no ViT pass is needed. This is exact at layer 0 (relative error 0.0030 in bf16, versus 0.055 for copying keys without rotation) and approximate deeper, as in CLM. Before each relocation the code asserts, via the model's own position routine, that Δ is constant across all components; there were 0 failures in the runs. A SHA-256 content-hashed cache of ViT outputs makes survivors free on the vision side, and at most K=6 survivors are relocated while the rest are prefilled.
On 720 synthetic V-NIAH questions (full-screen word cards inserted into three public-domain films, 4-way choice):
| Rebuild path | Prefill tokens | ViT frames | Latency | Answer agreement |
| Full recompute | 17,361 | 190 | 7.20 s | — |
| Prefix reuse | 16,571 | 182 | 8.09 s | 98.5% |
| SCR-VL | 12,191 (+4,380 moved) | 70 | 4.26 s | 97.4% |
Compute falls 37% (263 vs 416 TFLOPs) and end-to-end latency 41%. Prefix reuse saves almost nothing because the edit lands right after segment 1, exactly the case SCR targets.
The edited context itself is valuable: an oracle edit that densifies the true segment lifts accuracy from 52.2% to 96.9% (at 60 minutes, 38.8% to 91.7%). But when Qwen2.5-VL-7B picks segments itself, accuracy is 49.6%, below the no-edit 52.2%. The card is absent from the sparse sample in 62.9% of questions, and there the selection contains the needle segment only 6.8% of the time; localization mostly succeeds when the answer was already visible. When the pick is right (n=210), edit-full scores 97.6%. At a 64K budget the model collapses to the same segment (17) on 79.2% of questions and editing drags accuracy from 61.7% to 53.3%. On 180 Video-MME long-video questions all conditions sit at 54-56%, with SCR-VL agreeing with full recompute on 96.1% and prefilling 32% fewer tokens.
One honest wart: LLM-only time is 1.67 s for SCR-VL versus 1.46 s for full recompute, because the HuggingFace implementation needs explicit masks and chunked calls when prefilling on top of an existing cache. The end-to-end win comes entirely from the ViT cache, and whether a paged-attention engine removes the LLM-side overhead is untested.
This gives video agents a cheap "change your mind" primitive. Any mid-context edit previously forced recomputation of everything after the first changed block; here one rotation per surviving segment suffices, and the shared-offset property of M-RoPE is directly usable by anyone building long-video inference systems. The content-hashed ViT cache is independently useful. The catch is that localization is unsolved: a 7B VLM rarely finds a needle the sparse pass missed, so the end-to-end gain currently exists only under oracle edits. This is a mechanism validated, not a capability delivered.
The authors list seven, the heaviest being: the approximation is exact only at layer 0 and its effect on long generations is unmeasured; one model, one edit rule, one prompt; the main benchmark is synthetic, and an inserted title card is far easier to spot than a natural event; latencies come from a HuggingFace implementation on a shared machine. One more reading: model-selected edits lower accuracy at 40 and 60 minutes and at the 64K budget, so with the current 7B localizer, "editable video context" spends compute without buying accuracy until localization is fixed, likely through training or better prompting, which the authors leave open.