HiAP Shrinks Vision Transformers 1.44x Faster Without Multi-Stage Pruning Pipelines
A single-phase framework prunes Vision Transformers at four structural levels simultaneously, matching multi-stage pipelines while cutting DeiT-Small MACs by 33 percent.
ProTakeaways
- HiAP prunes Vision Transformers across four granularities in a single end-to-end training phase.
- Gumbel-Sigmoid gates cover attention heads, FFN blocks, intra-head dimensions, and FFN neurons jointly.
- A differentiable analytical MAC objective replaces importance ranking, offline solvers, and post-hoc thresholding.
- On DeiT-Small ImageNet, cuts MACs 33 percent at 79.33 percent Top-1, a 0.42 point drop.
- Measured 1.44x latency speedup on a single GPU with a 33 percent pruned ViT-Tiny on CIFAR-10.
- Objective optimizes MACs, not calibrated latency; no public code release accompanies the paper.
Compressing Vision Transformers has become an arms race of increasingly baroque pipelines. Most competitive methods stitch together importance ranking, offline solvers, mask scheduling, and a separate fine-tuning phase, each with its own knobs. A new framework called Hierarchical Auto-Pruning (HiAP) collapses that entire chain into a single end-to-end training run, and lets the network decide, on its own, which heads, blocks, dimensions, and neurons to keep.
The bottleneck isn't just FLOPs
Structured pruning for ViTs has largely fixated on one granularity at a time. Methods that prune only micro-structures such as intra-head dimensions reduce FLOPs but preserve the network's overall depth and the number of attention heads. That leaves a bigger problem untouched: on modern accelerators, latency and energy are often dominated not by compute but by memory bandwidth, and transferring data between DRAM and SRAM can cost orders of magnitude more energy than the corresponding computation.
ViTs are especially exposed here because every retained block still has to load weights and materialize an N by N attention map. Pruning only whole heads or blocks fixes the bandwidth issue but tends to shred accuracy. The authors argue you need to prune both levels at once, and you need to do it without the multi-stage bookkeeping that dominates the current literature.
Gates at four granularities
HiAP inserts learnable Gumbel-Sigmoid gates at two levels of every transformer block. Gumbel-Sigmoid is a trick for making binary keep/prune decisions differentiable by adding logistic noise and passing the result through a temperature-controlled sigmoid, so gradients can flow into the on/off logits during training.
- Macro gates decide whether entire attention heads or entire FFN blocks survive.
- Micro gates trim value-path dimensions inside surviving heads and neurons inside surviving FFN blocks.
The gates are optimized against three things simultaneously: the task loss (with knowledge distillation from a dense teacher), an analytical estimate of the network's Multiply-Accumulate operations, and a feasibility penalty that stops the optimizer from greedily zeroing entire layers before the weights have time to adapt. The budget coefficient steers the network to a target compute level while the gates gradually harden into a dense, smaller subnetwork at convergence.

Why the cost model matters
The differentiable MAC accounting is where a lot of the elegance lives. HiAP decomposes the network's expected compute into three marginal costs: the overhead of keeping a head open at all (Q, K, V projections plus the attention map), the incremental cost of a single value dimension, and the cost of a single FFN neuron. Because those terms are linear in the gate expectations, the optimizer can cleanly attribute penalties to individual structures.
The practical consequence is emergent behavior. Within the first 10 epochs, the network aggressively reduces the number of active attention heads from 6 to an average of 2 to 4 per layer. Most notably, the algorithm consistently identifies the FFN block in the final transformer layer as entirely redundant, permanently closing its macro-gate. Later in training, micro-gates take over and produce heterogeneous widths: earlier FFN layers keep close to 1400 of 1536 neurons while deeper ones drop toward 1200, and per-head dimensions get trimmed from 64 down to 32 or fewer.
How it holds up on ImageNet
On ImageNet-1K with DeiT-Small (dense baseline 4.6G MACs), HiAP compresses the model to 3.1G MACs, roughly a 33 percent reduction, with a Top-1 drop of 0.42 percent. That trails the best specialized pipelines by a small margin. GOHSP, for instance, actually gains 0.08 percent at 3.0G MACs, and ViT-Slim holds accuracy flat at 3.1G. Where HiAP wins is process simplicity, not raw Pareto dominance.
| Method | MACs (G) | Top-1 (%) | vs. dense |
|---|---|---|---|
| WDPruning | 3.1 | 78.55 | -1.25 |
| S2ViT | 3.1 | 79.22 | -0.58 |
| ViT-Slim | 3.1 | 79.90 | 0.00 |
| GOHSP | 3.0 | 79.98 | +0.08 |
| HiAP | 3.1 | 79.33 | -0.42 |
On a smaller CIFAR-10 ViT-Tiny, HiAP beats both L1-norm structured pruning and uniform-ratio pruning at 33 and 50 percent compression. More importantly, the theoretical savings translate to real hardware. When profiling the 33.1 percent pruned model, measured latency improves from 5.57 ms to 3.86 ms on a single GPU. This represents a 1.44x inference speedup, confirming that the discovered sub-networks do not rely on sparse convolution engines to realize their efficiency.
Tuning the macro-micro balance
An ablation over the ratio of macro to micro penalty weights is worth studying if you want to reuse the method. A 2:1 balance produced the best accuracy-cost trade-off on DeiT-Small.
- Macro-only: aggressively drops heads and skips entire blocks via residuals, but leaves MLPs at nearly 100 percent width, wasting the budget.
- Micro-only: keeps every head open in every layer and shrinks neurons hard, sometimes indirectly killing MLP blocks unstably.
- 2:1 macro to micro: stable hierarchical trajectory, best accuracy at the target compute.

What it doesn't fix
The authors are candid about the limits. The objective optimizes expected MACs, not calibrated latency or energy, so realized speedups can vary with hardware and kernels. HiAP also produces a static sub-network, which means it is orthogonal to (but does not replace) dynamic token-pruning methods like DynamicViT or ToMe that cut sequence length adaptively. And the paper focuses on classification with DeiT-Small; extending the recipe to detection backbones or larger ViTs is left for future work.
No public code release is mentioned in the paper. If you want to reproduce it today, you would be reimplementing the Gumbel-Sigmoid gate machinery, the analytical MAC decomposition, and the feasibility penalties from the algorithm listing yourself. For teams that already have a distillation-based ViT training loop, that is a manageable lift, and the payoff is skipping the search-rank-mask-retrain pipeline entirely.