Beyond Attention Masks: Instruction Anchoring for Efficient In-Context Diffusion Generation

Yangshuai Liu, Zheming Li, Jiaao Li, Kang He, Ziliang Lai +2 more
8/21/2026
cs.CV
diffusion-flowtransformer-attentiondistillation

No confident code implementation found for this paper.

Abstract

In-context diffusion transformers concatenate instruction, target, and reference tokens into a single sequence for joint attention. Reference-side computation must therefore be repeated at every denoising step, with the cost growing rapidly as more references are added.

Show full abstract

Decoupling reference tokens from the target enables exact key-value reuse across denoising steps, but prevents the references from attending to the instruction, degrading instruction following and reference fidelity. This trade-off cannot be resolved through attention-mask design alone. We introduce AnchorCache, a parameter-free token-layout and attention-mask co-design that inserts static text anchors. These anchors condition the reference representations on the instruction during cache construction, after which the resulting reference keys and values can be reused exactly across denoising steps. To recover the quality initially lost through this structural conversion, we apply teacher-forced velocity distillation followed by a short on-policy stage that queries the teacher at student-visited states. To our knowledge, this is the first use of on-policy distillation for architectural recovery in diffusion models. Across benchmarks spanning image, speech, and video generation, AnchorCache matches full-attention quality. Its efficiency gains increase with the reference-context size, reaching a 6.40x speedup in diffusion transformer inference.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{liu2026beyond,
  title  = {Beyond Attention Masks: Instruction Anchoring for Efficient In-Context Diffusion Generation},
  author = {Yangshuai Liu and Zheming Li and Jiaao Li and Kang He and Ziliang Lai and Zhitai Liu and Chengru Song},
  year   = {2026},
  eprint = {2608.21229},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2608.21229v3}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2608.21229.svg)](https://codeofpaper.com/paper/2608.21229)

Discussion