SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2109.11797 · 2021

CPT: Colorful Prompt Tuning for Pre-trained Vision-Language Models

arXiv · PDF · Open in the Atlas

Code that ran

12 of 13 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 9 have no contract verdict; 3 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/2109.11797.json · badge: /api/ran/2109.11797.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
thunlp/cpt canonical (classifier label)
classifier basis: census
12 ran · 1 no recorded run
FunctionStatusWhere it lives
compute_score_with_logits Ran
ran; our contract draft was wrong, not the code
thunlp/cpt/Oscar/oscar/fewshot/gqa_cpt.py
code served (permissive licence) · get_code("89bdd6decba2b415")
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. 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 torch
import torch.nn as nn

torch.manual_seed(0)

# The function expects:
# 1. logits: a tensor that can be passed to torch.max(logits, 1) - needs shape (batch_size, num_classes)
# 2. labels: a tensor that has .size() method and supports scatter_ operations - needs same shape as logits for element-wise multiplication

batch_size = 2
num_classes = 4

# Create logits tensor with shape (batch_size, num_classes)
logits = torch.randn(batch_size, num_classes)

# Create labels tensor with shape (batch_size, num_classes)
# This should be one-hot encoded or binary labels for the scores computation to make sense
labels = torch.zeros(batch_size, num_classes)
labels[0, 1] = 1
labels[1, 3] = 1

ARGS = {
    "logits": logits,
    "labels": labels
}
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
get_evaluate_file Ran
ran on a synthesized input
thunlp/cpt/Oscar/oscar/fewshot/refcoco_cpt.py
code served (permissive licence) · get_code("01da88ba6172509e")
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 str. 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.path as op

def get_evaluate_file(predict_file):
    assert predict_file.endswith('.tsv')
    fpath = op.splitext(predict_file)[0]
    return fpath + '.eval.json'

ARGS = {
    'predict_file': 'predictions.tsv'
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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_evaluate_method Ran
ran on a synthesized input
thunlp/cpt/Oscar/oscar/fewshot/refcoco_cpt.py
code served (permissive licence) · get_code("e040a3d039f5af10")
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 str. 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.path as op
import tempfile

# Create temporary file paths with 'nocaps' and 'coco' in their names
temp_dir = tempfile.gettempdir()

nocaps_predict_file = op.join(temp_dir, "predictions_nocaps.json")
coco_predict_file = op.join(temp_dir, "predictions_coco.json")

# Test with nocaps file
ARGS = {
    'predict_file': nocaps_predict_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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
instance_bce_with_logits Ran
ran; our contract draft was wrong, not the code
thunlp/cpt/Oscar/oscar/fewshot/gqa_cpt.py
pointer only (licence: MIT); the stored copy get_code serves, from linweizhedragon/retrieval-augmented-visual-question-answering, is pointer only (licence: GPL-3.0) · get_code("e36ec4e0a52c6a4b")
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 linweizhedragon/retrieval-augmented-visual-question-answering, and GPL-3.0, as GitHub detects it on that repository, is not in the permissive set Syntology serves inline. 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.

template1 Ran
ran on a synthesized input
thunlp/cpt/Oscar/oscar/datasets/refcoco_zsl_cpt_dataset.py
code served (permissive licence) · get_code("d48bb07bc01dfdb7")
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 str. 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)

# Analyzing the function:
# - caption: used with string concatenation (+), so it should be a string
# - posi_tokens: passed but not used in the function body, could be any type
#   but based on naming convention likely tokens/indices, use a small tensor or list

caption = "A dog"
posi_tokens = torch.tensor([1, 2, 3, 4], dtype=torch.long)

ARGS = {
    "caption": caption,
    "posi_tokens": posi_tokens,
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
template2 Ran
ran on a synthesized input
thunlp/cpt/Oscar/oscar/datasets/refcoco_zsl_cpt_dataset.py
code served (permissive licence) · get_code("c0fd672552e0160f")
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 str. 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)

# Analyze the function:
# template2(caption, posi_tokens)
# - caption: used with string concatenation (+), so it's a string
# - posi_tokens: not used in the function body, but is a parameter
# The function returns a string

caption = "The object"
posi_tokens = torch.tensor([[1, 0, 1, 0], [0, 1, 0, 1]], dtype=torch.float32)

ARGS = {
    "caption": caption,
    "posi_tokens": posi_tokens
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
template3 Ran
ran on a synthesized input
thunlp/cpt/Oscar/oscar/datasets/refcoco_zsl_cpt_dataset.py
code served (permissive licence) · get_code("39e9626ebfd96e62")
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 str. 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)

# Analyzing the function:
# - caption: used with string concatenation (+), so needs to be a string
# - posi_tokens: not used in the function body, but is a parameter

caption = "The object"
posi_tokens = torch.tensor([[1, 0, 1, 0], [0, 1, 0, 1]])

ARGS = {
    "caption": caption,
    "posi_tokens": posi_tokens
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
tokenize Ran
ran on a synthesized input
thunlp/cpt/Oscar/oscar/datasets/refcoco_fsl_cpt_dataset.py
code served (permissive licence) · get_code("7ab756d02fb91e21")
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. 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)

# Create a minimal tokenizer stand-in class
class MinimalTokenizer:
    def __init__(self):
        self.vocab = {
            '[CLS]': 101,
            '[SEP]': 102,
            '[PAD]': 0,
            'hello': 1000,
            'world': 1001,
            'this': 1002,
            'is': 1003,
            'test': 1004,
            'text': 1005,
        }
    
    def tokenize(self, text):
        """Split text into tokens."""
        return text.lower().split()
    
    def convert_tokens_to_ids(self, tokens):
        """Convert tokens to IDs, using vocab or default to 999."""
        return [self.vocab.get(token, 999) for token in tokens]

# Create tokenizer instance
tokenizer = MinimalTokenizer()

# Create text inputs
text_a = "hello world"
text_b = "this is test"

# Create image features tensor (small, 4 features with 3 dimensions)
img_feat = torch.randn(4, 3)

# Define ARGS dict with all parameters
ARGS = {
    'tokenizer': tokenizer,
    'text_a': text_a,
    'text_b': text_b,
    'img_feat': img_feat,
    'max_img_seq_len': 50,
    'max_seq_a_len': 40,
    'max_seq_len': 70,
    'cls_token_segment_id': 0,
    'pad_token_segment_id': 0,
    'sequence_a_segment_id': 0,
    'sequence_b_segment_id': 1,
}
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 — a tuple 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
tokenize Ran
ran on a synthesized input
thunlp/cpt/Oscar/oscar/datasets/vg_cpt_dataset.py
code served (permissive licence) · get_code("0a1867725d8d31b1")
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. 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)

