Video Models

Same memory, 39.7 GB down to 5.2 GB: Nvidia and Stanford gave video models an H.264

December 5, 20262 views阅读中文原文
Same memory, 39.7 GB down to 5.2 GB: Nvidia and Stanford gave video models an H.264

On December 2, a paper landed on arXiv with a plain title: "Fast and Adaptive Visual Memory for Video and World Models." Fifteen authors, from NVIDIA and Stanford. First author Liyuan Zhu is affiliated with both.

One number in it is worth pausing on. A 30-second context costs 39.7 GB of KV cache under full attention. Their method needs 5.2 GB. In the same table, inference compute drops from 5.73 PF to 0.32 PF.

The method is called CodecMem. The idea is not complicated: take the H.264 trick of encoding only what changed, and move it into the memory of a video generation model.

This article is based on the arXiv paper (2612.04174v1) and NVIDIA's official project page, cross-checked against reports from AI Weekly and Emergent. All three agree on the core numbers.

TL;DR

  • What it is: a visual memory codec for video and world models. It decides which past frames are worth keeping and in what form.
  • What it fixes: the longer the video, the more history a model has to carry, and that history is what kills memory and compute.
  • Key numbers: first place among 12 compressed-memory baselines at 60 seconds of context, 18x fewer inference FLOPs than dense attention, 5.2 GB of KV cache against 39.7 GB.
  • Can you use it today: the paper and project page are public, but there is no code and no weights, and the license is CC BY-NC-SA 4.0, which rules out commercial use.

That last point matters. This is a research paper, not a product you can sign up for.

What the bill actually looks like

When a video model renders second 60, it still has to remember who appeared in second 1, which side the light came from, whether the cup on the table moved.

The standard approach keeps every token of every past frame in attention. Tokens pile up linearly. The paper cites an earlier estimate: a 33B video model using dense attention over one minute of context needs 334 GiB of KV cache.

Put that in hardware terms. One H100 has 80 GB. A single minute of memory does not fit across four of them.

Existing shortcuts all leak somewhere. Keep only keyframes and fast motion loses detail. Prune by similarity and you cut exactly what you need later. Offload KV to CPU and you trade memory for latency.

CodecMem starts from a different observation: the human eye and H.264 are already doing the same job, spending bits only on what cannot be predicted.

How it works

The encoder takes its own reconstruction of the previous frame, estimates motion with optical flow, and warps that frame forward. Where the warp lands accurately, it stores nothing.

Where the warp fails, it stores multi-scale tubelets. Small spatiotemporal patches. Newly revealed content, violent motion, occlusion boundaries, all of it ends up in those patches.

So a static shot costs almost nothing, and a chaotic camera move costs more. That is close to how your eye behaves. Stare at a blank wall and your brain does not recompute the wall every second.

The paper gives one clean comparison, taken from a world action model input:

Memory typeTokens for a three-camera inputNote
Dense attention11,900every token of every frame retained
CodecMem551only regions where warping fails

A 21.6x gap on the same clip.

The numbers side by side

The main experiment covers retrieval, tracking and spatial memory, with up to 60 seconds of context, against 12 compressed-memory baselines.

MetricDense attentionBest prior baselineCodecMem
Retrieval fg-PSNR22.0915.76 (MosaiChunk)21.15
Tracking extrapolation85.2%81.4% (WorldKV)90.8%
Spatial memory PSNR20.1220.29 (MemLearner)19.97
KV cache (30 s)39.7 GB4.9 GB (DC-Gen)5.2 GB
Inference compute5.73 PF0.28 PF (MemLearner)0.32 PF

Three things stand out. Note that the "1.5" in the paper's table is an average rank, not a cache size. Easy to misread.

Retrieval and spatial reconstruction do not beat dense attention. They come close. Tracking in-distribution is also slightly lower. What actually flips is extrapolation: training saw 1 to 15 cup swaps, testing went to 17 to 20, and CodecMem held 90.8% while dense attention fell to 85.2%. That is the interesting part, because it suggests the model is not just memorizing the training distribution.

The runner-up is not a pushover either. On RoboMME, RTP averages 48.6% success. CodecMem averages 71.3%. That is 22.7 points.

