SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2406.15479 · NeurIPS · 2024

Twin-Merging: Dynamic Integration of Modular Expertise in Model Merging

Yu Cheng, Zhenyi Lu, Chenghao Fan, Wei Wei, Dangyang Chen, Xiaoye Qu

arXiv · PDF · Open in the Atlas

Code that ran

7 of 11 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 0 have no contract verdict; 7 failures of our instrument; 4 no recorded run), measured 2026-11-24; 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/2406.15479.json · badge: /api/ran/2406.15479.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
LZY-the-boys/Twin-Merging canonical (classifier label)
classifier basis: census
7 ran · 4 no recorded run
FunctionStatusWhere it lives
args_inspector Ran
ran; our contract draft was wrong, not the code
LZY-the-boys/Twin-Merging/discriminative/utils.py
pointer only (licence: MIT); the stored copy get_code serves, from kiddo127/ESM, is pointer only (licence: NONE) · get_code("68332c06437c45b3")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from kiddo127/ESM, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

bernoulli Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
LZY-the-boys/Twin-Merging/discriminative/sparsify.py
pointer only (licence: MIT); the stored copy get_code serves, from kiddo127/ESM, is pointer only (licence: NONE) · get_code("f5f78d9bf8dfb1b1")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from kiddo127/ESM, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

deprecated Ran
ran; our contract draft was wrong, not the code
LZY-the-boys/Twin-Merging/discriminative/utils.py
pointer only (licence: MIT); the stored copy get_code serves, from kiddo127/ESM, is pointer only (licence: NONE) · get_code("670b577dd9aa8aa8")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from kiddo127/ESM, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

from_yaml Ran
ran; our contract draft was wrong, not the code
LZY-the-boys/Twin-Merging/discriminative/utils.py
pointer only (licence: MIT); the stored copy get_code serves, from kiddo127/ESM, is pointer only (licence: NONE) · get_code("32204061bb656051")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from kiddo127/ESM, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_ori_datasets Ran
ran; our contract draft was wrong, not the code
LZY-the-boys/Twin-Merging/discriminative/router.py
code served (permissive licence) · get_code("9ceff24e89da3b6e")
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 numpy as np
from unittest.mock import Mock, MagicMock

torch.manual_seed(0)

# Create a minimal tokenizer stand-in
class MinimalTokenizer:
    def __call__(self, text, max_length=None, padding=True, truncation=True, return_tensors=None):
        # Return a dict with input_ids
        return {'input_ids': torch.tensor([[101, 2054, 2003, 102]], dtype=torch.long)}

# Create a minimal GLUEDataLoader stand-in
class MinimalGLUEDataLoader:
    def __init__(self, tokenizer=None):
        self.tokenizer = tokenizer
    
    def load_dataset(self, dataset_name, train_split_ratio_for_val=0.1, max_seq_length=128):
        # Return train_dataset, val_dataset, test_dataset, num_labels
        # Each dataset is a list of dicts with 'input_ids' key
        train_data = [
            {'input_ids': torch.tensor([101, 2054, 2003, 102, 0, 0], dtype=torch.long)},
            {'input_ids': torch.tensor([101, 1045, 2572, 102, 0, 0], dtype=torch.long)},
            {'input_ids': torch.tensor([101, 3231, 1045, 102, 0, 0], dtype=torch.long)},
        ]
        val_data = [
            {'input_ids': torch.tensor([101, 2054, 2003, 102, 0, 0], dtype=torch.long)},
        ]
        test_data = [
            {'input_ids': torch.tensor([101, 2054, 2003, 102, 0, 0], dtype=torch.long)},
            {'input_ids': torch.tensor([101, 1045, 2572, 102, 0, 0], dtype=torch.long)},
        ]
        return train_data, val_data, test_data, 2

# Mock the global glue_data_id_map
glue_data_id_map = {
    'sst2': 0,
    'mnli': 1,
}

# Inject the mock GLUEDataLoader into the namespace
import sys
current_module = sys.modules[__name__]
setattr(current_module, 'GLUEDataLoader', MinimalGLUEDataLoader)
setattr(current_module, 'glue_data_id_map', glue_data_id_map)

