Visual Prompt
Tuning

Teach a frozen Vision Transformer a new task by learning only a few extra input vectors.

Menglin Jia, Luming Tang, Bor-Chun Chen, Claire Cardie, Serge Belongie, Bharath Hariharan, Ser-Nam Lim
Cornell University, Meta AI and University of Copenhagen. ECCV 2022.
Presented by Ertugrul Senturk
October 2026

Pretrain one big model once, then adapt it to each task

ImageNet-21k14 million photos in 21,000 everyday categories. Pretraining takes weeks and is done once, by Google.
ViT-B/16A Vision Transformer with 85.8 million weights that has learned general visual features.
A horned puffinA blue sports car
Fine-grained categories200 bird species, 196 car models
Aerial photo of a city blockStained tissue under a microscope
Satellite and microscopeland use from above, tissue slides
A rendered scene with several objectsA road seen from a car
Counting and distancehow many objects, how far away
Dermoscopy image of a skin lesionChest X-ray
Medical imagesmy own experiments, shown later

Each new task is small: most tasks in the paper have only 1,000 training images, far too few to train from scratch. So we start from the pretrained model and adapt it.

The paper asks how to adapt it best: accurately, and cheaply enough to store for every task. Next, the standard answer and what it costs, then the cheaper methods tried before VPT.

Dataset examples from Jia et al. 2022, Fig. 10. ViT-B/16: Dosovitskiy et al. 2021. The pretrained checkpoint used here and in the paper is Google's ImageNet-21k ViT-B/16.

Full fine-tuning stores a new copy of the model per task

Full fine-tuning retrains every weight of the pretrained model on the new task, and it is usually the most accurate option. The cost is that each task keeps its own retrained copy, so storage grows with every task and with the size of the model.

Model size
343 MB
345 MB

32-bit weights: ViT-B/16 85.8M, ViT-L/16 303M, ViT-H/14 632M. A VPT file is 50 prompts at every layer plus a 102-class head. Squares are sized by area.

Cheaper methods existed, but none matched full fine-tuning

Bias came closest and even beat full fine-tuning on 8 of the 24 tasks, but on average no cheaper method reached it. VPT takes a third route: it leaves the model alone and changes the input.

Mean test accuracy over the paper's 24 tasks, ViT-B/16 (Jia et al. 2022, Table 1, mean of the four group averages). The right column is the share of weights trained for each task.

Where the word "prompt" comes from

2020GPT-3
Classifythesentiment:prompt: words a person chose
thefilmwasgreatinput
→
frozen language model
→
positive
2021Prompt tuning
prompt: learned vectors, no words
thefilmwasgreatinput
→
frozen language model
→
positive

In 2020, a prompt was text. GPT-3, a frozen model with 175 billion weights, was only trained to continue text, yet it does a new task when you type a description of the task in front of the input. Not a single weight changes. But words are discrete, so the only way to improve a prompt is trial and error.

In 2021, prompt tuning (Lester et al.) replaced the words with learned vectors that correspond to no word. They are trained by gradient descent on the task's examples while the model stays frozen, and they are all you store per task. Prefix-tuning (Li & Liang) does the same at every layer.

The sentiment example is illustrative. Brown et al. 2020 (GPT-3); Lester, Al-Rfou, Constant 2021 (prompt tuning, T5); Li & Liang 2021 (prefix-tuning).

A visual prompt is the same idea applied to image patches

LanguageLester et al. 2021
thefilmwasgreat
→
frozen language model
→
positive
learned prompt: random at first, trained for the task, same for every input
↑“the film was great”
VisionJia et al. 2022
…
→
frozen Vision Transformer
→
melanoma
learned prompt: random at first, trained for the task, same for every image
↑The dermoscopy image with its grid of 16 by 16 pixel patchesall 196 patches
of the image

The grey vectors come from the input, as before. The red ones do not: they start as random numbers, are trained on the task's examples while the model stays frozen, and are then put in front of every input of that task. A visual prompt is therefore not text and not a pattern painted on the pixels, only learned numbers in the model's input space.

