SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2007.04238 · 2020

Predicting the Accuracy of a Few-Shot Classifier

arXiv · PDF · Open in the Atlas

Code that ran

19 of 24 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 19 have no contract verdict; 0 failures of our instrument; 5 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/2007.04238.json · badge: /api/ran/2007.04238.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
mbonto/fewshot_generalization canonical (classifier label)
classifier basis: census
19 ran · 5 no recorded run
FunctionStatusWhere it lives
connect_parts_labels Ran
ran on a synthesized input
mbonto/fewshot_generalization/case_study_toolbox/monitoring.py
code served (permissive licence) · get_code("76f9783a1b61d46b")
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 float, ndim 0, dtype family float, 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 numpy as np
import torch

torch.manual_seed(0)

class MockRecorder:
    def record_balance(self, value):
        pass

# Create a simple graph representation (list of nodes)
graph = [0, 1, 2, 3, 4]

# Create part_a and part_b (subsets of nodes)
part_a = [0, 1]
part_b = [2, 3]

# Create labels tensor matching graph size
labels = torch.LongTensor([0, 0, 1, 1, 0])

# Define label values
label_0 = 0
label_1 = 1

# Create recorder
recorder = MockRecorder()

ARGS = {
    "recorder": recorder,
    "graph": graph,
    "part_a": part_a,
    "part_b": part_b,
    "labels": labels,
    "label_0": label_0,
    "label_1": label_1
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, 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
cosine_loss Ran
ran on a synthesized input
mbonto/fewshot_generalization/case_study_toolbox/diffusion_graph.py
code served (permissive licence) · get_code("57cb3daace2b4a07")
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 Tensor, ndim 0, dtype family float, 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

torch.manual_seed(0)

# z_latent: tensor used in einsum operations, should be shape (num_nodes, latent_dim)
z_latent = torch.randn(2, 4)

# bad_edges: list of tuples (a, b) where a and b are indices into z_latent
bad_edges = [(0, 1), (1, 0)]

# reduce: boolean flag
reduce = True

# memory_light: boolean flag
memory_light = False

ARGS = {
    'z_latent': z_latent,
    'bad_edges': bad_edges,
    'reduce': reduce,
    'memory_light': memory_light,
}
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 Tensor, ndim 0, dtype family float, 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
data_subset Ran
ran on a synthesized input
mbonto/fewshot_generalization/case_study_toolbox/loaders.py
code served (permissive licence) · get_code("19edf953403955ef")
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 tuple. 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 numpy as np

torch.manual_seed(0)

# Create sample data and labels
# The function expects:
# - data: a tensor that can be indexed with slices
# - labels: a tensor with unique label values
# - n_way: an integer specifying number of ways
# - ways: optional array of label indices to use

# Create data tensor with shape (8, 4) - 8 samples, 4 dimensions
data = torch.randn(8, 4)

# Create labels tensor with 4 unique labels (0, 1, 2, 3), 2 samples per label
labels = torch.LongTensor([0, 0, 1, 1, 2, 2, 3, 3])

# n_way: number of ways to sample (should be <= num_labels)
n_way = 2

ARGS = {
    "data": data,
    "labels": labels,
    "n_way": n_way,
    "ways": None
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is 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
degree Ran
ran on a synthesized input
mbonto/fewshot_generalization/toolbox/gsp.py
code served (permissive licence) · get_code("74f0e34092be4477")
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 Tensor, ndim 1, dtype family float, shape (2,) 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 function takes a graph parameter and computes the sum along dimension 1
# A graph is expected to be a tensor where we can sum along dim=1
# This is typically an adjacency matrix representation
# Shape: (num_nodes, num_nodes) or similar

graph = torch.randn(2, 4)

ARGS = {
    "graph": graph
}
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 Tensor, ndim 1, dtype family float, shape (2,) — shape (2,) 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
get_edges Ran
ran on a synthesized input
mbonto/fewshot_generalization/dot_correlation.py
code served (permissive licence) · get_code("7938ba61451c14fc")
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 dict. 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 networkx as nx

# Create a simple directed graph with weighted edges
dot_graph = nx.DiGraph()
dot_graph.add_edge(0, 1, weight=0.5)
dot_graph.add_edge(1, 2, weight=0.7)
dot_graph.add_edge(0, 2, weight=0.3)

ARGS = {
    'dot_graph': dot_graph
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
networkx — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
get_item Ran
ran on a synthesized input
mbonto/fewshot_generalization/case_study_toolbox/diffusion_graph.py
code served (permissive licence) · get_code("43da13fb5c9762a9")
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 float, ndim 0, dtype family float, 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

torch.manual_seed(0)

# The function calls .item() on the loss object, which is a method
# that converts a scalar tensor to a Python float.
# We need to create a scalar tensor (0-dimensional tensor).
loss = torch.tensor(2.5)

ARGS = {
    "loss": loss
}
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 float, ndim 0, dtype family float, 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
get_labels_stats Ran
ran on a synthesized input
mbonto/fewshot_generalization/case_study_toolbox/loaders.py
code served (permissive licence) · get_code("c2d2c9f53982f213")
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 tuple, ndim 1, dtype family int; 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

torch.manual_seed(0)

# Create a small tensor of labels
# The function calls torch.unique(labels).numpy().tolist() and checks shape[0]
# So we need a 1D or 2D tensor of integer labels
labels = torch.tensor([0, 0, 1, 1, 2, 2])

ARGS = {
    "labels": labels
}
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 tuple, ndim 1, dtype family int — a tuple output has no array shape of its own; none is stated
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
get_num_tests Ran
ran on a synthesized input
mbonto/fewshot_generalization/main_smooth.py
code served (permissive licence) · get_code("ebc8551f6c060c8b")
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 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

torch.manual_seed(0)

ARGS = {
    'training_type': 'single'
}
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 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
get_optimizer_myriam Ran
ran on a synthesized input
mbonto/fewshot_generalization/case_study_toolbox/classifiers.py
code served (permissive licence) · get_code("fbfb2b6c73aab0f3")
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 SGD. 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

torch.manual_seed(0)

# Create a minimal classifier that has parameters
class MinimalClassifier(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 2)
    
    def forward(self, x):
        return self.linear(x)

classifier = MinimalClassifier()

epoch = 5
n_epoch = 15

ARGS = {
    "classifier": classifier,
    "epoch": epoch,
    "n_epoch": n_epoch,
}
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 SGD — a SGD output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a SGD 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
get_optimizer_xuqing Ran
ran on a synthesized input
mbonto/fewshot_generalization/case_study_toolbox/classifiers.py
code served (permissive licence) · get_code("0bda046cfba112f7")
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 Adam. 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

torch.manual_seed(0)

class SimpleClassifier(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear1 = nn.Linear(4, 8)
        self.linear2 = nn.Linear(8, 2)
    
    def forward(self, x):
        x = torch.relu(self.linear1(x))
        x = self.linear2(x)
        return x

classifier = SimpleClassifier()

ARGS = {
    "classifier": classifier
}
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 Adam — a Adam output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Adam 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
l2_norm Ran
ran on a synthesized input
mbonto/fewshot_generalization/toolbox/load_data.py
code served (permissive licence) · get_code("f25da1f56ee17efe")
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 Tensor, ndim 2, dtype family float, shape (2, 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)

# Create a small tensor with shape (batch_size=2, features=4)
# The function divides each feature vector by its L2 norm along dim=1
data_set = torch.randn(2, 4)

ARGS = {
    "data_set": data_set
}
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 Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 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
min_cut_volume Ran
ran on a synthesized input
mbonto/fewshot_generalization/case_study_toolbox/monitoring.py
code served (permissive licence) · get_code("d45ef2e493387bc4")
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 float, ndim 0, dtype family float, 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
import networkx as nx

torch.manual_seed(0)

# Create a simple recorder mock
class Recorder:
    def record_balance(self, value):
        pass

# Create a simple graph with 2+ nodes for minimum_edge_cut
graph = nx.Graph()
graph.add_nodes_from([0, 1, 2, 3])
graph.add_edges_from([(0, 2), (0, 3), (1, 2), (1, 3)])

# Create labels tensor - need at least 2 elements for labels[0] and labels[1]
labels = torch.LongTensor([0, 1, 0, 1])

# Create params object with n_shot and n_way attributes
class Params:
    def __init__(self):
        self.n_shot = 1
        self.n_way = 2

params = Params()

# Create recorder instance
recorder = Recorder()

ARGS = {
    "recorder": recorder,
    "graph": graph,
    "labels": labels,
    "params": params
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
networkx, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, 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
parse_args Ran
ran on a synthesized input
mbonto/fewshot_generalization/case_study_toolbox/parse_grid.py
code served (permissive licence) · get_code("0372e4fb3bb09d78")
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 Namespace. 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 argparse

def parse_args(modes):
    parser = argparse.ArgumentParser(description='Graph Smoothness.')
    parser.add_argument('--dataset', default='wideresnet', help='Dataset key.')
    parser.add_argument('--mode', default='monitoring_volume', help='Mode of regularization. Can be %s' % modes)
    parser.add_argument('--classifier', default='logistic_regression', help='How to classify examples.')
    parser.add_argument('--n_way', default=5, type=int, help='number of classes.')
    parser.add_argument('--n_val', default=595, type=int, help='number of validation examples.')
    parser.add_argument('--n_shot', default=5, type=int, help='number of training examples.')
    parser.add_argument('--dot_name', default='densenet-m/novel/louvain_dendrogram_communities_1_20.dot')
    parser.add_argument('--arena', action='store_true')
    return parser.parse_args()

modes = ['monitoring_volume', 'regularization', 'smoothing']

ARGS = {
    'modes': modes
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Namespace — a Namespace output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Namespace 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
similarity Ran
ran on a synthesized input
mbonto/fewshot_generalization/toolbox/gsp.py
code served (permissive licence) · get_code("8cfe5c8977d8ff8b")
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 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 small tensors for data1 and data2
# data1: shape (2, 4) - 2 samples, 4 dimensions
# data2: shape (3, 4) - 3 samples, 4 dimensions
data1 = torch.randn(2, 4)
data2 = torch.randn(3, 4)

# metric parameter - must be 'cosine' based on the function implementation
metric = 'cosine'

# alpha parameter with default value
alpha = 1

ARGS = {
    'data1': data1,
    'data2': data2,
    'metric': metric,
    'alpha': alpha
}
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 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
split_train_test Ran
ran on a synthesized input
mbonto/fewshot_generalization/case_study_toolbox/loaders.py
code served (permissive licence) · get_code("b8616787a1c2279e")
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 tuple. 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 numpy as np

torch.manual_seed(0)
np.random.seed(0)

# Create synthetic data
# We need:
# - data: tensor with shape (n_samples, feature_dim)
# - labels: tensor with shape (n_samples,) containing class indices
# - n_shot: number of training samples per class
# - n_val: number of validation samples per class

num_classes = 3
samples_per_class = 8
feature_dim = 4

# Create data tensor: (24, 4) - 3 classes * 8 samples each, 4 features
data = torch.randn(num_classes * samples_per_class, feature_dim)

# Create labels tensor: (24,) - labels 0,1,2 repeated 8 times each
labels = torch.tensor([i for i in range(num_classes) for _ in range(samples_per_class)])

n_shot = 3
n_val = 2

ARGS = {
    'data': data,
    'labels': labels,
    'n_shot': n_shot,
    'n_val': n_val
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is 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
stoer_wagner_volume Ran
ran on a synthesized input
mbonto/fewshot_generalization/case_study_toolbox/monitoring.py
code served (permissive licence) · get_code("05c87e1dea719839")
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 float, ndim 0, dtype family float, 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 numpy as np
import torch
import networkx as nx

torch.manual_seed(0)

class MockRecorder:
    def record_balance(self, value):
        pass

class MockParams:
    def __init__(self):
        self.n_way = 2
        self.n_shot = 1

# Create a simple graph with 4 nodes
graph = nx.Graph()
graph.add_edges_from([(0, 1), (1, 2), (2, 3)])

# Create labels: 2 nodes with label 0, 2 nodes with label 1
labels = torch.LongTensor([0, 0, 1, 1])

recorder = MockRecorder()
params = MockParams()

ARGS = {
    "recorder": recorder,
    "graph": graph,
    "labels": labels,
    "params": params,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
networkx, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, 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
symmetrize_edges Ran
ran on a synthesized input
mbonto/fewshot_generalization/case_study_toolbox/diffusion_graph.py
code served (permissive licence) · get_code("28375cac1a41f128")
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 list. 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 numpy as np

torch.manual_seed(0)

# Construct edge_loss_pairs
# The function expects an iterable of tuples where each tuple is:
# (loss, (a, b)) where loss is a scalar and (a, b) is a tuple of node indices

edge_loss_pairs = [
    (0.5, (0, 1)),
    (0.3, (1, 2)),
    (0.7, (2, 3)),
]

ARGS = {
    'edge_loss_pairs': edge_loss_pairs
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list — a list output has no array shape of its own; none is 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
train_logistic_regression Ran
ran on a synthesized input
mbonto/fewshot_generalization/case_study_toolbox/classifiers.py
code served (permissive licence) · get_code("121dd5f5678761d4")
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 logistic_regression. 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 numpy as np

torch.manual_seed(0)

# Create small synthetic data
n_samples = 10
n_features = 4
n_classes = 3

data = torch.randn(n_samples, n_features)
labels = torch.randint(0, n_classes, (n_samples,))

device = 'cpu'

ARGS = {
    'data': data,
    'labels': labels,
    'n_way': n_classes,
    'device': device
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch, tqdm — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type logistic_regression — a logistic_regression output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a logistic_regression 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
train_logistic_regression Ran
ran on a synthesized input
mbonto/fewshot_generalization/toolbox/classifier.py
code served (permissive licence) · get_code("2a63cbfbc83dff58")
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 tuple. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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 numpy as np

torch.manual_seed(0)

# Create small training data
n_samples = 10
n_features = 4
n_classes = 3

# Create synthetic data: (n_samples, n_features)
data = torch.randn(n_samples, n_features)

# Create synthetic labels: (n_samples,) with values in [0, n_classes)
labels = torch.randint(0, n_classes, (n_samples,))

ARGS = {
    "data": data,
    "labels": labels,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is 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
LR_classifier Not yet run
unverified (harvested, no recorded run)
mbonto/fewshot_generalization/toolbox/classifier.py
code served (permissive licence) · get_code("abe1181c3d58647d")
How it ran

no invocation recorded.

compute_dot Not yet run
unverified (harvested, no recorded run)
mbonto/fewshot_generalization/dot_correlation.py
code served (permissive licence) · get_code("cfa9d0d8c2a753e6")
How it ran

no invocation recorded.

get_grid_search_params Not yet run
unverified (harvested, no recorded run)
mbonto/fewshot_generalization/case_study_toolbox/parse_grid.py
code served (permissive licence) · get_code("c83faab26be75af5")
How it ran

no invocation recorded.

gft Not yet run
unverified (harvested, no recorded run)
mbonto/fewshot_generalization/toolbox/gsp.py
code served (permissive licence) · get_code("75e942b8c2514117")
How it ran

no invocation recorded.

sample_case Not yet run
unverified (harvested, no recorded run)
mbonto/fewshot_generalization/toolbox/load_data.py
code served (permissive licence) · get_code("52d2c48eaa7da391")
How it ran

no invocation recorded.

Also present in other papers' code

Of 24 samples lifted from this paper's linked repositories, 24 carry a function identity and 0 do not. Of the 24 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 24 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

In the context of few-shot learning, one cannot measure the generalization ability of a trained classifier using validation sets, due to the small number of labeled samples. In this paper, we are interested in finding alternatives to answer the question: is my classifier generalizing well to previously unseen data? We first analyze the reasons for the variability of generalization performances. We then investigate the case of using transfer-based solutions, and consider three settings: i) supervised where we only have access to a few labeled samples, ii) semi-supervised where we have access to both a few labeled samples and a set of unlabeled samples and iii) unsupervised where we only have access to unlabeled samples. For each setting, we propose reasonable measures that we empirically demonstrate to be correlated with the generalization ability of considered classifiers. We also show that these simple measures can be used to predict generalization up to a certain confidence. We conduct our experiments on standard few-shot vision datasets.

For agents

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

get_harvested_code_for_paper("2007.04238")
get_code_for_paper("2007.04238")
have("2007.04238")

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

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

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

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

Connect an agent — have() is free.