Evolving Layer-Specific Scalar Functions for Hardware-Aware Transformer Adaptation
Kieran Carrigg, Sigur de Vries, Amirhossein Sadough, Marcel van Gerven
原文摘要
Vision Transformers (ViTs) achieve state-of-the-art performance on challenging vision tasks, but their deployment on edge devices is hindered by the computational complexity and global reduction bottleneck imposed by layer normalization. Recent methods attempt to bypass this by replacing normalization layers with hardware-friendly scalar approximations. However, these homogeneous replacements do not optimally fit to all layers' behaviour and rely on expensive model retraining. In this work, we propose a highly efficient, hardware-aware framework that utilizes genetic programming (GP) to evolve heterogeneous, layer-specific scalar functions directly from pre-trained network activations. Because each layer receives its own expression, the evolved functions adapt to the changing normalization behaviour across network depth. Coupled with a novel post-training re-alignment strategy, our approach eliminates the need to retrain models from scratch entirely. After only 20 epochs of re-alignment, our modified models recover $84.32\%$ Top-1 ImageNet-1K accuracy on ViT-B and $85.74\%$ on ViT-L. Across four pre-trained architectures (ViT-B, ViT-L, Swin-B, and ConvNeXt-B), our best variant stays within $0.8\%$ of the pre-trained model, and our expressions outperform the homogeneous Dynamic Tanh (DyT) baseline in 11 of 12 settings. By retaining near-baseline accuracy while removing the global reduction bottleneck, our expressions make normalization cheaper on edge hardware. In register-transfer level (RTL) simulations of two chips, they need about three times fewer compute cycles than LayerNorm and half of its off-chip reads on edge devices with small on-chip memory.
cs.CV · cs.AR