wikillm

Paper · 2023-04-13 · cs.CV

What does CLIP know about a red circle? Visual prompt engineering for VLMs

Drawing a plain red circle around a region, instead of cropping it, steers CLIP to that region. Zero-shot, marked images beat crops on keypoint naming and localisation and reach state-of-the-art referring-expression comprehension on most benchmarks (author-reported, e.g. 63.9% top-1 on RefCOCO+ testA). Circles also raise criminal labels for people.

Visual promptingVision-language pre-trainingZero-shot learningVisual groundingvisual-promptingclipzero-shotreferring-expressionkeypointsbias

arXivPDFMarkdown15 min read

AI-compiled by claude-haiku-5-5 on 2026-11-03, not yet reviewed by a human. Every claim cites its source; check it when a detail matters.

In plain words

CLIP matches pictures with text. People usually steer such a model by changing the words they give it. This paper changes the picture instead. Draw a plain red circle around one object, and CLIP starts to attend to that spot while still seeing the rest of the picture. You can then ask about the circled object, for example by naming it, or pick the circled object that a sentence describes.

The authors compare this with the older trick of cutting out the region and feeding only the crop. A crop throws away the surroundings, and the paper finds the surroundings matter. A circle keeps them, and in the tests on this card it does better. No training is needed; the circle is the only change.

The paper also finds a downside. Circles can push the model toward labels such as "criminal" or "missing person" for the people inside them, so the method must not be used on sensitive data.

TL;DR

  • Drawing a red circle on an image steers CLIP to the circled region without cropping away the context §1 §3.2.
  • Scored zero-shot, circled images beat crops on keypoint naming (CUB 58.2% vs 25.5%, both with Sinkhorn-Knopp) and keypoint localisation (CUB 45.2% vs 21.3%, both with the saliency mask), author-reported tab. 1 tab. 4.
  • Zero-shot referring-expression comprehension reaches state of the art on most benchmarks, e.g. 63.9% top-1 on RefCOCO+ testA tab. 5.
  • The same marking raises the rate at which people are labelled criminal, so it must not be used on sensitive data §4.4 tab. 6.

Problem

CLIP scores how well an image and a text match. It does not map a point in the image to a word, so a region must be encoded in the input somehow §3.1. The standard way is to crop the image around the region. Cropping loses the surrounding context, which the paper argues matters §3.2 §1.

The paper asks whether an edit in pixel space, a fixed visual prompt, can carry location information instead. It contrasts this with visual prompt tuning, where learnable tokens are trained for the task §1, footnote.

Assumptions stated in the paper:

  • The model is a zero-shot CLIP with no task training §3.1.
  • Referring-expression proposals come from MAttNet §4.3.
  • Keypoint localisation uses an unsupervised saliency mask (TokenCut) to drop background locations §3.3.
  • The authors conjecture that CLIP learned the circle from annotated images in its training data. They found about 70 such images among 10k candidates in YFCC15M, which they call rare (about 0.001%) §4.1. This is a hypothesis the paper does not test directly.

Method

Scoring a marked image §3.1 eq. 1

The paper casts zero-shot prediction as question and answer. For a question q and a candidate answer a, the score is computed on engineered inputs: s(q,a|i,t) = s(i_qa, t_qa) eq. 1. For keypoints and referring expressions, the image is marked at candidate a and the text encodes the question q §3.1.

  1. Pick candidate locations a. For each one, make i_a by drawing a red circle at a on the image. The marked image keeps the rest of the image §3.2.
  2. Encode the question as text t_q, for example "an image of" plus a keypoint name §3.3.
  3. Score each pair with s(i_a, t_q) and choose the best location or match §3.1 §3.3.

Marking is the paper's name for overlaying a circle, a box or an arrow at the location. Circles work best in its tests §3.2 §4.1 tab. 2.

Naming keypoints §3.3 eq. 2

