SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2204.08396 · ACL · 2022

STABLEMOE: Stable Routing Strategy for Mixture of Experts

Furu Wei, Li Dong, Bo Zheng, Zhifang Sui, Damai Dai, Shuming Ma, Baobao Chang

arXiv · PDF · Open in the Atlas

Code that ran

3 of 5 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (3 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 2 have no contract verdict; 1 failure of our instrument; 2 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2204.08396.json · badge: /api/ran/2204.08396.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
hunter-ddm/stablemoe marked official in Papers with Code
Papers with Code archive
3 ran · 2 no recorded run
FunctionStatusWhere it lives
All2AllDDM Ran
ran on a synthesized input · constructed an object; no result was computed
hunter-ddm/stablemoe/fairseq/modules/moe_layer.py
code served (permissive licence) · get_code("5356a8b839712f52")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, All2AllDDM: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# The All2AllDDM.forward method expects:
# - xs: a tensor
# - input_splits: optional list of integers or None
# - output_splits: optional list of integers or None

# Create a small tensor for xs
# Shape: [batch_size, feature_dim] where batch_size=2, feature_dim=4
xs = torch.randn(2, 4)

# Define input_splits and output_splits
# These should be lists of integers that partition the batch dimension
# For a batch of size 2, we could split as [1, 1]
input_splits = [1, 1]
output_splits = [1, 1]

ARGS = {
    "xs": xs,
    "input_splits": input_splits,
    "output_splits": output_splits,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type All2AllDDM — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a All2AllDDM output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
AllGatherDDM Ran
ran on a synthesized input · constructed an object; no result was computed
hunter-ddm/stablemoe/fairseq/modules/moe_layer.py
code served (permissive licence) · get_code("e528be86ed880f26")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, AllGatherDDM: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.distributed as dist
from unittest.mock import MagicMock, patch

torch.manual_seed(0)

# Mock the distributed module since we're running on CPU without actual distributed setup
def mock_all_gather(tensor_list, tensor):
    """Mock all_gather that fills the list with copies of the tensor"""
    for i in range(len(tensor_list)):
        tensor_list[i].copy_(tensor)

def mock_get_rank():
    return 0

def mock_get_world_size():
    return 2

def mock_reduce(tensor, dst_rank, async_op=False):
    """Mock reduce operation"""
    mock_op = MagicMock()
    mock_op.wait = MagicMock()
    return mock_op

# Patch distributed functions
with patch('torch.distributed.all_gather', side_effect=mock_all_gather):
    with patch('torch.distributed.get_rank', side_effect=mock_get_rank):
        with patch('torch.distributed.get_world_size', side_effect=mock_get_world_size):
            with patch('torch.distributed.reduce', side_effect=mock_reduce):
                # Create tensors for all_gather
                tensor = torch.randn(2, 4)
                tensor_list = [torch.zeros(2, 4) for _ in range(2)]
                
                ARGS = {
                    'tensor_list': tensor_list,
                    'tensor': tensor
                }
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type AllGatherDDM — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a AllGatherDDM output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
LayerNorm Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT) · constructed an object; no result was computed
hunter-ddm/stablemoe/fairseq/modules/moe_layer.py
code served (permissive licence) · get_code("6c81c70bbfbf525b")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, LayerNorm: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    "normalized_shape": (4,),
    "eps": 1e-05,
    "elementwise_affine": True,
    "export": False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type LayerNorm — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a LayerNorm output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
MoESublayer Not yet run
unverified (harvested, no recorded run)
hunter-ddm/stablemoe/fairseq/modules/moe_layer.py
code served (permissive licence) · get_code("93e1d819e54459ae")
How it ran

no invocation recorded.

SwitchLayer Not yet run
unverified (harvested, no recorded run)
hunter-ddm/stablemoe/fairseq/modules/moe_layer.py
code served (permissive licence) · get_code("15fba723c24113ac")
How it ran

no invocation recorded.

Also present in other papers' code

Of 5 samples lifted from this paper's linked repositories, 5 carry a function identity and 0 do not. Of the 5 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 5 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

The Mixture-of-Experts (MoE) technique can scale up the model size of Transformers with an affordable computational overhead. We point out that existing learning-to-route MoE methods suffer from the routing fluctuation issue, i.e., the target expert of the same input may change along with training, but only one expert will be activated for the input during inference. The routing fluctuation tends to harm sample efficiency because the same input updates different experts but only one is finally used. In this paper, we propose STABLEMOE with two training stages to address the routing fluctuation problem. In the first training stage, we learn a balanced and cohesive routing strategy and distill it into a lightweight router decoupled from the backbone model. In the second training stage, we utilize the distilled router to determine the token-to-expert assignment and freeze it for a stable routing strategy. We validate our method on language modeling and multilingual machine translation. The results show that STABLEMOE outperforms existing MoE methods in terms of both convergence speed and performance. The code is available at https://github. com/Hunter-DDM/stablemoe.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2204.08396")
get_code_for_paper("2204.08396")
have("2204.08396")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2204.08396.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2204.08396.svg)](https://syntology.ai/paper/2204.08396)

Connect an agent — have() is free.