In language, prompt tuning matched full fine-tuning only once the model had about 10 billion weights. VPT beats full fine-tuning on 20 of 24 tasks with an 86-million-weight ViT-B.

Lester et al. 2021 (T5); Jia et al. 2022, Table 1. Not to be confused with CoOp (Zhou et al. 2021, text prompts for CLIP) or Bahng et al. 2022 (a pixel pattern).

How a Vision Transformer reads an image

A fixed grid cuts the image into 196 patches of 16 × 16 pixels, and each patch, read row by row, becomes a vector of 768 numbers. One extra vector, [CLS], goes in front to collect a summary of the whole image: the 12 layers mix all 197 vectors, and the head reads only [CLS] to name the class.

The layers only see a sequence of vectors, so we can add a few more.

ViT-B/16: 12 layers, vectors of 768 numbers, 85.8 million weights. Dosovitskiy et al., ICLR 2021. Image: a melanoma from DermaMNIST, 224 × 224 pixels.

VPT trains a few extra input vectors and the head

Figures: Jia et al. 2022, Fig. 2. Equations (6) and (8) of the paper: x class token, E patch vectors, P prompts, Z the prompt positions after a layer, Li layer i.

Why a few extra tokens can steer a frozen network

In every layer, each token takes in information from all the other tokens; this is attention. With prompts in the sequence, [CLS] and every patch also take in information from the prompts.

So training the prompts changes what the frozen network computes, without changing a single weight.

Mechanism: Sec. 3 of Jia et al. 2022; Appendix B relates it to prefix-tuning ("VPT-prefix"). Line widths and the red share of [CLS] are illustrative, not measured.

How much VPT trains and stores per task

N · p · d = 12 × 50 × 768 = 460,800prompt numbers, plus 78,438 for a 102-class head

Numbers trained and stored per task

Full fine-tuning
all 85.8 million weights, retrained for this task
343 MB100%
VPT-deep
the same 85.8 million weights, frozen and shared by every task
2.2 MB0.63%

Compute per image

Plain ViT
197 tokens
1.00×
VPT-deep
197 tokens
1.27×+50 prompt tokens
Prompt length p

More prompts keep the file small, but every image carries them through all 12 layers.

ViT-B/16, N = 12 layers, d = 768, 32-bit numbers. Compute counts multiply-adds per layer for n tokens (12nd² + 2n²d). The paper measures about 2× test latency at p = 200 (Jia et al. 2022, Table 12).

VPT in code: a few lines and one new hyperparameter

# VPT-deep on a frozen ViT-B/16, simplified from demo/vpt/vpt_model.pyvit = timm.create_model(BACKBONE, pretrained=True)                # ImageNet-21k ViT-B/16vit.requires_grad_(False)                                         # backbone frozenprompts = nn.Parameter(torch.empty(12, p, 768).uniform_(-b, b))   # trained: 12 layers × p × 768head = nn.Linear(768, num_classes)                                # trained: the classifier def forward(img):    x = vit._pos_embed(vit.patch_embed(img))                      # [CLS] + 196 patch vectors    for i, layer in enumerate(vit.blocks):        rest = x[:, 1:] if i == 0 else x[:, 1 + p:]               # drop last layer's prompts        P = prompts[i].expand(len(x), -1, -1)                     # this layer's prompts        x = layer(torch.cat([x[:, :1], P, rest], dim=1))          # frozen layer on [CLS, P, rest]    return head(vit.norm(x)[:, 0])                                # classify from [CLS]

The prompts start random, with Xavier-uniform values as in the official code. The paper tried smarter starts, such as class prototypes, and random did as well or better.

Training is plain SGD with momentum for 100 epochs on a cosine schedule. Learning rate and weight decay are picked on a validation split, for every method alike.

The one new hyperparameter is the prompt length p, chosen per task from {1, 5, 10, 50, 100, 200} on the validation split.