Given m keypoint names and m locations, predict the permutation Π that matches each name to one location. The cost of matching name q to location a is C_qa = s(i_a, t_q) §3.3. The paper decodes the cost with optimal transport: the permutation that maximises the sum of Π_qa exp(−τ C_qa) eq. 2. The decoding is solved with the Sinkhorn-Knopp algorithm, which renormalises C §3.3.

Pseudocode
# Match keypoint names to marked locations  [§3.3] [eq. 2]
# Input:  image; names (m strings); locations (m points)
# Output: permutation matrix (m, m)

def match_names(image, names, locations):
    # One marked image per candidate location  [§3.2] [app. Keypoint tasks]
    marked = [red_circle(image, loc) for loc in locations]  # m images
    # Text prompt for each name  [§3.3]
    prompts = ["an image of " + name for name in names]     # m strings
    # Cost C[q, a] = s(i_a, t_q)  [§3.3]
    cost = clip_similarity(marked, prompts)                 # (m, m)
    # Soft assignment: Sinkhorn-Knopp on exp(-tau * C)  [eq. 2] [§3.3]
    plan = sinkhorn(exp(-tau * cost))                       # (m, m)
    # Hard permutation from the soft plan  [not stated in the paper]
    return round_to_permutation(plan)

Localising keypoints §3.3 app. Keypoint tasks

Here the locations are unknown. Candidates are a regular M × M grid, restricted to a salient region from TokenCut §3.3. The keypoint with name q is then the argmax over the remaining candidates of s(i_a, t_q) §3.3. The paper's argmax has no temperature.

Pseudocode
# Localise one named keypoint  [§3.3] [app. Keypoint tasks]
# Input:  image; name (str); saliency (H, W) in {0, 1}
# Output: (row, col) of the best candidate

def localise(image, name, saliency, grid_size=30):
    # Regular grid of M x M candidate locations, M = 30  [app. Keypoint tasks]
    candidates = regular_grid(grid_size)                    # (900, 2)
    # Drop candidates outside the salient region  [§3.3] [app. Keypoint tasks]
    candidates = [c for c in candidates if saliency[c] == 1]
    # Dataset-specific template for the name  [app. Keypoint tasks]
    text = template.format(part=name)
    # Score each candidate by its circled image  [§3.2] [§3.3]
    scores = [clip_score(red_circle(image, c), text) for c in candidates]
    # Best candidate: argmax over a  [§3.3]
    return candidates[argmax(scores)]

Referring-expression comprehension §3.3 eq. 3

Proposals A come from MAttNet §4.3. For each query q, the best proposal is the argmax over a of s(i_a, t_q) minus the mean score of a over the other queries eq. 3. The paper says this subtraction downweights proposals, such as faces, that respond strongly to every query §3.3. The circle variants and the backbone ensemble are in the appendix app. Referring Expressions Detection.

Pseudocode
# Pick the box that matches a referring expression  [§3.3] [eq. 3]
# Input:  image; boxes (N, 4) from MAttNet; query (str)
#         other_queries (Q strings; the paper uses Q = 500)
# Output: index of the chosen box

def comprehend(image, boxes, query, other_queries):
    # Prefix the query with "This is"  [app. Referring Expressions Detection]
    text = "This is " + query
    best_index = None
    best_score = -inf
    for index, box in enumerate(boxes):
        # Three marked views of the box  [app. Referring Expressions Detection]
        views = [red_circle(image, box),
                 red_circle_blur_outside(image, box),
                 red_circle_gray_outside(image, box)]
        # Score the query, minus the mean over the other queries  [eq. 3]
        # How the views and the two backbones are combined is not stated.
        score = clip_score(views, text)
        score = score - mean(clip_score(views, t) for t in other_queries)
        if score > best_score:
            best_score = score
            best_index = index
    return best_index

Hyperparameters

Values as stated in the paper. "Not stated" means the paper does not give the value in the text or appendix checked.

