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

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

6 Oct 2023arXiv:2310.04361archive 2025-07-28

Filip Szatkowski, Bartosz Wójcik, Mikołaj Piórczyński, Simone Scardapane

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.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2310.04361")

Code

Syntology Ran 15 of 17 code samples harvested from 2 repositories linked to this paper; 2 have no recorded run. Of those that ran: 1 ran · honoured contract; 1 ran · fixture could not drive it; 13 ran with no contract checked.

By repository: official repository: 17 samples from 2 repositories, 15 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

bartwojcik/d2dmoe officialmentioned in papermentioned on GitHubpytorchMIT report
bartwojcik/sadmoe officialmentioned in papermentioned on GitHubpytorchMIT report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

17 samples harvested; 15 ran; 1 honoured the contract we drafted; 2 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran · honoured contract
1ran · fixture could not drive it
13ran
2unverified

Licence: 0 of the 17 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from 2 repositories linked to this paper, official or community; each sample names its own and says which. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

ResNet18 bartwojcik/d2dmoe/architectures/resnets.py official repository ran MIT (permissive) · 24b15be4477fe752 · report
ResNet34 bartwojcik/d2dmoe/architectures/resnets.py official repository ran MIT (permissive) · 724da9ddbe842c71 · report
ResNet50 bartwojcik/d2dmoe/architectures/resnets.py official repository ran MIT (permissive) · fdc0140887df3eb4 · report
calculate_budget_probs bartwojcik/d2dmoe/methods/l2w.py official repository ran MIT (permissive) · 4937750817132da0 · report
distill_last bartwojcik/d2dmoe/methods/early_exit.py official repository ran MIT (permissive) · 749fa6172f0861c6 · report
distill_later bartwojcik/d2dmoe/methods/early_exit.py official repository ran MIT (permissive) · 354a6510f7664ed4 · report
distill_next bartwojcik/d2dmoe/methods/early_exit.py official repository ran MIT (permissive) · 81302f1b9ee58713 · report
function_to_module bartwojcik/d2dmoe/common.py official repository ran MIT (permissive) · 60ea649e8d15f74e · report
get_distribution_target bartwojcik/d2dmoe/methods/avit.py official repository ran fingerprinted MIT (permissive) · 99d9eef611aa5bd9 · report
init_ bartwojcik/d2dmoe/architectures/moe/moe_layers.py official repository ran fingerprinted MIT (permissive) · bbfd90d32d03bc6a · report
mixup_target bartwojcik/d2dmoe/utils.py official repository ran MIT (permissive) · c6e83b9cea10865d · report
one_hot bartwojcik/d2dmoe/utils.py official repository ran MIT (permissive) · 6caffa789f1bdabe · report
rand_bbox bartwojcik/d2dmoe/utils.py official repository ran MIT (permissive) · 3913c620f6926f42 · report
round_filters bartwojcik/sadmoe/architectures/efficientnet.py official repository ran · honoured contract fingerprinted MIT (permissive) · 6c7d046d7dd60b22 · report
torch_conv_out_spatial_shape bartwojcik/sadmoe/architectures/efficientnet.py official repository ran · fixture could not drive it fingerprinted MIT (permissive) · 97d77e37b5677cd8 · report
ffn_filter_condition bartwojcik/d2dmoe/architectures/gpt.py official repository unverified MIT (permissive) · 64451ac21be6935a · report
get_activation bartwojcik/sadmoe/architectures/efficientnet.py official repository unverified MIT (permissive) · d9d9a4a8f00a818e · report

Tasks

Mixture-of-Experts

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

Absolute Position EncodingsAdamAttentionBASEBPEDense ConnectionsDropoutLabel SmoothingLayer NormalizationLinear LayerMulti-Head AttentionPosition-Wise Feed-Forward LayerResidual ConnectionSoftmaxTransformer

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections