A 9B Model That Reads Week-Long Video Memory with Code Beats GPT-5 by ~20 Points on EgoLifeQA

Programmatic Multimodal Memory: Learning to Read Long Videos with Code

Xuanming Shang, Yuhang Han, Yan Shu, Dingning Liu, Li Ding, Tao Qiang, Zhiqi Shao, Zequn Yang, Yanfeng Wang

cs.CV

2026-11-30

PMM keeps video memory unconsolidated and trains a 9B Root model to search it with code; it averages 72.70% on five benchmarks, 12.1 points above its zero-shot version.

What problem this solves

Questions like "who bought the blueberries?" over hours or days of footage hinge on a few seconds of evidence in a recording far longer than any model can read at once. Most memory systems decide what matters at write time: they compress the video into memory banks, graphs or entity stores before any question exists. The writer cannot know whether a future question will be about a week-long habit or a passing glance, and whatever it drops is gone.

The other route, searching raw frames from scratch per question, gets too costly as recordings grow.

The authors first run a controlled check on 484 EgoLifeQA questions with annotated evidence. Single-round retrieval over plain 30-second captions already matches the consolidated memory of WorldMM, and adding raw frames of the retrieved segments gives another 5.1 points. But top-10 retrieval recalls under 40% of the evidence, and widening to top-50 multiplies visual cost fivefold while still missing nearly 40%. Unconsolidated memory works, but it needs adaptive, multi-step search.

Method

PMM (Programmatic Multimodal Memory) has a write phase and a read phase.

Writing happens once and is question-agnostic. A frozen VLM (Qwen3.8-27B) captions each 10-second window with timestamps. Coarser layers (30 s, 3 min, 10 min, 1 h) are summarized from text alone, each merging only contiguous windows below it, so every record still maps back to raw frames. A transcript layer holds speech. There is no graph and no embedding index; any retrieval structure is computed by the reading program.

At read time the memory sits in a persistent Python REPL as a variable rather than in the prompt, following Recursive Language Models. The Root model writes code each turn and sees only what the code prints. Three kinds of operation are available:

A typical trajectory greps the 1-hour layer for "blueberry", reads the matching hour at 30-second resolution, then sends three candidate windows to one see call to find who took the box. The 7.1M-character memory never enters the prompt; the Root's last-turn input is 10.8K tokens.

Only the Root (Qwen3.5-9B) is trained. SFT uses DeepSeek-V4.1-Flash teacher trajectories, keeping only those that answered correctly, ran cleanly, and actually observed the annotated evidence interval, so the student cannot learn to guess. RL is GRPO with a binary answer-correctness reward and no term for format, tool use or cost. A second stage trains on 108 questions the first stage made learnable.

Results

Five benchmarks: EgoLifeQA, HippoVlog, MLVU, LongVideoBench, VideoMME Long.

System5-benchmark avgNote
PMM-9B zero-shot60.62starting point
PMM-9B SFT68.84+8.22
PMM-9B SFT+RL72.70+3.86 more
PMM with DeepSeek Root (no training)75.82best overall
GPT-569.78direct frames
Gemini 2.5 Pro66.48direct frames
DVD (best training-free agent)63.62
M3-Agent54.82write-time consolidation

On week-long EgoLifeQA, PMM-9B scores 68.4%, 19.8 points above GPT-5 and 22.0 above Gemini 2.5 Pro. On HippoVlog it scores 80.8%, ahead by 5.1 and 8.8. Proprietary models still lead on MLVU, which the authors attribute to shorter videos that uniform frame sampling covers well.

PMM-9B uses 158K input tokens per question. Open-source baselines using more tokens are all less accurate; those using fewer score at least 16.6 points lower (for example LongVideo-R1 at 54.64% with 77K).

Ablations (DeepSeek Root, 1,000-question subset): removing external memory costs 15.92 points and raises input from 118K to 315K tokens. Packing memory into a 32K prompt costs 4.89 points. Single-call JSON tools trail code by 1.36 to 2.30 points. Under a 10-turn cap, adaptive search beats a fixed coarse-to-fine pipeline by 5.89 points with fewer tokens (71K vs 95K). Accuracy climbs from 60.81% at 2 turns to 76.38% at 20.

Why it matters

This is a direct counterexample to write-time consolidation. With the same Root and submodel, an uncompressed memory read by code beats WorldMM, HippoMM and M3-Agent even before any training. Keep the memory plain and put the intelligence on the reading side.

Three practical takeaways: localize in text first and look at frames only for a few windows; loop and batch inside one code block instead of one tool call per turn; and spend training effort on the Root, since swapping the submodel from 8B to 27B adds 0.22 points under DeepSeek while swapping the Root from 9B to 27B adds 13.18.

The contribution is largely an assembly: the REPL paradigm, GRPO and distillation are existing parts, and the new piece is wiring them to a time-aligned multi-scale memory.

Limitations

Terms

Source

Related papers

All paper explainers