huggingface / huggingface/diffusers

Add KV Cache for Autoregressive Inference

Open
#12,600 15 comments 9 reactions 1 assignee View on GitHub

@zucchini-nlp is already working on this.

Since Nov 21, 2025.

advanced consider-for-modular-diffusers contributions-welcome modular-diffusers stale
Dominant language
Python
Stars
34.5k
Forks
7.3k
Avg merge
3d 3h
Merged PRs (30d)
91

Description

Autoregressive Diffusion Techniques such as Self Forcing rely on a rolling KV Cache across video frame chunks to transfer information from past context frames to the current frames being denoised.

This rolling KV Cache design (or variants similar to it) is likely to show up in other types of long video generation/ world models, so it would be good to see if we can support it natively in Diffusers.

Tasks

  • Implement rolling KV Cache seen in Self Forcing using Diffusers' cache hooks design.
  • Add a Modular Block to Wan Modular Pipelines that uses this rolling KV Cache to perform autoregressive inference.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.