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

What CogVideoX is

CogVideoX is a text-to-video diffusion transformer. Like the other video tabs it denoises the latent of a 3-D causal VAE as a sequence of space-time tokens, but it does not read the prompt through a separate cross-attention: prompt tokens and video tokens are concatenated into one sequence and share every attention layer. Because text and video live in different spaces, each block gives them separate normalisation, the expert adaptive LayerNorm that names its expert transformer.

The page records CogVideoX-2B, a 1,694 M-parameter transformer of 30 blocks with a 216 M VAE, generating 9 frames of 384 × 256 for A corgi running on a sunny beach, waves in the background in 50 DDIM steps on v-prediction, guidance 6 and seed 1. The board shows block 1 in full at steps 11 and 36.

The causal VAE and the tokens

The VAE compresses 4 × in time and 8 × in each spatial side into 16 channels: 9 × 256 × 384 × 3 = 2,654,208 numbers become 3 × 32 × 48 × 16 = 73,728, 36 times fewer, and are scaled by 1.153 before the transformer sees them. It is causal: every temporal convolution puts its padding at the start, repeating frame 0, so no frame sees a later one. Latent frame 0 holds frame 0 alone and each later latent frame the next four, as the CogVideoX VAE card groups them.

The transformer patchifies each latent frame into 2 × 2 patches, a 3 × 16 × 24 grid of 1,152 video tokens of width 1,920, and adds a fixed 3-D sin-cos position: a quarter of the width (480 numbers) encodes the frame, the rest the column and the row (720 each), and prompt tokens get zeros. The 2B model was trained with these sinusoidal positions (the larger 5B model uses 3-D RoPE instead), and positions are divided by 1.875 first so this small grid spans the range of positions the model was trained on. The 3-D sin-cos position card shows the selected token's three parts.

Expert adaptive LayerNorm

A DiT block is conditioned on the timestep through adaptive LayerNorm: an MLP of the timestep embedding gives a shift, a scale and a gate for each sublayer. CogVideoX computes two such sets from the same embedding, one for the video tokens (the vision expert) and one for the prompt tokens (the text expert), applied after one shared LayerNorm:

The two streams then meet in the same attention and feed-forward weights, and each adds the results back through its own gate. This keeps the parameter count of a single-stream transformer while letting the two modalities keep different statistics. The Expert adaLN card shows, at the selected step, the RMS of every expert's shift, scale and gate in all 30 blocks, the text expert's rows beside the vision expert's.

Joint attention

The Joint Attention card is one softmax over the 226 prompt positions and the 1,152 video tokens together: every video token reads every other video token of every frame and every prompt token, and the prompt tokens read the video too (the board includes two of them, cor and beach, among its queries). Queries and keys are LayerNorm-ed per head first:

The prompt comes from T5-XXL padded to 226 tokens: 16 real tokens and 210 padding tokens, which are real pad embeddings rather than zeros and are not masked, so they are keys too; the card sums their weight into one column. Joint attention over text and image tokens is the MMDiT idea of Stable Diffusion 3 (see the SD 3.5 and FLUX tabs); CogVideoX's paper calls its version 3-D text-video hybrid attention: one attention over all frames at once, rather than separate spatial and temporal layers.

v-prediction and DDIM

CogVideoX is a discrete-time diffusion model: at step the latent is . Its schedule starts from Stable Diffusion's scaled-linear , divides the signal-to-noise ratio by 3, and rescales it so that the last step has , pure noise. That zero terminal SNR means sampling starts from exactly what the model was trained on, but it makes predicting the noise useless at the first step, where . So the model predicts the velocity

which at is simply . Sampling takes 50 deterministic DDIM steps at trailing timesteps 999, 979, …, 19, each rebuilding the next latent from and : , with from a prompt pass and an empty-prompt pass. The v-prediction · DDIM card plays the loop and lists these numbers for the selected token; step 11 runs at () and step 36 at ().

Where it came from

CogVideoX follows CogVideo (2022), an autoregressive transformer over discrete video tokens, by moving to diffusion on a continuous VAE latent. Its pieces come from image models: the DiT backbone with adaLN, the joint attention of Stable Diffusion 3, v-prediction from progressive distillation and zero terminal SNR from Lin et al. Wan keeps cross-attention to the prompt instead of joint attention (see the Wan tab), and LTX-Video moves the patchify into a far more compressed VAE (see the LTX tab).

Papers

  1. CogVideoX: Text-to-Video Diffusion Models with An Expert Transformer Zhuoyi Yang et al. · ICLR 2025 The model this tab records: the 3-D causal VAE, expert adaptive LayerNorm, 3-D hybrid attention over text and video, v-prediction with zero SNR.
  2. Scaling Rectified Flow Transformers for High-Resolution Image Synthesis Patrick Esser et al. · ICML 2024 MMDiT, joint attention over text and image tokens with separate weights per modality, and SNR shifting for large inputs.
  3. Progressive Distillation for Fast Sampling of Diffusion Models Tim Salimans, Jonathan Ho · ICLR 2022 Introduces the v-parametrisation, which stays well defined at zero signal-to-noise ratio.
  4. Common Diffusion Noise Schedules and Sample Steps are Flawed Shanchuan Lin, Bingchen Liu, Jiashi Li, Xiao Yang · WACV 2024 Rescaling a schedule to zero terminal SNR, with v-prediction and trailing timesteps, as CogVideoX's scheduler does.
  5. Denoising Diffusion Implicit Models Jiaming Song, Chenlin Meng, Stefano Ermon · ICLR 2021 DDIM, the deterministic sampler that rebuilds each latent from the predicted x₀ and ε.
  6. Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer Colin Raffel et al. · JMLR 2020 T5, whose XXL encoder (v1.1) turns the prompt into the 226 vectors joint attention reads.
  7. CogVideo: Large-scale Pretraining for Text-to-Video Generation via Transformers Wenyi Hong et al. · arXiv 2022 The autoregressive predecessor over discrete video tokens that CogVideoX replaced with latent diffusion.

See also