TL;DR
Hierarchical Auto-Pruning (HiAP) simplifies Vision Transformer (ViT) compression by casting structured pruning as a single-phase, end-to-end learning problem. By jointly optimizing stochastic gates across four structural granularities simultaneously, it eliminates complex multi-stage pipelines while translating over 90% of theoretical compute savings into real-world hardware speedups.
What Problem Does This Paper Address?
Vision Transformers (ViTs) achieve state-of-the-art performance in computer vision but are notoriously heavy, suffering from high computational costs and massive memory bandwidth bottlenecks. Structured pruning helps by removing entire components (like attention heads or FFN neurons) to create smaller, dense sub-networks that run fast on standard hardware.
However, existing structured pruning methods suffer from two major flaws:
- Single-granularity focus: They typically prune either macro-structures (entire blocks/heads) or micro-structures (internal dimensions/neurons). Pruning only micro-structures reduces compute (FLOPs) but preserves overall depth, leaving memory bandwidth bottlenecks unaddressed. Conversely, pruning only macro-structures risks severe performance degradation.
- Pipeline complexity: Most high-performing methods rely on cumbersome multi-stage pipelines involving importance ranking, offline auxiliary solvers, post-hoc thresholding, and separate fine-tuning phases. This makes them difficult to implement, extend, and reproduce.
Methods
HiAP introduces a single-shot, budget-aware framework that jointly optimizes model weights and sparsity allocations across four granularities in a single end-to-end training phase.
- Hierarchical Gating: It applies learnable stochastic Gumbel-Sigmoid gates at both the macro level (entire attention heads and FFN blocks) and micro level (intra-head dimensions and FFN neurons).
- Differentiable Cost Modeling: Instead of using a generic sparsity target, the authors formulate an analytical, differentiable Multiply-Accumulate (MAC) cost model. This explicitly penalizes the hardware overhead of keeping structures active.
- Continuous-to-Discrete Annealing: During training, a temperature parameter ($\tau$) is gradually lowered. This forces the soft, probabilistic gates to "harden" into deterministic binary (0 or 1) decisions by the time the model converges.
- Feasibility Penalties: To prevent the network from greedily dropping entire layers early on (structural collapse) before the weights can adapt, the loss function includes threshold penalties ensuring minimum retention quotas.
- Physical Extraction: At the end of training, pruned structures are physically deleted from the weight matrices. What remains is an ordinary, dense ViT that requires no custom sparse kernels for acceleration.
Datasets
The framework was evaluated on the standard ImageNet-1K dataset for image classification. The authors applied HiAP to two widely used baselines: DeiT-Base (17.6G MACs) and DeiT-Small (4.6G MACs).
Key Insights and Ideas
- Scale-Dependent Architecture Search: The optimal pruning strategy changes based on model scale. At an identical penalty ratio, HiAP compresses DeiT-Base by removing attention heads while keeping FFN blocks, but does the exact opposite for DeiT-Small (closing whole FFN blocks while keeping proportionally more heads). Methods with fixed per-layer ratios cannot discover this organically.
- Dropping Beats Thinning: The cost model reveals that keeping an attention head open incurs a massive fixed cost (72% of a full head's cost in DeiT-Base) for computing projections and attention maps, regardless of internal dimensions. Consequently, the optimizer naturally prefers deleting entire heads over making them narrower.
- Reversible Search Space: Because the gates remain differentiable throughout training, early pruning decisions aren't permanent. If the weights adapt, a previously closed FFN block can reopen later in the run, avoiding the permanent misjudgments common in ranking-based methods.
Key Results
- Competitive Accuracy: On ImageNet-1K, HiAP compressed DeiT-Base to 7.4G MACs while maintaining 80.88% top-1 accuracy (only a 0.83% drop from the dense baseline), outperforming more complex pipelines like UVC and LPViT. For DeiT-Small, it reached 3.1G MACs at 79.33% top-1 accuracy.
- Real Hardware Speedups: Because HiAP physically extracts the sub-network rather than just masking weights, it achieves exceptional hardware efficiency. On an NVIDIA A100 GPU, it realized 93% to 96% of its theoretical MAC reduction as actual wall-clock throughput speedup, vastly outperforming competing methods like SAViT (62–78%) and $S^2$ViTE (5%).
Limitations and Future Work
- Value-Path Restriction: The micro-gates currently only prune the value path ($V$) of attention heads. The query ($Q$) and key ($K$) projections remain unpruned, leaving roughly 70% of a head's compute fixed even if its internal dimension shrinks. Extending gating to $Q$ and $K$ is a primary next step.
- Proxy Metrics: The objective function targets theoretical MAC counts rather than directly measuring platform-calibrated latency or energy consumption.
- Distillation Dependency: The training relies on knowledge distillation from a heavy teacher model (RegNetY-160), and the authors did not isolate the exact performance contribution of this distillation.
Summary updated