Recipe: Jia et al. 2022, Sec. 4.1 and Appendix A. Code is my re-implementation, which reproduces the paper's Oxford Flowers result (99.1% vs the paper's 99.0%).

The paper tests VPT on 24 very different tasks

A puffin, from CUB-200
CUB-200
Frangipani flowers, from Oxford Flowers
Oxford Flowers
A blue car, from Stanford Cars
Stanford Cars
A Boston terrier, from Stanford Dogs
Stanford Dogs

FGVC, 5 tasks

Fine-grained categories, such as 200 bird species, with thousands of training images.

A mayfly, from Caltech101
Caltech101
A striped texture, from DTD
DTD
A Persian cat, from Oxford Pets
Oxford Pets
A rock arch, from SUN397
SUN397

VTAB Natural, 7 tasks

Ordinary photos of objects, textures, animals and scenes, close to the pretraining data.

Farmland seen from a satellite, from EuroSAT
EuroSAT
An aerial photo of a building, from Resisc45
Resisc45
A stained tissue slide, from Patch Camelyon
Patch Camelyon
A retina scan, from Retinopathy
Retinopathy

VTAB Specialized, 4 tasks

Images from special sensors: satellites, tissue slides under a microscope, and retina cameras.

Rendered 3D objects to count, from CLEVR
CLEVR count
A white shape on black, from dSprites
dSprites location
A street seen from a car, from KITTI
KITTI distance
A toy plane at an angle, from SmallNORB
SmallNORB azimuth

VTAB Structured, 8 tasks

Geometry instead of categories, such as counting objects or judging distance.

All 24 tasks use the same frozen ViT-B/16, pretrained on ImageNet-21k. The 19 VTAB tasks have only 1,000 training images each.

Images: Jia et al. 2022, Fig. 10, four example tasks per group. VTAB-1k: Zhai et al. 2019.

VPT-deep beats full fine-tuning on 20 of 24 tasks

Jia et al. 2022, Table 1 and Tables 13–14: ViT-B/16 pretrained on ImageNet-21k, mean test accuracy within each group. For all 24 tasks, the mean of the four group averages.

VPT leads with little data and stays ahead with more

VPT-deep against

Jia et al. 2022, Fig. 3: ViT-B/16, mean test accuracy over the five FGVC tasks, each method trained on a share of every task's training images. The paper gives these values only as a figure; they were read from its vector drawing in the PDF, and the 100% points match Table 1.

The result holds for larger backbones too

VTAB group

Jia et al. 2022, Fig. 4: VTAB-1k, mean test accuracy per group, backbones pretrained on ImageNet-21k. The paper gives these values only as a figure; they were read from its vector drawing in the PDF, and the ViT-B points match Table 1.

Four places to put the prompt

Numbers from Jia et al. 2022, Fig. 5 (ViT-B/16, prompts in the first layer only); "All four" is the mean of the three groups. Diagrams redrawn.

How many prompts, and at which layers

With prompts, the same frozen network separates the classes

Linear probe
frozen network, no prompts
VPT-deep
same frozen network, with prompts
Full fine-tuning
every weight retrained

Each dot is one test image, coloured by its true class; the number is test accuracy. With the frozen features alone, the classes overlap. With prompts, the same frozen network produces clearly separated groups, so a simple linear head can tell them apart.

t-SNE maps of the final [CLS] vector, test set, from Jia et al. 2022, Fig. 9. Accuracies from Fig. 9 and Table 13.

Where VPT falls short

VPT saves storage, not training memory or inference time

Low-Rank
Adaptation

Teach a frozen model a new task by learning a small, low-rank change to its weights.

Edward J. Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, Lu Wang, Weizhu Chen
Microsoft. ICLR 2022. Results on images from Zhang, Zhou & Liu 2022 and Zhu et al. 2024.
Presented by Ertugrul Senturk
October 2026

From VPT to LoRA

