SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2603.00478 · 2026

Benchmarking Few-shot Transferability of Pre-trained Models with Improved Evaluation Protocols

Xu Luo, Jingkuan Song, Lianli Gao, Heng Shen, Ji Zhang

arXiv · PDF · Open in the Atlas

Code that ran

6 of 7 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 3 have no contract verdict; 3 failures of our instrument; 1 no recorded run), measured 2026-11-22; 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/2603.00478.json · badge: /api/ran/2603.00478.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
Frankluox/FewTrans community
Papers with Code archive
6 ran · 1 no recorded run
FunctionStatusWhere it lives
CC_head Ran
ran on a synthesized input
Frankluox/FewTrans/architectures/classifier/finetune.py
code served (permissive licence) · get_code("9c307f84a120b3e3")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 2, dtype family float, shape (2, 3) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.utils.weight_norm import WeightNorm

class Linear_normalized(nn.Linear):

    def __init__(self, in_features: int, out_features: int) -> None:
        super().__init__(in_features, out_features, False)

    def forward(self, input):
        return F.linear(input, F.normalize(self.weight, dim=1), self.bias)

def weight_norm(module, name='weight', dim=0):
    WeightNorm.apply(module, name, dim)
    return module

class CC_head(nn.Module):

    def __init__(self, indim, outdim, scale_cls=10.0, learn_scale=True):
        super().__init__()
        self.L = weight_norm(Linear_normalized(indim, outdim), name='weight', dim=0)
        self.scale_cls = nn.Parameter(torch.FloatTensor(1).fill_(scale_cls), requires_grad=learn_scale)

    def forward(self, features):
        assert features.dim() == 2
        x_normalized = F.normalize(features, p=2, dim=1, eps=1e-12)
        cos_dist = self.L(x_normalized)
        classification_scores = self.scale_cls * cos_dist
        return classification_scores

INIT_ARGS = {
    'indim': 4,
    'outdim': 3,
    'scale_cls': 10.0,
    'learn_scale': True
}

ARGS = {
    'features': torch.randn(2, 4)
}

