SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2407.00256 · ICML · 2024

One Prompt is not Enough: Automated Construction of a Mixture-of-Expert Prompts

Cho-Jui Hsieh, Tianyi Zhou, Sung Hwang, Ruochen Wang, Minhao Cheng, Sohyun An

arXiv · PDF · Open in the Atlas

Code that ran

4 of 7 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; 1 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 3 failures of our instrument; 3 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/2407.00256.json · badge: /api/ran/2407.00256.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
ruocwang/mixture-of-prompts canonical (classifier label)
classifier basis: census
4 ran · 3 no recorded run
FunctionStatusWhere it lives
add_demos_to_prompt Ran
ran; our contract draft was wrong, not the code
ruocwang/mixture-of-prompts/mop/src/pe_manager.py
code served (permissive licence) · get_code("6a34bf650bbf498c")
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

class TemplateManager:
    def __init__(self):
        self.demos = DemosTemplate()

class DemosTemplate:
    def fill(self, demos):
        return "Demo section:\n" + str(demos)

# Create arguments
prompt = "This is the initial prompt"
demos = ["Example 1: input -> output", "Example 2: input -> output"]
temp_man = TemplateManager()
max_length = 200

ARGS = {
    "prompt": prompt,
    "demos": demos,
    "temp_man": temp_man,
    "max_length": max_length
}
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
compute_exp_stats Ran
ran, honoured the contract we drafted
ruocwang/mixture-of-prompts/mop/src/exp_utils.py
code served (permissive licence) · get_code("f890ea0b93a37532")
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 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 numpy as np

def compute_exp_stats(all_results):
    all_best = []
    all_top10 = []
    for result in all_results:
        all_best.append(result['best_avg_loss'])
        all_top10.append(np.mean(result['top10_avg_losses']))
    avg_best, std_best = (np.mean(all_best), np.std(all_best))
    avg_top10, std_top10 = (np.mean(all_top10), np.std(all_top10))
    return ((avg_best, std_best), (avg_top10, std_top10))

# Construct valid arguments
all_results = [
    {
        'best_avg_loss': 0.5,
        'top10_avg_losses': np.array([0.6, 0.55, 0.58, 0.62, 0.59, 0.61, 0.57, 0.63, 0.56, 0.64])
    },
    {
        'best_avg_loss': 0.4,
        'top10_avg_losses': np.array([0.5, 0.45, 0.48, 0.52, 0.49, 0.51, 0.47, 0.53, 0.46, 0.54])
    },
    {
        'best_avg_loss': 0.6,
        'top10_avg_losses': np.array([0.7, 0.65, 0.68, 0.72, 0.69, 0.71, 0.67, 0.73, 0.66, 0.74])
    }
]

ARGS = {
    'all_results': all_results
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 2, 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
kMeansRes Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
ruocwang/mixture-of-prompts/mop/src/algo/mixture_of_experts/utils.py
code served (permissive licence) · get_code("9c4133378318a325")
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 float64, ndim 0, 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 numpy as np
from sklearn.cluster import KMeans

# Create small sample data for clustering
# rows are samples, columns are features
np.random.seed(0)
scaled_data = np.random.randn(10, 4)  # 10 samples, 4 features

# Define parameters
k = 3
alpha_k = 0.1
seed = 0

ARGS = {
    "scaled_data": scaled_data,
    "k": k,
    "alpha_k": alpha_k,
    "seed": seed
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
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
set_all_seed Ran
ran; our contract draft was wrong, not the code
ruocwang/mixture-of-prompts/mop/src/misc.py
code served (permissive licence) · get_code("12ac50dad1160c09")
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. 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 random
import numpy as np

# Set seed for reproducibility
torch.manual_seed(0)
random.seed(0)
np.random.seed(0)

# The function set_all_seed takes a single parameter: seed (an integer)
# It sets seeds for random, numpy, torch, and cuda
# The function returns a success message string

ARGS = {
    'seed': 42
}
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 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
chooseBestKforKMeansParallel Not yet run
unverified (harvested, no recorded run)
ruocwang/mixture-of-prompts/mop/src/algo/mixture_of_experts/utils.py
code served (permissive licence) · get_code("7f2494772490fb0a")
How it ran

no invocation recorded.

pick_gpu_lowest_memory Not yet run
unverified (harvested, no recorded run)
ruocwang/mixture-of-prompts/mop/src/exp_utils.py
code served (permissive licence) · get_code("0ed5636df814298e")
How it ran

no invocation recorded.

save_image Not yet run
unverified (harvested, no recorded run)
ruocwang/mixture-of-prompts/mop/src/exp_utils.py
code served (permissive licence) · get_code("25ca89c7cda28f21")
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, 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 7 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

Large Language Models (LLMs) exhibit strong generalization capabilities to novel tasks when prompted with language instructions and incontext demos. Since this ability sensitively depends on the quality of prompts, various methods have been explored to automate the instruction design. While these methods demonstrated promising results, they also restricted the searched prompt to one instruction. Such simplification significantly limits their capacity, as a single demofree instruction might not be able to cover the entire complex problem space of the targeted task. To alleviate this issue, we adopt the Mixture-of-Expert paradigm and divide the problem space into a set of sub-regions; Each sub-region is governed by a specialized expert, equipped with both an instruction and a set of demos. A two-phase process is developed to construct the specialized expert for each region: (1) demo assignment: Inspired by the theoretical connection between incontext learning and kernel regression, we group

For agents

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

get_harvested_code_for_paper("2407.00256")
get_code_for_paper("2407.00256")
have("2407.00256")

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

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

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

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

Connect an agent — have() is free.