SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2305.12129 · ACL · 2023

Lifting the Curse of Capacity Gap in Distilling Language Models

Chen Zhang, Yang Yang, Benyou Wang, Jiahao Liu, Jingang Wang, Dawei Song, Yunsen Xian

arXiv · PDF · Open in the Atlas

Code that ran

7 of 13 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 6 have no contract verdict; 1 failure of our instrument; 6 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/2305.12129.json · badge: /api/ran/2305.12129.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
genezc/minimoe marked official in Papers with Code
Papers with Code archive
7 ran · 6 no recorded run
FunctionStatusWhere it lives
GateLinear Ran
ran on a synthesized input
genezc/minimoe/modules/modeling_moebert_gate.py
code served (permissive licence) · get_code("6abd1347d0c44be3")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 2, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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

# INIT_ARGS for GateLinear.__init__
INIT_ARGS = {
    'in_features': 8,
    'out_features': 5,
    'bias': True
}

# The class has a moefy method that modifies the layer, so we need to call it
# The forward method (inherited from nn.Linear) expects input tensor
# We'll create a setup that constructs, calls moefy, then calls forward

# For the forward pass (inherited from nn.Linear)
ARGS = {
    'input': torch.randn(2, 8)  # batch_size=2, in_features=8
}

# Since we need to call moefy before forward, we define a custom METHOD
# But first, let's understand: moefy changes out_features, so we need to handle this carefully
# After moefy(num_experts=3), out_features becomes 3
# So the forward pass will output shape (2, 3)

# Actually, looking at the code more carefully:
# - GateLinear is constructed with in_features and out_features
# - moefy() changes out_features to num_experts and reinitializes weights
# - forward() is inherited from nn.Linear and uses self.weight and self.bias

# The test harness will construct the instance and call it
# But moefy needs to be called first to set up the modified structure
# Since we can't control the call sequence in this format, we provide args for forward

# Let's just provide the standard forward args
# The instance can be called directly after construction
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float — no output shape is stated: observe_signature.py observed this class with its constructor sizes canonicalised where it could, which the node does not record, so its shape is not stated as this setup block's
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
MoEBertAttention Ran
ran on a synthesized input
genezc/minimoe/modules/modeling_moebert_gate.py
code served (permissive licence) · get_code("0906fd483dd042ca")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned NoneType. 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

class MockConfig:
    def __init__(self):
        self.hidden_size = 8
        self.num_attention_heads = 2
        self.attention_head_size = None
        self.attention_probs_dropout_prob = 0.1
        self.position_embedding_type = 'absolute'
        self.layer_norm_eps = 1e-12
        self.hidden_dropout_prob = 0.1

INIT_ARGS = {
    'config': MockConfig()
}

# Create input tensors
batch_size = 2
seq_length = 4
hidden_size = INIT_ARGS['config'].hidden_size

hidden_states = torch.randn(batch_size, seq_length, hidden_size)
attention_mask = torch.zeros(batch_size, 1, 1, seq_length)
head_mask = None

