Learning Plug-and-play Memory for Guiding Video Diffusion Models

1University of California, San Diego
2Google Research, Australia
* Equal contribution, listed in alphabetical order.
Corresponding author.
DiT-Mem Pipeline

Overview of DiT-Mem. Given a text prompt, we retrieve relevant videos from an external memory and encode them into compact memory tokens using our Memory Encoder. This encoder consists of stacked 3D CNNs for spatiotemporal downsampling, frequency-domain filters (LPF/HPF) for disentangling appearance and dynamics, and shared self-attention for semantic aggregation. These memory tokens are then injected into the self-attention layers of the frozen DiT backbone, providing plug-and-play guidance that improves physical consistency and realism without retraining the generation model.

Abstract

Diffusion Transformer (DiT) based video generation models have recently achieved impressive visual quality and temporal coherence, but they still frequently violate basic physical laws and commonsense dynamics, revealing a lack of explicit world knowledge. In this work, we explore to equip them with a plug-and-play memory that injects useful world knowledge. Motivated by in-context memory in Transformer-based LLMs, we conduct empirical studies to show that DiT can be steered via interventions on its hidden states, and simple low-pass and high-pass filters in the embedding space naturally disentangle low-level appearance and high-level physical/semantic cues, enabling targeted guidance. Building on these observations, we propose a learnable memory encoder DiT-Mem, composed of stacked 3D CNNs, low-/high-pass filters, and self-attention layers. The encoder maps reference videos into a compact set of memory tokens, which are concatenated as the memory within the DiT self-attention layers. During training, we keep the diffusion backbone frozen, and only optimize the memory encoder. It yields a rather efficient training process on few training parameters (e.g. 150M) and 10k data samples, and enables plug-and-play usage at inference time. Extensive experiments on state-of-the-art models demonstrate the effectiveness of our method in improving physical rule following and video fidelity.

Video Gallery

"A person is sword fighting"

"A polar bear is playing guitar"

"A person is pouring water into a teacup"

"golden fish swimming in the ocean"

"pouring milk into a kettle"

"A piece of copper is ignited, emitting a vivid and unique flame as it burns steadily"

"A panda playing on a swing set"

"A person is running on treadmill"

"A small burning match was thrown into a pile of dry leaves"

"A squeeze of honey is slowly released in the space station, spreading the liquid into the surrounding area"

"A drone is hovering above a quiet and glassy swimming pool, with the reflection of the drone appearing on the water surface"

"A metal fork is gently placed into a glass of crystal-clear water, displaying the interesting visual distortions and reflections as the fork meets the liquid"

Experimental Results

We evaluate our methods on three comprehensive benchmarks: (1) PhyGenBench targets physical commonsense in text-to-video generation with 160 prompts spanning 27 physical laws; (2) VBench provides hierarchical evaluation decomposing "quality" into well-defined dimensions; (3) OpenVidHD Test Set measures low-level video generation metrics (FVD, CLIP, Action/Motion) on 100 clips.

In-Depth Analysis

We further analyze how DiT-Mem behaves under architectural ablations, memory size changes, and frequency branch selections. Use the slider below to navigate across the studies.

BibTeX

@misc{2511.19229,
  Author = {Selena Song and Ziming Xu and Zijun Zhang and Kun Zhou and Jiaxian Guo and Lianhui Qin and Biwei Huang},
  Title = {Learning Plug-and-play Memory for Guiding Video Diffusion Models},
  Year = {2025},
  Eprint = {arXiv:2511.19229},
}