Optimizing Transformers: Metaheuristics for Attention Head Pruning
摘要
Attention head pruning in transformers has been explored to reduce computational complexity while maintaining strong relative performance. In this setting, this work compares traditional pruning criteria with metaheuristic-based approaches. Instead of relying on expensive training from scratch or iterative fine-tuning, this work investigates an alternative strategy for navigating the intricate dependencies between attention heads within each self-attention module of a transformer. Specifically, this study applies structured pruning to attention head pruning in Vision Transformers and examines how various algorithms can assess the relative importance of different attention heads. The most effective approach identified in this study was based on Simulated Annealing combining accuracy and computational effort into a single normalized objective that guided the optimization toward balanced pruning solutions. This method preserved 95.64% of the original model performance while reducing the number of attention heads by 55% compared to the unpruned model.