SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2410.20444 · NeurIPS · 2024

Vector Quantization Prompting for Continual Learning

Yu Li, Li Jiao, Qiuxia Lai, Qiang Xu

arXiv · PDF · Open in the Atlas

Code that ran

7 of 15 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; 6 failures of our instrument; 8 no recorded run), measured 2026-11-23; 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/2410.20444.json · badge: /api/ran/2410.20444.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
jiaolifengmi/VQ-Prompt canonical (classifier label)
classifier basis: census
6 ran · 3 no recorded run
jiaolifengmi/vq-prompt canonical (classifier label)
classifier basis: classifier_2025
1 ran · 5 no recorded run
FunctionStatusWhere it lives
build_cifar_transform Ran
ran; our contract draft was wrong, not the code
jiaolifengmi/VQ-Prompt/dataloaders/utils.py
code served (permissive licence) · get_code("f83acd2eda10d232")
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 Compose. 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
from torchvision import transforms

torch.manual_seed(0)

ARGS = {
    "is_train": True,
    "input_size": 224,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Compose — a Compose output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Compose 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
build_transform Ran
ran; our contract draft was wrong, not the code
jiaolifengmi/VQ-Prompt/dataloaders/utils.py
code served (permissive licence) · get_code("aa97aea5d1c8ffb8")
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 Compose. 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
from torchvision import transforms

torch.manual_seed(0)

ARGS = {
    "is_train": True,
    "input_size": 224
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Compose — a Compose output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Compose 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
get_transform Ran
ran; our contract draft was wrong, not the code
jiaolifengmi/VQ-Prompt/dataloaders/utils.py
code served (permissive licence) · get_code("b682650616ae4f66")
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 Compose. 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
from torchvision import transforms

torch.manual_seed(0)

ARGS = {
    'dataset': 'CIFAR100',
    'phase': 'test',
    'aug': True,
    'resize_imnet': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Compose — a Compose output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Compose 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
interpolate_pos_embed Ran
ran; our contract draft was wrong, not the code
jiaolifengmi/vq-prompt/models/vit.py
code served (permissive licence) · get_code("c6ec173f19f5c34d")
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 Tensor, ndim 3, dtype family float, shape (1, 17, 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

torch.manual_seed(0)

class PatchEmbed(nn.Module):
    def __init__(self, num_patches):
        super().__init__()
        self.num_patches = num_patches

class VisualEncoder(nn.Module):
    def __init__(self, num_patches, pos_embed_shape):
        super().__init__()
        self.patch_embed = PatchEmbed(num_patches)
        self.pos_embed = torch.randn(pos_embed_shape)

# Create a visual encoder with 16 patches (4x4 grid)
# pos_embed shape: (1, num_patches + num_extra_tokens, embedding_dim)
num_patches = 16
num_extra_tokens = 1
embedding_size = 4
visual_encoder = VisualEncoder(
    num_patches=num_patches,
    pos_embed_shape=(1, num_patches + num_extra_tokens, embedding_size)
)

# Create pos_embed_checkpoint with original size 2x2 (4 patches) + 1 extra token
# This will trigger interpolation from 2x2 to 4x4
orig_size = 2
orig_num_patches = orig_size * orig_size
pos_embed_checkpoint = torch.randn(1, orig_num_patches + num_extra_tokens, embedding_size)

ARGS = {
    "pos_embed_checkpoint": pos_embed_checkpoint,
    "visual_encoder": visual_encoder,
}
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 Tensor, ndim 3, dtype family float, shape (1, 17, 4) — shape (1, 17, 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
ortho_penalty Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
jiaolifengmi/VQ-Prompt/models/zoo.py
code served (permissive licence) · get_code("a763dc6f8d5d1498")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned Tensor, ndim 0, dtype family float; no output shape is stated. 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 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 2D tensor t and computes t @ t.T
# We need a small 2D tensor
# Using shape (4, 3) to make it non-square and distinct dimensions
t = torch.randn(4, 3)

ARGS = {
    't': t
}
Setup block drafted by
a language model, Claude Sonnet 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 Tensor, ndim 0, dtype family float — no output shape is stated: observe_signature.py could not observe it (call:AssertionError)
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
parse_txt Ran
ran; our contract draft was wrong, not the code
jiaolifengmi/VQ-Prompt/dataloaders/dataloader.py
code served (permissive licence) · get_code("cdf0934ebf6a93cd")
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 tempfile
import os

# Create a temporary text file with the expected format
temp_dir = tempfile.mkdtemp()
txt_file = os.path.join(temp_dir, "test.txt")

# Write test data in the format: "index content"
with open(txt_file, 'w') as f:
    f.write("0 hello\n")
    f.write("1 world\n")
    f.write("2 test\n")

ARGS = {
    "txt_file": txt_file
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — 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
tensor_prompt Ran
ran, honoured the contract we drafted
jiaolifengmi/VQ-Prompt/models/zoo.py
code served (permissive licence) · get_code("3f33843b601c8d4d")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned Parameter, ndim 2, dtype family float, shape (3, 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

torch.manual_seed(0)

# The function creates a parameter tensor with dimensions (a, b) or (a, b, c)
# and initializes it either orthogonally or uniformly

# Test case 1: 2D tensor without orthogonal initialization
a_val = 3
b_val = 4
c_val = None
ortho_val = False

ARGS = {
    'a': a_val,
    'b': b_val,
    'c': c_val,
    'ortho': ortho_val
}
Setup block drafted by
a language model, Claude Sonnet 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 Parameter, ndim 2, dtype family float, shape (3, 4) — shape (3, 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
CosineSchedulerIter Not yet run
unverified (harvested, no recorded run)
jiaolifengmi/vq-prompt/learners/prompt.py
code served (permissive licence) · get_code("fe7f9a1f5cd3c429")
How it ran

no invocation recorded.

NormalNN Not yet run
unverified (harvested, no recorded run)
jiaolifengmi/vq-prompt/learners/prompt.py
code served (permissive licence) · get_code("a447093382d3a413")
How it ran

no invocation recorded.

Prompt Not yet run
unverified (harvested, no recorded run)
jiaolifengmi/vq-prompt/learners/prompt.py
code served (permissive licence) · get_code("677d8160bcc4ebc6")
How it ran

no invocation recorded.

VQPrompt Not yet run
unverified (harvested, no recorded run)
jiaolifengmi/vq-prompt/learners/prompt.py
code served (permissive licence) · get_code("6ffe4ffedcac064a")
How it ran

no invocation recorded.

_LRSchedulerIter Not yet run
unverified (harvested, no recorded run)
jiaolifengmi/vq-prompt/learners/prompt.py
code served (permissive licence) · get_code("23f35d8ff6184ceb")
How it ran

no invocation recorded.

accuracy Not yet run
unverified (harvested, no recorded run)
jiaolifengmi/VQ-Prompt/utils/metric.py
code served (permissive licence) · get_code("0c4bbcb160a04955")
How it ran

no invocation recorded.

calc_forgetting Not yet run
unverified (harvested, no recorded run)
jiaolifengmi/VQ-Prompt/utils/calc_forgetting.py
code served (permissive licence) · get_code("4e39da6c733f9f2c")
How it ran

no invocation recorded.

jpg_image_to_array Not yet run
unverified (harvested, no recorded run)
jiaolifengmi/VQ-Prompt/dataloaders/dataloader.py
pointer only (licence: MIT); the stored copy get_code serves, from zhoujiahuan1991/NeurIPS2025-C2Prompt, is pointer only (licence: NONE) · get_code("e1da3ea75e559fb9")
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 zhoujiahuan1991/NeurIPS2025-C2Prompt, 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. No invocation recorded.

Also present in other papers' code

Of 15 samples lifted from this paper's linked repositories, 15 carry a function identity and 0 do not. Of the 15 distinct functions with an identity, 6 are also present in other papers whose code we hold (5 with at least one paper dated earlier, 0 the same month, 3 later) and 9 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
interpolate_pos_embed 52 other papers
43 dated earlier, 7 later, 2 same year, order not determinable
1905.12794 (2019-05)
Fashion IQ: A New Dataset Towards Retrieving Images by Natural Language Feedback
2111.09452 (2021-11)
Open Vocabulary Object Detection with Pseudo Bounding-Box Labels
2205.11169 (2022-05)
PEVL: Position-enhanced Pre-training and Prompt Tuning for Vision-language Models
and 49 more not named here
tensor_prompt 6 other papers
3 dated earlier, 3 later · 1 only as an assembly brick
2211.13218 (2022-11)
CODA-Prompt: COntinual Decomposed Attention-based Prompting for Rehearsal-Free Continual Learning
2402.04129 (2024-02)
OVOR: OnePrompt with Virtual Outlier Regularization for Rehearsal-Free Class-Incremental Learning
2403.08568 (2024-03)
Consistent Prompting for Rehearsal-Free Continual Learning
and 3 more not named here
accuracy
brick of this paper's assembly: helper
2 other papers
2 dated earlier · 1 only as an assembly brick
2002.06774 (2020-02)
Residual Continual Learning
2106.09701 (2021-06)
Always Be Dreaming: A New Approach for Data-Free Class-Incremental Learning
ortho_penalty 2 other papers
2 dated earlier
2211.13218 (2022-11)
CODA-Prompt: COntinual Decomposed Attention-based Prompting for Rehearsal-Free Continual Learning
2402.04129 (2024-02)
OVOR: OnePrompt with Virtual Outlier Regularization for Rehearsal-Free Class-Incremental Learning
build_transform 1 other paper
1 dated earlier
2407.00113 (2024-07)
Personalized Federated Continual Learning via Multi-granularity Prompt
jpg_image_to_array 1 other paper
1 later
2509.19674 (2025-09)
C²Prompt: Class-aware Client Knowledge Interaction for Federated Continual 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-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Continual learning requires to overcome catastrophic forgetting when training a single model on a sequence of tasks. Recent top-performing approaches are promptbased methods that utilize a set of learnable parameters (i.e., prompts) to encode task knowledge, from which appropriate ones are selected to guide the fixed pretrained model in generating features tailored to a certain task. However, existing methods rely on predicting prompt identities for prompt selection, where the identity prediction process cannot be optimized with task loss. This limitation leads to sub-optimal prompt selection and inadequate adaptation of pre-trained features for a specific task. Previous efforts have tried to address this by directly generating prompts from input queries instead of selecting from a set of candidates. However, these prompts are continuous, which lack sufficient abstraction for task knowledge representation, making them less effective for continual learning. To address these challenges, we propose VQ-Prompt, a prompt-based continual learning method that incorporates Vector Quantization (VQ) into end-to-end training of a set of discrete prompts. In this way, VQ-Prompt can optimize the prompt selection process with task loss and meanwhile achieve effective abstraction of task knowledge for continual learning. Extensive experiments show that VQ-Prompt outperforms state-of-the-art continual learning methods across a variety of benchmarks under the challenging class-incremental setting. The code is available at https://github.com/jiaolifengmi/VQ-Prompt.

For agents

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

get_harvested_code_for_paper("2410.20444")
get_code_for_paper("2410.20444")
have("2410.20444")

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

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

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

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

Connect an agent — have() is free.