ARGS = {
    'hidden_states': hidden_states,
    'attention_mask': attention_mask,
    'head_mask': head_mask,
    'output_attentions': False
}
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type NoneType — a NoneType output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a NoneType 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
MoEBertEmbeddings Ran
ran on a synthesized input
genezc/minimoe/modules/modeling_moebert_gate.py
code served (permissive licence) · get_code("d059c2309fca697b")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 3, dtype family float, shape (2, 8, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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

class MoEBertEmbeddings(nn.Module):
    """Construct the embeddings from word, position and token_type embeddings."""

    def __init__(self, config):
        super().__init__()
        self.word_embeddings = nn.Embedding(config.vocab_size, config.hidden_size, padding_idx=config.pad_token_id)
        self.position_embeddings = nn.Embedding(config.max_position_embeddings, config.hidden_size)
        self.token_type_embeddings = nn.Embedding(config.type_vocab_size, config.hidden_size)
        self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps)
        self.dropout = nn.Dropout(config.hidden_dropout_prob)
        self.register_buffer('position_ids', torch.arange(config.max_position_embeddings).expand((1, -1)))

    def forward(self, input_ids=None, token_type_ids=None, position_ids=None, inputs_embeds=None):
        if input_ids is not None:
            input_shape = input_ids.shape
        else:
            input_shape = inputs_embeds.shape[:-1]
        seq_length = input_shape[1]
        if position_ids is None:
            position_ids = self.position_ids[:, :seq_length]
        if token_type_ids is None:
            token_type_ids = torch.zeros(input_shape, dtype=torch.long, device=self.position_ids.device)
        if inputs_embeds is None:
            inputs_embeds = self.word_embeddings(input_ids)
        token_type_embeddings = self.token_type_embeddings(token_type_ids)
        embeddings = inputs_embeds + token_type_embeddings
        position_embeddings = self.position_embeddings(position_ids)
        embeddings += position_embeddings
        embeddings = self.LayerNorm(embeddings)
        embeddings = self.dropout(embeddings)
        return embeddings


class Config:
    def __init__(self):
        self.vocab_size = 100
        self.hidden_size = 4
        self.pad_token_id = 0
        self.max_position_embeddings = 16
        self.type_vocab_size = 2
        self.layer_norm_eps = 1e-12
        self.hidden_dropout_prob = 0.1


INIT_ARGS = {
    'config': Config()
}

ARGS = {
    'input_ids': torch.randint(1, 100, (2, 8), dtype=torch.long),
    'token_type_ids': None,
    'position_ids': None,
    'inputs_embeds': None
}

