AutoencoderKLWan
Wan-VAE, the 3D causal video autoencoder of Wan 2.1, compressing video 4x8x8 with a chunked feature cache.
Diffusion and generative · 1,886 operations Checked
Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.
At a glance
- Parameters
- 126.9M
- Operations
- 1,886
- Framework
- PyTorch
- Recurrent
- No
- Published
- 2025
- Cited by
- 3,706 (as of 17 November 2026)
- Authors
- Team Wan, Ang Wang, Baole Ai and others
- Source
- diffusers 0.38.0
- License
- Apache-2.0
- Checked
- Passed: the trace was replayed operation by operation and matched the model's own output for this input.
Files
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
Details
- Stable ID
- m156
- Graph hash
- 74f565db1fab57e4731d4739131fe31734d6238c9f10cae0f26732d84d2f2f61
- Skeleton hash
- e8e166618d60afd01c789717cb333b0ff709ebff1dbb948171e84c2d9f7455f0
- Architecture hash
- 9adf0340f4480fa91900ce928fe2b4931b0ee1d3ea83ada6b5f56f4f61b8db2b
- Diagram SHA-256
- d7cc085520d9fa3aaea750aab3a6c636e5b0e98ab62f0e122502ba9dd220cf1a
- TorchLens version
- 2.36.0
- Renderer
- graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
- Check
- Forward pass replayed in PyTorch
How this diagram was made
diffusers.models.autoencoders.autoencoder_kl_wan.AutoencoderKLWan(base_dim=96, z_dim=16, dim_mult=[1, 2, 4, 4], num_res_blocks=2, attn_scales=[], temperal_downsample=[False, True, True], dropout=0.0, latents_mean=[-0.7571, -0.7089, -0.9113, 0.1075, -0.1745, 0.9653, -0.1517, 1.5508, 0.4134, -0.0715, 0.5517, -0.3632, -0.1922, -0.9497, 0.2503, -0.2921], latents_std=[2.8184, 1.4541, 2.3275, 2.6558, 1.2196, 1.7708, 2.6052, 2.0743, 3.2687, 2.1526, 2.8652, 1.5579, 1.6382, 1.1253, 2.8251, 1.916])
What it is
The captured member of this family is not the Wan diffusion transformer but Wan-VAE, the 3D causal VAE architecture that the Wan report proposes specifically for video generation. Wan itself is a comprehensive and open suite of video foundation models built upon the mainstream diffusion transformer paradigm, offered in 1.3B and 14B parameter sizes. The encoder of Wan-VAE encodes a video from pixel space into the latent space, which is then fed into the subsequent diffusion transformer structure.
Wan-VAE can compress the spatio-temporal dimension of a video by 4 x 8 x 8 times. Given an input video with 1 + T frames, it compresses the spatio-temporal dimensions to [1 + T/4, H/8, W/8] while expanding the number of channels to 16. The first frame is compressed to better handle the image data, following MagViT-v2. All GroupNorm layers are replaced with RMSNorm layers to preserve temporal causality, and the input feature channel in the spatial upsampling layer is halved, which gives a 33 percent reduction in memory consumption during inference. With the base channels tuned, Wan-VAE achieves a compact model size of only 127M parameters.
Training is a three-stage approach: a 2D image VAE with the same structure is first trained on image data, then inflated into a 3D causal Wan-VAE to provide an initial spatial compression prior. The losses are L1 reconstruction loss, KL loss, and LPIPS perceptual loss weighted by coefficients of 3, 3e-6, and 3, and the final fine-tuning on high-quality videos integrates the GAN loss from a 3D discriminator. For inference, a feature cache mechanism is implemented within the causal convolution module. The video is divided into 1 + T/4 chunks, the number of frames in each processing chunk is limited to at most 4, and cached frame-level features from preceding chunks feed the causal convolutions of subsequent chunks. This preserves feature coherence across chunk boundaries and supports stable inference for infinite-length videos. Under the same hardware, the report says the VAE's reconstruction speed is 2.5 times faster than HunYuan Video.
Key idea. Wan-VAE is a 3D causal video VAE that combines 4 x 8 x 8 spatio-temporal compression, RMSNorm in place of GroupNorm for causality, and a chunk-wise feature cache so that it can encode and decode unlimited-length 1080P videos without losing historical temporal information. The report describes it as more efficient and scalable and better suited for integration with diffusion-based generative models such as DiT.
- Wan-VAE
- Wan 2.1
- Wan2.1
- AutoencoderKLWan
- Wan VAE
- 3D causal VAE
- video VAE
- spatio-temporal variational autoencoder
- video foundation model
- diffusion transformer
- Wan: Open and Advanced Large-Scale Video Generative Models
- diffusers
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
Cite the paper
@misc{wan2025wanopenadvancedlargescale,
title={Wan: Open and Advanced Large-Scale Video Generative Models},
author={Team Wan and Ang Wang and Baole Ai and Bin Wen and Chaojie Mao and Chen-Wei Xie and Di Chen and Feiwu Yu and Haiming Zhao and Jianxiao Yang and Jianyuan Zeng and Jiayu Wang and Jingfeng Zhang and Jingren Zhou and Jinkai Wang and Jixuan Chen and Kai Zhu and Kang Zhao and Keyu Yan and Lianghua Huang and Mengyang Feng and Ningyi Zhang and Pandeng Li and Pingyu Wu and Ruihang Chu and Ruili Feng and Shiwei Zhang and Siyang Sun and Tao Fang and Tianxing Wang and Tianyi Gui and Tingyu Weng and Tong Shen and Wei Lin and Wei Wang and Wei Wang and Wenmeng Zhou and Wente Wang and Wenting Shen and Wenyuan Yu and Xianzhong Shi and Xiaoming Huang and Xin Xu and Yan Kou and Yangyu Lv and Yifei Li and Yijing Liu and Yiming Wang and Yingya Zhang and Yitong Huang and Yong Li and You Wu and Yu Liu and Yulin Pan and Yun Zheng and Yuntao Hong and Yupeng Shi and Yutong Feng and Zeyinzi Jiang and Zhen Han and Zhi-Fan Wu and Ziyu Liu},
year={2025},
eprint={2503.20314},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2503.20314},
}