SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2607.16721 · 2026

Half the Experts, All the Code: One-Shot Domain Pruning of Mixture-of-Experts LLMs for Coding *

Anik Jha

arXiv · PDF · Open in the Atlas

Code that ran

16 of 24 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; 2 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 13 failures of our instrument; 8 no recorded run), measured 2026-11-24; 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/2607.16721.json · badge: /api/ran/2607.16721.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
anik-jha/moep canonical (classifier label)
classifier basis: census
16 ran · 8 no recorded run
FunctionStatusWhere it lives
attach Ran
ran; our contract draft was wrong, not the code
anik-jha/moep/src/moep/profiler.py
code served (permissive licence) · get_code("894154deb5051f92")
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 tuple. 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 pathlib import Path

torch.manual_seed(0)

# Create a minimal adapter class
class MinimalAdapter:
    def __init__(self, num_experts=3):
        self.num_experts = num_experts
        self.router_prob = 'softmax'
    
    def moe_blocks(self, model):
        # Return list of (layer_id, block) tuples
        # Extract from model.moe_blocks attribute
        for i, block in enumerate(model.moe_blocks):
            yield (i, block)

# Create minimal expert block with required structure
class ExpertBlock(nn.Module):
    def __init__(self, hidden_dim=4, num_experts=3):
        super().__init__()
        self.hidden_dim = hidden_dim
        self.num_experts = num_experts
        
        # Gate/router
        self.gate = nn.Linear(hidden_dim, num_experts)
        
        # Experts container
        self.experts = nn.Module()
        
        # Create individual experts
        for e in range(num_experts):
            # gate_up_proj: projects hidden_dim to 2*intermediate_dim
            intermediate_dim = 6
            gate_up = nn.Linear(hidden_dim, 2 * intermediate_dim)
            down = nn.Linear(intermediate_dim, hidden_dim)
            
            setattr(self.experts, f'gate_up_proj_{e}', gate_up)
            setattr(self.experts, f'down_proj_{e}', down)
        
        # Store gate_up_proj and down_proj as lists for indexing
        self.experts.gate_up_proj = nn.ModuleList([
            nn.Linear(hidden_dim, 12) for _ in range(num_experts)
        ])
        self.experts.down_proj = nn.ModuleList([
            nn.Linear(6, hidden_dim) for _ in range(num_experts)
        ])
        self.experts.act_fn = nn.GELU()
    
    def forward(self, hidden, top_k_index, top_k_weights):
        return hidden

# Create minimal model
class MinimalModel(nn.Module):
    def __init__(self, num_layers=2, hidden_dim=4, num_experts=3):
        super().__init__()
        self.moe_blocks = nn.ModuleList([
            ExpertBlock(hidden_dim, num_experts) for _ in range(num_layers)
        ])
    
    def forward(self, x):
        return x

# Instantiate model and adapter
model = MinimalModel(num_layers=2, hidden_dim=4, num_experts=3)
adapter = MinimalAdapter(num_experts=3)

ARGS = {
    'model': model,
    'adapter': adapter,
}
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 tuple — a tuple output has no array shape of its own; none is 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
attach_item_hooks Ran
ran; our contract draft was wrong, not the code
anik-jha/moep/src/moep/attribution.py
code served (permissive licence) · get_code("f4e9c5dd00440d2e")
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 tuple. 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 minimal adapter class with moe_blocks method
class MinimalAdapter:
    def __init__(self, num_blocks: int):
        self.num_blocks = num_blocks
    
    def moe_blocks(self, model):
        """Yields tuples of (name, block) for each MoE block"""
        for i in range(self.num_blocks):
            yield (f"block_{i}", model.blocks[i])

# Create a minimal model with expert blocks
class ExpertsModule(nn.Module):
    def __init__(self):
        super().__init__()
    
    def forward(self, x):
        return x

class MoEBlock(nn.Module):
    def __init__(self):
        super().__init__()
        self.experts = ExpertsModule()
    
    def forward(self, x):
        return x

