wikillm

Paper · 2022-04-15 · cs.CV, cs.LG

Pushing the Limits of Simple Pipelines for Few-Shot Learning: External Data and Fine-Tuning Make a Difference

P>M>F: unsupervised pre-training on external data, then ProtoNet meta-training, then optional per-domain fine-tuning at meta-test with augmentation and a learning rate picked on a few tasks. Author-reported: 98.4% on miniImageNet 5-way-5-shot with DINO ViT-base; 84.75 average on Meta-Dataset (8 source domains, with fine-tuning).

Few-shot learningMeta-learningSelf-supervised learningTransfer learningfew-shot-learningself-supervised-pretrainingfine-tuningprototypical-networksvision-transformer

arXivPDFCodeMarkdown19 min read

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

In plain words

Few-shot learning is about teaching a model a new category from only a handful of labelled pictures. Most research in this area designs clever training schemes for small, old-fashioned networks. This paper asks a more practical question: what happens if you simply start from a network that someone already trained on a huge pile of unlabelled images, and then add a simple few-shot method on top?

The recipe has three stages. First, the network learns general picture features from unlabelled data. Second, it is trained on many small simulated few-shot tasks, where each class is represented by the average feature of its example pictures and a new picture is labelled by finding the closest class average. Third, when a new task comes from a very different kind of picture, the network is briefly adjusted on the few labelled examples, using random flips, colour changes and shifts to create varied copies of them.

The authors find that the choice of pre-training data and of a modern transformer backbone matters more than the few-shot training method itself. Adjusting the network at test time helps most when the new task looks unlike the training data. The results are strong, but they come from a setting that uses much more external data than most earlier papers, so they are not a like-for-like comparison.

TL;DR

P>M>F stands for pre-training, then ProtoNet meta-training, then fine-tuning. The pre-training uses external unlabelled data such as ImageNet-1k, and the backbone can be a ResNet or a ViT. The meta-trained model classifies by nearest class prototype, and it can optionally be fine-tuned per domain with augmentation at test time. The authors report results above many prior methods on miniImageNet, CIFAR-FS, Meta-Dataset and cross-domain benchmarks. They warn that these numbers are not directly comparable to prior work, which often uses no external data. §1 §4.2

Problem

Standard few-shot benchmarks restrict the source data to the meta-training split and use small networks such as CNN-4-64 or ResNet-12. The authors argue that this setup hides the effect of two practical choices: the external data used for pre-training and the architecture used, including modern vision transformers. A third choice is whether to fine-tune the backbone on the labelled support set at test time, which is often avoided. §1

The paper assumes few-shot tasks that are sampled from a set of domains (for example Meta-Dataset) and that a small labelled support set is the only labelled data available for a new task. It assumes that unlabelled external data exists for the modality. §1 §5

Method