NameValueWhereNotes
marker shape (keypoints)circle, red, no fill§3.2 app. Keypoint tasksarrow, square and cross were tested and scored lower tab. 2
marker radius, keypointsr = 0.06 H, H = shorter image sideapp. Keypoint tasks20 px at H = 336
marker thickness, keypointst = 0.01 Happ. Keypoint tasks3 px at H = 336
marker size, best in appendix sweepradius 12 px, thickness 4 pxapp. Keypoint tasksCUB, text-to-image; see Pitfalls
marker size unit, referring expressions0.5% of the larger image sideapp. Referring Expressions Detection"thin" circle; size 1 is best in the sweep
keypoint backboneCLIP ViT-L/14@336px§4.1 app. Keypoint tasksbest of the backbones tested tab. 3
naming text prompt"an image of" + keypoint name§3.3
localisation text template, CUB"This is the {part} of a bird"app. Keypoint tasks
localisation text template, SPair71k"This image shows the {part} of the {animal}"app. Keypoint tasks
localisation gridM = 30, so 900 candidates before the maskapp. Keypoint tasks
saliency maskunsupervised TokenCut§3.3 §4.2
temperature τ (eq. 2)1/150app. Keypoint tasksstated in the localisation paragraph; see Pitfalls
Sinkhorn-Knopp iterationsnot stated§3.3
PCK threshold α0.1, with δ = α · max(H, W)§4.2H, W = bounding-box size
referring-expression backbonesensemble of RN50×16 and ViT-L/14@336px§4.3 app. Referring Expressions Detectionchosen as best ensemble
referring-expression proposalsMAttNet boxes§4.3
query prefix"This is"app. Referring Expressions Detection
mean subtraction, Q500 randomly sampled expressionsapp. Referring Expressions Detectionsampling pool not stated
marked views per boxred circle; + blur outside; + grey outsideapp. Referring Expressions Detectionthe three are ensembled
success criterionIoU > 0.5 with the ground-truth box§4.3
bias sample, faces1000 random FaceSynthetics faces§4.4
bias sample, people1352 COCO val person crops, box area ≥ 10% of image§4.4

Results

Author-reported. Setup for keypoints: CUB-200-2011 and SPair71k, with names added by the authors to SPair71k §4.1 app. Datasets. Setup for referring expressions: RefCOCO, RefCOCO+, RefCOCOg, MAttNet proposals §4.3. Zero-shot comparisons, with the supervised Pseudo-Q row marked as not zero-shot.

Naming keypoints, % correct tab. 1. Name-to-keypoint (left) and keypoint-to-name (right). SK = Sinkhorn-Knopp normalisation.

MethodCUBBirdCatDogHorseSheepCow
Random8.216.815.010.59.415.111.9
Crop w/o SK15.828.528.528.520.126.129.7
Crop w/ SK25.535.137.534.623.932.936.3
Red Circle w/o SK46.554.853.151.640.147.445.2
Red Circle w/ SK58.267.660.159.353.156.752.8
Method (keypoint-to-name)CUBBirdCatDogHorseSheepCow
Random8.216.815.010.59.415.111.9
Crop w/o SK18.722.419.124.014.927.325.1
Crop w/ SK25.836.132.532.719.835.332.5
Red Circle w/o SK29.526.824.936.918.831.828.9
Red Circle w/ SK56.567.254.459.749.856.653.0

The paper reports that red circles about double the crop baseline on naming §4.1.

Marker shape and colour, CUB naming tab. 2. Mean ± std over sizes, with the best value. The table caption describes these columns differently from the rows; see Pitfalls.

Marker shapeMeanBest
Circle33.5 ± 4.546.5
Arrow28.3 ± 3.136.3
Square24.1 ± 3.636.3
Cross21.5 ± 6.334.5
Circle colourMeanBest
Red36.4 ± 5.146.5
Green34.3 ± 4.243.3
Purple34.0 ± 3.741.9
Blue32.7 ± 3.941.1
Yellow32.4 ± 4.040.8

