AI
NVIDIA CodecMem: Motion-Compensated Tubelet Memory Cuts Long-Context Video FLOPs 18x
Dense attention over 60 seconds of video demands up to 334 GiB of KV cache in a 33B model. NVIDIA's CodecMem borrows motion-compensated warping from video codecs to store multi-scale RGB tubelets only where optical flow fails—cutting inference FLOPs 18x and shrinking 30s KV cache from 39.7 GB to 1.5 GB while beating dense attention on extrapolation tracking.
8 min read
NVIDIA CodecMem: Motion-Compensated Tubelet Memory Cuts Long-Context Video FLOPs 18x
Executive Summary
On December 2–3, 2026, researchers from NVIDIA, Stanford, and UIUC published CodecMem (Fast and Adaptive Visual Memory for Video and World Models, full HTML paper), a 100+ fps motion-compensated tubelet codec that replaces dense historical KV caches in long-context video generators and robotic world action models (WAMs).
Dense attention over a 60-second clip in a 33B video model (MiniMax-H3) requires 334 GiB of KV cache and 851 ms per denoising step across four GB300 GPUs. CodecMem attacks that bottleneck with three verified results:
- 18x fewer inference FLOPs & 26x smaller KV cache: On a 30-second
Wan2.1-T2V-1.3Breference workload (215,280 dense tokens), CodecMem cuts BF16 KV cache from 39.7 GB to 1.5 GB and reduces inference compute from 5.73 PF to 0.32 PF (17.9x / ~18x), ranking #1 (average rank 1.5) across 12 compressed-memory baselines. - Surpasses dense attention on length extrapolation: On cup-shell tracking beyond training length (17–20 swaps), CodecMem achieves 90.8% accuracy versus 85.2% for unlimited-budget dense attention.
- Stronger robotic world-action policies: Integrated into
Cosmos 3 Nano, CodecMem reaches 71.3% average success on RoboMME (vs. 48.6% forRTPand 28.8% forCosmos 3keyframes) and matches dense memory on in-context robotic pushing with 4.7x fewer inference FLOPs (1.0k vs. 4,760 tokens per attempt). - Availability caveat: As noted by Emergent, no public code or model checkpoints have been released yet on the project page (
research.nvidia.com/labs/amri/projects/codecmem), and all benchmarks reflect the authors' own FastGen evaluation harness.
Architecture & How It Works
Traditional video codecs such as H.264 avoid storing every pixel of every frame by warping prior reconstructions with motion vectors and encoding residuals only where prediction fails. However, standard codecs emit bitstreams that must be decoded back to pixels before a vision transformer can read them. CodecMem bridges that gap by outputting multi-scale RGB tubelets that a pretrained video VAE can encode directly into latent tokens.
flowchart LR
Sink["Sink Frame (Full Cache) + Recent Chunk (Full Res)"] --> DiT["Causal DiT / World Action Model"]
Past["Incoming 4-Frame Window"] --> Flow["Half-Res DIS Optical Flow Warp"]
Flow --> Error["Compute Prediction Error vs. Ground Truth"]
Error --> Gate{"PSNR > Quality Gate?"}
Gate -- "Yes (Static)" --> Skip["Skip Tubelet (0 Tokens)"]
Gate -- "No (Motion / Novel)" --> Select["Greedy Multi-Scale Tubelet Selection (32..256px -> 32x32)"]
Select --> VAE["Pretrained Video VAE Crop + Pool + Scale Embed + RoPE"]
VAE --> DiTCore System Specifications
| Component | Specification | Engineering Implication |
|---|---|---|
| Window & Flow Estimator | 4-frame windows (n=4); half-res DIS optical flow (8×8 tiles) |
Runs at 126–161 FPS on one NVIDIA H100 (13x faster than AutoGaze's 9.6 FPS) |
| Multi-Scale Tubelets | Spatial boxes s ∈ {32, 64, 128, 256} resized to 32×32 |
Large boxes cover coherent camera pans cheaply; 32px boxes keep fine detail |
| Adaptive Quality Gate | Greedy error reduction capped by budget K or PSNR threshold γ |
Near-static clips use ~3% of dense tokens; fast-changing clips use ~24% |
| Token Conditioning | Pretrained VAE latent crop/pool + learned scale embedding + phase-aligned RoPE | Reuses frozen VAE distribution with zero new encoder training |
| Causal Memory Layout | h_q = x_sink ⊕ M_{1:q-2} ⊕ x_{q-1} |
Recent chunk stays full-res; codec compresses q-1 in parallel with generation |
| Validated Backbones | Wan2.1-T2V-1.3B, Wan2.1-T2V-14B, MiniMax-H3 (33B), Cosmos 3 Nano (16B) |
Trained on 16–32 NVIDIA GB300 GPUs in NVIDIA's FastGen framework |
Closed-Loop Warping & Why RGB Tubelets Beat Residuals
During each 4-frame window, the codec estimates a single half-resolution Dense Inverse Search (DIS) optical flow field from the first frame back to its own previous reconstruction I_hat_0 and warps forward under a constant-motion assumption. A greedy loop then selects candidate s × s tubelets (all resized to 32 × 32) that maximize squared-error reduction, skipping any region whose PSNR already clears the quality gate γ. Crucially, CodecMem closes the loop by pasting the selected tubelets into P and recomputing flow against the new reconstruction—preventing drift from compounding across windows (open-loop selection drops reconstruction PSNR from 25.45 to 23.71).
A counterintuitive ablation in Table 4 of the CodecMem paper also shows that storing classic motion + residual tokens drops reconstruction PSNR from 25.45 to 22.53 (and replacing some tubelets with flow tokens drops PSNR to 25.25). Why? Because pretrained video diffusion transformers already understand RGB latent patches from their VAE, whereas flow vectors and residual differences lie outside the pretrained latent distribution. By giving the DiT actual RGB tubelets where warping fails—and letting the transformer infer smooth motion across gaps—CodecMem avoids training a separate residual encoder.
{
"codecmem_config": {
"window_frames": 4,
"tubelet_scales_px": [32, 64, 128, 256],
"normalized_tubelet_px": 32,
"quality_gate_psnr_db": 28.0,
"token_budget_ratio": 0.125,
"flow_estimator": "DIS_half_res_8x8"
}
}
Benchmarks, Cost & Latency Analysis
The authors benchmarked CodecMem in FastGen on Wan2.1-T2V-1.3B against 12 compressed-memory baselines (including WorldKV, MosaiChunk, DeCoPrune, RECAP-Forcing, FramePack, MilliVid, DC-Gen, Helios, GDN, TTT, LongLive-RAG, and MemLearner) alongside unlimited-memory Dense attention and VSA.
Long-Context Video Memory & Efficiency (30s Reference, 832×480)
| Method | Retrieval (fg-PSNR ↑) | Tracking Extrap. (% ↑) | Spatial (PSNR ↑) | Avg. Rank (↓) | KV Cache (GB ↓) | Infer. FLOPs (PF ↓) |
|---|---|---|---|---|---|---|
| Dense Attention (Unlimited) | 22.09 | 85.2% | 20.12 | — | 39.7 GB | 5.73 PF |
| VSA (Unlimited) | 19.09 | 79.0% | 20.27 | — | 40.3 GB | 1.85 PF |
| CodecMem (Limited Budget) | 21.15 | 90.8% | 19.97 | 1.5 | 1.5 GB | 0.32 PF |
| DC-Gen | 14.29 | 73.1% | 17.49 | 5.3 | 4.9 GB | 0.29 PF |
| WorldKV | 7.16 | 81.4% | 19.19 | 5.3 | 19.8 GB | 1.87 PF |
| MemLearner | 7.52 | 18.9% | 20.29 | 7.2 | 6.6 GB | 0.28 PF |
| GDN (Linear State) | 7.84 | 58.5% | 16.97 | 8.2 | 0.9 GB | 0.85 PF |
Key takeaway: Every competing baseline specialized in one task and collapsed on another—MemLearner topped spatial reconstruction (20.29 PSNR) but collapsed to 18.9% on tracking extrapolation and 7.52 on retrieval, while GDN achieved a tiny 0.9 GB cache but scored 7.84 on retrieval. CodecMem is the only limited-budget method in the top three across all three tasks.
Robotics (RoboMME), VBench Distillation & 60s Audio-Video Scaling
- RoboMME World Action Models: Fine-tuned on
Cosmos 3 Nano, CodecMem scored 71.3% overall (71.25 ± 0.5% across 3 runs), beatingRTP(48.6%),LingBot-VA(40.4%), andCosmos 3with 32 keyframes (28.8%). Its largest lead came on Counting (88.5% vs. 33.5% for RTP), which requires dense temporal memory. Note that specialized Vision-Language-Action (VLA) models likeSimpleMemVLAstill score higher (88.3%) on RoboMME. - Few-Step Distilled Video Generation (VBench): Distilled into a 4-step streaming generator (
SF+CodecMem), the model scores 84.43 Total and 85.44 Quality on VBench, edging outCausal Forcing(84.04 Total / 84.59 Quality) andSelf Forcing(83.74 Total / 84.48 Quality), while trading a slight dip in Semantic alignment (80.38 vs. 81.84). - 60-Second
MiniMax-H3(33B) Scaling: On 4× NVIDIA GB300 GPUs, dense attention at 60 seconds balloons to 334 GiB KV cache and 851 ms/step, whereas a 10% CodecMem budget caps cache at 33 GiB and latency at 219 ms/step (3.9x faster than dense attention and 2.1x faster than VSA). In a 64-prompt Gemini VLM-judge evaluation of 60s audio-video rollouts, 96% of scripted dialogue lines were intelligible with CodecMem vs. 25–31% forRAVENandMosaiChunk, with strong drift dropping from 26–32/64 prompts down to 2/64.
Production Deployment & Trade-Offs
Where CodecMem Excels
- Autoregressive world simulators & embodied robotics: Tasks with mostly static backgrounds and localized object/arm motion (or multi-attempt in-context learning) benefit hugely from adaptive token allocation—spending 4.7x fewer FLOPs per attempt without losing spatial or temporal state.
- Minute-scale streaming video + audio generation: Compatible with 4-step ODE/DMD/GAN distillation, CodecMem prevents character/subject drift over 60-second rollouts without blowing past GPU HBM limits.
Architectural Limitations & Caveats
- Repeated camera revisits waste budget: As the authors explicitly note in Section D (Limitations), CodecMem only predicts each window from the immediately preceding reconstruction (
I_hat_0). If a robot or camera pans away from an object and repeatedly pans back, CodecMem re-encodes the same region every time instead of deduplicating against long-term 3D memory. - Task-agnostic greedy pixel selection: Tubelets are selected greedily by RGB pixel MSE, not downstream task salience—meaning small, critical objects with subtle pixel error can be skipped if a high-contrast background change dominates the
Kbudget. - No public code yet & occasional audio hallucinations: As of December 4, 2026, checkpoints and CUDA kernels are not yet open-sourced; additionally, on 18 silent prompts in the 60s
MiniMax-H3test, CodecMem occasionally hallucinated ~1.9s of speech per video where baselines stayed silent.
FAQ
1. How does NVIDIA CodecMem reduce video KV cache size?
CodecMem warps its reconstruction of the previous frame using fast half-resolution DIS optical flow and only encodes multi-scale RGB tubelets where warping fails (novel content or complex motion). Static regions cost zero or minimal tokens, cutting a 30s BF16 KV cache from 39.7 GB to 1.5 GB.
2. How fast is the CodecMem tubelet selector?
Implemented in CUDA, the greedy flow-driven selector runs at 126–161 FPS on a single NVIDIA H100—over 13x faster than learned selectors like AutoGaze (9.6 FPS) and requiring no selector training.
3. Does CodecMem work with existing pretrained video VAEs?
Yes. Because CodecMem stores RGB tubelets (32×32 normalized thumbnails from 32–256px boxes) rather than motion vectors or residuals, the frozen pretrained video VAE encodes them directly with added scale embeddings and phase-aligned RoPE.
4. How does CodecMem perform on robotics benchmarks?
On RoboMME with Cosmos 3 Nano, CodecMem achieves 71.3% average success (including 88.5% on Counting), outperforming RTP (48.6%) and Cosmos 3 keyframes (28.8%), and matches dense memory on in-context pushing at 4.7x fewer FLOPs.
5. Are NVIDIA CodecMem code and weights available to download?
Not yet. The paper (arXiv:2612.04174) was published December 2–3, 2026 and lists a project page, but public code and model checkpoints have not been released as of December 5, 2026.
Sources
- Fast and Adaptive Visual Memory for Video and World Models — arXiv:2612.04174 (Published December 2, 2026 — Primary)
- Fast and Adaptive Visual Memory for Video and World Models (Full HTML) — arXiv (Published December 3, 2026 — Primary)
- Hugging Face Daily Papers Index — CodecMem (Indexed December 3–4, 2026 — Primary/Index)
- NVIDIA CodecMem Cuts Long-Context Video FLOPs 18x — Emergent (Published December 4–5, 2026 — Secondary)
- CodecMem Paper Summary — Robotics Center (Published December 2, 2026 — Secondary)