Revisiting Non-Autoregressive Transformers for Efficient Image Synthesis

Zanlin Ni, Yulin Wang, Renping Zhou, Jiayi Guo, Jinyi Hu, Zhiyuan Liu, Shiji Song, Yuan Yao, Gao Huang · DOI

Abstract

The field of image synthesis is currently flourishing due to the advancements in diffusion models. While diffusion models have been successful, their computational intensity has prompted the pursuit of more efficient alternatives. As a representative work, non-autoregressive Transformers (NATs) have been recognized for their rapid generation. However, a major drawback of these models is their inferior performance compared to diffusion models. In this paper, we aim to re-evaluate the full potential of NATs by revisiting the design of their training and inference strategies. Specifically, we identify the complexities in properly configuring these strategies and indicate the possible sub-optimality in existing heuristic-driven designs. Recognizing this, we propose to go beyond existing methods by directly solving the optimal strategies in an automatic framework. The resulting method, named AutoNAT, advances the performance boundaries of NATs notably, and is able to perform comparably with the latest diffusion models at a significantly reduced inference cost. The effectiveness of AutoNAT is validated on four benchmark datasets, i.e., ImageNet-256 & 512, MS-COCO, and CC3M.

Introduction

While diffusion models like Stable Diffusion and DiT currently dominate the landscape of high-fidelity image synthesis, their iterative denoising process is computationally demanding, requiring numerous sequential steps. Non-Autoregressive Transformers (NATs) present a compelling alternative, designed for speed by predicting multiple image tokens in parallel.

The NAT generation process iteratively decodes tokens in parallel from a masked latent space to produce a final image.

Despite their speed advantage, NATs have historically lagged behind diffusion models in image quality. This research posits that the performance gap is not a fundamental architectural flaw but rather a consequence of sub-optimal, manually-tuned heuristics used during training and inference. By replacing these human-designed rules with an automated optimization framework, we demonstrate that NATs can achieve state-of-the-art quality with significantly higher efficiency.

The AutoNAT Framework

The core of our approach is AutoNAT, a unified framework that treats training and generation strategies as variables to be optimized rather than fixed rules. We identify four critical scheduling functions that govern NAT performance:

  1. Re-masking Ratio $r(t)$: Determines the fraction of tokens to be re-masked at each generation step.
  2. Sampling Temperature $\tau_1(t)$: Regulates the randomness in token selection.
  3. Re-masking Temperature $\tau_2(t)$: Controls the criteria for identifying and re-masking "unreliable" tokens.
  4. Guidance Scale $s(t)$: Modulates the strength of classifier-free guidance.

To optimize these functions, we employ an Alternating Optimization algorithm. This process alternates between optimizing the generation strategy for a fixed model using gradient descent and searching for the optimal training mask ratio distribution $p(r)$ to retrain the model.

Experimental Evaluation

We validated AutoNAT across several diverse benchmarks, including ImageNet-256 & 512, MS-COCO, and CC3M. Our investigation revealed that common heuristics are often bottlenecks. For instance, we found that a simple fixed mask ratio during training can outperform the more complex "cosine" distribution typically used in models like MaskGIT. Ablation studies further highlighted that the sampling temperature ($\tau_1$) is the most critical hyperparameter; failing to optimize it leads to a significant degradation in image quality.

Furthermore, we observed high strategy transferability: configurations optimized on smaller, less expensive models transfer effectively to larger architectures, enabling efficient scaling of the optimization process.

Results and Discussion

AutoNAT significantly improves the Pareto front of the speed-vs-quality tradeoff. As shown in the figure below, AutoNAT models achieve a 5.1× speedup over leading diffusion models like DiT and LDM while maintaining comparable or superior FID scores.

FID vs. Sampling Compute. AutoNAT (red) achieves a 5.1× speedup over diffusion models while maintaining superior image quality.

On ImageNet-256, AutoNAT-L achieved a state-of-the-art FID of 2.68 in just 8 steps. This performance not only surpasses previous NAT models like MaskGIT (FID 6.18) but also rivals much slower diffusion-based counterparts. These efficiency gains are hardware-agnostic, translating to both GPU and CPU environments, which makes AutoNAT highly suitable for real-time applications and edge deployment.

Conclusion

AutoNAT demonstrates that the perceived quality limitations of Non-Autoregressive Transformers are largely due to sub-optimal strategy design. By automating the optimization of training and inference schedules, we bridge the gap between NATs and diffusion models. While the performance remains tied to the quality of the underlying VQ-autoencoder, AutoNAT establishes a new benchmark for efficient image synthesis.

Summary updated

BibTeX
@inproceedings{ni2024revisiting,
  author = {Zanlin Ni and Yulin Wang and Renping Zhou and Jiayi Guo and Jinyi Hu and Zhiyuan Liu and Shiji Song and Yuan Yao and Gao Huang},
  title = {{Revisiting Non-Autoregressive Transformers for Efficient Image Synthesis}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2024},
  doi = {10.1109/cvpr52733.2024.00669},
}
Figure