Backbones for naming tab. 3. Name-to-keypoint and keypoint-to-name, % correct, with the appendix sample sizes. ★ = evaluated at 336 × 336 input.

MethodBackboneDataParamsN→K CUBN→K SPairK→N CUBK→N SPair
CLIPViT-B/32400M87M19.126.719.125.6
CLIPViT-B/16400M86M22.234.022.133.6
CLIPRN50×16400M167M30.641.029.740.0
CLIPViT-L/14400M304M47.954.348.051.2
CLIPViT-L/14★400M304M58.258.356.556.8
OpenCLIPViT-B/322B87M19.427.520.727.2
OpenCLIPViT-L/142B304M33.942.433.341.5
OpenCLIPViT-H/142B632M45.053.742.850.5
OpenCLIPViT-g/142B1.01B44.247.242.543.6
OpenCLIPViT-G/142B1.84B50.452.548.948.6
SLIPViT-S/1615M22M13.017.812.016.7
SLIPViT-B/1615M86M17.316.516.717.1
SLIPViT-L/1615M303M24.626.324.125.0
CLIP†ViT-S/1615M22M11.416.512.415.8
CLIP†ViT-B/1615M86M14.018.414.817.8
CLIP†ViT-L/1615M303M15.020.515.820.4
FILIP‡ViT-B/3215M90M8.915.68.715.6
DeFILIPViT-B/3215M90M12.519.512.519.4
CLIP‡ViT-B/3215M90M10.614.111.014.3
DeCLIPViT-B/3215M90M15.819.915.818.7
DeCLIPViT-B/3288M90M19.423.619.722.3

Data: 400M = WIT-400M, 2B = LAION-2B, 15M = YFCC-15M, 88M = DeCLIP-88M. †, ‡: the authors evaluated the models trained by the cited SLIP and DeCLIP papers tab. 3 caption. The paper says marking gains grow with pretraining set and encoder size, and that LAION-2B pretraining gives worse results than WIT-400M, which it attributes to filtering §4.1 fig. 6.

Keypoint localisation, PCK (α = 0.1) tab. 4. "Mask" = saliency mask.

MethodMaskCUBBirdCatDogHorseSheepCow
Random✗1.13.11.83.63.03.03.4
Random✓8.36.74.74.65.53.34.3
Crop✗16.925.527.322.616.120.022.7
Crop✓21.328.428.821.916.023.424.5
Red Circle✗32.350.752.755.938.342.438.0
Red Circle✓45.253.454.556.440.943.242.2

Referring expressions, top-1 accuracy % tab. 5. ZS = zero-shot.

MethodZSRefCOCO valtestAtestBRefCOCO+ valtestAtestBRefCOCOg valtest
DTWREG✗39.241.137.739.240.138.1––
Pseudo-Q✗56.058.354.138.945.132.146.347.4
CPT✓32.236.130.331.935.228.836.736.5
ReCLIP† (crop baseline)✓42.043.539.047.450.143.957.857.2
ReCLIP‡ (+ relations)✓45.846.147.147.950.145.159.359.0
Red Circle✓49.858.639.955.363.945.459.458.9

The paper says red circles beat the other zero-shot methods on most columns, including ReCLIP‡, which adds hand-written relation rules. ReCLIP‡ is better on RefCOCO testB and RefCOCOg test tab. 5 §4.3.

Referring-expression backbones, Red Circle rows only app. Referring Expressions Detection. The full table, including ReCLIP's rows, is in the paper.