# Create the tokenizer
tokenizer = MinimalTokenizer()

# Define ARGS
ARGS = {
    'mode': 'train',
    'tokenizer': tokenizer,
    'max_len': 3000,
}
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 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
magnitude Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
LZY-the-boys/Twin-Merging/discriminative/sparsify.py
pointer only (licence: MIT); the stored copy get_code serves, from kiddo127/ESM, is pointer only (licence: NONE) · get_code("b6e10ff5abcddad1")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from kiddo127/ESM, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

svd Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
LZY-the-boys/Twin-Merging/discriminative/sparsify.py
code served (permissive licence) · get_code("5dfa439bd79443ac")
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 (4, 3) 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 2D tensor for SVD decomposition
tensor = torch.randn(4, 3, dtype=torch.float32)

# Set density to a value between 0 and 1
# This controls the rank of the approximation
density = 0.75

# Build the ARGS dictionary with all parameters
ARGS = {
    'tensor': tensor,
    'density': density,
}
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 (4, 3) — shape (4, 3) 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
load_causallm Not yet run
unverified (harvested, no recorded run)
LZY-the-boys/Twin-Merging/generative/model.py
code served (permissive licence) · get_code("5a42da8e258e5c0d")
How it ran

no invocation recorded.

load_classifier Not yet run
unverified (harvested, no recorded run)
LZY-the-boys/Twin-Merging/generative/model.py
code served (permissive licence) · get_code("ebc5519f98dc7c94")
How it ran

no invocation recorded.

load_glue Not yet run
unverified (harvested, no recorded run)
LZY-the-boys/Twin-Merging/discriminative/router.py
code served (permissive licence) · get_code("b27d590fb18bf106")
How it ran

no invocation recorded.

load_seq2seqlm Not yet run
unverified (harvested, no recorded run)
LZY-the-boys/Twin-Merging/generative/model.py
code served (permissive licence) · get_code("8c91b2b57ae37256")
How it ran

no invocation recorded.

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 11 distinct functions with an identity, 5 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 5 later) and 6 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
args_inspector 1 other paper
1 later
2606.19164 (2026-06)
Essential Subspace Merging for Multi-Task Learning
bernoulli 1 other paper
1 later
2606.19164 (2026-06)
Essential Subspace Merging for Multi-Task Learning
deprecated 1 other paper
1 later
2606.19164 (2026-06)
Essential Subspace Merging for Multi-Task Learning
from_yaml 1 other paper
1 later
2606.19164 (2026-06)
Essential Subspace Merging for Multi-Task Learning
magnitude 1 other paper
1 later
2606.19164 (2026-06)
Essential Subspace Merging for Multi-Task Learning

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

In the era of large language models, model merging is a promising way to combine multiple task-specific models into a single multitask model without extra training. However, two challenges remain: (a) interference between different models and (b) heterogeneous data during testing. Traditional model merging methods often show significant performance gaps compared to fine-tuned models due to these issues. Additionally, a one-size-fits-all model lacks flexibility for diverse test data, leading to performance degradation. We show that both shared and exclusive task-specific knowledge are crucial for merging performance, but directly merging exclusive knowledge hinders overall performance. In view of this, we propose Twin-Merging, a method that encompasses two principal stages: (1) modularizing knowledge into shared and exclusive components, with compression to reduce redundancy and enhance efficiency; (2) dynamically merging shared and taskspecific knowledge based on the input. This approach narrows the performance gap between merged and fine-tuned models and improves adaptability to heterogeneous data. Extensive experiments on 20 datasets for both language and vision tasks demonstrate the effectiveness of our method, showing an average improvement of 28.34% in absolute normalized score for discriminative tasks and even surpassing the fine-tuned upper bound on the generative tasks. 1

For agents

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

get_harvested_code_for_paper("2406.15479")
get_code_for_paper("2406.15479")
have("2406.15479")

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

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

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

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

Connect an agent — have() is free.