SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2412.09441 · 2024

MOS: Model Surgery for Pre-Trained Model-Based Class-Incremental Learning

arXiv · PDF · Open in the Atlas

Code that ran

13 of 17 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; 3 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 10 failures of our instrument; 4 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/2412.09441.json · badge: /api/ran/2412.09441.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
sun-hailong/aaai25-mos canonical (classifier label)
classifier basis: census
9 ran · 3 no recorded run
sun-hailong/lamda-pilot canonical (classifier label)
classifier basis: census
4 ran · 1 no recorded run
FunctionStatusWhere it lives
build_transform Ran
ran; our contract draft was wrong, not the code
sun-hailong/aaai25-mos/utils/data.py
pointer only (licence: NONE) · get_code("b620954495190c1a")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, sun-hailong/aaai25-mos 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.

build_transform_coda_prompt Ran
ran; our contract draft was wrong, not the code
sun-hailong/aaai25-mos/utils/data.py
pointer only (licence: NONE) · get_code("84339af3a90298e2")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, sun-hailong/aaai25-mos 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.

conv1x1 Ran
ran; our contract draft was wrong, not the code
sun-hailong/lamda-pilot/backbone/resnet.py
code served (permissive licence) · get_code("d9def42110729a85")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned Conv2d. 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 conv1x1 takes in_planes, out_planes, and stride as parameters
# It returns an nn.Conv2d layer configured for 1x1 convolution
# We need to provide valid integer arguments for these parameters

ARGS = {
    "in_planes": 3,
    "out_planes": 64,
    "stride": 1
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Conv2d — a Conv2d output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Conv2d 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
conv3x3 Ran
ran; our contract draft was wrong, not the code
sun-hailong/lamda-pilot/backbone/resnet.py
code served (permissive licence) · get_code("160bb14bd76201b4")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned Conv2d. 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)