BackboneRefCOCO valtestAtestBRefCOCO+ valtestAtestBRefCOCOg valtest
RN50×1645.5252.9938.5949.9857.5542.1153.9454.35
ViT-B/3238.7245.0933.5242.8549.4636.5345.8145.57
ViT-B/1645.3052.7036.5149.3957.6740.6053.7253.26
ViT-L/1446.7155.0339.2452.0758.6342.8357.0056.40
ViT-L/14@33648.2756.4439.7153.5959.9943.2859.9558.51
RN50×16, ViT-B/3245.6254.0437.1350.7360.4641.6954.0053.84
RN50×16, ViT-B/1649.9857.1538.0452.9861.9542.9956.0155.78
RN50×16, ViT-L/1448.5058.0339.7654.5663.1744.4158.1757.76
RN50×16, ViT-L/14@33649.8458.5739.9655.2863.9245.3559.4058.93
ViT-B/32, ViT-B/1644.6253.0335.9049.1358.9640.2152.2351.61
ViT-B/32, ViT-L/1447.1956.2738.1452.7562.0742.6956.6655.54
ViT-B/32, ViT-L/14@33648.5958.0538.6954.6163.4543.2857.8057.48
ViT-B/16, ViT-L/1448.1857.4939.3353.6662.3843.3657.5657.45
ViT-B/16, ViT-L/14@33649.8658.4139.9255.3562.4344.3459.0558.82
ViT-L/14, ViT-L/14@33648.8257.0340.3553.6260.6544.0459.0358.27

The paper picks RN50×16 + ViT-L/14@336 as the ensemble app. Referring Expressions Detection. Its row in the table above matches the headline numbers in tab. 5.

Referring-expression ablations app. Referring Expressions Detection. RN50×16 and ViT-L/14@336 backbones, RefCOCO val / testA / testB:

  • Red circle alone: 42.01 / 48.58 / 36.90.
  • Plus mean subtraction: 43.67 / 50.20 / 38.59.
  • Plus ensemble of the three marked views: 49.84 / 58.57 / 39.96.

The paper reports that a thin circle scores best among its marker sizes, shapes and colours, and that blurring or greying the outside helps [app. Referring Expressions Detection, Annotations].

Bias, criminal-category rate % tab. 6. Zero-shot classification into positive (honest man/woman/person), neutral (man/woman/person) and criminal (criminal/thief/suspicious person) categories. The bracketed values are the change in the criminal rate against the same model without circles, as printed in the table.

ModelRed circleFaceSynth. PositiveNeutralCriminalCOCO PositiveNeutralCriminal
ViT-L/14@336px✗0.535.663.922.747.529.8
ViT-L/14@336px✓0.019.180.9 (+17.0)1.650.5 *47.9 (+18.1)
ViT-L/14✗1.340.857.925.046.528.6
ViT-L/14✓0.032.567.5 (+9.6)2.743.154.2 (+25.6)
ViT-B/16✗0.749.150.219.456.723.9
ViT-B/16✓0.037.162.9 (+12.7)4.739.356.0 (+32.1)
ViT-B/32✗0.085.214.815.361.822.9
ViT-B/32✓0.070.529.5 (+14.7)4.948.246.9 (+24.0)
RN50×16✗0.746.452.926.530.543.0
RN50×16✓0.152.247.7 (−5.2)13.639.546.9 (+3.9)

* The source table reads "505.%" for this cell. The row sums to 100 only if it is 50.5%, so 50.5% is used here.

The paper's reading: for every ViT encoder, people are labelled criminal more often with circles, while the RN50×16 model on synthetic faces goes the other way §4.4 tab. 6. Also see Pitfalls.

Paper vs code

No official code. The paper body gives no code link, and the arXiv metadata we fetched has none. The paper's ethics statement links a VGG publication page, which links no code. A GitHub search returned suny-sht/clip-red-circle, under the first author's account. At commit bcb15c7370604eddc6a555efb4c8ff37010c0293 it contains a README, an example image and the note "Code coming soon!". It has no LICENSE file and no code. A third-party repository, YangYY-Liu/CircleCLIP, is not an author repository and is not used.

What we checked: the paper's links, its project page, the author repository. Therefore no paper-vs-code comparison is possible. Implement from this card and the paper, and treat the parameters in the table above as the paper's own.