class MockTokenizer:
    def __init__(self):
        self.vocab = {
            '[CLS]': 101,
            '[SEP]': 102,
            'hello': 7592,
            'world': 2088,
            'this': 2023,
            'is': 2003,
            'a': 1037,
            'test': 3231,
            'sample': 6233,
            'text': 3231,
        }
    
    def tokenize(self, text):
        if text is None:
            return []
        words = text.lower().split()
        tokens = []
        for word in words:
            if word in self.vocab:
                tokens.append(word)
            else:
                tokens.append('[UNK]')
        return tokens
    
    def convert_tokens_to_ids(self, tokens):
        ids = []
        for token in tokens:
            if token in self.vocab:
                ids.append(self.vocab[token])
            else:
                ids.append(100)  # UNK token id
        return ids

tokenizer = MockTokenizer()
text_a = "hello world"
text_b = "this is test"
img_feat = torch.randn(10, 4)  # 10 image features of dimension 4

ARGS = {
    'tokenizer': tokenizer,
    'text_a': text_a,
    'text_b': text_b,
    'img_feat': img_feat,
    'max_img_seq_len': 55,
    'max_seq_a_len': 40,
    'max_seq_len': 70,
    'cls_token_segment_id': 0,
    'pad_token_segment_id': 0,
    'sequence_a_segment_id': 0,
    'sequence_b_segment_id': 1,
}
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 — a tuple 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
trim_batch Ran
ran; our contract draft was wrong, not the code
thunlp/cpt/Oscar/oscar/fewshot/gqa_cpt.py
pointer only (licence: MIT); the stored copy get_code serves, from linweizhedragon/retrieval-augmented-visual-question-answering, is pointer only (licence: GPL-3.0) · get_code("12516cd21b436092")
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 linweizhedragon/retrieval-augmented-visual-question-answering, and GPL-3.0, as GitHub detects it on that repository, is not in the permissive set Syntology serves inline. 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.

vcr_collate_fn Ran
ran on a synthesized input
thunlp/cpt/Oscar/oscar/fewshot/vcr_nsp_cpt.py
code served (permissive licence) · get_code("2e1b1ca48e16a324")
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. 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 a batch where:
# - batch is a list of items
# - each item in batch is itself an iterable (like a tuple) with n_choices elements
# - each choice element can be either a torch.Tensor or something else
# - all tensors at the same position across choices should be stackable

# Create a simple batch structure:
# Each sample has 3 choices (n_choices=3)
# Each choice has 2 elements: (tensor, label)

choice_1_sample_1 = (torch.randn(2, 4), "label_a")
choice_2_sample_1 = (torch.randn(2, 4), "label_b")
choice_3_sample_1 = (torch.randn(2, 4), "label_c")
sample_1 = (choice_1_sample_1, choice_2_sample_1, choice_3_sample_1)