The pipeline has three phases §3:

  1. Pre-training of the backbone on unlabelled external data with an unsupervised loss. The paper considers DINO, BEiT and CLIP style checkpoints, with ResNet or ViT backbones, and does not train them itself §3.1. The code loads released checkpoints and contains no pre-training script [code: models/init.py#L70-L80].
  2. Meta-training with ProtoNet on simulated few-shot episodes from labelled base classes. Each class prototype is the mean embedding of its support images. The query is classified by a softmax over negative cosine distances to the prototypes §3.2 eq. 1. The variant is "various-way-various-shot": the number of classes and shots changes from episode to episode §3.2 §4.
  3. Meta-testing, with optional fine-tuning. By default the meta-trained ProtoNet is applied to new tasks without any change §3.3. If the new task is from an unseen domain, the whole backbone is fine-tuned for a few gradient steps on the support set. Each step builds a pseudo query set by augmenting the support images, and the prototypes are recomputed from the un-augmented support images with the current weights §3.3 alg. 1.

The learning rate for fine-tuning is chosen automatically per domain. The authors sample N = 5 extra tasks from each domain, test a fixed grid of learning rates on them, and reuse the best rate for every task in that domain §3.3. The paper does not say which split these tasks come from.

The core ProtoNet classifier in pseudocode form (the paper's eq. 1 with the code's scaling):

Pseudocode
# ProtoNet classification of one episode  [§3.2] [eq. 1]
# Input:  supp_x (B, nSupp, C, H, W)
#         supp_y (B, nSupp)
#         qry_x  (B, nQry, C, H, W)
# Output: logits (B, nQry, nClasses)

def protonet_logits(supp_x, supp_y, qry_x):
    # 1. Embed support and query images with the same backbone  [§3.2]
    supp_f = backbone(supp_x)                   # (B, nSupp, d)
    qry_f = backbone(qry_x)                     # (B, nQry, d)
    # 2. Prototype of class k = mean of its support embeddings  [§3.2]
    protos = class_mean(supp_f, supp_y)         # (B, nClasses, d)
    # 3. Cosine similarity of L2-normalised vectors
    #    [eq. 1] [code: models/protonet.py#L22-L23]
    cosine = normalize(qry_f) @ normalize(protos).T
    # 4. Code multiplies by a learned scale and adds a learned bias
    #    [code: models/protonet.py#L26]
    logits = scale_cls * (cosine + bias)
    return logits

Test-time fine-tuning, following alg. 1 with the choices made in the code:

Pseudocode
# Meta-test fine-tuning of the whole backbone  [alg. 1] [§3.3]
# Input:  supp_x, supp_y, qry_x, meta-trained weights, learning rate lr
# Output: logits for qry_x

def finetune_and_classify(supp_x, supp_y, qry_x, lr):
    # 0. Start every task from the meta-trained weights
    #    [code: models/deploy.py#L198]
    load_meta_trained_weights(backbone)
    # 1. Adam over backbone parameters only, betas (0.9, 0.999), no weight decay
    #    [code: models/deploy.py#L214-L217]
    opt = Adam(backbone.parameters(), lr=lr)
    for step in range(num_steps):             # 50 in [supp. §3]; see Pitfalls
        # 2. With probability 0.9, augment the support batch (flip, colour,
        #    translation)  [§3.3] [supp. §3] [code: models/utils.py#L9-L20]
        aug_x = maybe_augment(supp_x, prob=0.9)
        # 3. Prototypes from the un-augmented support set, with the
        #    current weights  [alg. 1]
        protos = class_mean(backbone(supp_x), supp_y)
        # 4. Classify the augmented support images against those
        #    prototypes  [alg. 1]
        logits = cosine_logits(backbone(aug_x), protos)
        loss = cross_entropy(logits, supp_y)
        opt.step(loss)
    # 5. Recompute prototypes with the adapted backbone, then classify
    #    the queries  [alg. 1]
    protos = class_mean(backbone(supp_x), supp_y)
    return cosine_logits(backbone(qry_x), protos)

Meta-training schedule §4: the backbone is trained for 100 epochs, each of 2000 episodes. The learning rate warms up linearly from 1e-6 to 5e-5 over 5 epochs and then decays with a cosine schedule to 1e-6. Validation episodes decide which checkpoint is kept. The paper uses one common schedule for every architecture and dataset, which it says may be sub-optimal for some of them. Strong regularisation and data augmentation are said to be turned off §4. The optimiser is not named in the paper.

Key equation eq. 1: the probability of class k for query x is a softmax over the negative cosine distances to all class prototypes, where each prototype c_k is the mean of the support embeddings of class k. Eq. 1 has no temperature or bias term; the code adds both (see Paper vs code).

Hyperparameters

NameValueWhereNotes
Pre-trainingnone in this paper§3.1Released checkpoints are reused. Table 1 varies the checkpoint (DINO, DeiT, CLIP, BEiT, supervised ImageNet-1k or 21k) tab. 1
BackbonesResNet-18, ResNet-50, ViT-small, ViT-base§4 tab. 1Patch size and head config not stated in the paper
Distancecosine§3.2 eq. 1Code: normalised dot product times learned scale
Learned scale and bias (code)scale init 10, bias init 0, both trainedprotonet.pyNot in the paper
Meta-train epochs100§4Code default --epochs 100 args.py
Episodes per epoch2000§4Code epoch length is nEpisode × number of base sources (see Pitfalls) meta_h5_dataset.py
Peak learning rate5e-5§4Code default --lr 5e-5 args.py but scaled by world size / 8 when fp16 is on main.py
Warm-up1e-6 to peak over 5 epochs§4Code: warmup-lr 1e-6, warmup-epochs 5 args.py args.py
Final learning rate1e-6 (cosine)§4Code min-lr 1e-6 args.py
Optimiser (meta-training)not stated§4Code: SGD, momentum 0.9, weight decay 0 main.py; the args default 'adamw' is not used main.py
Model mode during meta-trainingnot stated§4Code keeps the model in eval mode main.py engine.py
Mixed precisionnot stated§4Code default on args.py
Few-shot shape, miniImageNet / CIFAR-FS5-way, 1 or 5 shot, 15 query per class§4Code nClsEpisode 5, nQuery 15 args.py
Few-shot shape, Meta-Datasetways, shots, queries sampled uniformly from dataset specs§4Code limits: min 5 and max 50 ways, max 10 query per class, max 500 support, max 100 per class args.py
Validation episodes (Meta-Dataset)not stated§4Code: 120 per domain args.py
Test episodes600 per dataset§4Code: 600 on the Meta-Dataset test split meta_h5_dataset.py
Image size, miniImageNet84 × 84§4Code default is 224 unless --img-size is set args.py mini_imagenet.py
Image size, CIFAR-FS32 × 32§4Code default is 224 unless --img-size is set cifar_fs.py
Image size, Meta-Datasetnot stated§4Code default 128 args.py
Fine-tuning learning ratesearched over {0.01, 0.001, 0.0001, 0}§3.3Code grid for Meta-Dataset: {0, 1e-4, 1e-3, 1e-2} test_meta_dataset.py
Learning-rate search tasks per domainN = 5§3.3Code uses the first 6 test-split episodes (see Pitfalls) engine.py
Fine-tuning steps50 (ablation default)[supp. §3]Code default 40 args.py; README examples use 100
Fine-tuning optimiserAdam, betas (0.9, 0.999), no weight decayalg. 1 deploy.pyOnly backbone parameters are updated
Augmentation probability0.9[supp. §3]Code default args.py
Augmentation typesnot named in the paper textalg. 1Code default color and translation args.py
Fine-tuning learning rate used in Table 30.01 and 0.001 fixed, plus tunedtab. 3"Tuned" means the per-domain search above

Results

Author-reported. Setup: ProtoNet meta-test with a nearest-centroid classifier unless stated otherwise tab. 1. Benchmarks: miniImageNet and CIFAR-FS (5-way, 1 or 5 shot) §4; Meta-Dataset with 8 source domains, or ImageNet-only §4; a cross-domain benchmark meta-trained on miniImageNet with four target domains §4 tab. 6.

Table 1 summarises pre-training and architecture on Meta-Dataset (average over target datasets), miniImageNet and CIFAR-FS (5-way-5-shot) tab. 1. "MetaTr" is the meta-training method; "-" means no meta-training.

IDArchPre-trainMetaTrMDminiINCIFAR
0ViT-smallDINO (IN1K)-67.497.079.8
1ViT-smallDeiT (IN1K)-67.598.884.6
2ResNet50DINO (IN1K)-63.891.576.1
3ResNet50Sup. (IN1K)-62.496.482.3
4ViT-smallDINO (IN1K)PN78.498.092.5
5ViT-smallDEiT (IN1K)PN79.399.493.6
6ViT-small-PN52.849.159.8
7ResNet50DINO (IN1K)PN72.492.084.0
8ResNet50Sup. (IN1K)PN70.297.487.6
9ResNet50-PN62.972.268.4
10ResNet18-PN63.373.770.2
11ViT-baseDINO (IN1K)PN79.298.492.2
12ViT-baseCLIP (YFCC)PN80.098.193.2
13ViT-baseSup. (IN21K)PN81.499.296.7
14ViT-baseBEiT (IN21K)PN82.899.097.5
15ResNet50CLIP (YFCC)PN75.092.282.6

Table 2 shows other few-shot learners on top of the same features: MetaQDA and MetaOptNet with ResNet and with DINO ViT-small. Each row lists 5-way-1-shot and 5-way-5-shot for miniImageNet and CIFAR-FS tab. 2.

IDArchPre-trainMetaTrminiIN 5/1miniIN 5/5CIFAR 5/1CIFAR 5/5
0ViT-smallDINO (IN1K)-88.897.059.179.8
1ViT-smallDINO (IN1K)ProtoNet93.198.081.192.5
2ResNet18-MetaQDA65.181.0--
3ViT-smallDINO (IN1K)MetaQDA92.097.077.290.1
4ResNet12-MetaOptNet64.180.072.885.0
5ViT-smallDINO (IN1K)MetaOptNet92.297.870.284.1

Table 3 shows the effect of test-time fine-tuning on Meta-Dataset (average over all domains, and the out-of-distribution subset) tab. 3 fig. 3. Meta-training used either ImageNet only (IN) or all of Meta-Dataset (MD).

MArchPre-trainMetaTr (source)MetaTeAvgOut-D
1ViT-smallDINOPN (IN)PN68.3867.68
2ViT-smallDINOPN (IN)PN+FT (lr=0.01)76.0576.54
3ViT-smallDINOPN (IN)PN+FT (lr=0.001)74.4774.51
4ViT-smallDINOPN (IN)PN+FT (tuned)77.5377.85
5ViT-smallDINOPN (MD)PN78.4355.71
6ViT-smallDINOPN (MD)PN+FT (lr=0.01)76.0973.26
7ViT-smallDINOPN (MD)PN+FT (lr=0.001)74.6469.97
8ViT-smallDINOPN (MD)PN+FT (tuned)83.1375.72

Table 4 compares with state-of-the-art few-shot methods on miniImageNet and CIFAR-FS §4.2 tab. 4. The P>M>F rows carry the same numbers as the ProtoNet rows without fine-tuning in Table 1. Columns are CIFAR-FS 5w1s and 5w5s, miniImageNet 5w1s and 5w5s, and the external data and labels flags.

Method (backbone)Ext. dataExt. labelsCIFAR 5w1sCIFAR 5w5sminiIN 5w1sminiIN 5w5s
Inductive
ProtoNet (CNN-4-64)49.468.255.572.0
Baseline++ (CNN-4-64)48.266.4
MetaOpt-SVM (ResNet12)72.084.361.477.9
Meta-Baseline (ResNet12)68.683.7
RS-FSL (ResNet12)yes65.3
Transductive
Fine-tuning (WRN-28-10)76.685.865.778.4
SIB (WRN-28-10)80.085.370.079.2
PT-MAP (WRN-28-10)87.790.782.988.8
CNAPS + FETI (ResNet18)yesyes79.991.5
Self-supervised
ProtoNet (WRN-28-10)73.686.162.979.9
ProtoNet (AMDIM ResNet)yes76.891.0
EPNet + SSL (WRN-28-10)yes79.288.1
Semi-supervised
LST (ResNet12)yes70.178.7
PLCM (ResNet12)yes77.686.170.183.7
P>M>F (IN1K, ResNet50)yes73.784.079.292.0
P>M>F (IN1K, ViT-small)yes81.192.593.198.0
P>M>F (IN1K, ViT-base)yes84.392.295.398.4

Table 5 gives Meta-Dataset results for the 8 in-domain training sources and for ImageNet-only meta-training tab. 5. The ViT-small average of 83.13 equals the tuned fine-tuning row in Table 3 tab. 3, so the P>M>F rows here appear to include fine-tuning. The text does not state this for every row.

Meta-Dataset, 8 in-domain sources:

Method (backbone)INetOmglotAcraftCUBDTDQDrawFungiFlowerSignCOCOAvg
ProtoNet (RN18)67.0144.579.5671.1467.0165.1864.8840.2686.8546.4863.29
CNAPs (RN18+Adapter)50.891.783.773.659.574.750.288.956.539.466.90
SUR (RN18+Adapter)57.293.290.182.373.581.967.988.467.451.375.32
T-SCNAPs (RN18+Adapter)58.893.984.176.869.078.648.891.676.148.772.64
URT (RN18+Adapter)55.794.485.876.371.882.563.588.269.452.273.98
FLUTE (RN18)51.893.287.279.268.879.558.191.658.450.071.78
URL (RN18+Adapter)57.5194.5188.5980.5476.1781.9468.7592.1163.3454.0375.75
ITA (RN18+Adapter)57.3594.9689.3381.4276.7482.0167.492.1883.5555.7578.07
P>M>F (DINO/IN1K, RN50)67.5185.9180.381.6787.0872.8460.0394.6987.1758.9277.61
P>M>F (DINO/IN1K, ViT-small)74.5991.7988.3391.0286.6179.2374.294.1288.8562.5983.13
P>M>F (DINO/IN1K, ViT-base)77.0291.7689.7392.9486.9480.278.2895.7989.8664.9784.75

Meta-Dataset, ImageNet-only meta-training (columns: in-domain ImageNet, then out-of-domain datasets, then average):

Method (backbone)INetOmglotAcraftCUBDTDQDrawFungiFlowerSignCOCOAvg
ProtoNet (RN18)50.559.9853.168.7966.5648.9639.7185.2747.124156.10
ALFA+FP-MAML (RN12)52.861.8763.4369.7570.7859.1741.4985.9660.7848.1161.41
BOHB (RN18)51.9267.5754.1270.6968.3450.3341.3887.3451.848.0359.15
CTX (RN34)62.7682.2179.4980.6375.5772.6851.5895.3482.6559.974.28
P>M>F (DINO/IN1K, RN50)67.0875.3375.3972.0886.4266.7950.5394.1486.5458.273.25
P>M>F (DINO/IN1K, ViT-small)74.6980.6876.7885.0486.6371.2554.7894.5788.3362.5777.53
P>M>F (DINO/IN1K, ViT-base)76.6981.4280.3384.3886.8775.4355.9395.1489.6865.0179.09

Table 6 is the cross-domain benchmark. Each entry is 5-way 5-, 20- or 50-shot accuracy, on ChestX, ISIC, EuroSAT and CropDisease tab. 6:

Method (backbone)ChestX 5w5s5w20s5w50sISIC 5w5s5w20s5w50sEuroSAT 5w5s5w20s5w50sCropDisease 5w5s5w20s5w50s
ProtoNet (RN10)24.0528.2129.3239.5749.5051.9973.2982.2780.4879.7288.1590.81
RelationNet (RN10)22.9626.6328.4539.4141.7749.3261.3174.4374.9168.9980.4585.08
MetaOptNet (RN10)22.5325.5329.3536.2849.4254.8064.4479.1983.6268.4182.8991.76
Finetune (RN10)25.9731.3235.4948.1159.3166.4879.0887.6490.8989.2595.5197.68
CHEF (RN10)24.7229.7131.2541.2654.3060.8674.1583.3186.5586.8794.7896.77
STARTUP (RN10)26.9433.1936.9147.2258.6364.1682.2989.2691.9993.0297.5198.45
DeepCluster2 (IN1K, RN50)26.5131.5134.1740.7349.9153.6588.3992.0293.0793.6396.6397.04
P>M>F (DINO/IN1K, ResNet50)27.1331.5734.1743.7854.0657.8689.1893.0896.0695.0697.2597.77
P>M>F (DINO/IN1K, ViT-small)27.2735.3341.3950.1265.7873.5085.9891.3295.4092.9698.1299.24

Supplementary numbers [supp. §1], averages over all Meta-Dataset target domains, without test-time fine-tuning: the first column meta-trains on the 8 in-domain sources, the second on ImageNet only. A dash means the supplement does not report that row.

Pre-train and backboneMeta-train: 8 sourcesMeta-train: ImageNet only
DINO (ViT-small)78.52868.38
DINO (ViT-base)79.50768.85
CLIP (ViT-base)79.98570.891
DINO (ResNet50)72.38264.086
CLIP (ResNet50)75.00764.909
Sup. 21k (ViT-base)81.4468.3
BEiT + Sup. 21k (ViT-base)82.75576.238
Sup. 1k (ViT-small)78.673-
Sup. 1k (ViT-base)80.71467.785
Sup. 1k (ResNet50)70.21-
None (ViT-small)52.805-
None (ResNet50)62.901-

Supplementary miniImageNet and CIFAR-FS table [supp. §2], 5-way accuracy:

Pre-trainArchMetaTrminiIN 5w1sminiIN 5w5sCIFAR 5w1sCIFAR 5w5s
DINOViT-smallPN93.198.081.192.5
DINOViT-basePN95.398.484.392.2
CLIPViT-basePN93.198.185.393.2
DINOResNet50PN79.292.073.784.0
CLIPResNet50PN78.992.271.482.6
Sup. 21kViT-basePN97.299.292.396.7
BEiT + Sup. 21kViT-basePN96.69993.897.5
Sup. 1kViT-smallPN97.799.486.293.6
Sup. 1kViT-basePN99.299.888.294.3
Sup. 1kResNet50PN91.797.47787.6
NoneViT-smallPN36.549.145.959.8
NoneResNet50PN46.160.354.168.4

Figure 1 (teaser) places the ProtoNet + ViT + CLIP result against results aggregated from prior few-shot studies, and includes ProtoNet with a randomly initialised ViT for comparison fig. 1 §1. Table 1 shows the randomly initialised ViT performing poorly tab. 1 §3.1. Figure 3 describes fine-tuning on Meta-Dataset: held-out datasets such as traffic signs and COCO benefit from it, and so do datasets far from ImageNet such as Omniglot and QuickDraw fig. 3 §4.1.2. The supplementary ablation (fine-tuning hyperparameters on validation domains) finds that the learning rate dominates, that a higher augmentation probability helps, and that 50 steps work well at the right learning rate [supp. §3].

Paper vs code

Code: github.com/hushell/pmf_cvpr22, Apache-2.0, commit 25bf65f013405b6596ed89c3e3bb4f9dda917694. The paper links this repository in §4.2. The abstract links a project page, which the README also links.

  • Distance and scale. Eq. 1 uses cosine distance with no temperature or bias §3.2 eq. 1. Because exp(-(1 - cos)) is proportional to exp(cos), eq. 1 as written has an implicit scale of 1. The code multiplies the cosine by a learned scale initialised at 10 and adds a learned bias initialised at 0, and both are trained during meta-training protonet.py protonet.py.
  • Peak learning rate under fp16. The paper states 5e-5 as the peak §4. The code multiplies the peak by world size / 8 whenever fp16 is on, and fp16 is on by default. A single-GPU run therefore peaks at 6.25e-6 for --lr 5e-5. The 8-GPU case is the one where the code's scaling is neutral. The paper does not give a GPU count main.py args.py.
  • Optimiser. The paper does not name one. The code uses SGD with momentum 0.9 and no weight decay, and the AdamW default in the arguments is not used main.py.
  • Model mode. The code calls the model with training mode off during meta-training, so any batch-norm or dropout layers run in evaluation mode engine.py main.py.
  • Early stopping. The paper says validation decides when to stop §4. The code keeps the checkpoint with the best validation accuracy but runs all epochs main.py.
  • Epoch length. The paper says each epoch is 2000 episodes §4. The Meta-Dataset loader's length is nEpisode multiplied by the number of base sources, which is 16,000 with the eight default sources meta_h5_dataset.py meta_h5_dataset.py.
  • Image size. The paper says 84 × 84 for miniImageNet and 32 × 32 for CIFAR-FS §4. The code default is 224 for both, unless --img-size is passed args.py mini_imagenet.py cifar_fs.py.
  • Evaluation split for miniImageNet and CIFAR-FS. The paper reports 600 test episodes §4. With --eval the code evaluates the fixed 1000-episode validation file (val1000Episode JSON) [code: datasets/init.py#L72-L73] [code: datasets/init.py#L52-L53] mini_imagenet.py. The Meta-Dataset path uses the test split with 600 episodes, as in the paper meta_h5_dataset.py.
  • Augmentation during meta-training. The paper says data augmentation is turned off §4. The miniImageNet training transform still applies random resized crops (scale 0.05 to 1), colour jitter of 0.4 and horizontal flips mini_imagenet.py.
  • Learning-rate search for fine-tuning. The paper uses N = 5 tasks per domain §3.3. The Meta-Dataset script scores each candidate learning rate on the first six episodes of the test-split loader, using query labels, then reports accuracy on the same test loader test_meta_dataset.py engine.py meta_h5_dataset.py. The reported accuracy is therefore chosen on the same split it reports. The paper does not say which split the N tasks come from.
  • Learning-rate grid for CDFSL. The paper uses {0.01, 0.001, 0.0001, 0} §3.3. The Meta-Dataset script uses {0, 1e-4, 1e-3, 1e-2} test_meta_dataset.py, and the CDFSL script uses {0, 1e-4, 5e-4, 1e-3} test_bscdfsl.py.
  • Fine-tuning steps and default. The ablation fixes 50 steps and probability 0.9 [supp. §3]. The argument default is 40 args.py, the class default is 50 deploy.py, and the README examples use 100 steps [README: Fine-tuning on meta-test tasks].
  • Augmentation decision. The code decides once per step whether to augment the whole support batch, rather than per image utils.py.
  • Per-episode learning-rate search. The code also has a finetune_autolr option that holds out part of each support set to choose the learning rate per episode deploy.py. The paper describes a per-domain search, and the README and test scripts use the per-domain version. The LaTeX source contains a commented-out supplementary paragraph saying the main results used per-episode fine-tuning. It is not in the compiled paper, so this card follows the main text.
  • Algorithm 1 notation. The pseudocode writes the logits as the norm of the feature times the norm of the prototype. The code normalises each vector separately and applies the learned scale and bias alg. 1 protonet.py deploy.py.
  • README Meta-Dataset learning rate. The README gives --lr 5e-4 for Meta-Dataset, ten times the paper's common 5e-5 [README: On Meta-Dataset with 8 source domains] §4.
  • Pre-training code. The repository has no pre-training script. It loads released checkpoints such as DINO ViT-small from the DINO release URL [code: models/init.py#L70-L80].

Pitfalls

  • Learning-rate selection leaks into reported numbers in the code. The Meta-Dataset and CDFSL scripts pick the fine-tuning learning rate with query labels from the test split, then report accuracy on that split test_meta_dataset.py test_bscdfsl.py. Treat the code's fine-tuning numbers as optimistic until a held-out split is used. The paper's intent is a few labelled tasks per domain, but it does not say where they come from §3.3.
  • Fine-tuning is expensive. Each test task backpropagates through the full backbone for many steps. The authors say this may not run on embedded platforms without backpropagation §5. The cost scales with the number of steps (50 in the ablation, 40 in the code default, 100 in the README examples) [supp. §3] args.py.
  • Learning rate sensitivity. A single fixed rate such as 0.01 helps some Meta-Dataset domains and hurts others. The paper attributes the inconsistent fine-tuning gains to this §4.1.2 tab. 3.
  • Peak learning rate depends on the number of GPUs. Under the code's fp16 scaling, the effective peak is proportional to the number of GPUs. Check the logged learning rate before comparing runs main.py.
  • Unstated details. The paper does not state the optimiser, weight decay, batch of episodes per update, number of GPUs, Meta-Dataset image size, validation episode count, pre-training hyperparameters, or whether the model is in training mode during meta-training §4. The code fills most of these, but the values are code defaults and may not be what the paper's numbers used.
  • Class overlap. Pre-training on ImageNet-1k shares classes with several meta-test datasets, and the paper says CUB, aircraft and COCO have class overlap with ImageNet §4.1.1 (footnote). The paper argues that overlap is hard to avoid in practical benchmarks and that the self-supervised community does not treat it as a problem. It notes the overlap is less common in FSL pipelines §4.1.1.
  • Inconsistent averages inside the paper. Table 1 gives 78.4 and 79.2 for the Meta-Dataset average of DINO ViT-small and ViT-base with ProtoNet, while the supplement gives 78.528 and 79.507 for the same rows tab. 1 [supp. §1]. Use the table you are reproducing and cite it.
  • Not directly comparable. The authors say their numbers are not directly comparable to much prior work, because the architecture and external data differ §4.2. Do not read the rows in Tables 4 to 6 as a fair ranking.
  • Domain is undefined outside Meta-Dataset. The learning-rate search is per domain §3.3, but the paper does not say how a new task's domain is identified beyond the Meta-Dataset datasets.
  • Table 4 and Tables 5 to 6 may use different protocols. Table 4 rows match the no-fine-tuning ProtoNet numbers in Table 1. Table 5's ViT-small row matches the tuned fine-tuning row in Table 3. The text does not state the fine-tuning setting for Table 6 tab. 1 tab. 3 tab. 4 tab. 5 tab. 6.

Lineage

  • Builds on: ProtoNet (Snell et al., prototypical networks; cited in the paper as [snell2017prototypical]) for the meta-training classifier. The change is cosine distance, a ViT or ResNet backbone, and external pre-training §3.2.
  • Builds on: test-time fine-tuning of the support set, as in the works cited as [guo2020broader] and [li2021improvingFSL]. The change is that augmented support images form the pseudo query set, rather than the support set itself, and the whole backbone is updated rather than part of it §3.3.
  • Builds on: self-supervised foundation models such as DINO, BEiT and CLIP, used as released checkpoints §3.1.
  • Compared against: MetaOptNet, MetaQDA, SIB, PT-MAP, CNAPs, SUR, URT, URL, ITA, FLUTE and others in Tables 2 and 4 to 6 tab. 2 tab. 4 tab. 5 tab. 6.
  • Superseded by: none recorded in this wiki.

Source and license

Adapted from “Pushing the Limits of Simple Pipelines for Few-Shot Learning: External Data and Fine-Tuning Make a Difference” by Shell Xu Hu, Da Li, Jan Stühmer, Minyoung Kim, Timothy M. Hospedales (arXiv:2204.07305), 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. Code citations refer to https://github.com/hushell/pmf_cvpr22 at commit 25bf65f01340 (Apache-2.0). Any quoted code is shown under that license.