School of Computer Science, Peking University,Β 2Huawei Inc.

Figure 1: Visualization of MagCache on Open-Sora and Wan2.1. MagCache can achieve better visual quality with a comparable or less latency. More demos are shown in the subfolders of each model.
We introduce Magnitude-aware Cache (MagCache), a training-free caching approach that estimates and leverages the fluctuating differences among model outputs across timesteps based on the robust magnitude observations, thereby accelerating the inference. MagCache works well for Video Diffusion Models, Image Diffusion models. For more details and results, please visit our project page.

Figure 2: Relationships between output residuals across diffusion timesteps. Magnitude ratio serves as both an accurate and stable criterion for measuring the difference between residuals.
- If you like our project, please give us a star β on GitHub for the latest update.
- [2025/8/20] π₯ Support Qwen-Image and Qwen-Image-Edit with 1.5x speedup officially.
- [2025/8/7] π₯ Support Wan2.2 with 1.5-2x speedup officially.
- [2025/7/14] π₯ Support OmniGen2 with 1.9x speedup officially.
- [2025/6/30] π₯ Support Flux-Kontext with 2x speedup officially.
- [2025/6/19] π₯ Support FramePack officially.
- [2025/6/17] π₯ Support VACE 1.3B&14B officially.
- [2025/6/17] π₯ MagCache is supported by ComfyUI-WanVideoWrapper. Thanks @kijai.
- [2025/6/16] π₯ Support Chroma officially. Please try it in ComfyUI-MagCache.
- [2025/6/12] π₯ Support ComfyUI-MagCache officially. Please have a try!
- [2025/6/10] π₯ Support Wan2.1, HunyuanVideo, FLUX, Open-Sora.
- [2025/6/10] π Release the code of MagCache.
- [2025/6/10] π Release the paper of MagCache.
If you develop/use MagCache in your projects and you would like more people to see it, please inform us.(zehongma@stu.pku.edu.cn)
ComfyUI
- ComfyUI-WanVideoWrapper
- ComfyUI-MagCache (Community) for MagCache. Support Flux now. Thanks @wildminder. Our official ComfyUI-MagCache now support Wan2.1, HunyuanVideo, Flux.
Text to Video
Image to Video
Video Editing
Text to Image
Image Editing
Demos
- HunyuanVideo T2V 720P
HunyuanVideo_T2V_720P__Two_Astronauts.mp4
Prompt: The video shows two astronauts in bulky suits walking slowly on the moonβs surface....
The video shows two astronauts in bulky suits walking slowly on the moonβs surface, against a vast starry universe. Their steps are heavy and slow, kicking up dust in the low-gravity environment. The scene is silent, mysterious, and evokes the courage and dreams of space exploration.- Wan2.1 14B I2V 720P
Wan14B_I2V_720P_A_Woman.mp4
Prompt: A woman in black lace stands confidently in a dim Art Deco interior with polished marble floors....
A woman in black lace stands confidently in a dim Art Deco interior with polished marble floors. Stark chiaroscuro lighting highlights her sharp features as she tilts her head, crimson lips parting in a knowing smile. Her smoldering gaze meets the viewer while she turns gracefully, lace casting shifting shadows on the walls. A medium shot with a subtle dolly zoom, framed by velvet drapes, adds depth. The mysterious, refined atmosphere blends modern elegance with vintage Hollywood glamour, rendered in 8K hyper-realistic detail, metallic gold accents glowing in the soft light.- Wan2.1 14B T2V 720P
Wan14B_T2V_720P_Two_Astronauts.mp4
Prompt: The video shows two astronauts in bulky suits walking slowly on the moonβs surface....
The video shows two astronauts in bulky suits walking slowly on the moonβs surface, against a vast starry universe. Their steps are heavy and slow, kicking up dust in the low-gravity environment. The scene is silent, mysterious, and evokes the courage and dreams of space exploration.Wan14B_T2V_A_Stylish_Woman_Tokyo.mp4
Prompt: A stylish woman walks down a Tokyo street filled with warm glowing neon....
A stylish woman walks down a Tokyo street filled with warm glowing neon and animated city signage. She wears a black leather jacket, a long red dress, and black boots, and carries a black purse. She wears sunglasses and red lipstick. She walks confidently and casually. The street is damp and reflective, creating a mirror effect of the colorful lights. Many pedestrians walk about.- Wan2.1 1.3B T2V 480P
Wan1.3B_T2V_Two_Cat_Boxing.mp4
Prompt: Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage.
Prompt: Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage.OpenSora.mp4
Prompt: A tranquil tableau of an ornate Victorian streetlamp....
A tranquil tableau of an ornate Victorian streetlamp standing on a cobblestone street corner, illuminating the empty night- FramePack
framepack_demo.mp4
Prompt: The girl dances gracefully, with clear movements, full of charm.
The girl dances gracefully, with clear movements, full of charm.- FLUX-dev T2I
Prompt: A photo of a black bicycle.
Prompt: A photo of a black bicycle.- Welcome for PRs to support other models.
- Please implement the
magcache_calibrationfunction by referring the code in MagCache4Wan2.1 - Utilize a random prompt or input to generate the magnitude ratio.
- Implement the
magcache_forwardfunction by adding a few lines into the original forward function. - Reuse the default hyper-parameters or set your own hyper-parameters to achieve a trade-off between latency and quality.
This repository is built based on VideoSys, Diffusers, Open-Sora, FLUX, Chroma, Wan2.1, HunyuanVideo, FramePack, and TeaCache. Thanks for their contributions!
- The core code of this project is released under the Apache 2.0 license as found in the LICENSE file. The core code includes the calibration and forward code of MagCache.
- For VideoSys, TeaCache, Diffusers, Open-Sora, HunyuanVideo, FLUX, Chroma, FramePack, and Wan2.1 please follow their LICENSE.
If you find MagCache is useful in your research or applications, please consider giving us a star β and citing it by the following BibTeX entry.
@misc{ma2025magcachefastvideogeneration,
title={MagCache: Fast Video Generation with Magnitude-Aware Cache},
author={Zehong Ma and Longhui Wei and Feng Wang and Shiliang Zhang and Qi Tian},
year={2025},
eprint={2506.09045},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2506.09045},
}









