Exploiting Activation Sparsity with Dense to Dynamic-k Mixture-of-Experts Conversion

Filip Szatkowski, Bartosz W'ojcik, Mikolaj Pi'orczy'nski, S. Scardapane
2/12/2026

No official code found. Best implementation: bartwojcik/D2DMoE (9 stars, MIT, last commit 2024-12-27).

Abstract

Transformer models can face practical limitations due to their high computational requirements. At the same time, such models exhibit significant activation sparsity, which can be leveraged to reduce the inference cost by converting parts of the network into equivalent Mixture-of-Experts (MoE) layers. Despite the crucial role played by activation sparsity, its impact on this process remains unexplored. We demonstrate that the efficiency of the conversion can be significantly enhanced by a proper regularization of the activation sparsity of the base model. Moreover, motivated by the high variance of the number of activated neurons for different inputs, we introduce a more effective dynamic-$k$ expert selection rule that adjusts the 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 an efficient implementation that translates these computational savings into actual wall-clock 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.

View on arXivView PDF

Code Implementations(1)

bartwojcik/D2DMoECommunity100%
MIT
90Shell, PythonFeb 26, 20241 years agoMIT

Similar Papers

Cite this paper

@article{szatkowski2026exploiting,
  title  = {Exploiting Activation Sparsity with Dense to Dynamic-k Mixture-of-Experts Conversion},
  author = {Filip Szatkowski and Bartosz W'ojcik and Mikolaj Pi'orczy'nski and S. Scardapane},
  year   = {2026},
  eprint = {2310.04361},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2310.04361},
  journal = {NEURIPS 2023 2023}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2310.04361.svg)](https://codeofpaper.com/paper/2310.04361)

Discussion