VPTJia et al. 2022
…
→
frozen Vision Transformer
→
head
Learned vectors join the image patches, so every image carries a longer sequence through every layer.
LoRAHu et al. 2022
…
→
frozen Vision Transformersmall trained change to its weights
→
head
The input stays as it is. A small change to the weights is learned, and after training it is added into them.

VPT trained 0.6% of the weights and beat full fine-tuning on 20 of 24 tasks. But its prompts make every image slower, and they can never be folded into the model.

LoRA leaves the input alone and changes the weights instead. It ends up storing about as little per task as VPT, while the model runs exactly as fast as before.

VPT: Jia et al., ECCV 2022 (0.6% of the weights with 50 prompts per layer and a 102-class head; 20 of 24 tasks, Table 1). LoRA: Hu et al., ICLR 2022, first posted in June 2021.

Every fine-tuned copy is as big as the model

The paper starts from the largest model of its time, GPT-3, with 175 billion weights. Each fine-tuned copy takes 350 GB, so a service with a hundred tasks would store 35 TB. LoRA keeps one shared model and only a small file per task, and the frozen weights also need no optimizer state, which cuts training memory from 1.2 TB to 350 GB.

Model
343 MB
345 MB

GPT-3 in 16-bit numbers: 350 GB per copy, 35 MB per LoRA file at rank 4 on the query and value weights (Hu et al. 2022, Sec. 4.2). ViT-B/16 in 32-bit: 343 MB per copy; its LoRA file is rank 8 on the same weights plus a 102-class head. Squares are sized by area.

Earlier cheap methods cost time or sequence length

Adapters insert small extra layers into every block. They have few weights, but an image or a sentence must pass through them one after another, so serving a single input takes 20 to 30% longer. With large batches the gap shrinks to 2 or 3%.

Prompt methods such as prefix tuning and VPT lengthen the input instead. That leaves less room for the real input and costs compute in every layer, and on GPT-3 prefix tuning got worse beyond 256 prompt tokens.

LoRA adds no layer and no token at test time.

Hu et al. 2022, Table 1: one forward pass of GPT-2 medium, mean of 100 trials on one NVIDIA Quadro RTX 8000; bars are drawn relative to the fine-tuned model in each setting. Prefix tuning: Sec. 5.5 and Table 15.

What a low-rank matrix is

The photo of a cat rebuilt from one piece

A grayscale photo is a matrix of 274 × 274 brightness values. Any matrix can be written as a sum of simple pieces, where each piece is one column of numbers times one row. The rank is the number of pieces.

LoRA bets that the change fine-tuning makes to a weight matrix is like this photo: a few pieces carry almost all of it.

Not from the paper: the best rank-r approximation (SVD) of an Oxford Pets photo, Jia et al. 2022, Fig. 10. The low-rank bet follows Li et al. 2018 and Aghajanyan et al. 2021.

LoRA adds a trainable bypass to a frozen weight

Paper figure: the input x goes through the pretrained weight W and, in parallel, through A and then B; the two outputs are added to give h. B starts at zero, A starts random.

Figure: Hu et al. 2022, Fig. 1, where orange is trained. Equation (3) and Sec. 4.1. The paper sets α to the first r it tries and does not tune it.

LoRA on a 3 × 3 weight matrix

Made-up numbers with rank r = 1 and α/r = 1, so every product can be checked by eye. In ViT-B the same happens with 768 × 768 weights and r = 8.

Where LoRA goes in a Vision Transformer

One of the 12 blocks of ViT-B/16. Placement as in Hu et al. 2022, Sec. 4.2, and Houlsby et al. 2019. Zhang et al. 2022, Fig. 1a, draws LoRA, the adapter and VPT in one block.

VPT and LoRA side by side

One layer of ViT-B/16 drawn for each. VPT-deep with 50 prompts per layer (Jia et al. 2022); LoRA with rank 8 on the query and value weights (Hu et al. 2022). Both train the same 102-class head.

How much LoRA trains and stores per task