if __name__ == '__main__':
    model = CC_head(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Output: {output}")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
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, 3) — shape (2, 3) 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
FinetuneModel Ran
ran on a synthesized input
Frankluox/FewTrans/architectures/classifier/finetune.py
code served (permissive licence) · get_code("6e7626e8fa75cc1e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 2, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import torch.nn.functional as F
from copy import deepcopy
from torch.nn.utils.weight_norm import WeightNorm

class CC_head(nn.Module):

    def __init__(self, indim, outdim, scale_cls=10.0, learn_scale=True):
        super().__init__()
        self.L = weight_norm(Linear_normalized(indim, outdim), name='weight', dim=0)
        self.scale_cls = nn.Parameter(torch.FloatTensor(1).fill_(scale_cls), requires_grad=learn_scale)

    def forward(self, features):
        assert features.dim() == 2
        x_normalized = F.normalize(features, p=2, dim=1, eps=1e-12)
        cos_dist = self.L(x_normalized)
        classification_scores = self.scale_cls * cos_dist
        return classification_scores

class Linear_normalized(nn.Linear):

    def __init__(self, in_features: int, out_features: int) -> None:
        super().__init__(in_features, out_features, False)

    def forward(self, input):
        return F.linear(input, F.normalize(self.weight, dim=1), self.bias)

def weight_norm(module, name='weight', dim=0):
    WeightNorm.apply(module, name, dim)
    return module

class FinetuneModel(torch.nn.Module):
    def __init__(self, backbone, way, device, use_alpha, use_beta, head):
        super().__init__()
        self.backbone = deepcopy(backbone).to(device)
        if head == 'cc':
            self.L = CC_head(backbone.outdim, way).to(device)
        elif head == 'fc':
            self.L = nn.Linear(backbone.outdim, way).to(device)
            self.L.weight.data.fill_(1)
            self.L.bias.data.fill_(0)
        self.use_beta = use_beta
        self.head = head

    def forward(self, x, backbone_grad=True):
        if backbone_grad:
            x = self.backbone(x)
        else:
            with torch.no_grad():
                x = self.backbone(x)
        if self.head == 'NCC' and self.use_beta:
            x = self.backbone.beta(x)
        if x.dim() == 4:
            x = F.adaptive_avg_pool2d(x, 1).squeeze_(-1).squeeze_(-1)
        x = F.normalize(x, dim=1)
        if not self.head == 'NCC':
            x = self.L(x)
        return x

class DummyBackbone(nn.Module):
    def __init__(self, outdim):
        super().__init__()
        self.outdim = outdim
        self.conv = nn.Conv2d(3, 8, 3, padding=1)
        self.fc = nn.Linear(8, outdim)
        self.beta = nn.Linear(outdim, outdim)
    
    def forward(self, x):
        if x.dim() == 4:
            x = self.conv(x)
            x = F.adaptive_avg_pool2d(x, 1).squeeze_(-1).squeeze_(-1)
            x = self.fc(x)
        else:
            x = self.fc(x)
        return x

backbone = DummyBackbone(outdim=6)

INIT_ARGS = {
    'backbone': backbone,
    'way': 5,
    'device': 'cpu',
    'use_alpha': False,
    'use_beta': False,
    'head': 'cc'
}

ARGS = {
    'x': torch.randn(2, 3, 8, 8),
    'backbone_grad': True
}
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
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 — no output shape is stated: observe_signature.py observed this class with its constructor sizes canonicalised where it could, which the node does not record, so its shape is not stated as this setup block's
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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
Linear_normalized Ran
ran on a synthesized input
Frankluox/FewTrans/architectures/classifier/finetune.py
code served (permissive licence) · get_code("b7ff4274adef3152")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 2, dtype family float, shape (2, 3) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

INIT_ARGS = {
    'in_features': 4,
    'out_features': 3,
}

ARGS = {
    'input': torch.randn(2, 4),
}

if __name__ == '__main__':
    from torch.nn.functional import normalize, linear
    
    class Linear_normalized(nn.Linear):
        def __init__(self, in_features: int, out_features: int) -> None:
            super().__init__(in_features, out_features, False)

        def forward(self, input):
            return linear(input, normalize(self.weight, dim=1), self.bias)
    
    model = Linear_normalized(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Output: {output}")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
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, 3) — shape (2, 3) 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
compute_prototypes Ran
ran; our contract draft was wrong, not the code
Frankluox/FewTrans/architectures/classifier/finetune.py
code served (permissive licence) · get_code("49c7656c86e98689")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned Tensor, ndim 2, dtype family float, shape (3, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Analyze the function:
# - features_support: used with torch.mm(), so needs to be a 2D tensor
# - labels_support: transposed (0,1), used with torch.mm(), sum(dim=1), expand_as()
# 
# The function computes prototypes by:
# 1. Transposing labels_support
# 2. Matrix multiply: labels_support_transposed @ features_support
# 3. Normalizing by sum of labels per class
#
# For torch.mm(A, B) to work: A is (n_classes, n_samples), B is (n_samples, n_features)
# So labels_support should be (n_samples, n_classes) and features_support should be (n_samples, n_features)

n_samples = 2
n_classes = 3
n_features = 4

# features_support: (n_samples, n_features)
features_support = torch.randn(n_samples, n_features)

# labels_support: (n_samples, n_classes) - one-hot or soft labels
# Each row is a sample, each column is a class
labels_support = torch.tensor([
    [1.0, 0.0, 0.0],
    [0.0, 1.0, 0.0]
], dtype=torch.float32)

ARGS = {
    "features_support": features_support,
    "labels_support": labels_support
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (3, 4) — shape (3, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
prototype_scores Ran
ran; our contract draft was wrong, not the code
Frankluox/FewTrans/architectures/classifier/finetune.py
code served (permissive licence) · get_code("d40e49983134b77a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned Tensor, ndim 2, dtype family float, shape (2, 3) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn.functional as F

torch.manual_seed(0)

# Create small tensors for the function
# support_embeddings: shape (num_support, embedding_dim)
# support_labels: shape (num_support,) with class indices
# query_embeddings: shape (num_query, embedding_dim)

num_support = 6
num_query = 2
embedding_dim = 4
num_classes = 3

# Support embeddings: 6 samples with 4-dim embeddings
support_embeddings = torch.randn(num_support, embedding_dim)

# Support labels: 6 samples with class indices (0, 1, or 2)
# Make sure we have at least one sample per class for valid prototypes
support_labels = torch.tensor([0, 0, 1, 1, 2, 2], dtype=torch.long)

# Query embeddings: 2 samples with 4-dim embeddings
query_embeddings = torch.randn(num_query, embedding_dim)

ARGS = {
    "support_embeddings": support_embeddings,
    "support_labels": support_labels,
    "query_embeddings": query_embeddings,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 3) — shape (2, 3) 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
weight_norm Ran
ran; our contract draft was wrong, not the code
Frankluox/FewTrans/architectures/classifier/finetune.py
code served (permissive licence) · get_code("2471db1563b59f62")
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 Linear. 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
from torch.nn.utils.weight_norm import weight_norm

torch.manual_seed(0)

# Create a simple module with a weight parameter
module = nn.Linear(in_features=3, out_features=4, bias=True)

# Define arguments for weight_norm function
ARGS = {
    'module': module,
    'name': 'weight',
    'dim': 0
}
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 Linear — a Linear output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Linear 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
Finetuner Not yet run
unverified (harvested, no recorded run)
Frankluox/FewTrans/architectures/classifier/finetune.py
code served (permissive licence) · get_code("993d6647ab035c82")
How it ran

no invocation recorded.

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 7 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.

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

Few-shot transfer has been revolutionized by stronger pre-trained models and improved adaptation algorithms. However, there lacks a unified, rigorous evaluation protocol that is both challenging and realistic for real-world usage. In this work, we establish FEWTRANS, a comprehensive benchmark containing 10 diverse datasets, and propose the Hyperparameter Ensemble (HPE) protocol to overcome the "validation set illusion" in data-scarce regimes. Our empirical findings demonstrate that the choice of pre-trained model is the dominant factor for performance, while many sophisticated transfer methods offer negligible practical advantages over a simple full-parameter fine-tuning baseline. To explain this surprising effectiveness, we provide an in-depth mechanistic analysis showing that full finetuning succeeds via distributed micro-adjustments and more flexible reshaping of high-level semantic representations without suffering from overfitting. Additionally, we quantify the performance collapse of multimodal models in specialized domains as a result of linguistic rarity using adjusted Zipf frequency scores. By releasing FEWTRANS, we aim to provide a rigorous "ruler" to streamline reproducible advances in few-shot transfer learning research. We make the FEWTRANS benchmark publicly available at https://github.com/Frankluox/FewTrans. Recent progress in computer vision [1]-[4] suggests that good performance on a variety of vision tasks can be achieved at low cost by transferring a pretrained, large-scale model with only a few labeled samples, facilitating downstream scenarios where labeled data can be expensive or difficult to obtain. This few-shot transferability of pre-trained models can be further improved by adopting recently proposed transfer algorithms that are claimed to be better than vanilla finetuning in terms of accuracy or efficiency, such as partial finetuning [5], low-rank adaptation [6], adapter tuning [7]-[10], meta-learning [11]-[13], prompt tuning [14]-[17] and so on. However, the evaluation criteria of few-shot transfer have not been unified and diverge across separate threads of research, which hinders newly proposed pretrained models or transfer algorithms from being accurately evaluated and compared with previous ones. Through systematic experiments, we identify two critical deficiencies in previous evaluation setups caused by the specific nature of few-shot problems. First, we observe a "sampling lottery" effect, where extreme performance variation caused by random task sampling makes

For agents

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

get_harvested_code_for_paper("2603.00478")
get_code_for_paper("2603.00478")
have("2603.00478")

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

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

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

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

Connect an agent — have() is free.