Affix Cache for Diffusion Large Language Models

Kaihua Liang, An Zhong, Xin Tan, Zafar Ayyub Qazi, Hong Xu, Jian Weng, Marco CaniniarXiv 2026

TL;DR

Diffusion Large Language Models (DLLMs) offer powerful bidirectional context modeling but suffer from high inference costs because their global attention mechanism invalidates standard Key-Value (KV) caching. To solve this, the authors introduce ACache, a fine-grained caching mechanism that identifies and recomputes only a small subset (~20%) of critical "Anchor Tokens" while safely reusing the rest of the cache. This approach recovers virtually all accuracy loss from naive cache reuse while slashing recomputation latency by up to 55.7% and boosting end-to-end throughput by up to 1.68×.

What Problem Does This Paper Address?

In traditional autoregressive (AR) language models, Key-Value (KV) caching is straightforward: because attention is causal (tokens only look backward), the KV states of a shared prefix (like a system prompt) remain static and can be instantly reused across different user requests.

Diffusion Large Language Models (DLLMs) break this paradigm. Instead of generating text left-to-right, they iteratively denoise an entire sequence in parallel using global, bidirectional attention. This means the KV states of your prompt tokens are tightly coupled with the dynamically changing, masked generation tokens. If you naively freeze and reuse a prefix cache, it quickly becomes stale, severely degrading generation quality. Consequently, state-of-the-art DLLM frameworks are forced to periodically recompute the entire KV cache from scratch, creating a massive computational bottleneck.

Figure 1: Cache reuse in AR LLMs and DLLMs. Left: causal AR inference supports direct reuse of shared prefixes. Middle: in DLLMs, bidirectional attention couples the KV states of shared context with evolving generated tokens, preventing naive reuse. Right: ACache reuses a shared affix while selectively recomputing Anchor Tokens.

Methods

The authors propose ACache (Affix Cache), which shifts the focus from simple prefix caching to affix caching—meaning it can reuse contiguous text spans whether they appear at the beginning, middle, or end of a prompt.

ACache operates via two main phases:

  1. Anchor Selection: At the very beginning of a request, the system runs a quick, one-shot forward probe. It measures the cross-attention weights flowing from the initial masked generation tokens to the shared affix tokens. The tokens that receive the highest aggregate attention are designated as Anchor Tokens—stable semantic reference points that dictate how the model interprets the shared text under changing contexts.
  2. Selective Recomputation: During the iterative decoding loop, ACache constructs a hybrid working cache. It freezes and reuses the precomputed KV states for the majority of the affix tokens, but selectively recomputes the KV states for the Anchor Tokens and the request-specific tokens.

To make this practical, the authors built a prototype on top of the Nano-vLLM engine and Fast-dLLM. They implemented a customized Triton attention kernel utilizing a dual-mapping system: a write-side recomputation map for updating fresh states, and a per-request read-slot map that presents a seamless, full-context logical view to the attention kernel without duplicating physical memory.

Datasets

The framework was evaluated across three distinct tasks to test different reasoning and retrieval capabilities:

  • GSM8K: Mathematical reasoning using few-shot prompts.
  • MBPP: Python code generation.
  • BABILong (0k/qa1 split): Long-context needle-in-a-haystack retrieval.

The evaluations were performed using two open-source DLLMs: LLaDA-8B-Instruct and Dream-v0-Instruct-7B.

Key Insights and Ideas

  • Attention Concentration: Empirical observations revealed that attention importance is not evenly distributed; it concentrates heavily on a small, highly stable subset of affix tokens across the entire denoising process.
  • The Non-Anchor Cache is Essential: Through an ablation study called DropNA (where non-anchor tokens were discarded entirely rather than kept frozen), the authors proved that ACache is not just a token-pruning scheme. The frozen non-anchor cache still provides vital background context that sustains model accuracy.
  • Flexibility of Bidirectional Models: Because DLLMs use bidirectional attention, cache reuse isn't restricted to the start of a sequence (prefixes). It works equally well for infixes and suffixes, opening up new architectural possibilities for complex prompt structures like Retrieval-Augmented Generation (RAG).

Key Results

  • Accuracy Recovery: By recomputing just 20% of the affix tokens (an Anchor ratio of 0.2), ACache closed the accuracy gap caused by naive cache reuse, matching the performance of full, expensive recomputation.
  • Latency Reductions: ACache reduced recompute-forward latency across all tested batched-inference settings by 15.3% to 55.7%.
  • Throughput Gains: When integrated into a realistic inference stack with continuous batching, ACache achieved up to a 1.68× speedup in end-to-end token throughput at larger batch sizes (e.g., batch size 16).
  • Memory Efficiency: Peak KV cache memory usage dropped by up to 43.3% because the shared prefix blocks did not need to be duplicated for every concurrent request.

Limitations and Future Work

While the theory behind ACache supports general affix caching (prefixes, infixes, and suffixes), the current system prototype is scoped only to shared prefixes. Supporting arbitrary infixes and suffixes within an engine like Nano-vLLM requires complex, position-aware span registration and physical-to-logical indirection layers due to how positional rotations are handled in paged memory.

Additionally, ACache currently requires developers to explicitly declare shared text spans before inference. The authors note that a valuable direction for future work would be developing an automated system that dynamically discovers and caches recurring text patterns online.

Summary updated

BibTeX
@misc{liang2026affix,
  author = {Kaihua Liang and An Zhong and Xin Tan and Zafar Ayyub Qazi and Hong Xu and Jian Weng and Marco Canini},
  title = {{Affix Cache for Diffusion Large Language Models}},
  year = {2026},
  eprint = {2608.26140},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2608.26140},
}
Figure