SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2401.06066 · ACL · 2024

DeepSeekMoE: Towards Ultimate Expert Specialization in Mixture-of-Experts Language Models

Deli Chen, Zhifang Sui, Damai Dai, Y Li, Runxin Xu, Chengqi Deng, Chong Ruan, Fuli Luo, Huazuo Gao, Jiashi Li, Wangding Zeng, Wenfeng Liang, and 5 more

arXiv · PDF · Open in the Atlas

Code that ran

6 of 7 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 3 have no contract verdict; 3 failures of our instrument; 1 no recorded run), measured 2026-11-23; 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/2401.06066.json · badge: /api/ran/2401.06066.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
deepseek-ai/deepseek-moe canonical (classifier label)
classifier basis: census
3 ran · 0 no recorded run
kamanphoebe/look-into-moes community
Papers with Code archive
3 ran · 1 no recorded run
FunctionStatusWhere it lives
AddAuxiliaryLoss Ran
ran on a synthesized input · constructed an object; no result was computed
kamanphoebe/look-into-moes/deepseekmoe/modeling_deepseek.py
code served (permissive licence) · get_code("aa0e5786a11892c1")
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, AddAuxiliaryLoss: 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.nn as nn

torch.manual_seed(0)

# Create a small input tensor with batch size 2 and dimension 4
x = torch.randn(2, 4, requires_grad=True)

# Create a scalar loss tensor that requires grad
loss = torch.tensor(0.5, requires_grad=True)

ARGS = {
    "x": x,
    "loss": loss,
}
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 AddAuxiliaryLoss — 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 AddAuxiliaryLoss 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
DeepseekMLP Ran
ran on a synthesized input · constructed an object; no result was computed
kamanphoebe/look-into-moes/deepseekmoe/modeling_deepseek.py
code served (permissive licence) · get_code("e891924b51d92aff")
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, DeepseekMLP: 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.nn as nn
from types import SimpleNamespace

torch.manual_seed(0)

# Create a minimal config object with required attributes
config = SimpleNamespace(
    hidden_size=4,
    intermediate_size=8,
    hidden_act='gelu',
    pretraining_tp=1
)

# Create input tensor: batch_size=2, hidden_size=4
x = torch.randn(2, 4)

ARGS = {
    'config': config,
    'hidden_size': None,
    'intermediate_size': None
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DeepseekMLP — 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 DeepseekMLP 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
MoEGate Ran
ran on a synthesized input · constructed an object; no result was computed
kamanphoebe/look-into-moes/deepseekmoe/modeling_deepseek.py
code served (permissive licence) · get_code("392ad184ccb1c933")
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, MoEGate: 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.nn as nn
import math

torch.manual_seed(0)

class Config:
    def __init__(self):
        self.num_experts_per_tok = 2
        self.n_routed_experts = 4
        self.scoring_func = 'softmax'
        self.aux_loss_alpha = 0.01
        self.seq_aux = True
        self.norm_topk_prob = True
        self.hidden_size = 8

config = Config()

hidden_states = torch.randn(2, 3, 8)

ARGS = {
    'config': config,
}
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 MoEGate — 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 MoEGate 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
build_instruction_prompt Ran
ran; our contract draft was wrong, not the code
deepseek-ai/deepseek-moe/finetune/finetune.py
code served (permissive licence) · get_code("765ee58c7d78fb1b")
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) and returned str. 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