if __name__ == '__main__':
    model = MoEBertEmbeddings(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Expected shape: (2, 8, 4)")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float, shape (2, 8, 4) — shape (2, 8, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
MoEBertIntermediate Ran
ran on a synthesized input
genezc/minimoe/modules/modeling_moebert_gate.py
code served (permissive licence) · get_code("16f3cea91fa35e41")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 3, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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

class MockConfig:
    def __init__(self):
        self.hidden_size = 8
        self.intermediate_size = 12
        self.hidden_act = "gelu"

config = MockConfig()

INIT_ARGS = {
    "config": config
}

ARGS = {
    "hidden_states": torch.randn(2, 5, 8),  # batch_size=2, seq_len=5, hidden_size=8
    "expert_idx": None
}
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float — no output shape is stated: observe_signature.py observed this class with its constructor sizes canonicalised where it could, which the node does not record, so its shape is not stated as this setup block's
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
MoEBertOutput Ran
ran on a synthesized input
genezc/minimoe/modules/modeling_moebert_gate.py
code served (permissive licence) · get_code("fbfad05bb8c37ef0")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 3, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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

class Config:
    def __init__(self):
        self.hidden_size = 4
        self.intermediate_size = 6
        self.layer_norm_eps = 1e-12
        self.hidden_dropout_prob = 0.1

INIT_ARGS = {
    'config': Config()
}

ARGS = {
    'hidden_states': torch.randn(2, 3, 6),
    'input_tensor': torch.randn(2, 3, 4),
    'expert_idx': None,
    'expert_gate': None
}
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float — no output shape is stated: observe_signature.py observed this class with its constructor sizes canonicalised where it could, which the node does not record, so its shape is not stated as this setup block's
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
MoEBertPooler Ran
ran on a synthesized input
genezc/minimoe/modules/modeling_moebert_gate.py
code served (permissive licence) · get_code("2af6f69a908eee12")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 2, dtype family float, shape (2, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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

class Config:
    def __init__(self, hidden_size):
        self.hidden_size = hidden_size

INIT_ARGS = {
    'config': Config(hidden_size=4)
}

ARGS = {
    'hidden_states': torch.randn(2, 3, 4)
}

if __name__ == '__main__':
    model = nn.Module()
    
    class MoEBertPooler(nn.Module):
        def __init__(self, config):
            super().__init__()
            self.dense = nn.Linear(config.hidden_size, config.hidden_size)
            self.activation = nn.Tanh()

        def forward(self, hidden_states):
            first_token_tensor = hidden_states[:, 0]
            pooled_output = self.dense(first_token_tensor)
            pooled_output = self.activation(pooled_output)
            return pooled_output
    
    pooler = MoEBertPooler(**INIT_ARGS)
    output = pooler(**ARGS)
    print(output.shape)
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
one_hot Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
genezc/minimoe/modules/modeling_moebert_gate.py
code served (permissive licence) · get_code("882d0552fedc5aa1")
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 Tensor, ndim 3, dtype family int, shape (2, 4, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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)

# Create a small indices tensor with shape (2, 4)
# Values should be in range [0, num_classes)
indices = torch.tensor([[0, 1, 2, 3], [1, 2, 0, 1]], dtype=torch.long)

# num_classes must be a positive integer greater than max index value
num_classes = 4

ARGS = {
    "indices": indices,
    "num_classes": num_classes,
}
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 Tensor, ndim 3, dtype family int, shape (2, 4, 4) — shape (2, 4, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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
MoEBertEncoder Not yet run
unverified (harvested, no recorded run)
genezc/minimoe/modules/modeling_moebert_gate.py
code served (permissive licence) · get_code("215b29e96dbea836")
How it ran

no invocation recorded.

MoEBertLayer Not yet run
unverified (harvested, no recorded run)
genezc/minimoe/modules/modeling_moebert_gate.py
code served (permissive licence) · get_code("ea3533cf6785ab2e")
How it ran

no invocation recorded.

MoEBertModel Not yet run
unverified (harvested, no recorded run)
genezc/minimoe/modules/modeling_moebert_gate.py
code served (permissive licence) · get_code("29c6962b86d5b64c")
How it ran

no invocation recorded.

MoEBertSelfAttention Not yet run
unverified (harvested, no recorded run)
genezc/minimoe/modules/modeling_moebert_gate.py
code served (permissive licence) · get_code("a401370bc11c23ef")
How it ran

no invocation recorded.

MoEBertSelfOutput Not yet run
unverified (harvested, no recorded run)
genezc/minimoe/modules/modeling_moebert_gate.py
code served (permissive licence) · get_code("09da8fe5de680832")
How it ran

no invocation recorded.

MoELinear Not yet run
unverified (harvested, no recorded run)
genezc/minimoe/modules/modeling_moebert_gate.py
code served (permissive licence) · get_code("abc80e95eaef3d78")
How it ran

no invocation recorded.

Also present in other papers' code

Of 13 samples lifted from this paper's linked repositories, 13 carry a function identity and 0 do not. Of the 13 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 13 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

Pretrained language models (LMs) have shown compelling performance on various downstream tasks, but unfortunately they require a tremendous amount of inference compute. Knowledge distillation finds a path to compress LMs to small ones with a teacher-student paradigm. However, when the capacity gap between the teacher and the student is large, a curse of capacity gap appears, invoking a deficiency in distilling LMs. While a few studies have been carried out to fill the gap, the curse is not yet well tackled. In this paper, we aim at lifting the curse of capacity gap via enlarging the capacity of the student without notably increasing the inference compute. Largely motivated by sparse activation regime of mixture of experts (MOE), we propose a mixture of minimal experts (MINIMOE), which imposes extra parameters to the student but introduces almost no additional inference compute. Experimental results on GLUE and CoNLL demonstrate the curse of capacity gap is lifted by the magic of MINIMOE to a large extent. MINIMOE also achieves the state-of-the-art performance at small FLOPs compared with a range of competitive baselines. With a compression rate as much as ∼50×, MINIMOE preserves ∼95% GLUE score of the teacher. 1

For agents

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

get_harvested_code_for_paper("2305.12129")
get_code_for_paper("2305.12129")
have("2305.12129")

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

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

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

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

Connect an agent — have() is free.