LazyMAR: Accelerating Masked Autoregressive Models via Feature Caching

Feihong Yan, Qingyan Wei, Jiayi Tang, Jiajun Li, Yulin Wang, Xuming Hu, Huiqi Li, Linfeng Zhang · OpenReview

Abstract

Masked Autoregressive (MAR) models have emerged as a promising approach in image generation, expected to surpass traditional autoregressive models in computational efficiency by leveraging parallel decoding. However, their dependence on bidirectional self-attention inherently conflicts with conventional KV caching mechanisms, creating unexpected computational bottlenecks. This paper introduces LazyMAR, a training-free, plug-and-play framework that addresses these bottlenecks by leveraging two types of redundancy: Token Redundancy and Condition Redundancy. Experimental results demonstrate that LazyMAR achieves up to 2.83× acceleration with almost no drop in generation quality on ImageNet 1K.

Introduction

Autoregressive (AR) models generate images token-by-token, a process that is inherently sequential and slow. Masked Autoregressive (MAR) models were designed to mitigate this by predicting multiple tokens in parallel. However, unlike standard Large Language Models (LLMs) that use causal attention, MAR models rely on bidirectional self-attention, where every token can "see" every other token. This requirement means that all token representations must be updated at every decoding step, preventing the use of traditional Key-Value (KV) caching. LazyMAR overcomes this by identifying and caching redundant information across decoding steps.

Methodology: Leveraging Redundancy

Token Cache and Token Redundancy

The researchers observed that a large portion of tokens exhibit very similar representations across adjacent decoding steps. Specifically, tokens that were decoded in earlier steps remain highly stable, while tokens decoded in the most recent step show the most significant changes.

Visualization of token redundancy. The heatmap (right) shows that tokens decoded in the most recent step (blue boxes on left) have the highest difference (darker blue in heatmap), while tokens from previous steps (brown) are highly redundant and suitable for caching.

LazyMAR employs a "Similarity-based Strategy" to exploit this. It computes only the first three layers of the network for all tokens and calculates the cosine similarity between these early features and the cached features from the previous step. Due to a high correlation (ρ = 0.923) between early-layer and final-layer feature differences, the model can skip the remaining expensive layers for highly similar tokens, reusing their cached values instead. This mechanism allows the model to skip approximately 84% of token computations on average.

Condition Cache and Condition Redundancy

High-quality MAR models typically use Classifier-Free Guidance (CFG), which requires running the model twice per step: once with a conditional prompt and once unconditionally. This effectively doubles the computational cost. LazyMAR identifies Condition Redundancy, noting that while absolute outputs change, the residual (the difference between conditional and unconditional outputs) is remarkably stable across steps.

The Condition Cache mechanism. The graph (right) illustrates that the residual (yellow line) is 35.5× more stable than the raw conditional or unconditional outputs, making it an ideal candidate for caching to skip the unconditional branch.

By caching this residual, LazyMAR can skip the unconditional computation branch in most steps. To prevent approximation errors from accumulating, the system periodically performs a full "ground-truth" computation to refresh the cache.

Key Results and Performance

LazyMAR was evaluated on the ImageNet 1K dataset at 256 × 256 resolution across various model scales (MAR-B, MAR-L, and MAR-H).

  • Speedup: On the MAR-H model (943M parameters), LazyMAR achieved a 2.83× speedup.
  • Quality Preservation: The acceleration comes with a negligible impact on image quality; for MAR-H, the FID only moved from 1.59 to 1.69.
  • Robustness: Unlike simple step-reduction techniques which often cause image distortion, LazyMAR maintains the structural integrity of the original generation process.
  • Hardware Agnostic: The performance gains were consistent across both GPU (NVIDIA 3090) and CPU (Intel 12900K) environments.

Conclusion

LazyMAR provides a robust, training-free solution to the efficiency bottlenecks of bidirectional Masked Autoregressive models. By intelligently caching redundant token features and CFG residuals, it brings the efficiency of KV-style caching to parallel decoding architectures, significantly reducing the computational cost of high-quality image synthesis.

Summary updated

BibTeX
@inproceedings{yan2025lazymar,
  author = {Feihong Yan and Qingyan Wei and Jiayi Tang and Jiajun Li and Yulin Wang and Xuming Hu and Huiqi Li and Linfeng Zhang},
  title = {{LazyMAR: Accelerating Masked Autoregressive Models via Feature Caching}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2025},
}
Figure