SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2405.14124 · NeurIPS · 2024

Mixture of Experts Meets Prompt-Based Continual Learning

Nhat Ho, Huy Nguyen, Trang Nguyen, Minh Le, An Nguyen, Trang Pham, Linh Van Ngo

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 (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 3 violated it and 1 has no contract verdict; 2 failures of our instrument; 1 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/2405.14124.json · badge: /api/ran/2405.14124.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
Minhchuyentoancbn/MoE_PromptCL canonical (classifier label)
classifier basis: census
5 ran · 1 no recorded run
minhchuyentoancbn/moe_promptcl canonical (classifier label)
classifier basis: classifier_2025
1 ran · 0 no recorded run
FunctionStatusWhere it lives
MlpMapping Ran
ran on a synthesized input
minhchuyentoancbn/moe_promptcl/vits/norga_prompt_vision_transformer.py
code served (permissive licence) · get_code("128fb8ed7af68c7a")
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

INIT_ARGS = {
    'dim': 4,
    'hidden': [2, 3],
    'drop': 0.1,
    'act_layer': nn.GELU,
    'norm_layer': nn.LayerNorm,
    'fc_with_norm': False,
}

ARGS = {
    'x': torch.randn(2, 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 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)
cosine_similarity Ran
ran, violated the contract we drafted
Minhchuyentoancbn/MoE_PromptCL/engines/loss.py
code served (permissive licence) · get_code("b5f44526e6cc6a9d")
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 1, dtype family float, shape (2,) 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 two small tensors with shape (batch_size=2, dim=4)
a = torch.randn(2, 4)
b = torch.randn(2, 4)

ARGS = {
    'a': a,
    'b': b,
    'eps': 1e-08
}
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 1, dtype family float, shape (2,) — shape (2,) 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
inter_class_relation Ran
ran; our contract draft was wrong, not the code
Minhchuyentoancbn/MoE_PromptCL/engines/loss.py
code served (permissive licence) · get_code("8ddba0e578df5797")
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 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

torch.manual_seed(0)

# Create small tensors for y_s and y_t
# Shape: (batch_size=2, num_classes=4)
y_s = torch.randn(2, 4)
y_t = torch.randn(2, 4)

# Create a mask tensor with the same shape as the output of pearson_correlation
# pearson_correlation(y_s, y_t) returns shape (2,), so mask should be (2,)
mask = torch.ones(2)

ARGS = {
    "y_s": y_s,
    "y_t": y_t,
    "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 Tensor, 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
pearson_correlation Ran
ran, violated the contract we drafted
Minhchuyentoancbn/MoE_PromptCL/engines/loss.py
code served (permissive licence) · get_code("8eb964c14770de5c")
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 1, dtype family float, shape (2,) 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 small tensors for testing
# Shape: (batch_size=2, feature_dim=4)
a = torch.randn(2, 4)
b = torch.randn(2, 4)

# Optional eps parameter with default value
eps = 1e-08

ARGS = {
    "a": a,
    "b": b,
    "eps": eps,
}
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 1, dtype family float, shape (2,) — shape (2,) 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
target_transform Ran
ran, violated the contract we drafted
Minhchuyentoancbn/MoE_PromptCL/datasets.py
code served (permissive licence) · get_code("265ea374aab10001")
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 1, dtype family float, shape (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 numpy as np

torch.manual_seed(0)

# Analyze the function: target_transform(x, nb_classes)
# The function returns x + nb_classes
# x should be numeric (supports addition)
# nb_classes should be numeric (supports addition with x)

# Create a small numeric value for x
x = torch.tensor([1, 2, 3, 4], dtype=torch.float32)

# Create a small numeric value for nb_classes
nb_classes = 10

ARGS = {
    'x': x,
    'nb_classes': nb_classes
}
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 Tensor, ndim 1, dtype family float, shape (4,) — shape (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
task_inference_accuracy Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
Minhchuyentoancbn/MoE_PromptCL/utils.py
code served (permissive licence) · get_code("92b87c2e87500812")
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 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

torch.manual_seed(0)

# Analyze the function:
# - prompt_idx: a tensor that gets transposed and used in eq() comparison
# - target: a tensor with .item() method, used to index target_task_map and get size via .size(0)
# - target_task_map: a dict mapping from target values to task indices

# Set up small tensors
batch_size = 2
num_prompts = 4

# prompt_idx should be a 2D tensor that will be transposed
# After transpose, it should have shape (num_prompts, batch_size)
# So before transpose, shape is (batch_size, num_prompts)
prompt_idx = torch.tensor([[0, 1, 2, 3],
                           [1, 2, 3, 0]], dtype=torch.long)

# target should be a 1D tensor of size batch_size
# Its values will be used as keys in target_task_map
target = torch.tensor([0, 1], dtype=torch.long)

# target_task_map: dict mapping target values to task indices
# Need to map both 0 and 1 (the values in target)
target_task_map = {
    0: 0,
    1: 1,
    2: 2,
    3: 3
}

ARGS = {
    "prompt_idx": prompt_idx,
    "target": target,
    "target_task_map": target_task_map
}
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 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
get_dataset Not yet run
unverified (harvested, no recorded run)
Minhchuyentoancbn/MoE_PromptCL/datasets.py
code served (permissive licence) · get_code("f8e1687c33938e06")
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, 4 are also present in other papers whose code we hold (4 with at least one paper dated earlier, 0 the same month, 3 later) and 3 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
target_transform 6 other papers
5 dated earlier, 1 later
2112.08654 (2021-12)
Learning to Prompt for Continual Learning
2308.09610 (2023-08)
On the Effectiveness of LayerNorm Tuning for Continual Learning in Vision Transformers
2310.13888 (2023-10)
Towards a General Framework for Continual Learning with Pre-training
and 3 more not named here
pearson_correlation 3 other papers
2 dated earlier, 1 later
2204.02557 (2022-04)
MixFormer: Mixing Features across Windows and Dimensions
2205.10536 (2022-05)
Knowledge Distillation from A Stronger Teacher
2509.23871 (2025-09)
Taught Well Learned Ill: Towards Distillation-conditional Backdoor Attack
cosine_similarity 2 other papers
1 dated earlier, 1 later
2205.10536 (2022-05)
Knowledge Distillation from A Stronger Teacher
2509.23871 (2025-09)
Taught Well Learned Ill: Towards Distillation-conditional Backdoor Attack
get_dataset 1 other paper
1 dated earlier
2310.13888 (2023-10)
Towards a General Framework for Continual Learning with Pre-training

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

Exploiting the power of pre-trained models, prompt-based approaches stand out compared to other continual learning solutions in effectively preventing catastrophic forgetting, even with very few learnable parameters and without the need for a memory buffer. While existing prompt-based continual learning methods excel in leveraging prompts for state-of-the-art performance, they often lack a theoretical explanation for the effectiveness of prompting. This paper conducts a theoretical analysis to unravel how prompts bestow such advantages in continual learning, thus offering a new perspective on prompt design. We first show that the attention block of pre-trained models like Vision Transformers inherently encodes a special mixture of experts architecture, characterized by linear experts and quadratic gating score functions. This realization drives us to provide a novel view on prefix tuning, reframing it as the addition of new task-specific experts, thereby inspiring the design of a novel gating mechanism termed Non-linear Residual Gates (NoRGa). Through the incorporation of non-linear activation and residual connection, NoRGa enhances continual learning performance while preserving parameter efficiency. The effectiveness of NoRGa is substantiated both theoretically and empirically across diverse benchmarks and pretraining paradigms. Our code is publicly available at https://github.com/Minhchuyentoancbn/MoE_PromptCL.

For agents

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

get_harvested_code_for_paper("2405.14124")
get_code_for_paper("2405.14124")
have("2405.14124")

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

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

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

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

Connect an agent — have() is free.