提出ENAT模型,让图像生成更快更省算力
ENAT: Rethinking Spatial-temporal Interactions in Token-based Image Synthesis
- 分离可见与掩码令牌计算,提升空间交互效率
- 只重点更新关键区域,减少重复计算,提速40%以上
- 适合追求高效图像生成的开发者和研究者
近期基于标记的生成方法在图像合成中表现优异。以非自回归变压器(NAT)为例,可在少数步骤内生成高质量图像。其生成过程逐步展开,每一步通过掩码令牌填充未生成区域并推断。本文深入分析NAT机制,发现两个自然模式:空间上,掩码令牌主要用于信息汇聚解码,而可见令牌主要提供信息,深层表示仅依赖自身;时间上,相邻步骤间交互主要集中于少数关键令牌的更新,多数令牌计算高度重复。基于此,我们提出ENAT模型,显式强化这些内在交互。空间层面,独立编码可见令牌,掩码令牌则条件化于完全编码的可见令牌进行解码;时间层面,优先计算关键令牌,最大程度复用先前已计算的令牌表示。ENAT显著提升NAT性能的同时大幅降低计算成本。在ImageNet-256、ImageNet-512和MS-COCO上的实验验证了其有效性。代码已公开于https://github.com/LeapLabTHU/ENAT。
原文摘要 · Abstract (English)
Recently, token-based generation have demonstrated their effectiveness in image synthesis. As a representative example, non-autoregressive Transformers (NATs) can generate decent-quality images in a few steps. NATs perform generation in a progressive manner, where the latent tokens of a resulting image are incrementally revealed. At each step, the unrevealed image regions are padded with mask tokens and inferred by NAT. In this paper, we delve into the mechanisms behind the effectiveness of NATs and uncover two important patterns that naturally emerge from NATs: Spatially (within a step), although mask and visible tokens are processed uniformly by NATs, the interactions between them are highly asymmetric. In specific, mask tokens mainly gather information for decoding, while visible tokens tend to primarily provide information, and their deep representations can be built only upon themselves. Temporally (across steps), the interactions between adjacent generation steps mostly concentrate on updating the representations of a few critical tokens, while the computation for the majority of tokens is generally repetitive. Driven by these findings, we propose EfficientNAT (ENAT), a NAT model that explicitly encourages these critical interactions inherent in NATs. At the spatial level, we disentangle the computations of visible and mask tokens by encoding visible tokens independently, while decoding mask tokens conditioned on the fully encoded visible tokens. At the temporal level, we prioritize the computation of the critical tokens at each step, while maximally reusing previously computed token representations to supplement necessary information. ENAT improves the performance of NATs notably with significantly reduced computational cost. Experiments on ImageNet-256, ImageNet-512 and MS-COCO validate the effectiveness of ENAT. Code is available at https://github.com/LeapLabTHU/ENAT.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。