SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2205.09357 · 2022

Continual Pre-Training Mitigates Forgetting in Language and Vision

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, 0 violated it and 6 have no contract verdict; 0 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/2205.09357.json · badge: /api/ran/2205.09357.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
andreacossu/continual-pretraining-nlp-vision canonical (classifier label)
classifier basis not recorded on the link
6 ran · 1 no recorded run
FunctionStatusWhere it lives
add_colorbar Ran
ran on a synthesized input
andreacossu/continual-pretraining-nlp-vision/cka.py
code served (permissive licence) · get_code("4f1b09f46b03c233")
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 Colorbar. 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
import matplotlib.pyplot as plt
from matplotlib import image as mimage
from mpl_toolkits import axes_grid1

# Create a figure and axis
fig, ax = plt.subplots()

# Create a simple image data
image_data = np.random.rand(4, 3)

# Display the image on the axis
im = ax.imshow(image_data)

# Define ARGS dict with all parameters
ARGS = {
    'im': im,
    'aspect': 10,
    'pad_fraction': 0.5,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
matplotlib, mpl_toolkits, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Colorbar — a Colorbar output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Colorbar 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
create_tokenizer_cl Ran
ran on a synthesized input
andreacossu/continual-pretraining-nlp-vision/utils.py
code served (permissive licence) · get_code("2ed8cd5f08e8e626")
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 Mock. 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 os
import torch
from unittest.mock import Mock, MagicMock
from transformers import AutoTokenizer

torch.manual_seed(0)

# Mock the AutoTokenizer.from_pretrained to avoid network calls
original_from_pretrained = AutoTokenizer.from_pretrained

def mock_from_pretrained(tokenizer_name, cache_dir=None):
    """Create a minimal mock tokenizer with required methods"""
    tokenizer = Mock()
    tokenizer.add_tokens = MagicMock(return_value=5)  # Return number of added tokens
    return tokenizer

# Patch AutoTokenizer
AutoTokenizer.from_pretrained = mock_from_pretrained

ARGS = {
    'tokenizer_name': 'bert-base-uncased',
    'exp_id': 2,
    'add_tokens': True
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Mock — a Mock 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
mean_pooling Ran
ran on a synthesized input
andreacossu/continual-pretraining-nlp-vision/senteval.py
code served (permissive licence) · get_code("249e014939153c23")
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 (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

torch.manual_seed(0)

# Create model_output: a 3D tensor of shape (batch_size, sequence_length, embedding_dim)
# batch_size=2, sequence_length=3, embedding_dim=4
model_output = torch.randn(2, 3, 4)

# Create attention_mask: a 2D tensor of shape (batch_size, sequence_length)
# batch_size=2, sequence_length=3
attention_mask = torch.ones(2, 3)

ARGS = {
    "model_output": model_output,
    "attention_mask": attention_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 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: none by the harness; any seed is in the setup block
mycollate Ran
ran on a synthesized input
andreacossu/continual-pretraining-nlp-vision/continual-pretraining-cv-unsupervised.py
code served (permissive licence) · get_code("5a1f7cf9990b1ac9")
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 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 expects a batch parameter which is a list of tuples
# Each tuple contains: (x_element, label_int, tid_int)
# x_element can be any type (it goes into a list)
# label and tid are converted to tensors, so they should be integers

batch = [
    ("sample_0", 0, 5),
    ("sample_1", 1, 7),
]

ARGS = {
    "batch": batch
}
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 2, 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
mycollate_mbatches Ran
ran on a synthesized input
andreacossu/continual-pretraining-nlp-vision/continual-pretraining-cv-unsupervised.py
code served (permissive licence) · get_code("c7fe1178d14f6de8")
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

torch.manual_seed(0)

# The function expects mbatches, which is a list of batches
# Each batch is a list/tuple where:
# - batch[0] is a list of elements (concatenated with +=)
# - batch[i] for i > 0 are tensors (concatenated with torch.cat on dim=0)

# Create a simple mini-batch structure
# mbatches is a list of 2 batches, each batch has 3 elements
batch1 = [
    ["item1", "item2"],  # batch[0]: list of items
    torch.randn(2, 4),   # batch[1]: tensor with batch_size=2, feature_dim=4
    torch.randn(2, 3),   # batch[2]: tensor with batch_size=2, feature_dim=3
]

batch2 = [
    ["item3", "item4"],  # batch[0]: list of items
    torch.randn(2, 4),   # batch[1]: tensor with batch_size=2, feature_dim=4
    torch.randn(2, 3),   # batch[2]: tensor with batch_size=2, feature_dim=3
]

mbatches = [batch1, batch2]

ARGS = {
    "mbatches": mbatches
}
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
remap_classes Ran
ran on a synthesized input
andreacossu/continual-pretraining-nlp-vision/utils.py
code served (permissive licence) · get_code("c734372fb6ca5cba")
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

filtered_classes = [53, 120, 65, 35, 37, 17, 49, 109, 97, 108]

def remap_classes(example):
    example['primary_cat'] = filtered_classes.index(example['primary_cat'])
    return example

example = {
    'primary_cat': 120,
    'other_field': 'some_value'
}

ARGS = {
    'example': example
}
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 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
create_tokenizer Not yet run
unverified (harvested, no recorded run)
andreacossu/continual-pretraining-nlp-vision/utils.py
code served (permissive licence) · get_code("219b7aaf978adc4f")
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, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 0 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
add_colorbar 1 other paper
1 dated earlier
2108.08810 (2021-08)
Do Vision Transformers See Like Convolutional Neural Networks?

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

Pre-trained models are nowadays a fundamental component of machine learning research. In continual learning, they are commonly used to initialize the model before training on the stream of non-stationary data. However, pre-training is rarely applied during continual learning. We formalize and investigate the characteristics of the continual pre-training scenario in both language and vision environments, where a model is continually pre-trained on a stream of incoming data and only later fine-tuned to different downstream tasks. We show that continually pre-trained models are robust against catastrophic forgetting and we provide strong empirical evidence supporting the fact that self-supervised pre-training is more effective in retaining previous knowledge than supervised protocols. Code is provided at https://github.com/AndreaCossu/continual-pretraining-nlp-vision .

For agents

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

get_harvested_code_for_paper("2205.09357")
get_code_for_paper("2205.09357")
have("2205.09357")

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

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

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

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

Connect an agent — have() is free.