[Paper Review] Vision Transformer with Attention Map Hallucination and FFN Compaction
This paper proposes hallucinated-MHSA (hMHSA) and compact-FFN (cFFN) to reduce Vision Transformer complexity by exploiting redundancy in attention maps and feed-forward networks. hMHSA generates half of the attention maps via cheap operations from the other half, while cFFN uses matrix factorization and re-parameterization to compress the FFN, achieving 10%-20% FLOPs and parameters reduction across DeiT, NextViT, and PVT backbones with competitive accuracy.
Vision Transformer(ViT) is now dominating many vision tasks. The drawback of quadratic complexity of its token-wise multi-head self-attention (MHSA), is extensively addressed via either token sparsification or dimension reduction (in spatial or channel). However, the therein redundancy of MHSA is usually overlooked and so is the feed-forward network (FFN). To this end, we propose attention map hallucination and FFN compaction to fill in the blank. Specifically, we observe similar attention maps exist in vanilla ViT and propose to hallucinate half of the attention maps from the rest with much cheaper operations, which is called hallucinated-MHSA (hMHSA). As for FFN, we factorize its hidden-to-output projection matrix and leverage the re-parameterization technique to strengthen its capability, making it compact-FFN (cFFN). With our proposed modules, a 10$\%$-20$\%$ reduction of floating point operations (FLOPs) and parameters (Params) is achieved for various ViT-based backbones, including straight (DeiT), hybrid (NextViT) and hierarchical (PVT) structures, meanwhile, the performances are quite competitive.
Motivation & Objective
- To address the overlooked redundancy in multi-head self-attention (MHSA) and feed-forward network (FFN) components in Vision Transformers.
- To reduce computational complexity (FLOPs and parameters) without sacrificing model performance.
- To explore whether attention maps in MHSA are correlated and can be hallucinated rather than computed fully.
- To redesign FFN using matrix factorization and re-parameterization for compactness while preserving representational capacity.
- To validate the proposed modules across diverse ViT architectures: straight (DeiT), hybrid (NextViT), and hierarchical (PVT).
Proposed method
- Proposes hallucinated-MHSA (hMHSA) to generate half of the attention maps from the other half using cheaper operations, avoiding full Q-K correlation computation.
- Employs matrix factorization on the hidden-to-output projection matrix in FFN to suppress redundancy and reduce parameter count.
- Applies re-parameterization technique to the factorized FFN, enabling a single, strong inference-time forward pass from multiple training-time branches.
- Uses a compact ratio t to control the degree of compaction in cFFN, with t=2/3 selected as optimal for accuracy-efficiency trade-off.
- Applies hMHSA and cFFN to various ViT backbones including DeiT, NextViT, and PVTv2, maintaining competitive performance.
- Employs ablation studies to evaluate the impact of re-parameterization branches (r), factorization on different matrices (M1 vs M2), and compaction ratio (t).
Experimental results
Research questions
- RQ1Can redundant attention maps in MHSA be effectively hallucinated using cheaper operations instead of full Q-K correlation?
- RQ2Does matrix factorization of the FFN projection matrix reduce redundancy while preserving model capacity?
- RQ3How does re-parameterization enhance the performance of a compacted FFN without increasing inference cost?
- RQ4What is the optimal balance between compaction ratio and accuracy in the proposed cFFN module?
- RQ5Can hMHSA and cFFN be effectively generalized across diverse ViT architectures, including straight, hybrid, and hierarchical structures?
Key findings
- hMHSA reduces MHSA computation by hallucinating half of the attention maps from the other half, achieving significant FLOPs and parameter savings with minimal performance drop.
- cFFN with matrix factorization and re-parameterization reduces FLOPs and parameters by 10%-20% across multiple ViT backbones while maintaining competitive accuracy.
- The ablation study shows that factorizing the hidden-to-output projection matrix (M2) yields better performance than factorizing the input-to-hidden matrix (M1), with a 0.2% accuracy gain.
- Using r=2 re-parameterization branches in cFFN achieves the best trade-off between performance and training cost, outperforming r=1 and r=3.
- The optimal compaction ratio t=2/3 in cFFN achieves 70.2% top-1 accuracy on PVTv2-b1, outperforming the baseline by 0.3% when FLOPs and parameters are matched.
- Transfer learning results on CIFAR-100 and Stanford-Dog show that the proposed models match or slightly exceed the performance of their original counterparts.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.