Vision Transformers (ViTs) have emerged as state-of-the-art models for various vision tasks recently. However, their heavy computation costs remain daunting for resource-limited devices. To address this, researchers have dedicated themselves to compressing redundant information in ViTs for acceleration. However, existing approaches generally sparsely drop redundant image tokens by token pruning or brutally remove channels by channel pruning, leading to a sub-optimal balance between model performance and inference speed. Moreover, they struggle when transferring compressed models to downstream vision tasks that require the spatial structure of images, such as semantic segmentation. To tackle these issues, we propose CAIT, a joint \underline{c}ompression method for ViTs that achieves a harmonious blend of high \underline{a}ccuracy, fast \underline{i}nference speed, and favorable \underline{t}ransferability to downstream tasks. Specifically, we introduce an asymmetric token merging (ATME) strategy to effectively integrate neighboring tokens. It can successfully compress redundant token information while preserving the spatial structure of images. On top of it, we further design a consistent dynamic channel pruning (CDCP) strategy to dynamically prune unimportant channels in ViTs. Thanks to CDCP, insignificant channels in multi-head self-attention modules of ViTs can be pruned uniformly, significantly enhancing the model compression. Extensive experiments on multiple benchmark datasets show that our proposed method can achieve state-of-the-art performance across various ViTs.
翻译:视觉Transformer(ViTs)近年来已成为各类视觉任务中的前沿模型。然而,其高昂的计算成本对资源受限设备而言仍具挑战。为此,研究者致力于通过压缩ViTs中的冗余信息以实现加速。然而,现有方法通常通过令牌剪枝稀疏地丢弃冗余图像令牌,或通过通道剪枝直接移除通道,导致模型性能与推理速度间难以达到最优平衡。此外,当将压缩模型迁移至需要图像空间结构的下游视觉任务(如语义分割)时,这些方法往往表现不佳。为解决上述问题,我们提出CAIT——一种面向ViTs的联合压缩方法,实现了高精度、快速推理速度及优异下游任务可迁移性的和谐统一。具体而言,我们引入非对称令牌融合(ATME)策略以有效整合相邻令牌。该策略能在压缩冗余令牌信息的同时,完整保留图像的空间结构。在此基础上,我们进一步设计了一致性动态通道剪枝(CDCP)策略,动态剪除ViTs中不重要的通道。得益于CDCP,ViTs多头自注意力模块中的次要通道得以统一剪枝,显著提升了模型压缩效率。在多个基准数据集上的大量实验表明,所提方法能在各类ViTs上取得最先进的性能表现。