↑↓ move Enter open ⌘K find from any page 256 of 256 tabs
Loading the recorded run…

What Wan is

Wan 2.1 is an open family of video generators built as a diffusion transformer (DiT): a video VAE compresses the clip into a small latent, a transformer denoises that latent as a sequence of space-time tokens, and the VAE decodes the result. Wan trains it with flow matching, conditions it on a prompt through cross-attention, and attends over every token of every frame at once.

The page records the 1.3 B text-to-video model: a 1,419 M-parameter transformer of 30 blocks and a 127 M VAE, generating 17 frames of 384 × 256 (16 frames a second) for A corgi running on a sunny beach, waves in the background, in 20 flow-matching steps with guidance 5 and seed 0. The board shows block 1 in full at steps 6 and 16; the cards below follow the token you pick.

A causal video VAE

Attention over raw pixels would be hopeless: the clip is 17 × 256 × 384 × 3 = 5,013,504 numbers. Wan-VAE compresses 4 × in time and 8 × in each spatial side into 16 channels, giving 5 × 32 × 48 × 16 = 122,880 numbers, 40.8 times fewer. Each channel is then normalised with its released mean and standard deviation.

The VAE is causal in time: its 3-D convolutions only look backwards, and frame 0 is compressed on its own, so latent frame 0 holds frame 0 and each later latent frame holds the next 4 frames, seeing only them and earlier ones. A single image is then just a one-frame video, and long videos can be encoded chunk by chunk with a cache of the previous chunk's features, as the Wan paper describes. The Wan-VAE card shows which frames each latent frame covers and one latent channel at a time.

Video tokens and 3-D RoPE

The transformer cuts the latent into patches of 1 × 2 × 2 (one latent frame, two by two positions): a 5 × 16 × 24 grid of 1,920 tokens, each a Linear map of its 64 numbers to the model width of 1,536. The Video tokens column marks the tokens shown on the board and colours every frame by the selected query's attention.

Self-attention by itself ignores order, so each token's query and key are rotated by its position, rotary position embedding (RoPE). Every head's 128 coordinates form 64 pairs; 22 pairs turn with the frame index, 21 with the row and 21 with the column, pair of an axis by angle with over that axis's coordinates. Because rotations compose, the score depends only on the offset between two tokens, not on where they are:

The 3-D RoPE card shows the angles of the token you pick, split into its frame, row and column parts.

One block

Each of the 30 blocks is conditioned on the timestep through adaptive LayerNorm (adaLN): an MLP of the timestep embedding produces a shift , a scale and a gate for the self-attention and the feed-forward. The Wan paper shares that MLP across all blocks and lets each block learn its own biases on top. Cross-attention to the prompt sits between the two, with a plain LayerNorm and no gate:

The 3-D Self-Attention card is full attention: every query reads all 1,920 tokens of all five latent frames, so motion and appearance are modelled together rather than by separate spatial and temporal layers. Its queries and keys are RMS-normalised across all 12 heads before the rotation, which keeps the scores in range:

The Cross-Attention card reads the prompt as encoded by umT5-XXL, a multilingual T5, padded to 512 vectors: 16 real tokens and 496 padding vectors of zeros, with no mask. All the zero vectors project to the same key, so the last column of the card is the weight on each pad, and the popup gives the pads' total.

Flow matching

Wan is trained with flow matching on the straight path between data and noise. At noise level the latent is , and the transformer predicts the path's constant velocity with a squared-error loss. (The Wan paper runs time the other way, from noise to data, which flips the sign of .) Sampling walks the path from down to 0 with Euler steps, mixing a prompt pass and a negative-prompt pass with classifier-free guidance:

The 20 levels are pushed towards high noise by a shift of 3, , the timestep shift Esser et al. introduced for large images, which need more noise to hide the same amount of their content. Step 6 runs at and step 16 at . The Flow matching card plays the loop with each step's decoded and predicted , and lists both velocities, the guided one, and the next for the selected token, checked against the recorded step. Wan's pipeline defaults to a UniPC multistep solver; this run uses plain Euler steps so every step is the formula above.

Where it came from

DiT showed that a plain transformer with adaLN could replace the U-Net as a diffusion backbone; flow matching and rectified flow gave the straight-path objective, and Stable Diffusion 3 scaled the two together for images. Video models then extended the tokens to space-time. CogVideoX puts text and video tokens in one joint attention (see the CogVideoX tab), LTX-Video compresses far harder in its VAE (see the LTX tab), and Wan keeps separate cross-attention with full 3-D self-attention, released from 1.3 B to 14 B parameters.

Papers

  1. Wan: Open and Advanced Large-Scale Video Generative Models Team Wan et al. · arXiv 2025 The Wan 2.1 models: the causal Wan-VAE, the DiT with a shared timestep MLP and umT5 cross-attention, and flow-matching training.
  2. Flow Matching for Generative Modeling Yaron Lipman et al. · ICLR 2023 Training a velocity field to follow a chosen probability path; the straight path is the objective Wan uses.
  3. Flow Straight and Fast: Learning to Generate and Transfer Data with Rectified Flow Xingchao Liu, Chengyue Gong, Qiang Liu · ICLR 2023 Rectified flow: the linear interpolation between noise and data and its constant velocity, sampled with Euler steps.
  4. Scaling Rectified Flow Transformers for High-Resolution Image Synthesis Patrick Esser et al. · ICML 2024 Rectified-flow transformers at scale, with the resolution-dependent timestep shift σ ↦ sσ/(1 + (s − 1)σ) that Wan's sampler applies.
  5. Scalable Diffusion Models with Transformers William Peebles, Saining Xie · ICCV 2023 DiT: patch tokens and adaLN conditioning on the timestep, the backbone Wan extends to video.
  6. RoFormer: Enhanced Transformer with Rotary Position Embedding Jianlin Su et al. · arXiv 2021 Rotary position embedding, which Wan applies separately along frames, rows and columns.
  7. UniMax: Fairer and more Effective Language Sampling for Large-Scale Multilingual Pretraining Hyung Won Chung et al. · arXiv 2023 Introduces umT5, the multilingual T5 whose encoder Wan uses for its prompts.

See also