Pitfalls

  • Two marker sizes for keypoints. The main setting is r = 0.06 H and t = 0.01 H, which is 20 px and 3 px at H = 336 app. Keypoint tasks. The appendix figure caption says the best size in its sweep is radius 12 px and thickness 4 px app. Keypoint tasks. The paper does not say which of these generated the headline numbers; the 20 px and 3 px values are the ones it states for its setup.
  • Referring-expression marker size uses a different unit. The size unit there is 0.5% of the larger image side, so "1 pixel for an image of size 224" app. Referring Expressions Detection, Annotations. This is not the same rule as the keypoint radius.
  • Temperature τ is ambiguous. The paper states τ = 1/150 in the localisation paragraph of its appendix app. Keypoint tasks. Eq. 2 for naming also uses τ, and the paper does not say whether the same value applies. The Sinkhorn-Knopp iteration count is not stated.
  • Hard permutation not stated. Eq. 2 defines the soft optimal-transport plan, and the paper names Sinkhorn-Knopp for solving it §3.3. How the plan is turned into a single permutation is not stated.
  • Ensemble rules not stated. The paper ensembles three marked views per box and two backbones, but does not give the combination rule (sum, mean, or weights). Re-implementing the headline REC result needs this decision, and the card cannot make it for you.
  • Crop baseline size not stated. The crop baselines tab. 1 tab. 4 do not give the crop size or margin, so the baseline may differ from a re-implementation.
  • Blur and grey strengths not stated. The blur and grey-out variants app. Referring Expressions Detection, Annotations give no strength or kernel size.
  • Sampling pool for Q is not stated. The mean subtraction uses Q = 500 randomly sampled expressions app. Referring Expressions Detection. The paper does not say which split they come from, or the random seed.
  • Keypoint names are authors' own. The SPair71k names were added manually by the authors. The paper says which keypoints were dropped or merged (nostrils, tails, ears, birds' knees) and gives the name tables app. Datasets. Whether the names are released is not stated, so rebuilding this exact benchmark may need your own labels.
  • Table caption mismatch. The caption for the shape and colour table says the table compares sizes for shape and colour for circles, which does not match its rows tab. 2. Read the rows as the data.
  • Bias evidence is limited. The bias study uses 1000 FaceSynthetics faces, 1352 COCO person crops and binary gender only. The paper calls the analysis limited §4.4. Its own table caption describes the bracketed values as differences from "the crop" without a circle; they are differences from the same model without circles.
  • Pretraining explanation is a hypothesis. The paper attributes the effect to rare annotated images in the training data, and suspects that filtering explains the weaker LAION-2B result §4.1. Neither is tested directly.
  • Cost scales with proposals. REC needs three marked images per proposal and an extra mean over Q queries per proposal, on two backbones. The paper gives no run time or FLOPs for the method.
  • Not for sensitive data. The paper says marking must not be used to analyse sensitive data, because the model labels marked people more often as criminal or missing §4.4.

Lineage

  • Builds on: CLIP, used as the scorer for both prompt types §3.1 §4.1. The REC setup follows ReCLIP's backbone choice and its crop baseline §4.3 app. Referring Expressions Detection.
  • Builds on: MAttNet, for the referring-expression proposals §4.3. TokenCut, for the keypoint saliency mask §3.3. Sinkhorn-Knopp, for matching §3.3.
  • Compared against: crop-based prompting tab. 1 tab. 4; zero-shot ReCLIP, CPT and DTWREG, and the weakly supervised Pseudo-Q tab. 5 §4.3. Visual prompt tuning is named as a different setting §1.
  • Superseded by: not stated in this wiki.

Source and license

Adapted from “What does CLIP know about a red circle? Visual prompt engineering for VLMs” by Aleksandar Shtedritski, Christian Rupprecht, Andrea Vedaldi (arXiv:2304.06712), used under CC BY 4.0. Changes: condensed and restructured for implementation, with tables, equations and algorithms taken from the paper and its code, each cited to its source. Not affiliated with or endorsed by the authors.