Search

Search papers and lessons

Stable Video Diffusion: Scaling Latent Video Diffusion Models to Large Datasets

Andreas Blattmann, Tim Dockhorn, Sumith Kulal et al. · 2023

Blattmann et al. (2023) show that curating a large video pretraining set and training in three stages gives a strong latent video diffusion model, usable for text-to-video, image-to-video and multi-view generation.

On this page

  • Colour = topic mix
  • Probability
  • Calculus
  • Discrete math
  • Linear algebra
  • Architectures
  • Generative models
  • ReadReady to readNot yet

TL;DR

Blattmann and colleagues (2023) show that a latent video diffusion model becomes much stronger when its pretraining data is carefully curated and its training runs in three stages: image pretraining, video pretraining on a large filtered set, and high-quality finetuning. The resulting base model is a general motion prior. It can be finetuned into a text-to-video model, an image-to-video model with camera-motion control, a frame interpolator, and a multi-view object generator.

Builds on: Latent Diffusion Model, Classifier-Free Guidance, Diffusion Model · Leads to: CogVideoX: Text-to-Video Diffusion Models with An Expert Transformer, which uses video diffusion at scale

Why it mattered

Open image-to-video models. In human preference votes, the paper's image-to-video model was preferred over two commercial systems, Gen-2 and Pika, on visual quality. The authors released the model, so an open model became competitive with products that were only available as hosted services.

Data as the lever. Before this paper, many video models were trained on small public sets such as WebVid-10M, and each group curated its data in its own ad hoc way. The paper gives an explicit curation pipeline and shows that curation helps. It turned data selection into a question that other groups had to report on.

Reusable motion and 3D priors. The base model was finetuned into camera-motion LoRA modules, a frame interpolator, and a multi-view model. The multi-view finetune was competitive with specialised multi-view methods, with a much smaller training budget.

The problem

Video diffusion models need two things that image models do not. They need a large amount of video, and they need many frames to be processed at once, so each training step is expensive. Earlier papers had combined a pretrained image diffusion model with temporal layers, then trained on a small high-quality set, and they had varied the training recipe widely. The field had no agreed answer to three questions.

First, how much should data be filtered? Raw web video contains many cuts, fades, static scenes, and clips with text overlays, which hurt generation. Second, does pretraining on a large set at low resolution help when the final model is trained on a small high-quality set at high resolution? Third, does starting from an image model still help when the video data is large?

The paper answers these with controlled comparisons, using the same architecture and training schedule throughout, and with human preference votes instead of automatic metrics alone.

How it works

The method is a pipeline of three training stages, with curation before the first video stage. Each stage is a standard diffusion training run that starts from the previous stage's weights.

  1. Curate the video set. Split long videos at scene cuts, caption each clip, then combine the captions into one. Filter out clips with little motion using optical flow, clips with heavy text using text detection, and clips with low aesthetic scores.
  2. Stage I, image pretraining. Start from the image model Stable Diffusion 2.1, so the network already knows spatial structure.
  3. Stage II, video pretraining. Insert temporal convolution and attention layers after each spatial layer, then train on the large curated set at low resolution.
  4. Stage III, high-quality finetuning. Train on a much smaller set of clips with high visual quality, at higher resolution, with the noise schedule shifted towards more noise.
  5. Downstream finetunes. Starting from the base model, finetune for text-to-video, for image-to-video, for frame interpolation, or for multi-view generation.

Here is a toy trace of the curation filter. The numbers are illustrative and are not from the paper. Suppose a pool of 100 clips each has an average optical flow score, and the filter removes the bottom 25 percent.

  1. Sort the 100 clips by flow score, from lowest to highest.
  2. Remove the 25 lowest-scoring clips, since they are the near-static ones.
  3. Keep the remaining 75 clips for pretraining.
  4. Check: 100−25=75100 - 25 = 75, and the kept clips all have scores above the cut.

The cut-off for each filter is a design choice that the paper tunes against its evaluations, which is why curation is slow and costly to get right.

flowchart LR
  A["Raw videos with cuts"] --> B["Cut detection and captions"]
  B --> C["Filters: motion, text, aesthetics"]
  C --> D["Stage I: image model SD 2.1"]
  D --> E["Stage II: video pretraining, low resolution"]
  E --> F["Stage III: high-quality finetuning, high resolution"]
  F --> G["Text-to-video, image-to-video, multi-view"]

The math

The paper uses the continuous-time diffusion framework of Karras et al. (2022), which the paper calls EDM. Write p(x;σ)p(\mathbf{x}; \sigma) for the data distribution after adding Gaussian noise of standard deviation σ\sigma. Starting from large noise and removing it step by step follows the probability flow ODE.

Step 1 in symbols: the probability flow