The compute savings are not estimates. The 18x comes from dividing FLOPs in the same table.

How to use it

You cannot pip install this yet. The project page has the paper, method demos and video samples. No repo, no weights.

To reproduce it, the path looks like this:

  1. Start from Wan2.1-T2V-1.3B or 14B. Every ablation in the paper uses those two.
  2. Implement the tubelet codec. Flow is estimated with DIS on grayscale frames at half resolution, with no variational refinement.
  3. Swap the DiT conditioning from full-history tokens to codec memory tokens. Watch the scale embedding and mixed-resolution RoPE. Get either wrong and training collapses.
  4. Cap the memory budget per window. The text-to-video model keeps 12.5% of dense tokens, the retrieval model 6.6%.
  5. Budget 16 GB300 GPUs to start. The world action model runs used 32.

Step 3 is where most teams will stall. The paper devotes a whole subsection to the scale embedding, which tells you this is not a plug-in module.

Who it is for

Three groups should read it.

Teams doing long-form video generation. Subject consistency past 15 seconds is the hard part. On VBench-Long, split into 0-5 s, 5-10 s and 10-15 s segments, CodecMem beats the no-memory control on subject consistency, temporal quality and visual quality in every segment. That is value you can bank now.

People building world models and embodied agents. That 71.3% on RoboMME is not a video quality score. It is a robot completing tasks in a scene, and those tasks live or die on whether the policy remembers what it just saw.

Anyone whose GPU is pinned by KV cache. 5.2 GB against 39.7 GB means the same card handles longer context, or the same context handles more concurrency.

Not a good fit

If text alignment is your priority, wait. The paper says it plainly: among three Wan2.1-T2V-14B variants, CodecMem has the lowest text alignment score. It remembers pictures, not your prompt.

If you need something to run today, this is not it. No code, no weights, non-commercial license. Either wait for a release or implement it yourself.

If you make five-second clips, the gain is small. Memory compression pays off as context grows. A five-second shot barely has any history to carry.

Pitfalls

First: treating 5.2 GB as a universal cache figure. That number assumes a 30-second context and a 12.5% token budget. Change the model or the resolution and it moves.

Second: expecting better image quality. The goal is "don't degrade much," not "make it better." Retrieval and spatial reconstruction both land slightly below dense attention. That is the trade.

Third: ignoring the cost of optical flow itself. The encoder has to run above 100 fps to avoid becoming the bottleneck. The full model hits 126 fps on a single H100, but only at the resolution they tested.

Fourth: reading CC BY-NC-SA 4.0 as a commercial license. That covers the paper, not code. Two different things.

Cost and time

Money: the paper is free, the code does not exist, so your cost today is engineering hours, not a subscription.

Compute: training used 16 GB300 GPUs, and 32 for the world action model runs. Out of reach for individuals. A small team renting cloud should think twice.

Time: reproducing a paper at this density from scratch is weeks to months, depending on how comfortable the team is with DiTs and flow matching.

What you save: roughly 18x on inference FLOPs, about 27x on training, and about 7.6x on cache. That is money off the long-term bill. The more you serve, the more it saves.

Next step

First, read section 4 and section 5.4. The first explains how codec memory plugs into a DiT. The second covers long video and few-step distillation. Those two decide whether this lands for you.

Second, if you only want a gut check, watch the 60-second sample on the project page. Pay attention to subject consistency in the back half. That is where the memory mechanism earns its keep.

Third, if you ship a product, benchmark this against your current KV compression at equal budget. Table 1 in the paper already lines up 12 baselines. Reproducing that comparison beats guessing.

Sources

  • arXiv paper: Fast and Adaptive Visual Memory for Video and World Models, https://arxiv.org/abs/2612.04174
  • NVIDIA project page: https://research.nvidia.com/labs/amri/projects/codecmem
  • AI Weekly report: https://aiweekly.co/alerts/nvidia-stanford-codecmem-cuts-long-context-video-flops-18x
  • Emergent News report: https://emergent.sh/news/nvidia-codecmem-cuts-long-context-video-flops

Sources

Comments

0 published
Log inorsign up to leave a comment.

Loading comments...