MagCache4Wan2.1
June 17, 2025 · View on GitHub
MagCache can speedup Wan2.1 2.8x without much visual quality degradation, in a training-free manner. The following video shows the results generated by MagCache-Wan2.1. The corresponding hyper-parameters are shown in the following table, where E024K6R02 denotes magcache_threshold=0.24, magcache_K=6, and retention_ratio=0.2.
Usage
Follow Wan2.1 to clone the repo and finish the installation, then copy 'magcache_generate.py' in this repo to the Wan2.1 repo.
For T2V with 1.3B model, you can use the following command:
python magcache_generate.py --task t2v-1.3B --size 832*480 --ckpt_dir ./Wan2.1-T2V-1.3B --prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage." --base_seed 42 --offload_model True --t5_cpu --use_magcache --magcache_K 4 --retention_ratio 0.2 --magcache_thresh 0.12
For T2V with 14B model, you can use the following command:
python magcache_generate.py --task t2v-14B --size 1280*720 --ckpt_dir ./Wan2.1-T2V-14B --prompt "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." --base_seed 0 --offload_model True --t5_cpu --use_magcache --magcache_K 6 --retention_ratio 0.2 --magcache_thresh 0.24
# another prompt for visualization is:
# 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.
For I2V with 480P resolution, you can use the following command:
python magcache_generate.py --task i2v-14B \
--size 832*480 \
--ckpt_dir ./Wan2.1-I2V-14B-480P \
--image examples/wan_i2v_2.png \
--use_magcache \
--magcache_K 6 \
--magcache_thresh 0.24 \
--retention_ratio 0.2 \
--base_seed 0 \
--prompt "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."
For I2V with 720P resolution, you can use the following command:
python magcache_generate.py --task i2v-14B \
--size 1280*720 \
--ckpt_dir ./Wan2.1-I2V-14B-720P \
--image examples/wan_i2v.png \
--use_magcache \
--magcache_K 6 \
--retention_ratio 0.2 \
--magcache_thresh 0.24 \
--offload_model True \
--base_seed 0 \
--t5_cpu \
--frame_num 61 \
--prompt "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."
For VACE with 480P resolution, you can use the following command:
python magcache_generate_new.py --task vace-1.3B --size 832*480 \
--ckpt_dir ./Wan2.1-VACE-1.3B --src_ref_images examples/girl.png,examples/snake.png \
--use_magcache \
--magcache_K 3 \
--magcache_thresh 0.02 \
--retention_ratio 0.2 \
--prompt "在一个欢乐而充满节日气氛的场景中,穿着鲜艳红色春服的小女孩正与她的可爱卡通蛇嬉戏。她的春服上绣着金色吉祥图案,散发着喜庆的气息,脸上洋溢着灿烂的笑容。蛇身呈现出亮眼的绿色,形状圆润,宽大的眼睛让它显得既友善又幽默。小女孩欢快地用手轻轻抚摸着蛇的头部,共同享受着这温馨的时刻。周围五彩斑斓的灯笼和彩带装饰着环境,阳光透过洒在她们身上,营造出一个充满友爱与幸福的新年氛围。"
📈 Inference Latency Comparisons on a Single A800
Wan2.1 T2V 14B 720p
| Wan2.1 T2V 14B 720p | TeaCache (0.2) | MagCache (E024K6R02) |
|---|---|---|
| ~60min04s | ~30min01s | ~21min40s |

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.
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 T2V 1.3B 480p
| Wan2.1 t2v 1.3B | TeaCache (0.08) | MagCache (E012K2R02) | MagCache (E012K4R02) |
|---|---|---|---|
| ~189 s | ~95 s | ~87 s | ~68 s |

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.Wan2.1 I2V 14B 720p
| Wan2.1 i2v 720P ours | TeaCache (0.5) | MagCache (E012K4R02) | MagCache (E024K6R02) |
|---|---|---|---|
| ~30min40s | ~13min04s | ~11min35s | ~10min03s |

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 I2V 14B 480P
| Wan2.1 i2v 480P ours | TeaCache (0.26) | MagCache (E012K4R02) | MagCache (E024K6R02) |
|---|---|---|---|
| ~13min20s | ~5min22s | 4min43s | ~4min23s |
Citation
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},
}
Acknowledgements
We would like to thank the contributors to the Wan2.1 and TeaCache.