2 · N · m · d · r = 2 × 12 × 2 × 768 × 8 = 294,912numbers in the pairs, plus 78,438 for a 102-class head

Numbers trained and stored per task

Full fine-tuning
all 85.8 million weights, retrained for this task
343 MB100%
VPT-deep, 50 prompts
frozen and shared by every task
2.2 MB0.63%
LoRA
frozen and shared by every task
1.5 MB0.44%

Compute per image at test time

Plain ViT
197 tokens
1.00×
VPT-deep, 50 prompts
197 tokens
1.27×+50 tokens
LoRA, merged
197 tokens
1.00×nothing extra
Rank r
Weights

ViT-B/16: N = 12 blocks, d = 768, m adapted weights per block, 32-bit numbers. VPT-deep as before. Compute counts multiply-adds per layer for n tokens (12nd² + 2n²d).

LoRA's saving grows with the width of the model

Full change ΔW
d × d = d²
589,824 numbers on ViT-B
B and A together
d × r + r × d = 2rd
12,288 numbers on ViT-B

A full change to one d × d weight has d² numbers, while B and A together have 2rd. Since d is the square root of d², LoRA's cost grows like the square root of the full size, times the small constant 2r.

So the wider the model, the smaller LoRA's share. Together with adapting only the query and value weights, this is why GPT-3's task file is 10,000 times smaller than a copy.

One d × d attention weight, rank r = 8 for every model. Widths: ViT-B/16 768, ViT-L/16 1,024, ViT-H/14 1,280 (Dosovitskiy et al. 2021); GPT-3 12,288 (Hu et al. 2022, Sec. 1). 10,000 times: Hu et al. 2022, Sec. 4.2.

LoRA on a ViT in a few lines

vit = timm.create_model(BACKBONE, pretrained=True, num_classes=C)vit.requires_grad_(False); vit.head.requires_grad_(True) class LoRAqv(nn.Module):              # wraps qkv = Linear(768, 2304)    def __init__(self, qkv, r=8, alpha=8):        super().__init__()        d = qkv.in_features        self.qkv, self.s = qkv, alpha / r    # frozen W0, scale α/r        self.Aq = nn.Parameter(torch.randn(r, d) / d ** 0.5)        self.Av = nn.Parameter(torch.randn(r, d) / d ** 0.5)        self.Bq = nn.Parameter(torch.zeros(d, r))   # B = 0        self.Bv = nn.Parameter(torch.zeros(d, r))    def forward(self, x):        q, k, v = self.qkv(x).chunk(3, dim=-1)      # W0 x        q = q + self.s * x @ self.Aq.T @ self.Bq.T  # + B A x        v = v + self.s * x @ self.Av.T @ self.Bv.T        return torch.cat([q, k, v], dim=-1) for blk in vit.blocks: blk.attn.qkv = LoRAqv(blk.attn.qkv)

B starts at zero and A at small random values, so the first forward pass is exactly the pretrained model.

The two new choices are the rank r and which weights get a pair. On ViT-B, Zhang et al. use rank 8 with AdamW at a learning rate of 0.001 for 100 epochs.

After training, each pair is added into its qkv weight once, and the model is a plain timm ViT again.

My sketch for timm's ViT-B/16: 294,912 trained numbers in the pairs, and identical outputs before and after merging. Official code: loralib, github.com/microsoft/LoRA. Settings: Hu et al. 2022, Sec. 4.1; Zhang et al. 2022, App. A.2.

Results in the paper: language models

What happens when more weights are trained

Hu et al. 2022, Table 15 (the points of Fig. 2): GPT-3 175B, validation accuracy; LoRA with equal rank on query and value, from rank 1 to 64. Full fine-tuning trains all 175 billion weights.

Which weight matrices to adapt

Hu et al. 2022, Table 5: GPT-3 175B with the same 18 million trained weights in every LoRA row, validation accuracy (noise ±0.5 on WikiSQL, ±0.1 on MNLI). Full fine-tuning: Table 4.

