One of the biggest problems when generating images or videos is how slow the process can be. Fortunately, we now have a few good tricks to help speed up generation. In this post, we’ll go over our preferred solution when using ComfyUI: TeaCache and model compiling. During testing, we managed to speed up generation time by 3X with FLUX and 2.8X with Wan2.1 with no loss in quality. Without going into the details, TeaCache uses clever caching to take advantage of the fact that the output of many of the attention blocks inside diffusion models is very similar to their input. While model compiling speeds up inference by optimizing the model’s code. The great thing is that both of those techniques work out of the box with any ComfyUI workflow.
Performance improvement
TeaCache really feels like a free lunch and is perfect for speeding up API inference and ComfyUI workloads in general. However, model compiling has an important drawback that should be mentioned before we start: the first 2 to 3 generations of every session are much slower. This can make it hard to use effectively when running ComfyUI as an API unless servers are running for extended periods of time. We ran a few tests on Flux Dev and Wan2.1 text to video to quantify the performance gains:
As you can see, TeaCache on its own roughly halves the generation time with Flux and Wan2.1. And when combined with model compiling, you are looking at 2.5X to 3X speed improvements.
Utilisation
The TeaCache node from the ComfyUI-TeaCache node pack comes with two parameters. The first one, rel_l1_thresh, controls how often the cache will be refreshed. At 0 it is turned off, while at higher values, the cache is refreshed more often. The other parameter, max_skip_steps, sets the maximum number of steps that the cached memory can skip. The higher those values, the faster the generation will be. That said, we found during testing that at values higher than 0.4 / 3 for Flux and 0.2 / 3 for Wan2.1, generations started losing some details. Here are some examples using Flux Dev with different threshold values and skip steps. And again with Wan2.1:
As you can see, with Flux, results hardly change between 0 and 0.4 and start losing quality after that. While with Wan, results tend to be a lot more sensitive to the threshold. We found that 0.2 gave good results, like in the example above.
Installation
All you have to do to use these techniques is to install this node pack, and add the TeaCache and/or the Compile Model nodes after loading the diffusion model (if you are using LoRAs, the TeaCache node will go after the Load LoRA node). For a quick start, we’ve set up a template with everything you need to get started using TeaCache with Flux on ViewComfy. You can also use the Wan2.1 template and install ComfyUI-TeaCache to skip the model installation and run the model on Cloud GPUs.
- Install the TeaCache node pack.
- Load your diffusion model (and LoRAs if used).
- Add TeaCache and/or Compile Model nodes after loading the diffusion model.
- Restart ComfyUI to apply changes.
The ApplyFBCacheOnModel node is designed to enhance the efficiency of model execution by implementing a caching mechanism known as First Block Cache (FBCache). This node is particularly beneficial in scenarios where repeated computations can be avoided, thereby reducing processing time and resource usage. By caching intermediate results during model execution, it allows for faster retrieval of these results in subsequent operations, provided certain conditions are met. This caching strategy is especially useful in iterative processes like diffusion models, where similar computations are performed repeatedly. This parameter represents the model on which the FBCache will be applied. It is crucial as it determines the context in which the caching mechanism operates. This string parameter specifies the object within the model that the FBCache will target. By default, it is set to "diffusion_model".
A float parameter that controls the tolerance for caching, with a default value of 0.0. It ranges from 0.0 to 1.0, where lower values enforce stricter caching conditions. Setting this to 0 disables the FBCache effect, meaning no caching will occur. This float parameter defines the start time as a percentage of the sampling process where the FBCache effect can begin to apply. It ranges from 0.0 to 1.0, with a default of 0.0, indicating the beginning of the sampling. Similar to the start parameter, this float parameter specifies the end time as a percentage of the sampling process where the FBCache effect can apply. It also ranges from 0.0 to 1.0, with a default of 1.0, indicating the end of the sampling.
An integer parameter that limits the number of consecutive cache hits allowed. It has a default value of -1, which permits unlimited consecutive cache hits. Setting it to 0 disables the FBCache effect, while a positive value ensures that there is at least one full model call after each cached result. The output is the modified model with the FBCache applied. This model is optimized for performance through the caching mechanism, allowing for faster execution times in subsequent operations. Solution: Verify that all input parameters are set correctly and that the model is in a valid state before applying the FBCache.
Flux is slow because every denoising step reruns the entire transformer, and a lot of that work barely changes from one step to the next. FBCache ("first block cache," lifted from the Comfy-WaveSpeed / comfyui-flux-accelerator lineage) notices when a step is close enough to the last one and reuses the cached result instead of recomputing it. Caching techniques like this show up all over accelerated diffusion - it's the same idea behind TeaCache and the ParaAttention-style caches people run on Wan 2.2 for a reported lossless 2x. The logic: diffusion models change output gradually across steps, especially in the middle-to-late part of the schedule, so instead of paying full compute every step, you check how different the current step's activations are from the cached ones and skip recomputation when they're close enough.
Flux's transformer has two kinds of blocks - DoubleStreamBlocks (where image and text streams are processed jointly) and SingleStreamBlocks (where they've merged into one stream). This node lets you name specific block indices in each to skip outright, and separately caches the result of a step when it's similar enough to the last one, governed by a threshold. skip_DoubleStreamBlocks / skip_SingleStreamBlocks (strings, default "3,6,8,12" and "") - comma-separated block indices to skip entirely. fbcache_threshold (float, 0-1, default 0.25) - how similar consecutive steps need to be before the cache kicks in and skips recompute. start / end (0-1, defaults 0 and 1) - the fraction of the sampling schedule caching is allowed to run over.
No extra Python packages or model downloads for this node specifically - it operates purely on the Flux model you've already loaded. Outputs look mushy or smeared compared to no-cache. That's fbcache_threshold set too aggressive. It doesn't error but also doesn't speed anything up. Fine detail (hands, text, small objects) degrades more than everything else. That's the general trade-off with any caching scheme - detail-heavy regions are exactly where reusing a stale computation shows up first. It's incompatible with something else in your graph. Caching techniques in general have known friction with guidance methods that expect every step to be freshly computed (the same class of issue people hit combining caches with things like STG on video models).
Restart ComfyUI after configuring these options. The ApplyFBCacheAndSkipBlocks node is designed to optimize the processing of data blocks by implementing a caching mechanism and selectively skipping certain blocks. This node is particularly useful in scenarios where repeated computations can be avoided, thereby enhancing performance and efficiency. By caching the results of previously processed blocks, the node can quickly retrieve these results without re-executing the entire block, saving both time and computational resources. Additionally, the node allows for the skipping of specific blocks based on predefined conditions, which can be beneficial in workflows where certain blocks do not need to be processed every time.
The TeaCache is a powerful optimization technique that can significantly reduce generation time in ComfyUI workflows by caching intermediate results. TeaCache is a caching system built for Stable Diffusion pipelines. Here’s how it works: it stores intermediate tensors (like latent noise or model outputs) in GPU memory or RAM. TeaCache dramatically improves generation speed in ComfyUI by eliminating redundant processing steps. If you regularly render multiple frames or test prompts with the same setup, TeaCache is absolutely worth using. For example, users on Reddit reported that enabling TeaCache reduced 100-frame animations from 15 minutes to under 5 minutes, especially when paired with efficient schedulers like LCM. Let me break down how TeaCache actually works: it saves intermediate tensors generated during a Stable Diffusion workflow. TeaCache is one of the easiest ways to boost performance in ComfyUI, especially for animations, iterative testing, and complex workflows.

Practical guidance and quick-start tips
- Use TeaCache as a first-order speedup for API inferences and repeated-frame workflows.
- Expect the first few generations with model compiling to be slower, then see sustained gains in subsequent runs.
- Tune rel_l1_thresh and max_skip_steps carefully to avoid noticeable quality loss, especially with Wan2.1.
- Leverage existing templates for Flux and Wan2.1 to simplify setup and ensure compatibility with cloud GPUs.