Nodes/ComfyUI-WanVideoWrapper/WanVideo TeaCache
ComfyUI Node Runs on cloud

WanVideo TeaCache

Skip redundant Wan steps for a real speedup

By kijai·Created about a year ago·Updated 3 months ago· 6,655
WanVideo TeaCache
    • cache_args
    rel_l1_thresh0.300
    start_step1
    end_step-1
    cache_deviceoffload_device
    use_coefficientstrue
    modee

    TeaCache is one of the standard ways people make Wan tolerable on a home GPU, and this is the version that lives inside Kijai's WanVideoWrapper - not the deprecated KJNodes one, this is the maintained in-wrapper implementation. The idea is simple and it works: across Wan's many denoising steps, a lot of consecutive steps produce nearly identical output. TeaCache notices when a step is close enough to a cached one and reuses the cached result instead of doing the full, expensive transformer pass. Stack it with SageAttention and TorchCompile and it's a big part of what gets a 4090 from "unusable" to "5-ish minutes for an 81-frame clip."

    The node's own description is unusually candid about the gotchas, and it's worth reading them there because they're the whole game: "Early steps should never be skipped, with too aggressive values this can happen and the motion suffers."

    How it works

    Each step, TeaCache measures how different the model's input is from the last time it actually ran a full step. If the relative difference is under a threshold, it skips the compute and reuses the previous output. The skipping is guided by per-model coefficients - tuning constants matched to a specific Wan variant - which make the skip decisions much smarter than a raw threshold could. It outputs a cache_args bundle you plug into the sampler; the sampler does the actual caching during the run.

    The inputs and outputs that matter

    • rel_l1_thresh (default 0.3) - the aggressiveness dial. Higher skips more steps (faster, rougher); lower is conservative. Big caveat from the description: when you turn use_coefficients off, this value should be roughly 10x smaller than what you'd use with coefficients on. Don't carry a 0.3 over to the no-coefficients mode.
    • use_coefficients (default true) - leave it on. Coefficients are the model-specific tuning that keeps quality up; Kijai points to the official recommended values at the TeaCache4Wan repo.
    • start_step (default 1) - where caching kicks in. It defaults to 1, not 0, on purpose: the earliest steps set up motion and structure and must never be skipped. If motion looks mushy, start even later.
    • end_step (default -1) - -1 means "to the end."
    • cache_device (offload_device default) - keep the cache tensors off your GPU by default; only move to main_device if you've got VRAM to spare and want the speed.
    • mode (e / e0) - which internal signal drives the decision; leave at e unless a workflow says otherwise.

    Output is cache_args (type CACHEARGS) - wire it into the sampler's cache input.

    How to install it

    Comes with the WanVideoWrapper. ComfyUI Manager: search ComfyUI-WanVideoWrapper, install, restart. Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/kijai/ComfyUI-WanVideoWrapper
    pip install -r ComfyUI-WanVideoWrapper/requirements.txt
    

    then restart. No separate model download - it patches the Wan model you've already loaded.

    Common issues & troubleshooting

    Motion turned to slush. You skipped too aggressively or too early. Lower rel_l1_thresh, and push start_step later so the structural early steps always run. The description warns about exactly this.

    Faces drift across the clip. This is caching's signature cost, and it carries across every Wan cache technique: reusing skipped work means occasionally reusing something that should have changed, and faces are where you notice first. The community's consistent finding is that turning caching off improves face consistency - so if identity wobbles, that's the first thing to test.

    You copied a threshold that misbehaves. Almost always the coefficients toggle. With coefficients on, ~0.3 is normal; with them off, you need ~0.03. Mixing those up is the classic own-goal.

    CategoryWanVideoWrapper

    Inputs (6)

    NameTypeDefaultDescription
    rel_l1_threshFLOAT0.3000–1Higher values will make TeaCache more aggressive, faster, but may cause artifacts. Good value range for 1.3B: 0.05 - 0.08, for other models 0.15-0.30
    start_stepINT10–9999Start percentage of the steps to apply TeaCache
    end_stepINT-1-1–9999End steps to apply TeaCache
    cache_deviceCOMBOoffload_deviceDevice to cache to
    use_coefficientsBOOLEANtrueUse calculated coefficients for more accuracy. When enabled therel_l1_thresh should be about 10 times higher than without
    modeoptCOMBOeChoice between using e (time embeds, default) or e0 (modulated time embeds)

    Outputs (1)

    NameTypeDescription
    cache_argsCACHEARGS