How small the rank can be

Hu et al. 2022, Table 6: GPT-3 175B, validation accuracy at five ranks; noise ±0.5 on WikiSQL and ±0.1 on MNLI. On GPT-2 the best rank was between 4 and 16 (App. H.2).

Why a small rank is enough

Paper figure: heat maps of subspace similarity between the directions learned with rank 8 (rows i) and rank 64 (columns j), for the query and value changes. Only the first row is bright.

The authors trained rank 8 and rank 64 separately and compared the directions each learned. Bright means the two runs found the same direction. Only the first direction is clearly shared, with similarity above 0.5, and the rest overlap little, so most of the extra rank holds noise.

21.67

is how strongly the pretrained weight Wq acts along its own top 4 directions.

0.32

is how strongly it acts along the 4 directions of the learned change ΔWq: weak, but more than the 0.02 of random directions.

6.91

is the strength of the change along those directions, about 21 times what the pretrained weight had there.

The change does not repeat what the model already does. It strongly amplifies directions the model learned in pretraining but used weakly.

Hu et al. 2022, Fig. 3 (layer 48 of 96, GPT-3; values are normalized subspace similarity, 0 to 1) and Table 7 (rank 4, Frobenius norms).

LoRA on images

The paper itself has no image experiments. Vision groups tested it next, first on the same 19 VTAB-1k tasks as VPT, then on medical images.

Both use a ViT-B/16, so the numbers sit next to the VPT results.

A Persian cat, from Oxford Pets
Natural
A retina scan, from Retinopathy
Specialized
Rendered 3D objects to count, from CLEVR
Structured

LoRA, VPT and adapters on the same ViT

Zhang et al. 2022, Table 1: ViT-B/16 pretrained on ImageNet-21k, VTAB-1k test accuracy. LoRA (rank 8) and the adapter were trained by Zhang et al.; the other rows are Jia et al. 2022, Table 1. Group means computed from the per-task values; "all 19" is the mean of the three groups.

Neither LoRA nor VPT wins every task

LoRA is ahead on 15 of the 19 tasks, by up to 14 points on counting objects in CLEVR. VPT-deep is ahead on 4, and on CIFAR-100 by 12 points.

Zhang et al. conclude that no single method fits every task. Their method, NOAH, searches for a mix of LoRA, adapter and prompts per task, and reaches 75.5 on average.

Zhang et al. 2022, Table 1: per-task test accuracy of LoRA minus VPT-deep on VTAB-1k, ViT-B/16. Right of the line, LoRA is ahead.

LoRA on medical images

Where LoRA falls short

The rank and the weights are chosen by hand

The paper picks the query and value weights and a small rank by trying settings, and leaves a principled choice to future work. On VTAB-1k the best method even changes from task to task.

Merged weights serve one task at a time

Once BA is added into W, every input in a batch must belong to that task. Mixing tasks in one batch means keeping the pairs separate, which brings back a small extra cost; VPT's prompts mix freely.

A small rank assumes a nearby task

The authors expect a small rank to fail when the new task is far from pretraining, such as a different language. The low-rank analysis was only done on GPT-3, not on vision models.

Training still runs through the whole model

LoRA saves the optimizer state of the frozen weights, but the gradient still passes back through every layer. On ViT-B most memory is activations: freezing the backbone for VPT only cut it from 11.7 to 10.3 GB.

Hu et al. 2022, Sec. 4.2 (batching), footnote 6 (a different language), Sec. 7 and 8 (analysis on GPT-3, future work). Zhang et al. 2022, Fig. 1b. Jia et al. 2022, Table 12 (ViT-B/16, batch 64).

My experiments

I re-implemented VPT and LoRA and trained both on three medical imaging datasets from MedMNIST. A linear probe and full fine-tuning ran next to them, all four starting from the same ViT-B/16.

First the results, then all four models running live in this browser.

Dermoscopy image of a skin lesion
Skin lesions
Microscopy image of a blood cell
Blood cells
Chest X-ray
Chest X-rays