class MinimalModel(nn.Module):
    def __init__(self, num_blocks: int):
        super().__init__()
        self.blocks = nn.ModuleList([MoEBlock() for _ in range(num_blocks)])
    
    def forward(self, x):
        return x

# Set up parameters
num_layers = 3
num_blocks = 3

# Create model and adapter
model = MinimalModel(num_blocks)
adapter = MinimalAdapter(num_blocks)

# Create mask tensor: shape [num_layers, num_experts]
# num_experts can be different from num_layers for variety
num_experts = 8
mask = torch.randint(0, 2, (num_layers, num_experts), dtype=torch.bool)

ARGS = {
    "model": model,
    "adapter": adapter,
    "mask": mask,
}
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 tuple — a tuple output has no array shape of its own; none is 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_feedback Ran
ran; our contract draft was wrong, not the code
anik-jha/moep/src/moep/repair_eval.py
code served (permissive licence) · get_code("349bb92147fd4f64")
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 tuple, ndim 1, 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

torch.manual_seed(0)

# The function build_feedback takes two string parameters (or None)
# and returns a tuple of (feedback_message: str, feedback_mode: str)
# 
# Looking at the function body:
# - args_repr: str | None - a string representation of arguments, or None
# - expected_repr: str | None - a string representation of expected output, or None
#
# The function checks these conditions in order:
# 1. if args_repr and expected_repr: both are truthy strings
# 2. if args_repr: only args_repr is truthy
# 3. else: neither is truthy (generic case)
#
# We need to test all three paths, so we'll create test cases for each

ARGS = {
    "args_repr": "func(x=5, y=10)",
    "expected_repr": "42"
}
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 tuple, ndim 1, dtype family float — a tuple output has no array shape of its own; none is stated
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
build_item_sets Ran
ran; our contract draft was wrong, not the code
anik-jha/moep/src/moep/attribution.py
code served (permissive licence) · get_code("3bdd37a58f4172db")
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 json
from pathlib import Path
import tempfile
import shutil

# Create a temporary directory structure that mimics the expected run_dir layout
temp_dir = tempfile.mkdtemp()
run_dir = Path(temp_dir)

# Create the directory structure for evalplus results
base_dir = run_dir / 'evalplus' / 'base_q8' / 'humaneval-repair'
base_dir.mkdir(parents=True, exist_ok=True)

pruned_dir = run_dir / 'evalplus' / 'reap25_q8' / 'humaneval-repair'
pruned_dir.mkdir(parents=True, exist_ok=True)

mbpp_base_dir = run_dir / 'evalplus' / 'base_q8' / 'mbpp-repair'
mbpp_base_dir.mkdir(parents=True, exist_ok=True)

mbpp_pruned_dir = run_dir / 'evalplus' / 'reap25_q8' / 'mbpp-repair'
mbpp_pruned_dir.mkdir(parents=True, exist_ok=True)

# Create transitions.json for humaneval base_q8
humaneval_base_transitions = {
    'per_task': {
        'task_0': {'t1': 'pass'},
        'task_1': {'t1': 'pass'},
        'task_2': {'t1': 'fail'},
        'task_3': {'t1': 'pass'},
    }
}
(base_dir / 'transitions.json').write_text(json.dumps(humaneval_base_transitions))

# Create transitions.json for humaneval reap25_q8
humaneval_pruned_transitions = {
    'per_task': {
        'task_0': {'t1': 'pass'},
        'task_1': {'t1': 'fail'},
        'task_2': {'t1': 'fail'},
        'task_3': {'t1': 'pass'},
    }
}
(pruned_dir / 'transitions.json').write_text(json.dumps(humaneval_pruned_transitions))

# Create transitions.json for mbpp base_q8
mbpp_base_transitions = {
    'per_task': {
        'mbpp_0': {'t1': 'pass'},
        'mbpp_1': {'t1': 'pass'},
        'mbpp_2': {'t1': 'fail'},
    }
}
(mbpp_base_dir / 'transitions.json').write_text(json.dumps(mbpp_base_transitions))