ARGS = {
    "in_planes": 3,
    "out_planes": 64,
    "stride": 1,
    "groups": 1,
    "dilation": 1,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Conv2d — a Conv2d output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Conv2d 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
count_parameters Ran
ran, honoured the contract we drafted
sun-hailong/aaai25-mos/utils/toolkit.py
pointer only (licence: NONE); the stored copy get_code serves, from wangkiw/iclr23-memo, is pointer only (licence: NONE) · get_code("6bdbe3d6368c4cde")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, sun-hailong/aaai25-mos 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.

default_loader Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
sun-hailong/aaai25-mos/utils/data_manager.py
pointer only (licence: NONE) · get_code("2c9953e20558c977")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, sun-hailong/aaai25-mos 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_backbone Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
sun-hailong/aaai25-mos/utils/inc_net.py
pointer only (licence: NONE) · get_code("1228159f65c11926")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, sun-hailong/aaai25-mos 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.

interpolate_weights Ran
ran; our contract draft was wrong, not the code
sun-hailong/lamda-pilot/models/cofima.py
code served (permissive licence) · get_code("c4068ef3da0e1260")
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 torch
import numpy as np

torch.manual_seed(0)

# Construct theta_0: a dict of parameter tensors
theta_0 = {
    'layer1.weight': torch.randn(4, 3),
    'layer1.bias': torch.randn(4),
    'layer2.weight': torch.randn(5, 4),
}

# Construct theta_1: a dict of parameter tensors with same keys plus one extra
theta_1 = {
    'layer1.weight': torch.randn(4, 3),
    'layer1.bias': torch.randn(4),
    'layer2.weight': torch.randn(5, 4),
    'layer3.weight': torch.randn(2, 5),  # unique key not in theta_0
}

# Interpolation parameter
alpha = 0.5

# Fisher information matrix (list of two dicts)
fisher_mat = [
    {
        'layer1.weight': torch.randn(4, 3),
        'layer1.bias': torch.randn(4),
        'layer2.weight': torch.randn(5, 4),
    },
    {
        'layer1.weight': torch.randn(4, 3),
        'layer1.bias': torch.randn(4),
        'layer2.weight': torch.randn(5, 4),
        'layer3.weight': torch.randn(2, 5),
    }
]

ARGS = {
    'theta_0': theta_0,
    'theta_1': theta_1,
    'alpha': alpha,
    'fisher': False,
    'fisher_mat': None,
}
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 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
pil_loader Ran
ran, honoured the contract we drafted
sun-hailong/aaai25-mos/utils/data_manager.py
pointer only (licence: NONE) · get_code("66b63ed4f327a712")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, sun-hailong/aaai25-mos 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.

reduce_proxies Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
sun-hailong/aaai25-mos/backbone/linears.py
pointer only (licence: NONE); the stored copy get_code serves, from sun-hailong/cvpr24-ease, is pointer only (licence: NONE) · get_code("4072283c98270784")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, sun-hailong/aaai25-mos 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.

regularized_cn Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
sun-hailong/lamda-pilot/models/dgr.py
code served (permissive licence) · get_code("d7c13335c21a1194")
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. 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, 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 numpy as np
import torch
from torch.nn import functional as F

torch.manual_seed(0)

# The function expects:
# - outputs: a tensor that can be added to a prior and passed to F.cross_entropy
# - targets: a tensor of target class indices for cross_entropy
# - label_distribution: array-like of label frequencies

batch_size = 2
num_classes = 4

# outputs: logits tensor (batch_size, num_classes)
outputs = torch.randn(batch_size, num_classes)

# targets: class indices (batch_size,) with values in [0, num_classes)
targets = torch.tensor([0, 2], dtype=torch.long)

# label_distribution: histogram of class frequencies across dataset
# Should sum to something (will be normalized in function)
label_distribution = np.array([10.0, 5.0, 8.0, 7.0])

ARGS = {
    "outputs": outputs,
    "targets": targets,
    "label_distribution": label_distribution
}
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 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
target2onehot Ran
ran; our contract draft was wrong, not the code
sun-hailong/aaai25-mos/utils/toolkit.py
pointer only (licence: NONE); the stored copy get_code serves, from liangzu/loranpac, is pointer only (licence: NONE) · get_code("284e2e0345abe291")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, sun-hailong/aaai25-mos 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.

tensor2numpy Ran
ran, honoured the contract we drafted
sun-hailong/aaai25-mos/utils/toolkit.py
pointer only (licence: NONE); the stored copy get_code serves, from wangkiw/iclr23-memo, is pointer only (licence: NONE) · get_code("929c76a2fa2e8c42")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, sun-hailong/aaai25-mos 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.

accimage_loader Not yet run
unverified (harvested, no recorded run)
sun-hailong/aaai25-mos/utils/data_manager.py
pointer only (licence: NONE) · get_code("cf462ad7948ff43b")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, sun-hailong/aaai25-mos 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. No invocation recorded.

resnet18 Not yet run
unverified (harvested, no recorded run)
sun-hailong/lamda-pilot/backbone/resnet.py
code served (permissive licence) · get_code("1b21828124579725")
How it ran

no invocation recorded.

vit_base_patch16_224_in21k_mos Not yet run
unverified (harvested, no recorded run)
sun-hailong/aaai25-mos/backbone/vit_mos.py
pointer only (licence: NONE) · get_code("b29b6be35c316663")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, sun-hailong/aaai25-mos 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. No invocation recorded.

vit_base_patch16_224_mos Not yet run
unverified (harvested, no recorded run)
sun-hailong/aaai25-mos/backbone/vit_mos.py
pointer only (licence: NONE) · get_code("2dc78c999d4d5662")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, sun-hailong/aaai25-mos 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. No invocation recorded.

Also present in other papers' code

Of 17 samples lifted from this paper's linked repositories, 17 carry a function identity and 0 do not. Of the 17 distinct functions with an identity, 14 are also present in other papers whose code we hold (14 with at least one paper dated earlier, 4 the same month, 10 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
conv1x1 431 other papers
389 dated earlier, 1 the same month, 30 later, 10 same year, order not determinable, 1 undated · 38 only as an assembly brick
1409.1556 (2014-09)
Very Deep Convolutional Networks for Large-Scale Image Recognition
1506.01186 (2015-06)
Cyclical Learning Rates for Training Neural Networks
1507.05717 (2015-07)
An End-to-End Trainable Neural Network for Image-based Sequence Recognition and Its Application to Scene Text Recognition
and 428 more not named here
conv3x3 312 other papers
278 dated earlier, 1 the same month, 22 later, 10 same year, order not determinable, 1 undated · 31 only as an assembly brick
1409.1556 (2014-09)
Very Deep Convolutional Networks for Large-Scale Image Recognition
1507.05717 (2015-07)
An End-to-End Trainable Neural Network for Image-based Sequence Recognition and Its Application to Scene Text Recognition
1512.03385 (2015-12)
Deep Residual Learning for Image Recognition
and 309 more not named here
resnet18 95 other papers
80 dated earlier, 1 the same month, 10 later, 3 same year, order not determinable, 1 undated
1805.00907 (2018-05)
Glow: Graph Lowering Compiler Techniques for Neural Networks
1902.08153 (2019-02)
Learned Step Size Quantization
1904.01355 (2019-04)
FCOS: Fully Convolutional One-Stage Object Detection
and 92 more not named here
pil_loader 66 other papers
56 dated earlier, 2 the same month, 6 later, 2 same year, order not determinable
1502.03044 (2015-02)
Show, Attend and Tell: Neural Image Caption Generation with Visual Attention
1710.10196 (2017-10)
Progressive Growing of GANs for Improved Quality, Stability, and Variation
1711.02512 (2017-11)
Fine-tuning CNN Image Retrieval with No Human Annotation
and 63 more not named here
accimage_loader 39 other papers
32 dated earlier, 5 later, 2 same year, order not determinable
1702.00758 (2017-02)
HashNet: Deep Learning to Hash by Continuation
1711.02512 (2017-11)
Fine-tuning CNN Image Retrieval with No Human Annotation
1805.00907 (2018-05)
Glow: Graph Lowering Compiler Techniques for Neural Networks
and 36 more not named here
default_loader 28 other papers
23 dated earlier, 3 later, 2 same year, order not determinable
1907.02665 (2019-07)
Blind Image Quality Assessment Using A Deep Bilinear Convolutional Neural Network
2003.05033 (2020-03)
Generalized Energy Based Models
2003.13659 (2020-03)
Exploiting Deep Generative Prior for Versatile Image Restoration and Manipulation
and 25 more not named here
tensor2numpy 15 other papers
12 dated earlier, 3 later · 9 only as an assembly brick
2204.04662 (2022-04)
FOSTER: Feature Boosting and Compression for Class-Incremental Learning
2205.13218 (2022-05)
A Model or 603 Exemplars: Towards Memory-Efficient Class-Incremental Learning
aaai_26216 (2023 (year only))
Isolation and Impartial Aggregation: A Paradigm of Incremental Learning without Interference
and 12 more not named here
count_parameters 8 other papers
7 dated earlier, 1 later · 2 only as an assembly brick
2204.04662 (2022-04)
FOSTER: Feature Boosting and Compression for Class-Incremental Learning
2205.13218 (2022-05)
A Model or 603 Exemplars: Towards Memory-Efficient Class-Incremental Learning
aaai_26216 (2023 (year only))
Isolation and Impartial Aggregation: A Paradigm of Incremental Learning without Interference
and 5 more not named here
target2onehot 8 other papers
6 dated earlier, 2 later · 1 only as an assembly brick
aaai_26216 (2023 (year only))
Isolation and Impartial Aggregation: A Paradigm of Incremental Learning without Interference
2307.02251 (2023-07)
RanPAC: Random Projections and Pre-trained Models for Continual Learning
2307.12045 (2023-07)
Revisiting Distillation for Continual Learning on Visual Question Localized-Answering in Robotic Surgery
and 5 more not named here
reduce_proxies 7 other papers
6 dated earlier, 1 later · 1 only as an assembly brick
2307.12045 (2023-07)
Revisiting Distillation for Continual Learning on Visual Question Localized-Answering in Robotic Surgery
2403.12030 (2024-03)
Expandable Subspace Ensemble for Pre-Trained Model-Based Class-Incremental Learning
2404.06622 (2024-04)
Calibrating Higher-Order Statistics for Few-Shot Class-Incremental Learning with Pre-trained Vision Transformers
and 4 more not named here
build_transform 2 other papers
2 dated earlier
2404.06622 (2024-04)
Calibrating Higher-Order Statistics for Few-Shot Class-Incremental Learning with Pre-trained Vision Transformers
2409.07446 (2024-09)
Adaptive Adapter Routing for Long-Tailed Class-Incremental Learning
interpolate_weights 2 other papers
2 dated earlier
2312.08977 (2023-12)
Weighted Ensemble Models Are Strong Continual Learners
2401.16386 (2024-01)
Continual Learning with Pre-Trained Models: A Survey
build_transform_coda_prompt 1 other paper
1 dated earlier
2409.07446 (2024-09)
Adaptive Adapter Routing for Long-Tailed Class-Incremental Learning
regularized_cn 1 other paper
1 dated earlier
2401.16386 (2024-01)
Continual Learning with Pre-Trained Models: A Survey

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

Class-Incremental Learning (CIL) requires models to continually acquire knowledge of new classes without forgetting old ones. Despite Pre-trained Models (PTMs) have shown excellent performance in CIL, catastrophic forgetting still occurs as the model learns new concepts. Existing work seeks to utilize lightweight components to adjust the PTM, while the forgetting phenomenon still comes from {\em parameter and retrieval} levels. Specifically, iterative updates of the model result in parameter drift, while mistakenly retrieving irrelevant modules leads to the mismatch during inference. To this end, we propose MOdel Surgery (MOS) to rescue the model from forgetting previous knowledge. By training task-specific adapters, we continually adjust the PTM to downstream tasks. To mitigate parameter-level forgetting, we present an adapter merging approach to learn task-specific adapters, which aims to bridge the gap between different components while reserve task-specific information. Besides, to address retrieval-level forgetting, we introduce a training-free self-refined adapter retrieval mechanism during inference, which leverages the model's inherent ability for better adapter retrieval. By jointly rectifying the model with those steps, MOS can robustly resist catastrophic forgetting in the learning process. Extensive experiments on seven benchmark datasets validate MOS's state-of-the-art performance. Code is available at: https://github.com/sun-hailong/AAAI25-MOS

For agents

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

get_harvested_code_for_paper("2412.09441")
get_code_for_paper("2412.09441")
have("2412.09441")

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

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

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

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

Connect an agent — have() is free.