SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2202.01339 · NeurIPS · 2022

Understanding Cross-Domain Few-Shot Learning Based on Domain Similarity and Few-Shot Difficulty

Jaehoon Oh, Se-Young Yun, Sungnyun Kim, Namgyu Ho, Jin-Hwa Kim, Hwanjun Song

arXiv · PDF · Open in the Atlas

Code that ran

5 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; 1 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 3 failures of our instrument; 2 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2202.01339.json · badge: /api/ran/2202.01339.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
sungnyun/cd-fsl community (classifier label)
classifier basis not recorded on the link
5 ran · 2 no recorded run
FunctionStatusWhere it lives
conv3x3 Ran
ran; our contract draft was wrong, not the code
sungnyun/cd-fsl/backbone.py
pointer only (licence: MIT); the stored copy get_code serves, from lixiaotong97/DSU, is pointer only (licence: NONE) · get_code("fac5364e2f53c6db")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from lixiaotong97/DSU, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

default Ran
ran, violated the contract we drafted
sungnyun/cd-fsl/methods/byol.py
code served (permissive licence) · get_code("1c0f269ae9673b08")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned int, ndim 0, dtype family int, shape () 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 numpy as np

# The function `default` takes two parameters:
# - val: any value that might be None
# - def_val: a default value to return if val is None

# Test case 1: val is None, should return def_val
val_none = None
def_val_1 = 42

# Test case 2: val is not None, should return val
val_not_none = "some_value"
def_val_2 = "default_value"

# We'll use the first test case for ARGS
ARGS = {
    'val': val_none,
    'def_val': def_val_1
}
Setup block drafted by
a language model, Claude Sonnet 4.5, prompt python_fixture_v1
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, shape () — shape () 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
euclidean_dist Ran
ran; our contract draft was wrong, not the code
sungnyun/cd-fsl/methods/protonet.py
code served (permissive licence) · get_code("4dd319c45d372246")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 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

torch.manual_seed(0)

# Create two tensors with different numbers of samples but same feature dimension
# x: n samples with d features
# y: m samples with d features
# Using distinct sizes: n=2, m=3, d=4

x = torch.randn(2, 4)  # 2 samples, 4 features
y = torch.randn(3, 4)  # 3 samples, 4 features

ARGS = {
    'x': x,
    'y': y
}
Setup block drafted by
a language model, Claude Sonnet 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
flatten Ran
ran, honoured the contract we drafted
sungnyun/cd-fsl/methods/byol.py
code served (permissive licence) · get_code("4daa3e876f494d75")
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, 12) 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)

# The flatten function takes a tensor t and reshapes it to (batch_size, -1)
# It accesses t.shape and t.reshape()
# We need a tensor with at least 2 dimensions where the first is the batch dimension

t = torch.randn(2, 4, 3)  # batch_size=2, other dims will be flattened to 12

ARGS = {
    "t": t
}
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, 12) — shape (2, 12) 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
singleton Ran
ran; our contract draft was wrong, not the code
sungnyun/cd-fsl/methods/byol.py
code served (permissive licence) · get_code("c6bc247ffa36099c")
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 function. 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 functools import wraps

# Define the singleton decorator
def singleton(cache_key):
    def inner_fn(fn):
        @wraps(fn)
        def wrapper(self, *args, **kwargs):
            instance = getattr(self, cache_key)
            if instance is not None:
                return instance
            instance = fn(self, *args, **kwargs)
            setattr(self, cache_key, instance)
            return instance
        return wrapper
    return inner_fn

# Create a test class that uses the singleton decorator
class TestClass:
    def __init__(self):
        self._cached_model = None
    
    @singleton('_cached_model')
    def get_model(self):
        return nn.Linear(4, 3)

# Test the decorator by calling it
test_obj = TestClass()
model1 = test_obj.get_model()
model2 = test_obj.get_model()

# Verify caching works
assert model1 is model2, "Singleton caching failed"

# Define ARGS for the singleton function
ARGS = {
    'cache_key': '_cached_model'
}
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 function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
ResNet10 Not yet run
unverified (harvested, no recorded run)
sungnyun/cd-fsl/backbone.py
code served (permissive licence) · get_code("70c0c18a54fee43a")
How it ran

no invocation recorded.

get_backbone_class Not yet run
unverified (harvested, no recorded run)
sungnyun/cd-fsl/backbone.py
code served (permissive licence) · get_code("6318ff1a841efa4f")
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, 5 are also present in other papers whose code we hold (5 with at least one paper dated earlier, 3 the same month, 5 later) and 2 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
conv3x3 686 other papers
368 dated earlier, 5 the same month, 302 later, 11 same year, order not determinable · 31 only as an assembly brick
1406.2661 (2014-06)
Generative Adversarial Networks
1409.0575 (2014-09)
ImageNet Large Scale Visual Recognition Challenge
1412.6572 (2014-12)
Explaining and Harnessing Adversarial Examples
and 683 more not named here
euclidean_dist 16 other papers
9 dated earlier, 1 the same month, 6 later · 2 only as an assembly brick
1703.05175 (2017-03)
Prototypical Networks for Few-shot Learning
1902.08605 (2019-02)
Are Few-Shot Learning Benchmarks too Simple ? Solving them without Task Supervision at Test-Time
1905.13613 (2019-05)
Regression Networks for Meta-Learning Few-Shot Classification
and 13 more not named here
default 11 other papers
7 dated earlier, 4 later
2006.07733 (2020-06)
Bootstrap your own latent: A new approach to self-supervised Learning
2010.10241 (2020-10)
BYOL works even without batch statistics
2011.10043 (2020-11)
Propagate Yourself: Exploring Pixel-Level Consistency for Unsupervised Visual Representation Learning
and 8 more not named here
flatten 9 other papers
5 dated earlier, 4 later · 1 only as an assembly brick
2006.07733 (2020-06)
Bootstrap your own latent: A new approach to self-supervised Learning
2010.10241 (2020-10)
BYOL works even without batch statistics
2103.03230 (2021-03)
Barlow Twins: Self-Supervised Learning via Redundancy Reduction
and 6 more not named here
singleton 8 other papers
4 dated earlier, 1 the same month, 3 later
2006.07733 (2020-06)
Bootstrap your own latent: A new approach to self-supervised Learning
2010.10241 (2020-10)
BYOL works even without batch statistics
2103.06695 (2021-03)
BYOL for Audio: Self-Supervised Learning for General-Purpose Audio Representation
and 5 more not named here

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

Cross-domain few-shot learning (CD-FSL) has drawn increasing attention for handling large differences between the source and target domains-an important concern in real-world scenarios. To overcome these large differences, recent works have considered exploiting small-scale unlabeled data from the target domain during the pre-training stage. This data enables self-supervised pre-training on the target domain, in addition to supervised pre-training on the source domain. In this paper, we empirically investigate which pre-training is preferred based on domain similarity and few-shot difficulty of the target domain. We discover that the performance gain of self-supervised pre-training over supervised pre-training becomes large when the target domain is dissimilar to the source domain, or the target domain itself has low few-shot difficulty. We further design two pre-training schemes, mixed-supervised and two-stage learning, that improve performance. In this light, we present six findings for CD-FSL, which are supported by extensive experiments and analyses on three source and eight target benchmark datasets with varying levels of domain similarity and few-shot difficulty. Our code is available at https://github.com/sungnyun/understanding-cdfsl.

For agents

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

get_harvested_code_for_paper("2202.01339")
get_code_for_paper("2202.01339")
have("2202.01339")

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

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

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

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

Connect an agent — have() is free.