I tested VPT and LoRA on three medical datasets

Each method was trained twice: on 1,000 images, as in VTAB-1k, and on the full training set.

Dermoscopy image of a melanoma
melanoma
Dermoscopy image of a nevus
nevus

Skin lesions

Dermoscopy, 7 classes

1,000 or all 7,007 training images

Microscopy image of a neutrophil
neutrophil
Microscopy image of a platelet
platelet

Blood cells

Microscopy, 8 cell types

1,000 or all 11,959 training images

Chest X-ray, normal
normal
Chest X-ray with pneumonia
pneumonia

Chest X-rays

Radiographs, pneumonia or normal

1,000 or all 4,708 training images

head
ViT-B/16 frozen

Linear probe

Trains only a new head.

head
ViT-B/16 frozen

VPT-deep

Trains a head and 50 prompts per layer.

head
ViT-B/16 frozen
+

LoRA

Trains a head and rank-8 pairs beside Wq and Wv.

head
ViT-B/16 retrained

Full fine-tuning

Retrains all 85.8 million weights.

MedMNIST+ at 224 × 224 (Yang et al. 2023); skin lesions from HAM10000 (Tschandl et al. 2018). RTX 5070 Ti laptop GPU. SGD for linear probe and VPT, AdamW for LoRA and full fine-tuning; learning rate picked on validation.

VPT and LoRA on my three datasets

My runs: ViT-B/16 (ImageNet-21k), MedMNIST+ 224 × 224, balanced accuracy on the test set (the mean per-class recall), bars start at 0. Each method was trained once with 1,000 images and once with the full training set; there are no points in between.

What each method costs on skin lesions

Live demo: one image, four models

Pick a test image below,
or drop your own here
 

Linear probe

shared model + head

VPT-deep

shared model + prompts

LoRA

shared model + pairs

Full fine-tuning

own retrained model

All four start from the same ViT-B/16, pretrained on ImageNet-21k. Linear probe, VPT-deep and LoRA share one frozen copy of it; full fine-tuning runs its own retrained copy.

Not connectedResearch demo, not a diagnostic tool

Summary

20of 24

tasks where VPT-deep beat full fine-tuning, training 0.6% of a ViT-B pretrained with labels.

99.4%

less storage per task than a fully fine-tuned copy: 2.2 MB for VPT instead of 343 MB, and 1.5 MB for LoRA.

1.00×

the test-time cost of the original model with LoRA, because its change is added into the weights. VPT's prompts cost 1.27×.

74.6

mean VTAB-1k accuracy of LoRA on ViT-B/16, against 72.0 for VPT-deep and 69.0 for full fine-tuning.

–

average balanced accuracy of LoRA on my three medical datasets.

Jia et al. 2022, Table 1 (24 tasks, ViT-B/16) and Table 12; 0.6% is VPT-deep with 50 prompts per layer and a 102-class head, LoRA is rank 8 on the query and value weights with the same head. Zhang et al. 2022, Table 1, mean of the three VTAB-1k groups. Medical datasets: my runs, balanced accuracy on the test set.

References

The two papers

  1. Jia, Tang, Chen, Cardie, Belongie, Hariharan & Lim 2022. Visual prompt tuning. ECCV. arXiv:2203.12119.
  2. Hu, Shen, Wallis, Allen-Zhu, Li, Wang, Wang & Chen 2022. LoRA: low-rank adaptation of large language models. ICLR. arXiv:2106.09685.

Prompting before VPT

  1. Lester, Al-Rfou & Constant 2021. The power of scale for parameter-efficient prompt tuning. EMNLP.
  2. Li & Liang 2021. Prefix-tuning: optimizing continuous prompts for generation. ACL.
  3. Zhou, Yang, Loy & Liu 2022. Learning to prompt for vision-language models (CoOp). IJCV. arXiv:2109.01134.
  4. Bahng, Jahanian, Sankaranarayanan & Isola 2022. Exploring visual prompts for adapting large-scale models. arXiv:2203.17274.

