Nodes/ComfyUI-BerniniR Wrapper/Bernini-R TeaCache Args
ComfyUI Node

Bernini-R TeaCache Args

The block-skipping speedup that's a few steps from free

By xiaolibai-sys·Created 2 months ago·Updated 2 months ago· 9
Bernini-R TeaCache Args
    • teacache_args
    max_skip_blocks15
    start_block3
    rel_l1_thresh0.08
    warmup_steps1
    cooldown_steps2

    TeaCache is the Wan-ecosystem speed hack that's aged the best: between denoising steps, the latent changes only a little, so a chunk of transformer blocks will produce near-identical output to the last step. Instead of recomputing them, you skip them and reuse the previous result. BerniniR_TeaCacheArgs configures that skipping for this pack, and it's the difference between watching a Bernini-R clip render at a glacial pace and one that's merely slow.

    How it works

    At each step, the sampler compares the latent's L1 distance against the previous step at a designated "start block." If the change is below your threshold, it skips computing the next max_skip_blocks transformer blocks and reuses their previous outputs. That's fewer forward computations per step, and on a big DiT the savings compound. The tradeoff is quality risk: skip too aggressively and detail gets blurry or motion gets stiff. There's also a warmup/cooldown guard so structure formation at the start and detail refinement at the end always run in full.

    The inputs that matter

    • rel_l1_thresh - the skip decision threshold, default 0.08. The tooltip is honest about the trade: 0.04 is safe (minimal quality loss), 0.12 is fast (may degrade). This is your main speed/quality dial.
    • max_skip_blocks - how many blocks get cached, default 15. Larger = more speedup but more quality risk. This number must sit sensibly against the model's layer count.
    • start_block - where the L1 comparison happens, default 3. The first cacheable block.
    • warmup_steps (1) - first N steps never cache (structure formation).
    • cooldown_steps (2) - last N steps never cache (detail refinement).

    Output and wiring

    One output: teacache_args (BERNINI_TEACACHE) → the teacache_args input on BerniniR_KSampler. Disconnect it and TeaCache is off - that's the pack's explicit enable/disable mechanism, which is a nice way to A/B.

    How it interacts with everything else

    Two interactions are worth knowing, because both are handled deliberately in this pack:

    • TeaCache + torch.compile - both can be enabled together. When a compiled model is also TeaCache-accelerated, the pack restores the eager transformer forward so TeaCache's block-skipping hooks actually take effect (older versions could let compile silently disable TeaCache). The README calls this out specifically, so it's clearly been a trap before.
    • TeaCache + context windows - both are independent layers of the pack's VRAM/speed strategy and stack fine.

    Honest tuning advice

    Start at the defaults (rel_l1_thresh 0.08, max_skip_blocks 15, start_block 3) and go one direction: for a quality-first render, drop the threshold to 0.04 and watch the speed difference. Most people land somewhere in the middle and keep it. The community's long-standing word on TeaCache-family tricks is that they occasionally cost face consistency - if your faces look subtly wrong after enabling it, your threshold is probably too aggressive. And no, it won't save you from the fundamental Bernini-R tax: editing runs ~2× the compute of a Wan 2.2 generation because the source video joins the input. TeaCache makes that tax more bearable; it doesn't repeal it.

    CategoryBernini-R/Config

    Inputs (5)

    NameTypeDefaultDescription
    max_skip_blocksINT151–30Number of blocks in the caching window. Larger = more speedup but higher quality risk.
    start_blockINT30–29Index of the first cacheable block. L1 distance is compared here to decide skip vs compute.
    rel_l1_threshFLOAT0.080–1Skip blocks when the absolute mean L1 distance between consecutive step residuals < threshold (unnormalized). 0.04 = safe (minimal quality loss), 0.12 = fast (may degrade).
    warmup_stepsINT10–100First N denoising steps that never cache (structure formation phase).
    cooldown_stepsINT20–100Last N denoising steps that never cache (detail refinement phase).

    Outputs (1)

    NameTypeDescription
    teacache_argsBERNINI_TEACACHE