# Fast and Adaptive Visual Memory for Video and World Models

> CodecMem stores motion-compensated crops where its prediction fails, replacing dense attention to old frames. Across three memory tasks, it ranked first among 12 compressed-memory baselines; at 30 seconds it used 18× fewer inference FLOPs than dense attention.

- arXiv: https://arxiv.org/abs/2612.04174
- Authors: Liyuan Zhu, Chao Liu, Julius Berner, Tao Sun, Ying Shen, Shengyu Huang, Tianye Li, Amrita Mazumdar, Rafał Karp, Enting Liu, Haithem Turki, Gordon Wetzstein, Iro Armeni, Shalini De Mello, Alex Trevithick
- Published: 2026-12-03
- Topic: Generative models
- Visual carousel: https://instaxiv.com/p/2612.04174
- Explanation by InstaXiv, a secondary educational summary. Cite the original paper for exact results. InstaXiv is not affiliated with or endorsed by arXiv or Cornell University.

## A video codec that stores where prediction breaks

**18×** fewer inference FLOPs vs dense attention (30s)

## A complete video history has a growing price

**Dense attention:** At one minute, dense attention in a 33B video model needs 334 GiB of KV cache; the 18× result uses a separate 30-second Wan2.1-T2V-1.3B reference test.

**Other memory designs:** Fixed-size summaries may lose distant detail; retrieval keeps history but exposes only selected frames or tokens to each generation.

The goal: cheap reads, complete access to the past.

## CodecMem predicts each window, then stores the miss

![Figure 1](https://cdn.instaxiv.com/figures/2612.04174/figure1.webp)

It keeps the full sink frame, warps its previous reconstruction to predict each window, then stores tubelets where prediction error remains. (Figure 1)

## How the codec chooses what to remember

1. **Predict from reconstruction**: Flow warps the previous reconstruction; one first-frame estimate is reused for the four-frame window, assuming constant motion.
2. **Score multiscale tubelets**: Tubelets are spatial crops across a window; 32, 64, 128 and 256-pixel candidates compete by error removed.
3. **Choose greedily, then stop**: Greedily add the candidate that removes most error; stop at the cap or when the PSNR gate clears.

## How the generator reads compressed visual history

1. **Keep the live anchors**: The sink frame and latest chunk stay dense; older history becomes codec tokens.
2. **Encode selected crops**: A frozen VAE's latents are cropped and pooled to one size; scale and position mark each token's coverage.
3. **Attend to old context**: Each new chunk reads the sink, old codec tokens and recent chunk; cached keys and values are reused.

## Tubelets and scale cues both matter

| Method | Reconstruction PSNR |
| --- | --- |
| Motion + residual | 22.53 |
| Without scale embedding | 23.41 |
| **Full model** | **25.45** |

_Codec reconstruction ablation on 64 held-out SpatialVID clips; same Wan2.1-T2V-1.3B SFT setup._

## Memory spending tracks how much video changes

![Figure 8](https://cdn.instaxiv.com/figures/2612.04174/figure8.webp)

Across 100 ten-second egocentric clips, x is mean pixel change and y is token share of dense attention. With no cap, median use climbs as content changes faster. (Figure 8)

## The benchmark isolates three kinds of visual memory

![Figure 2](https://cdn.instaxiv.com/figures/2612.04174/figure2.webp)

Retrieval rebuilds a marked 4-second clip from 60 seconds; tracking follows a hidden ball through more cup swaps than training; spatial memory renders a revisited 3D view. (Figure 2)

## Near-dense quality with fewer inference FLOPs

| Method | Retrieval fg-PSNR | Track extrap. (%) | Spatial PSNR | Infer. FLOPs (PF) |
| --- | --- | --- | --- | --- |
| Dense attention | 22.09 | 85.2 | 20.12 | 5.73 |
| MosaiChunk | 15.76 | 31.9 | 16.36 | 1.95 |
| WorldKV | 7.16 | 81.4 | 19.19 | 1.87 |
| MemLearner | 7.52 | 18.9 | 20.29 | 0.28 |
| **CodecMem** | **21.15** | **90.8** | **19.97** | **0.32** |

_Table: compressed baselines match task budgets. FLOPs: Wan2.1-T2V-1.3B, 30-s history; counts include prefill, selection and 4 steps._

## Robot policies can reuse the whole episode

**Keyframe baseline:** On closed-loop RoboMME memory tasks, a Cosmos 3 Nano policy with 32 evenly spaced keyframes scores 28.8% average success.

**CodecMem:** With codec memory, the same policy scores 71.3%, ahead of RTP (48.6%) among WAMs; SimpleMemVLA scores 88.3% on the full public board.

## The same memory helps preserve long-video continuity

![Figure 6](https://cdn.instaxiv.com/figures/2612.04174/figure6.webp)

Three causal Wan2.1-T2V-14B variants differ only in history, on 15-second clips. CodecMem beats the no-codec twin on temporal, visual and subject scores across segments, but trails both on text alignment. (Figure 6)

## Where this memory can waste or misallocate tokens

- **No long-term deduplication**: Because prediction uses only the previous reconstruction, content that leaves and returns is encoded again.
- **Task-blind scoring**: Greedy pixel-error scoring is task-blind; high-error detail may not matter to a later task.

Best used when: Useful when redundant history is costly but old views matter; task-specific selection may need extra signals.

## Key takeaways

- CodecMem's 1.5 average task rank leads 12 compressed-memory baselines.
- Use adaptive memory when redundant visual history still matters for future actions or generations.
- How should memory select future task-relevant details, beyond what prediction currently misses?

## Links

- arXiv: https://arxiv.org/abs/2612.04174
- PDF: https://arxiv.org/pdf/2612.04174
- Project page: https://research.nvidia.com/labs/amri/projects/codecmem/

## Citation

```bibtex
@article{zhu2026fast,
  title   = {Fast and Adaptive Visual Memory for Video and World Models},
  author  = {Zhu, Liyuan and Liu, Chao and Berner, Julius and Sun, Tao and Shen, Ying and Huang, Shengyu and Li, Tianye and Mazumdar, Amrita and Karp, Rafał and Liu, Enting and Turki, Haithem and Wetzstein, Gordon and others},
  journal = {arXiv preprint arXiv:2612.04174},
  year    = {2026},
  url     = {https://arxiv.org/abs/2612.04174}
}
```