Ideas LoRA builds on

  1. Li, Farkhoor, Liu & Yosinski 2018. Measuring the intrinsic dimension of objective landscapes. ICLR.
  2. Aghajanyan, Zettlemoyer & Gupta 2021. Intrinsic dimensionality explains the effectiveness of language model fine-tuning. ACL.

Other parameter-efficient methods

  1. Houlsby et al. 2019. Parameter-efficient transfer learning for NLP (adapter). ICML.
  2. Lin, Madotto & Fung 2020. Exploring versatile generative language model via parameter-efficient transfer learning. Findings of EMNLP.
  3. Rücklé et al. 2021. AdapterDrop: on the efficiency of adapters in Transformers. EMNLP.
  4. Ben Zaken, Goldberg & Ravfogel 2022. BitFit: simple parameter-efficient fine-tuning for Transformer-based masked language-models (Bias). ACL.
  5. Zhang, Sax, Zamir, Guibas & Malik 2020. Side-tuning: a baseline for network adaptation via additive side networks (Sidetune). ECCV.

LoRA on images

  1. Zhang, Zhou & Liu 2022. Neural prompt search (NOAH). arXiv:2206.04673.
  2. Zhu et al. 2024. MeLo: low-rank adaptation is better than fine-tuning for medical image diagnosis. ISBI. arXiv:2311.08236.

References, continued

Models

  1. Dosovitskiy et al. 2021. An image is worth 16×16 words: Transformers for image recognition at scale (ViT). ICLR.
  2. Liu et al. 2021. Swin Transformer: hierarchical vision Transformer using shifted windows. ICCV.
  3. Chen, Xie & He 2021. An empirical study of training self-supervised vision Transformers (MoCo v3). ICCV.
  4. He et al. 2022. Masked autoencoders are scalable vision learners (MAE). CVPR.
  5. Zheng et al. 2021. Rethinking semantic segmentation from a sequence-to-sequence perspective with Transformers (SETR). CVPR.
  6. Chen et al. 2018. Encoder-decoder with atrous separable convolution for semantic image segmentation (DeepLab v3+). ECCV.
  7. Radford et al. 2021. Learning transferable visual models from natural language supervision (CLIP). ICML.
  8. Brown et al. 2020. Language models are few-shot learners (GPT-3). NeurIPS.
  9. Radford et al. 2019. Language models are unsupervised multitask learners (GPT-2). OpenAI report.
  10. Liu et al. 2019. RoBERTa: a robustly optimized BERT pretraining approach. arXiv:1907.11692.

Datasets and benchmarks

  1. Zhai et al. 2019. A large-scale study of representation learning with the visual task adaptation benchmark (VTAB). arXiv:1910.04867.
  2. Parkhi, Vedaldi, Zisserman & Jawahar 2012. Cats and dogs (Oxford Pets). CVPR.
  3. Zhou et al. 2019. Semantic understanding of scenes through the ADE20K dataset. IJCV.
  4. Zhong, Xiong & Socher 2017. Seq2SQL: generating structured queries from natural language using reinforcement learning (WikiSQL). arXiv:1709.00103.
  5. Williams, Nangia & Bowman 2018. A broad-coverage challenge corpus for sentence understanding through inference (MNLI). NAACL.
  6. Wang et al. 2019. GLUE: a multi-task benchmark and analysis platform for natural language understanding. ICLR.
  7. Jaeger et al. 2014; Moreira et al. 2012; Wang et al. 2017. Shenzhen chest X-ray, INbreast and ChestX-ray14, used by MeLo.
  8. Yang et al. 2023. MedMNIST v2: a large-scale lightweight benchmark for 2D and 3D biomedical image classification. Scientific Data.
  9. Tschandl, Rosendahl & Kittler 2018. The HAM10000 dataset, a large collection of multi-source dermatoscopic images of common pigmented skin lesions. Scientific Data.