ARGS = {
    "instruction": "What is the capital of France?"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
get_last_checkpoint Ran
ran; our contract draft was wrong, not the code
deepseek-ai/deepseek-moe/finetune/finetune.py
code served (permissive licence) · get_code("436288f52a3803bb")
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 str. 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 os
import tempfile
import shutil
from transformers.trainer_utils import PREFIX_CHECKPOINT_DIR

# Create a temporary directory structure for testing
temp_dir = tempfile.mkdtemp()

# Create some checkpoint directories
checkpoint_1_dir = os.path.join(temp_dir, f'{PREFIX_CHECKPOINT_DIR}-100')
checkpoint_2_dir = os.path.join(temp_dir, f'{PREFIX_CHECKPOINT_DIR}-200')
os.makedirs(checkpoint_1_dir)
os.makedirs(checkpoint_2_dir)

# Add some dummy files in the checkpoint directories
with open(os.path.join(checkpoint_1_dir, 'model.bin'), 'w') as f:
    f.write('dummy')
with open(os.path.join(checkpoint_2_dir, 'model.bin'), 'w') as f:
    f.write('dummy')

ARGS = {
    'checkpoint_dir': temp_dir
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
preprocess Ran
ran; our contract draft was wrong, not the code
deepseek-ai/deepseek-moe/finetune/finetune.py
code served (permissive licence) · get_code("9c25f2d50056db80")
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 dict. 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 copy
from typing import Optional, Dict, Sequence
import transformers
import numpy as np
import torch

# Create a minimal stand-in tokenizer
class MockTokenizer:
    def __init__(self):
        self.model_max_length = 512
    
    def __call__(self, text, max_length=None, truncation=False):
        # Return a simple mock tokenized output
        tokens = [101] + [102] * len(text.split()) + [103]  # Simple tokenization
        return type('TokenizedOutput', (), {
            'input_ids': tokens[:max_length] if max_length else tokens
        })()

tokenizer = MockTokenizer()

sources = [
    "Hello world",
    "Foo bar baz"
]

targets = [
    " response one",
    " response two"
]

ARGS = {
    "sources": sources,
    "targets": targets,
    "tokenizer": tokenizer
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
DeepseekMoE Not yet run
unverified (harvested, no recorded run)
kamanphoebe/look-into-moes/deepseekmoe/modeling_deepseek.py
code served (permissive licence) · get_code("163c5909c3ae9d0f")
How it ran

no invocation recorded.

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 2 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 1 the same month, 2 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.

FunctionAlso present inEarliest-datedOthers named
preprocess 23 other papers
8 dated earlier, 1 the same month, 12 later, 2 same year, order not determinable
2305.12870 (2023-05)
Lion: Adversarial Distillation of Proprietary Large Language Models
2306.17194 (2023-06)
On the Exploitability of Instruction Tuning
2308.07286 (2023-08)
The Devil is in the Errors: Leveraging Large Language Models for Fine-grained Machine Translation Evaluation
and 20 more not named here
build_instruction_prompt 1 other paper
1 later
2505.24449 (2025-05)
When Large Multimodal Models Confront Evolving Knowledge: Challenges and Explorations

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-23.

Repositories linked to this paper

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

Abstract

In the era of large language models, Mixtureof-Experts (MoE) is a promising architecture for managing computational costs when scaling up model parameters. However, conventional MoE architectures like GShard, which activate the top-K out of N experts, face challenges in ensuring expert specialization, i.e. each expert acquires non-overlapping and focused knowledge. In response, we propose the DeepSeek-MoE architecture towards ultimate expert specialization. It involves two principal strategies: (1) finely segmenting the experts into mN ones and activating mK from them, allowing for a more flexible combination of activated experts; (2) isolating K s experts as shared ones, aiming at capturing common knowledge and mitigating redundancy in routed experts. Starting from a modest scale with 2B parameters, we demonstrate that DeepSeekMoE 2B achieves comparable performance with GShard 2.9B, which has 1.5× expert parameters and computation. In addition, DeepSeekMoE 2B nearly approaches the performance of its dense counterpart with the same number of total parameters, which sets the upper bound of MoE models. Subsequently, we scale up DeepSeekMoE to 16B parameters and show that it achieves comparable performance with DeepSeek 7B and LLaMA2 7B, with only about 40% of computations.

For agents

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

get_harvested_code_for_paper("2401.06066")
get_code_for_paper("2401.06066")
have("2401.06066")

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

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

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

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

Connect an agent — have() is free.