dx=−σ˙(t) σ(t) ∇xlog⁡p(x;σ(t)) dt.d\mathbf{x} = -\dot\sigma(t)\,\sigma(t)\, \nabla_{\mathbf{x}} \log p(\mathbf{x}; \sigma(t))\, dt.

Here σ˙\dot\sigma is the rate at which the noise level changes, and ∇xlog⁡p\nabla_{\mathbf{x}} \log p is the score, the direction in which the data becomes more likely. Solving this ODE from noise to data is the sampling procedure, the same idea as the ODE samplers in Diffusion Model.

Step 2 in symbols: the score from a denoiser

The network is parameterised as a denoiser Dθ(x;σ)D_\theta(\mathbf{x}; \sigma), which predicts the clean sample, and the score is

sθ(x;σ)=Dθ(x;σ)−xσ2.s_\theta(\mathbf{x}; \sigma) = \frac{D_\theta(\mathbf{x}; \sigma) - \mathbf{x}}{\sigma^2}.

Predicting the clean sample is easier to train than predicting the score directly, and the scaling by σ2\sigma^2 keeps the loss well behaved across noise levels.

Step 3 in symbols: the training loss

The denoiser is trained by denoising score matching:

E[ λσ ∥Dθ(x0+n;σ,c)−x0∥22],n∼N(0,σ2I).\mathbb{E}\left[\, \lambda_\sigma \,\lVert D_\theta(\mathbf{x}_0 + \mathbf{n}; \sigma, \mathbf{c}) - \mathbf{x}_0 \rVert_2^2 \right], \qquad \mathbf{n} \sim \mathcal{N}(\mathbf{0}, \sigma^2 I).

Here x0\mathbf{x}_0 is a clean clip, c\mathbf{c} is its conditioning such as a caption, λσ\lambda_\sigma is a weight that depends on the noise level, and E\mathbb{E} is the average over clips, noise and noise levels. The video model is trained in the latent space of an autoencoder, so x0\mathbf{x}_0 is a latent representation rather than pixels.

Step 4 in symbols: shifting the noise schedule

The distribution over σ\sigma is shifted towards larger noise when the resolution grows, so higher-resolution clips are trained more often at high noise. The reason is that neighbouring pixels in a high-resolution frame are more correlated, so more noise is needed to hide the global structure the network must learn.

Results

Curation helps. The paper trains models on curated and uncurated subsets and compares them with human preference votes. The curated models are preferred, and the advantage persists after high-quality finetuning, which is the paper's main evidence that pretraining quality carries forward.

Pretraining from an image model helps. A video model with spatial layers initialised from Stable Diffusion 2.1 is preferred to one with random spatial weights.

Text-to-video and image-to-video. The base model was finetuned to higher resolution and compared with closed commercial systems. In the image-to-video comparison, human voters preferred the authors' model to Gen-2 and Pika on visual quality. Most of these comparisons are human preference votes rather than automatic metrics.

Multi-view generation. The image-to-video model finetuned on 3D object renders was evaluated on held-out objects. The authors report that it is competitive with specialised multi-view methods such as Zero123XL and SyncDreamer, at a much smaller training cost.

Limits. The main signal for data curation is human preference, which is slow and expensive to collect, and each filter threshold depends on such studies. Many results are human preference votes rather than standard automatic metrics. The model's motion comes from curated data, so its behaviour on other kinds of video is not established by the paper. The authors release code and weights, linked in the sources.

Reading guide

Read the paper in this order, with the lessons it needs at each part:

Check yourself

QuestionRecall: what are the three training stages in this paper, and what does each one add?Show answer

Stage I is image pretraining, which starts from a strong image model so the network knows spatial structure. Stage II is video pretraining on a large curated set at low resolution, which teaches motion. Stage III is high-quality finetuning on a smaller set at higher resolution, which raises visual quality.

QuestionComputation: a curation filter removes the bottom 50 percent of 240 clips ranked by a score. How many clips are kept, and what fraction of the original set is that?Show answer

Half of 240 is 120 removed, so 240−120=120240 - 120 = 120 clips are kept. That is 120/240=0.5120 / 240 = 0.5, or 50 percent of the original set.

QuestionWhy: explain why the paper shifts the noise schedule towards more noise when training at higher resolution.Show answer

Neighbouring pixels in a high-resolution frame are more correlated, so a given amount of noise hides less of the global structure. Training at high noise levels more often forces the network to learn that global structure at high resolution.

QuestionApplied: a team wants to reproduce the paper's image-to-video model with a much smaller video corpus. Which stage of the pipeline matters most to keep, and why?Show answer

Keep the curation and the high-quality finetuning, because the paper's curation results carry forward through finetuning. A small corpus cannot replace the scale of pretraining, so the team should spend its effort on filtering the corpus well and on the finetuning stage to recover visual quality.

Sources

Read the full paper

Andreas Blattmann, Tim Dockhorn, Sumith Kulal et al., 2023. arXiv:2311.15127