choice_1_sample_2 = (torch.randn(2, 4), "label_x")
choice_2_sample_2 = (torch.randn(2, 4), "label_y")
choice_3_sample_2 = (torch.randn(2, 4), "label_z")
sample_2 = (choice_1_sample_2, choice_2_sample_2, choice_3_sample_2)

batch = [sample_1, sample_2]

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 tuple — a tuple 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
vcr_collate_fn Ran
ran on a synthesized input
thunlp/cpt/Oscar/oscar/fewshot/vcr_qar_nsp_cpt.py
code served (permissive licence) · get_code("ffe4043326409d20")
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. 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)

# Understand the function:
# - raw_batch is a list of tuples (batch_q_a, batch_qa_r)
# - batch_q_a is a list of choices, where each choice is a list of items
# - batch_qa_r is similar
# - Each item can be a torch.Tensor or other type
# - The function flattens and reconstructs batches

# Create sample data matching the expected structure
# For a simple case: 2 samples in raw_batch, each with 4 choices

# Sample 1: (batch_q_a, batch_qa_r)
# batch_q_a: list of 4 choices, each choice has tensors and other data
sample_q_a_1 = [
    [torch.randn(2), torch.randn(3), "text1"],  # choice 0
    [torch.randn(2), torch.randn(3), "text2"],  # choice 1
    [torch.randn(2), torch.randn(3), "text3"],  # choice 2
    [torch.randn(2), torch.randn(3), "text4"],  # choice 3
]

sample_qa_r_1 = [
    [torch.randn(2), torch.randn(3), "reason1"],  # choice 0
    [torch.randn(2), torch.randn(3), "reason2"],  # choice 1
    [torch.randn(2), torch.randn(3), "reason3"],  # choice 2
    [torch.randn(2), torch.randn(3), "reason4"],  # choice 3
]

# Sample 2: similar structure
sample_q_a_2 = [
    [torch.randn(2), torch.randn(3), "text5"],
    [torch.randn(2), torch.randn(3), "text6"],
    [torch.randn(2), torch.randn(3), "text7"],
    [torch.randn(2), torch.randn(3), "text8"],
]

sample_qa_r_2 = [
    [torch.randn(2), torch.randn(3), "reason5"],
    [torch.randn(2), torch.randn(3), "reason6"],
    [torch.randn(2), torch.randn(3), "reason7"],
    [torch.randn(2), torch.randn(3), "reason8"],
]

# Construct raw_batch as list of tuples
raw_batch = [
    (sample_q_a_1, sample_qa_r_1),
    (sample_q_a_2, sample_qa_r_2),
]

ARGS = {
    "raw_batch": raw_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 tuple — a tuple 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
restore_training_settings Not yet run
unverified (harvested, no recorded run)
thunlp/cpt/Oscar/oscar/fewshot/refcoco_cpt.py
code served (permissive licence) · get_code("5ddea353591c2338")
How it ran

no invocation recorded.

Also present in other papers' code

Of 13 samples lifted from this paper's linked repositories, 13 carry a function identity and 0 do not. Of the 13 distinct functions with an identity, 3 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 3 later) and 10 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
compute_score_with_logits 2 other papers
1 dated earlier, 1 later
1912.02315 (2019-12)
12-in-1: Multi-Task Vision and Language Representation Learning
2401.07803 (2024-01)
Uncovering the Full Potential of Visual Grounding Methods in VQA
instance_bce_with_logits 1 other paper
1 later
2309.17133 (2023-09)
Fine-grained Late-interaction Multi-modal Retrieval for Retrieval Augmented Visual Question Answering
trim_batch 1 other paper
1 later
2309.17133 (2023-09)
Fine-grained Late-interaction Multi-modal Retrieval for Retrieval Augmented Visual Question Answering

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 Vision-Language Models (VL-PTMs) have shown promising capabilities in grounding natural language in image data, facilitating a broad variety of cross-modal tasks. However, we note that there exists a significant gap between the objective forms of model pre-training and fine-tuning, resulting in a need for large amounts of labeled data to stimulate the visual grounding capability of VL-PTMs for downstream tasks. To address the challenge, we present Cross-modal Prompt Tuning (CPT, alternatively, Colorful Prompt Tuning), a novel paradigm for tuning VL-PTMs, which reformulates visual grounding into a fill-in-the-blank problem with color-based co-referential markers in image and text, maximally mitigating the gap. In this way, CPT enables strong few-shot and even zero-shot visual grounding capabilities of VL-PTMs. Comprehensive experimental results show that the prompt-tuned VL-PTMs outperform their fine-tuned counterparts by a large margin (e.g., 17.3% absolute accuracy improvement, and 73.8% relative standard deviation reduction on average with one shot in RefCOCO evaluation). We make the data and code for this paper publicly available at https://github.com/thunlp/CPT.

For agents

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

get_harvested_code_for_paper("2109.11797")
get_code_for_paper("2109.11797")
have("2109.11797")

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

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

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

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

Connect an agent — have() is free.