CodecMem Fast and Adaptive Visual Memory for Video and World Models
A motion-compensated tubelet codec as the memory of a video model
World action model (top left): tokens of the 4 frames on screen, drawn to scale. Counts are for the whole three-camera input.
Clip so far: codec memory 551 tokens compared to 11,900 for dense attention, 21.6× fewer
CodecMem is a fast and adaptive codec for long-context video and world models. To encode an observation, it warps its own reconstruction of the previous frame with estimated flow and stores additional multi-scale tubelets only where this warping fails. The video model is conditioned on this codec memory, which spans the whole history, in place of dense attention over every token of every past frame.
How it works


33 dBno tubelet

Frame 80 is the next window’s reference
Past video
564 tubelets from 32 windows



2 × 2 tokens
Codec memory
Next chunk
Fine-tuning
next chunk + noise
CodecMem is in the top three on every metric of the three tasks and has by far the best average rank. Ranked among the 13 compressed memories, which all get the same memory budget. CodecMem far exceeds every other compressed memory, surpasses VSA and nears dense attention. Needle Watermark: after 60 s of moving polygons, the model regenerates the 4 s segment that carried a watermark. With more swaps than in training, only CodecMem surpasses dense attention. Cup Shell Game: the share of cups uncovered correctly. CodecMem is second among the compressed memories and close to dense attention. Revisit-NVS: novel views near the input trajectory in a static 3D scene.
Distilled autoregressive video models. Baseline numbers are from Causal Forcing.
Cosmos 3 with keyframes is the same policy as ours, given 32 evenly spaced keyframes in place of codec memory.
Each blue block holds as many tokens as the whole codec memory.
The interactive charts could not be loaded; all numbers are in the table below.
Numbers as a table
| Method | Retrieval | Tracking, % | Spatial memory | Avg. rank | Efficiency, 30 s of context | Eff. rank | |||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| fg-PSNR | fg-SSIM | In dist. | Extrap. | PSNR | LPIPS | Cache, GB | Train, PF | Infer., PF | |||
| Full memory, unlimited budget | |||||||||||
| Dense attention | 22.09 | 0.901 | 99.6 | 85.2 | 20.12 | 0.256 | – | 39.7 | 17.65 | 5.73 | – |
| VSA | 19.09 | 0.851 | 99.6 | 79.0 | 20.27 | 0.265 | – | 40.3 | 5.82 | 1.85 | – |
| Compressed memory, limited budget | |||||||||||
| WorldKV | 7.16 | 0.213 | 99.4 | 81.4 | 19.19 | 0.303 | 5.3 | 19.8 | 17.65† | 1.87 | 10.7 |
| MosaiChunk | 15.76 | 0.667 | 51.1 | 31.9 | 16.36 | 0.500 | 8.3 | 39.7 | 17.65¶ | 1.95 | 11.3 |
| DeCoPrune | 7.80 | 0.256 | 99.6 | 73.3 | 17.63 | 0.403 | 5.3 | 5.2 | 17.65† | 13.24 | 9.0 |
| RECAP-Forcing | 5.83 | 0.148 | 99.5 | 79.0 | 16.96 | 0.461 | 7.8 | 5.2 | 17.65† | 1.86 | 8.0 |
| FramePack | 11.14 | 0.425 | 66.5 | 35.0 | 18.10 | 0.390 | 6.2 | 0.2‡ | 0.96 | 1.14 | 5.7 |
| MilliVid | 10.19 | 0.363 | 95.0 | 61.1 | 17.41 | 0.448 | 6.7 | 5.2 | 0.69 | 0.37 | 4.0 |
| DC-Gen | 14.29 | 0.578 | 98.4 | 73.1 | 17.49 | 0.449 | 5.3 | 4.9 | 0.56 | 0.29 | 2.3 |
| Helios | 11.70 | 0.450 | 67.2 | 35.0 | 18.41 | 0.387 | 5.3 | 5.2 | 0.87 | 0.38 | 5.0 |
| GDN | 7.84 | 0.215 | 91.1 | 58.5 | 16.97 | 0.464 | 8.2 | 0.9 | 2.45 | 0.85 | 5.7 |
| TTT | 5.52 | 0.127 | 34.1 | 28.0 | 14.30 | 0.629 | 12.7 | 5.2 | 2.87 | 1.04 | 7.0 |
| LongLive-RAG | 5.44 | 0.128 | 56.6 | 30.8 | 16.73 | 0.443 | 10.8 | 39.7§ | 0.86 | 0.38 | 7.3 |
| MemLearner | 7.52 | 0.214 | 58.4 | 18.9 | 20.29 | 0.228 | 7.2 | 6.6 | 0.25 | 0.28 | 4.0 |
| CodecMem (ours) | 21.15 | 0.879 | 99.5 | 90.8 | 19.97 | 0.276 | 1.5 | 5.2 | 0.64 | 0.32 | 3.3 |
† Inference-time pruning on the dense-attention backbone. ‡ Recomputes its context at every step. § KV of all frames offloaded to CPU. ¶ Frozen dense-attention backbone and router distilled from it.
| Method | Total | Quality | Semantic |
|---|---|---|---|
| CausVid | 81.33 | 83.98 | 70.72 |
| Self Forcing | 83.74 | 84.48 | 80.77 |
| Causal Forcing | 84.04 | 84.59 | 81.84 |
| CodecMem, built on Self Forcing | 84.43 | 85.44 | 80.38 |
| Method | Success, % |
|---|---|
| Fast-WAM | 11.3 |
| LingBot-VA (time-aware) | 40.4 |
| RTP | 48.6 |
| Cosmos 3 (keyframes) | 28.8 |
| CodecMem | 71.3 |
| Example | Context tokens | Codec speed |
|---|---|---|
| Long video generation, new chunk at 58 s | 23× fewer | 118 fps at 1024×576 |
| World action model, new observation at 20 s | 10× fewer | 126 fps at 640×544 |
60 s videos with codec memory
We distill a pre-trained video model with codec memory to generate 60 s videos in 4 sampling steps at 1024×576. Each video follows a sequence of five captions. On 64 such prompts, a VLM judge rates only 2 of the 64 videos as strongly drifting. The videos are shown without sound.
▶ Play 60 sPottery studio
An older potter with silver hair teaches a teenage student in a gray apron at the wheel of a sunlit pottery studio.
- The potter guides the student's hands, and the red clay rises into a first bowl.
- The student cuts the bowl from the wheel with a wire and lifts it onto a wooden board.
- The student sets the bowl on the drying rack by the window, near a brick kiln, and they return to the wheel with a fresh ball of clay.
- The student centers and opens the clay alone while the potter watches.
- The student shapes a small vase and smooths its rim with a sponge.
Home kitchen
A woman with curly dark hair and a striped apron and a tall man with a beard in a blue shirt cook at a wooden island in a bright home kitchen.
- She kneads and cuts pasta dough while he cooks tomato sauce.
- They toss the pasta in the sauce and plate it, and he pours two glasses of red wine.
- They toast and eat side by side at the island.
- She brushes flour from his beard, he wipes his face with a dish towel, and they make strawberries with whipped cream.
- They eat dessert and then wash the dishes together at the sink.
Mountain meadow
A rider in a brown leather jacket and a wide-brimmed hat rides a chestnut horse through a meadow below snowcapped mountains.
- They gallop across the meadow, and a herd of wild horses runs alongside.
- At sunset they ride down the slope and across a stream to a small lake where the herd grazes.
- A pale gray mare touches noses with the chestnut horse, and the rider lets it drink.
- The rider takes off the saddle under a lone pine and lights a campfire.
- At night the rider rests against the saddle by the fire as a full moon rises over the lake.
Classroom
A young teacher in a mustard sweater and a group of excited children stand around a papier-mache volcano in an elementary school classroom.
- The teacher pours vinegar into the crater, and red foam erupts.
- A boy pours again, the foam drips onto the floor, and the teacher writes “dish soap” on the whiteboard.
- With dish soap added, a tall tower of red foam rises out of the crater.
- A girl with braids measures the tower with a ruler, and it topples onto the sneakers of a boy with glasses.
- The children go to their desks and draw the experiment.
Bakery
A baker with rolled-up sleeves, a white apron, and a flour-dusted beard works in a small artisan bakery with a large brick oven.
- Before dawn he shapes and scores loaves, bakes them, and flips the door sign to open.
- In the morning an elderly woman in a green wool coat buys a round loaf and waves goodbye.
- He kneads fresh dough, braids it into loaves, glazes them with egg, and sprinkles sesame seeds.
- He slides the braids into the oven, sets a timer, and drinks a cup of coffee.
- The timer rings, and he takes out the golden braids and tastes one.
Pizza oven
A pizzaiolo with a graying mustache and a white apron teaches a young couple, a woman in a yellow sundress and a man in a gray linen shirt, at a wood-fired brick oven on a stone patio at dusk.
- He shows them how to stretch the dough, and the couple pulls a second ball into a thin round together.
- The woman spreads tomato sauce, the man adds mozzarella and a smile of basil leaves, and the pizzaiolo drizzles olive oil.
- The pizzaiolo carries the pizza to the oven and slides it onto the hot floor.
- They watch the crust puff while he turns the pizza toward the flames, and he draws it out.
- He slices the pizza at the table, and the couple eats the first slices.
Space station
An astronaut with dark curly hair in a blue flight suit and an astronaut with a blond beard in a gray polo shirt float at an open wall panel inside a space station module.
- He holds a flashlight while she finds a loose connector and unscrews the inner cover.
- A screw tumbles away, he glides after it and catches it, and she pushes the connector into its socket.
- She drives the screws back in, and the camera drifts down the module to a round window that looks down on the Earth.
- The sun rises over the horizon, the camera floats back to them, and the lights of the panel turn from red to green.
- They bump fists and float to the window to watch the sunrise.
Tavern
A weary knight in chainmail and a muddy gray cloak enters a candlelit stone tavern on a stormy night, where an innkeeper with a red braid stands behind a long oak bar.
- The knight shuts the door against the storm, crosses the room past a lute player by the hearth, and sits at the bar.
- The innkeeper draws a tankard of ale, he drinks, and she asks where he is heading.
- She ladles stew from the pot over the fire and tears off bread, and he hangs his cloak by the hearth.
- He eats at a small table by the fire, and the lute player strikes up a brighter tune.
- He pays with a silver coin for a room, and she points him up the stairs.
Eight of the 64 prompts. The prompts are shortened here; each numbered event corresponds to one of the five captions.
Comparison with other MiniMax-H3 methods
MosaiChunk and RAVEN build on the same pre-trained model, MiniMax-H3. A VLM judge scores the 64 silent videos of each method.
Below, the eight prompts of the gallery for all three methods. The videos play in sync, and the caption that is active at the current time is highlighted.
▶ Play 60 sPrompt. An older potter with silver hair teaches a teenage student in a gray apron at the wheel of a sunlit pottery studio.
▶ Play 60 sPrompt. A woman with curly dark hair and a striped apron and a tall man with a beard in a blue shirt cook at a wooden island in a bright home kitchen.
▶ Play 60 sPrompt. A rider in a brown leather jacket and a wide-brimmed hat rides a chestnut horse through a meadow below snowcapped mountains.
▶ Play 60 sPrompt. A young teacher in a mustard sweater and a group of excited children stand around a papier-mache volcano in an elementary school classroom.
▶ Play 60 sPrompt. A baker with rolled-up sleeves, a white apron, and a flour-dusted beard works in a small artisan bakery with a large brick oven.
▶ Play 60 sPrompt. A pizzaiolo with a graying mustache and a white apron teaches a young couple, a woman in a yellow sundress and a man in a gray linen shirt, at a wood-fired brick oven on a stone patio at dusk.
▶ Play 60 sPrompt. An astronaut with dark curly hair in a blue flight suit and an astronaut with a blond beard in a gray polo shirt float at an open wall panel inside a space station module.
▶ Play 60 sPrompt. A weary knight in chainmail and a muddy gray cloak enters a candlelit stone tavern on a stormy night, where an innkeeper with a red braid stands behind a long oak bar.
Acting on what the policy saw earlier
A world action model with codec memory keeps the whole episode, or its earlier attempts, as codec tokens. All videos are closed-loop rollouts in simulation, on scenes not seen in training.
Robot cup game: tracking, then acting
The policy watches a cup game with 3–6 cups and 1–5 swaps, then lifts the cup that hides the ball.
The codec stores the whole episode in – tokens, compared to – for dense attention: – fewer.
The interactive figure could not be loaded.
- Warp the previous reconstruction
- Find where it fails the – gate
- Store tubelets there
RoboMME: the best world action model on all four suites
RoboMME tests whether a policy acts on what it saw earlier in the episode, in four suites: counting, permanence, reference and imitation. Cosmos 3 with keyframes is our policy given 32 evenly spaced keyframes in place of codec memory.
Two solved test episodes of our policy from this suite, front camera left and wrist camera right, at 1.5× speed. A red border marks the video the policy is shown before it acts.
▶ PlayPickXtimes
Instruction. “Pick up the blue cube and place it on the target, repeating this action four times, then press the button to stop.”
▶ PlaySwingXtimes
Instruction. “Pick up the green cube, move it to the top of the right-side target, then to the top of the left-side target, repeating this back-and-forth motion three times, finally press the button to stop.”
Two solved test episodes of our policy from this suite, front camera left and wrist camera right, at 1.5× speed. A red border marks the video the policy is shown before it acts.
▶ PlayButtonUnmask
Instruction. “First press the button, then pick up the container hiding the blue cube, finally pick up another container hiding the green cube.”
▶ PlayButtonUnmaskSwap
Instruction. “First press both buttons on the table, then pick up the container hiding the red cube, finally pick up another container hiding the blue cube.”
Two solved test episodes of our policy from this suite, front camera left and wrist camera right, at 1.5× speed. A red border marks the video the policy is shown before it acts.
▶ PlayVideoPlaceButton
Instruction. “Watch the video carefully, then place the green cube on the target right after the button was pressed.”
▶ PlayVideoPlaceOrder
Instruction. “Watch the video carefully, then place the green cube on the third target it was previously placed on.”
Two solved test episodes of our policy from this suite, front camera left and wrist camera right, at 1.5× speed. A red border marks the video the policy is shown before it acts.
▶ PlayInsertPeg
Instruction. “Watch the video carefully, then grasp the same end of the same peg you’ve picked before and insert it into the same side of the box.”
▶ PlayMoveCube
Instruction. “Watch the video carefully, then move the cube to the target in the same manner as before.”
In-context learning: pushing with hidden physics
A robot arm must push an object so that its centre stops inside a target. The physics differ per scene and are never given, so the first push usually misses and later pushes depend on remembering the earlier ones. Codec memory matches dense attention, which keeps every frame, with 4.7× fewer inference FLOPs.
▶ Play attempts in orderEach video plays the given exploration push, then the three models’ attempts side by side, marked hit or miss with the distance to the target centre; a panel stops once its model succeeds. The model without memory solves none of these three scenes; the chart covers all 96.
▶ Play attempts in orderEach video plays the given exploration push, then the three models’ attempts side by side, marked hit or miss with the distance to the target centre; a panel stops once its model succeeds. The model without memory solves none of these three scenes; the chart covers all 96.
▶ Play attempts in orderEach video plays the given exploration push, then the three models’ attempts side by side, marked hit or miss with the distance to the target centre; a panel stops once its model succeeds. The model without memory solves none of these three scenes; the chart covers all 96.
One scene, attempt by attempt (codec memory)
“Push the glossy plastic small cube so that its centre stops inside the orange disc.” Target radius 2.2 cm. The model corrects its push from the failed attempts in its context.
Retrieval, tracking and spatial memory
One task per skill, each with an output that is determined by the context. All methods share the same backbone, training data and schedule; the limited-budget baselines get the same memory budget as CodecMem. Click a still to play its video.
Needle Watermark. The model watches 60 s of moving polygons. A white square watermark marks one 4 s segment. After the video ends, the model must generate that segment again, so the polygons have to be where they were tens of seconds earlier. Bottom row of each comparison: absolute error on the polygons.
Input · 60 s context; watermark at 15.5–19.5 s, 41 s before generation
▶ Play inputOutput · the watermarked segment, generated from memory
▶ Play comparisonInput · 60 s context; watermark at 32.1–36.1 s, 24 s before generation
▶ Play inputOutput · the watermarked segment, generated from memory
▶ Play comparisonInput · 60 s context; watermark at 26.3–30.3 s, 30 s before generation
▶ Play inputOutput · the watermarked segment, generated from memory
▶ Play comparisonCup Shell Game. A ball is placed under one cup, and the cups are then swapped many times. After the input video, the model must generate the reveal: the cups lift, and the ball must appear under the right cup. These examples have 18–19 swaps, more than any training sequence (1–15), and several of the other memories lose track of the ball. The label of each cell says whether that method puts the ball under the right cup.
Input · ball placed, then 19 swaps
Output · generated reveal: ground truth, ours and nine other memories
Input · ball placed, then 18 swaps
Output · generated reveal: ground truth, ours and nine other memories
Input · ball placed, then 18 swaps
Output · generated reveal: ground truth, ours and nine other memories
Revisit-NVS. The model observes a context video of a static 3D scene with its cameras. It must then render a 3 s camera path that revisits views seen earlier. Each cell shows one method's rendering of the same clip.
Input · 30 s context
▶ Play contextOutput · novel views along the revisit path: ground truth and methods
▶ Play comparisonInput · 30 s context
▶ Play contextOutput · novel views along the revisit path: ground truth and methods
▶ Play comparisonInput · 30 s context
▶ Play contextOutput · novel views along the revisit path: ground truth and methods
▶ Play comparison