# Create transitions.json for mbpp reap25_q8
mbpp_pruned_transitions = {
    'per_task': {
        'mbpp_0': {'t1': 'pass'},
        'mbpp_1': {'t1': 'fail'},
        'mbpp_2': {'t1': 'fail'},
    }
}
(mbpp_pruned_dir / 'transitions.json').write_text(json.dumps(mbpp_pruned_transitions))

ARGS = {
    'run_dir': run_dir,
    'base_tag': 'base_q8',
    'pruned_tag': 'reap25_q8',
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — 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
build_repair_messages Ran
ran; our contract draft was wrong, not the code
anik-jha/moep/src/moep/repair_eval.py
code served (permissive licence) · get_code("efb53e7877fd5dbc")
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 list, ndim 1, 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 numpy as np

torch.manual_seed(0)

# Define arguments for build_repair_messages function
task_prompt = "Write a function that computes the sum of all elements in a list."

failed_solution = """def sum_list(lst):
    total = 0
    for item in lst:
        total += item
    return total

result = sum_list([1, 2, 3, 4])
print(result)
"""

feedback = "Your solution works correctly for the given test case. However, it does not handle edge cases like empty lists or non-numeric elements. Please add error handling."

ARGS = {
    'task_prompt': task_prompt,
    'failed_solution': failed_solution,
    'feedback': feedback
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
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
load_stats Ran
ran; our contract draft was wrong, not the code
anik-jha/moep/src/moep/profiler.py
code served (permissive licence) · get_code("890f12d88faab21a")
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 tuple, ndim 1, 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
from pathlib import Path
import tempfile
import os

# Create a temporary directory and file for testing
torch.manual_seed(0)
temp_dir = tempfile.mkdtemp()
temp_file = os.path.join(temp_dir, "test_stats.pt")

# Create sample data that matches what load_stats expects
stats_data = {
    'loss': torch.tensor([0.5, 0.3, 0.2, 0.1]),
    'accuracy': torch.tensor([0.7, 0.8, 0.85, 0.9])
}

meta_data = {
    'epoch': 100,
    'model_name': 'test_model',
    'timestamp': '2024-01-01'
}

# Create the checkpoint file
checkpoint = {
    'stats': stats_data,
    'meta': meta_data
}
torch.save(checkpoint, temp_file)

# Define ARGS for the load_stats function
ARGS = {
    'path': temp_file
}
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 tuple, ndim 1, dtype family float — a tuple output has no array shape of its own; none is stated
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
mask_router_logits Ran
ran; our contract draft was wrong, not the code
anik-jha/moep/src/moep/ablation.py
code served (permissive licence) · get_code("c5c9c50c58d0eef5")
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 list, ndim 1, 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
import torch.nn.functional as F

torch.manual_seed(0)

# Build a minimal gate module that the hook will operate on
class Gate(nn.Module):
    def __init__(self, hidden_dim, num_experts, top_k):
        super().__init__()
        self.hidden_dim = hidden_dim
        self.num_experts = num_experts
        self.top_k = top_k
        self.weight = nn.Parameter(torch.randn(num_experts, hidden_dim))
    
    def forward(self, hidden_states):
        # Reshape and compute logits
        hs = hidden_states.reshape(-1, self.hidden_dim)
        logits = F.linear(hs, self.weight)
        return logits

# Build a minimal MoE block with a gate
class MoeBlock(nn.Module):
    def __init__(self, hidden_dim, num_experts, top_k):
        super().__init__()
        self.gate = Gate(hidden_dim, num_experts, top_k)
    
    def forward(self, x):
        return self.gate(x)

# Build a minimal model that contains moe_blocks
class MiniModel(nn.Module):
    def __init__(self, num_layers, hidden_dim, num_experts, top_k):
        super().__init__()
        self.layers = nn.ModuleList([
            MoeBlock(hidden_dim, num_experts, top_k)
            for _ in range(num_layers)
        ])
    
    def forward(self, x):
        return x

# Build a minimal adapter that provides moe_blocks method
class MiniAdapter:
    def __init__(self, model):
        self.model = model
    
    def moe_blocks(self, model):
        # Yield (index, block) tuples as the function expects
        for i, block in enumerate(model.layers):
            yield (i, block)

# Set up parameters
num_layers = 3
num_experts = 5
hidden_dim = 4
top_k = 2

# Create model and adapter
model = MiniModel(num_layers, hidden_dim, num_experts, top_k)
adapter = MiniAdapter(model)

# Create mask: [num_layers, num_experts] bool tensor
# True means masked (ablated)
mask = torch.tensor([
    [True, False, False, False, False],
    [False, True, False, False, False],
    [False, False, True, False, False],
], dtype=torch.bool)

ARGS = {
    "model": model,
    "adapter": adapter,
    "mask": mask,
}
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 list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
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
pack_token_stream Ran
ran, honoured the contract we drafted
anik-jha/moep/src/moep/profiler.py
code served (permissive licence) · get_code("e119502864fd0a8c")
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 Tensor, ndim 2, dtype family int, shape (2, 5) 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)

# Construct arguments for pack_token_stream
# token_lists: list of lists of integers (token IDs)
# seq_len: desired sequence length for output chunks
# eos_id: end-of-sequence token ID

token_lists = [
    [10, 20, 30],
    [40, 50],
    [60, 70, 80, 90]
]

seq_len = 5

eos_id = 2

ARGS = {
    "token_lists": token_lists,
    "seq_len": seq_len,
    "eos_id": eos_id
}
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 Tensor, ndim 2, dtype family int, shape (2, 5) — shape (2, 5) 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
parse_scores Ran
ran; our contract draft was wrong, not the code
anik-jha/moep/src/moep/codeval.py
code served (permissive licence) · get_code("b9e6f7bbe3b43270")
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 re

def parse_scores(stdout: str) -> dict[str, float]:
    """Parse evalplus.evaluate stdout into {suite name: pass@1}."""
    scores = dict(re.findall('(\\S+ \\(.*?tests\\))\\s*\\npass@1:\\s*([0-9.]+)', stdout))
    if not scores:
        scores = dict(re.findall('(pass@1):\\s*([0-9.]+)', stdout))
    return {k: float(v) for k, v in scores.items()}


# Test case 1: stdout with suite names and pass@1 scores
stdout_with_suites = """HumanEval (164 tests)
pass@1: 0.85
LeetCode (50 tests)
pass@1: 0.92"""

ARGS = {
    "stdout": stdout_with_suites
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — 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
pruned_mask Ran
ran, violated the contract we drafted
anik-jha/moep/src/moep/attribution.py
code served (permissive licence) · get_code("05f75544cc1a75c7")
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 Tensor, ndim 2, dtype family float, shape (3, 8) 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 json
import tempfile
from pathlib import Path
import torch

torch.manual_seed(0)

# Create a temporary directory and file with the keep data structure
temp_dir = tempfile.TemporaryDirectory()
temp_path = Path(temp_dir.name)

# Create a keep.json file with the expected structure
keep_data = {
    'info': {
        'num_experts': 8
    },
    'layer_ids': [0, 1, 2],
    'keep': {
        '0': [0, 1, 2],
        '1': [1, 2, 3],
        '2': [2, 3, 4]
    }
}

keep_file = temp_path / 'keep.json'
keep_file.write_text(json.dumps(keep_data))

ARGS = {
    'keep_path': str(keep_file)
}
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 Tensor, ndim 2, dtype family float, shape (3, 8) — shape (3, 8) 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
run_pair Ran
ran; our contract draft was wrong, not the code
anik-jha/moep/src/moep/ablation.py
code served (permissive licence) · get_code("6e98522fb81e2502")
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 tuple, ndim 1, 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
import torch.nn.functional as F

torch.manual_seed(0)

# Build minimal MoE gate
class MiniGate(nn.Module):
    def __init__(self, hidden_dim=4, num_experts=6, top_k=2):
        super().__init__()
        self.hidden_dim = hidden_dim
        self.num_experts = num_experts
        self.top_k = top_k
        self.weight = nn.Parameter(torch.randn(num_experts, hidden_dim))
    
    def forward(self, x):
        return x

# Build minimal MoE block
class MiniMoeBlock(nn.Module):
    def __init__(self, hidden_dim=4, num_experts=6):
        super().__init__()
        self.gate = MiniGate(hidden_dim=hidden_dim, num_experts=num_experts, top_k=2)
    
    def forward(self, x):
        return x

# Build minimal adapter
class MiniAdapter:
    def __init__(self, blocks):
        self.blocks = blocks
    
    def moe_blocks(self, model):
        """Yield (index, block) tuples."""
        for i, block in enumerate(self.blocks):
            yield (i, block)

# Build minimal model
class MiniModel(nn.Module):
    def __init__(self, vocab_size=10, hidden_dim=4, num_layers=2, num_experts=6):
        super().__init__()
        self.vocab_size = vocab_size
        self.hidden_dim = hidden_dim
        self.embedding = nn.Embedding(vocab_size, hidden_dim)
        self.moe_layers = nn.ModuleList([
            MiniMoeBlock(hidden_dim=hidden_dim, num_experts=num_experts)
            for _ in range(num_layers)
        ])
        self.lm_head = nn.Linear(hidden_dim, vocab_size)
    
    def forward(self, input_ids, labels=None, use_cache=False):
        x = self.embedding(input_ids)
        # Flatten batch and seq dims for gate forward
        batch_size, seq_len = input_ids.shape
        x_flat = x.view(-1, self.hidden_dim)
        
        for layer in self.moe_layers:
            x_flat = layer(x_flat)
        
        x_flat = x_flat.view(batch_size, seq_len, self.hidden_dim)
        logits = self.lm_head(x_flat)
        
        loss = None
        if labels is not None:
            loss_fn = nn.CrossEntropyLoss()
            loss = loss_fn(logits.view(-1, self.vocab_size), labels.view(-1))
        
        class Output:
            pass
        
        out = Output()
        out.loss = loss
        return out

# Instantiate model and adapter
num_layers = 2
num_experts = 6
hidden_dim = 4

model = MiniModel(vocab_size=10, hidden_dim=hidden_dim, num_layers=num_layers, num_experts=num_experts)
adapter = MiniAdapter(model.moe_layers)

# Create input_ids: shape [2, 5] (batch=2, seq_len=5)
input_ids = torch.randint(0, 10, (2, 5))

# Create mask: shape [num_layers, num_experts] with some True values
mask = torch.zeros(num_layers, num_experts, dtype=torch.bool)
mask[0, :2] = True  # Mask first 2 experts in layer 0
mask[1, 3:5] = True  # Mask experts 3,4 in layer 1

ARGS = {
    "model": model,
    "adapter": adapter,
    "input_ids": input_ids,
    "mask": mask,
}
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 tuple, ndim 1, dtype family float — a tuple output has no array shape of its own; none is stated
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
seq_loss Ran
ran; our contract draft was wrong, not the code
anik-jha/moep/src/moep/ablation.py
code served (permissive licence) · get_code("094d04f4af2792de")
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 float, ndim 0, dtype family float, shape () 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

torch.manual_seed(0)

class StandInModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.embedding = nn.Embedding(num_embeddings=10, embedding_dim=4)
        self.linear = nn.Linear(4, 10)
        
    def forward(self, input_ids, labels, use_cache=False):
        # Return an object with a loss attribute
        x = self.embedding(input_ids)
        logits = self.linear(x)
        loss = logits.mean()  # simple loss for testing
        
        class Output:
            pass
        
        output = Output()
        output.loss = loss
        return output

model = StandInModel()
input_ids = torch.randint(0, 10, (1, 4), dtype=torch.long)

ARGS = {
    "model": model,
    "input_ids": input_ids,
}
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 float, ndim 0, dtype family float, shape () — shape () 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
tokenize_rows Ran
ran; our contract draft was wrong, not the code
anik-jha/moep/src/moep/data.py
code served (permissive licence) · get_code("8389363a3873fc0d")
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 list. 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)

class MockTokenizer:
    """Mock tokenizer that implements apply_chat_template."""
    
    def apply_chat_template(self, messages, tokenize=True, return_dict=False):
        """Convert messages to token ids."""
        # Simple mock: concatenate message contents and convert to token ids
        text = " ".join(m['content'] for m in messages)
        # Generate deterministic token ids based on text length
        token_ids = [hash(text + str(i)) % 1000 for i in range(len(text.split()) + 1)]
        return token_ids

# Create sample rows with chat messages
rows = [
    {
        'messages': [
            {'role': 'user', 'content': 'Hello'},
            {'role': 'assistant', 'content': 'Hi there'},
            {'role': 'user', 'content': 'How are you?'},
        ]
    },
    {
        'messages': [
            {'role': 'user', 'content': 'What is 2+2?'},
            {'role': 'assistant', 'content': 'The answer is 4'},
        ]
    },
]

# Create mock tokenizer
tokenizer = MockTokenizer()

# Define log function (default is print)
def mock_log(msg):
    print(msg)

ARGS = {
    'tok': tokenizer,
    'rows': rows,
    'log': mock_log,
}
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 list — a list output has no array shape of its own; none is 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
tokenize_rows_plain Ran
ran, honoured the contract we drafted
anik-jha/moep/src/moep/data.py
code served (permissive licence) · get_code("026adaeb0bca946f")
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 list, ndim 2, dtype family int; 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 numpy as np

class MockTokenizer:
    """Stand-in tokenizer that has a __call__ method returning input_ids."""
    def __call__(self, text):
        # Return a mock object with input_ids attribute
        # Simulate tokenization by hashing text length to create consistent token ids
        token_count = max(1, len(text) // 10)
        return type('TokenizationResult', (), {
            'input_ids': list(range(token_count))
        })()

# Create a mock tokenizer
tok = MockTokenizer()

# Create sample rows with the expected structure
rows = [
    {
        'messages': [
            {'content': 'Hello'},
            {'content': 'World'}
        ]
    },
    {
        'messages': [
            {'content': 'Foo'},
            {'content': 'Bar'},
            {'content': 'Baz'}
        ]
    }
]

ARGS = {
    'tok': tok,
    'rows': rows
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 2, dtype family int — a list output has no array shape of its own; none is stated
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
turn1_user_message Ran
ran; our contract draft was wrong, not the code
anik-jha/moep/src/moep/repair_eval.py
code served (permissive licence) · get_code("48641a7e6a6e7f12")
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 torch
import torch.nn as nn

torch.manual_seed(0)

# The function turn1_user_message takes a task_prompt string parameter
# and returns a formatted string combining INSTRUCTION_PREFIX with the task_prompt
# No complex objects needed - just a simple string argument

task_prompt_value = "Write a function to compute the sum of a list of numbers"

ARGS = {
    "task_prompt": task_prompt_value
}
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 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
write_eval Ran
ran; our contract draft was wrong, not the code
anik-jha/moep/src/moep/evalx.py
code served (permissive licence) · get_code("d3893fe99bf403d2")
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 PosixPath. 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 json
from pathlib import Path
import tempfile
import shutil

# Create a temporary directory for the test
temp_dir = tempfile.mkdtemp()

# Initialize eval.json with some existing data
eval_path = Path(temp_dir) / 'eval.json'
initial_data = {
    "existing_section": {"metric1": 0.95}
}
eval_path.write_text(json.dumps(initial_data, indent=2))

# Define the arguments
ARGS = {
    "run_dir": temp_dir,
    "section": "test_section",
    "payload": {
        "accuracy": 0.92,
        "loss": 0.15,
        "f1_score": 0.89
    }
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type PosixPath — a PosixPath output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a PosixPath 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
completion Not yet run
unverified (harvested, no recorded run)
anik-jha/moep/src/moep/codeval.py
code served (permissive licence) · get_code("452896dfec050e72")
How it ran

no invocation recorded.

evaluate_samples Not yet run
unverified (harvested, no recorded run)
anik-jha/moep/src/moep/codeval.py
code served (permissive licence) · get_code("3e39bc2a2d2a3dec")
How it ran

no invocation recorded.

export_gguf Not yet run
unverified (harvested, no recorded run)
anik-jha/moep/src/moep/export.py
code served (permissive licence) · get_code("9c9714431a00a332")
How it ran

no invocation recorded.

get_adapter Not yet run
unverified (harvested, no recorded run)
anik-jha/moep/src/moep/adapters.py
code served (permissive licence) · get_code("32c087012117c403")
How it ran

no invocation recorded.

heal Not yet run
unverified (harvested, no recorded run)
anik-jha/moep/src/moep/heal.py
code served (permissive licence) · get_code("4e7b923f15f0c379")
How it ran

no invocation recorded.

load_offloaded Not yet run
unverified (harvested, no recorded run)
anik-jha/moep/src/moep/loader.py
code served (permissive licence) · get_code("4d1c495402277bf7")
How it ran

no invocation recorded.

perplexity Not yet run
unverified (harvested, no recorded run)
anik-jha/moep/src/moep/evalx.py
code served (permissive licence) · get_code("e844b6e07ec7a670")
How it ran

no invocation recorded.

smoke Not yet run
unverified (harvested, no recorded run)
anik-jha/moep/src/moep/evalx.py
code served (permissive licence) · get_code("44eed9eda2af0fa3")
How it ran

no invocation recorded.

Also present in other papers' code

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

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 strongest open-weight coding models are mixture-of-experts (MoE) networks: most of their size comes from large pools of alternative "expert" subnetworks, of which only a few act on any given token. That pool is why these models do not fit on the machines most developers own, yet for a user who only wants coding help, most experts encode abilities that will never be invoked. We ask how many experts can be removed, and how to choose which, by pruning two recent open-weight MoE models from different families (Qwen3.6-35B-A3B and Gemma-4-26B-A4B) under five selection strategies, and judging the result the way a user would: by whether the model still writes correct code. Half the experts can be removed from either model with no statistically detectable loss on the primary code-generation benchmark, and the damage lands almost entirely on abilities outside coding, which is the intended trade. But the selection strategy that achieves this flips between the two models: the winner on one trails significantly on the other, whose own winner collapses outright at deeper pruning on the first, so a pruning recipe validated on one model family cannot be assumed to work on another. We further show that perplexity, the metric much of the pruning literature leans on, can rate a broken model above an intact one; that a lightweight fine-tune recovers about half of what aggressive pruning loses; and that against simply quantizing the full model to the same memory budget, pruning wins only where quantization would have to drop below 3 bits per weight. Five attempts to overturn that crossover, with failure criteria fixed in advance (better calibration, guarded selection, causally measured expert importance, failure attribution, and an agentic evaluation that lets each model repair its failures from execution feedback), all leave it standing, and the last shows single-shot benchmarks overstate compression penalties broadly: one repair turn erases the 2-bit quantization penalty entirely. Expert pruning works, but it demands per-model validation on the task the model will actually serve. * Preprint. Under review. Code, per-point expert selections, and quantized specialist checkpoints: github.com/anik-jha/moep.

For agents

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

get_harvested_code_for_paper("2607.16721")
get_code_for_paper("2607.16721")
have("2607.16721")

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

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

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

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

Connect an agent — have() is free.