1
Caching
Vladimir Mandic edited this page 2026-09-07 07:26:29 +02:00
This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Execution Caching

Caching accelerates inference by storing and reusing intermediate outputs of different layers, such as attention and feedforward layers, instead of performing the entire computation at each inference step

It significantly improves generation speed at the expense of more memory and doesnt require additional training

Tip

You may use caching on models that require larger step counts
But do not use caching on models that are tuned for fewer steps

Note

Which model supports which caching method depends on the model architecture: there is no universal approach, so experimentation is required

Caching methods:

  • FasterCache
  • FirstBlockCache
  • LayerSkip
  • MagCache
  • PyramidAttentionBroadcast
  • TaylorSeerCache
  • TextKVCache

See https://huggingface.co/docs/diffusers/v0.40.0/en/optimization/cache for more information