Exploiting Activation Sparsity with Dense to Dynamic-k Mixture-of-Experts Conversion
Transformer models can face practical limitations due to their high computationalrequirements. At the same time, such models exhibit significant activation sparsity,which can be leveraged to reduce the inference cost by converting parts of thenetwork into equivalent Mixture-of-Experts (MoE) layers. Despite the crucial roleplayed by activation sparsity, its impact on this process remains unexplored. Wedemonstrate that the efficiency of the conversion can be significantly enhancedby a proper regularization of the activation sparsity of the base model. Moreover,motivated by the high variance of the number of activated neurons for differentinputs, we introduce a more effective dynamic-k expert selection rule that adjuststhe number of executed experts on a per-token basis. To achieve further savings,we extend this approach to multi-head attention projections. Finally, we develop anefficient implementation that translates these computational savings into actual wallclock speedup. The proposed method, Dense to Dynamic-k Mixture-of-Experts(D2DMoE), outperforms existing approaches on common NLP and vision tasks,reducing inference cost by up to 60% without significantly impacting performance.
Institutions
- Warsaw University of Technology (PL)
- Jagiellonian University (PL)
- Integrated Detector Electronics AS (Norway) (NO)
- Corporación Universitaria de Colombia Ideas (CO)
- Innovative Designs in Environments for an Aging Society (US)
- Sapienza University of Rome (IT)
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2024-12-15
- DOI
- https://doi.org/10.5281/zenodo.14409485
- Primary Topic
- Domain Adaptation and Few-Shot Learning
- Type
- article
- Field-Weighted Citation Impact
- 0.00