SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2310.00451 · 2023

On the Role of Neural Collapse in Meta Learning Models for Few-shot Learning

arXiv · PDF · Open in the Atlas

Code that ran

9 of 10 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 0 have no contract verdict; 9 failures of our instrument; 1 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/2310.00451.json · badge: /api/ran/2310.00451.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
saakethmm/nc-prototypical-networks canonical (classifier label)
classifier basis: census
9 ran · 1 no recorded run
FunctionStatusWhere it lives
compute_nc1 Ran
ran; our contract draft was wrong, not the code
saakethmm/nc-prototypical-networks/protonets/utils/validate_nc.py
code served (permissive licence) · get_code("059fa545366b5fa9")
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
import torch.linalg as linalg

torch.manual_seed(0)

# Parameters for compute_nc1
# N = number of classes
# K = number of examples per class
# z_dim = feature dimension

N = 3  # number of classes
K = 2  # examples per class
z_dim = 4  # feature dimension

# Create features tensor: (N, K, z_dim)
features = torch.randn(N, K, z_dim)

# Create means tensor: (N, z_dim)
means = torch.randn(N, z_dim)

ARGS = {
    "features": features,
    "means": means,
}
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
compute_sigma_b Ran
ran; our contract draft was wrong, not the code
saakethmm/nc-prototypical-networks/protonets/utils/validate_nc.py
code served (permissive licence) · get_code("e2dc4f756030e978")
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 (4, 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)

# means: (N, z_dim) - N classes, z_dim latent dimension
# global_mean: (z_dim,)
# Let's use N=2 classes, z_dim=4 latent dimension

N = 2
z_dim = 4

means = torch.randn(N, z_dim)
global_mean = torch.randn(z_dim)

ARGS = {
    "means": means,
    "global_mean": global_mean,
}
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 (4, 4) — shape (4, 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
compute_sigma_w Ran
ran; our contract draft was wrong, not the code
saakethmm/nc-prototypical-networks/protonets/utils/validate_nc.py
code served (permissive licence) · get_code("f5a6d13ffcf83043")
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 (4, 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)

# Parameters based on function signature:
# features: (N, K, z_dim) - N classes, K examples per class, z_dim features
# means: (N, z_dim) - mean for each class

N = 2  # number of classes
K = 3  # number of examples per class
z_dim = 4  # feature dimension

features = torch.randn(N, K, z_dim)
means = torch.randn(N, z_dim)

ARGS = {
    "features": features,
    "means": means,
}
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 (4, 4) — shape (4, 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
convert_array Ran
ran; our contract draft was wrong, not the code
saakethmm/nc-prototypical-networks/protonets/utils/log.py
code served (permissive licence) · get_code("4601716ebff8a67b")
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 numpy as np

# Analyze the function:
# - It takes a parameter 'd' which should be a dict
# - It iterates over d.items()
# - For each value v, it checks if v is a dict
# - If v is a dict, it converts each nested value vv to np.array
# - If v is not a dict, it converts v directly to np.array

# Create test data with both nested dicts and simple values
d = {
    "simple_list": [1, 2, 3, 4],
    "simple_value": 42,
    "nested_dict": {
        "inner_list": [1.0, 2.0, 3.0],
        "inner_value": 5
    },
    "another_nested": {
        "data1": [7, 8, 9],
        "data2": [10, 11, 12, 13]
    }
}

ARGS = {
    "d": d
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — 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
euclidean_dist Ran
ran; our contract draft was wrong, not the code
saakethmm/nc-prototypical-networks/protonets/models/utils.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
evaluate Ran
ran; our contract draft was wrong, not the code
saakethmm/nc-prototypical-networks/protonets/utils/model.py
code served (permissive licence) · get_code("6737d2c557fcf23d")
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 torch
import torch.nn as nn
from torch.utils.data import DataLoader

torch.manual_seed(0)

# Define a simple meter class to track metrics
class SimpleMeter:
    def __init__(self):
        self.value = 0.0
    
    def reset(self):
        self.value = 0.0
    
    def add(self, val):
        if isinstance(val, torch.Tensor):
            self.value += val.item()
        else:
            self.value += val

# Define a minimal model that satisfies the function's usage
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def loss(self, sample, model_name):
        # sample is a dict or tuple from data_loader
        # Returns (something, output_dict) where output_dict has fields matching meters
        x = sample
        if isinstance(sample, dict):
            x = sample.get('input', torch.randn(2, 4))
        elif isinstance(sample, (list, tuple)):
            x = sample[0] if len(sample) > 0 else torch.randn(2, 4)
        
        # Produce output dictionary with fields for each meter
        output = {
            'loss': torch.tensor(0.5),
            'accuracy': torch.tensor(0.85),
            'metric': torch.tensor(0.92)
        }
        return None, output

# Create model instance
model = SimpleModel()

# Model name string
model_name = "test_model"

# Create a simple data loader with batch of samples
data_samples = [torch.randn(2, 4) for _ in range(3)]
data_loader = data_samples

# Create meters dictionary with fields matching what model.loss outputs
meters = {
    'loss': SimpleMeter(),
    'accuracy': SimpleMeter(),
    'metric': SimpleMeter()
}

# Construct ARGS
ARGS = {
    'model': model,
    'model_name': model_name,
    'data_loader': data_loader,
    'meters': meters,
    'desc': None
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, tqdm — 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
extract_meter_values Ran
ran; our contract draft was wrong, not the code
saakethmm/nc-prototypical-networks/protonets/utils/log.py
code served (permissive licence) · get_code("edcb0cddd78cf783")
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 torch
import torch.nn as nn


class MockMeter:
    """A simple meter that stores a value and returns it via value() method."""
    def __init__(self, val):
        self._val = val
    
    def value(self):
        return [self._val, "other_data"]


# Construct the meters dict with nested structure:
# meters[split_name][field_name] = meter_object
meters = {
    "train": {
        "loss": MockMeter(0.5),
        "accuracy": MockMeter(0.92),
    },
    "val": {
        "loss": MockMeter(0.3),
        "accuracy": MockMeter(0.95),
    },
    "test": {
        "loss": MockMeter(0.25),
    }
}

ARGS = {
    "meters": meters
}
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 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
register_model Ran
ran; our contract draft was wrong, not the code
saakethmm/nc-prototypical-networks/protonets/models/factory.py
code served (permissive licence) · get_code("896ba48590068c68")
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 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

torch.manual_seed(0)

# The register_model function takes a single parameter: model_name (a string)
# It returns a decorator that registers a function in MODEL_REGISTRY
# The function body simply stores the function and returns it

model_name = "test_model"

ARGS = {
    "model_name": model_name
}
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 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
render_meter_values Ran
ran; our contract draft was wrong, not the code
saakethmm/nc-prototypical-networks/protonets/utils/log.py
code served (permissive licence) · get_code("c0d75b572348ad84")
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 str. 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)

# Analyzing the function:
# - render_meter_values takes meter_values parameter
# - meter_values is a dict with keys representing splits
# - Each split maps to another dict with field names and numeric values
# - The function iterates through splits and fields, formatting each as a string
# - Values are formatted as floats with 6 decimal places

meter_values = {
    'train': {
        'loss': 0.456789,
        'accuracy': 0.987654,
        'f1_score': 0.876543
    },
    'val': {
        'loss': 0.567890,
        'accuracy': 0.965432,
        'f1_score': 0.854321
    }
}

ARGS = {
    'meter_values': meter_values
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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_model Not yet run
unverified (harvested, no recorded run)
saakethmm/nc-prototypical-networks/protonets/models/factory.py
code served (permissive licence) · get_code("ab239f4a02eaeab3")
How it ran

no invocation recorded.

Also present in other papers' code

Of 10 samples lifted from this paper's linked repositories, 10 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 6 are also present in other papers whose code we hold (6 with at least one paper dated earlier, 0 the same month, 1 later) and 4 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
euclidean_dist 16 other papers
13 dated earlier, 2 later, 1 same year, order not determinable · 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
convert_array 1 other paper
1 dated earlier
1902.08605 (2019-02)
Are Few-Shot Learning Benchmarks too Simple ? Solving them without Task Supervision at Test-Time
extract_meter_values 1 other paper
1 dated earlier
1902.08605 (2019-02)
Are Few-Shot Learning Benchmarks too Simple ? Solving them without Task Supervision at Test-Time
get_model 1 other paper
1 dated earlier
1902.08605 (2019-02)
Are Few-Shot Learning Benchmarks too Simple ? Solving them without Task Supervision at Test-Time
register_model 1 other paper
1 dated earlier
1902.08605 (2019-02)
Are Few-Shot Learning Benchmarks too Simple ? Solving them without Task Supervision at Test-Time
render_meter_values 1 other paper
1 dated earlier
1902.08605 (2019-02)
Are Few-Shot Learning Benchmarks too Simple ? Solving them without Task Supervision at Test-Time

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

Meta-learning frameworks for few-shot learning aims to learn models that can learn new skills or adapt to new environments rapidly with a few training examples. This has led to the generalizability of the developed model towards new classes with just a few labelled samples. However these networks are seen as black-box models and understanding the representations learnt under different learning scenarios is crucial. Neural collapse ($\mathcal{NC}$) is a recently discovered phenomenon which showcases unique properties at the network proceeds towards zero loss. The input features collapse to their respective class means, the class means form a Simplex equiangular tight frame (ETF) where the class means are maximally distant and linearly separable, and the classifier acts as a simple nearest neighbor classifier. While these phenomena have been observed in simple classification networks, this study is the first to explore and understand the properties of neural collapse in meta learning frameworks for few-shot learning. We perform studies on the Omniglot dataset in the few-shot setting and study the neural collapse phenomenon. We observe that the learnt features indeed have the trend of neural collapse, especially as model size grows, but to do not necessarily showcase the complete collapse as measured by the $\mathcal{NC}$ properties.

For agents

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

get_harvested_code_for_paper("2310.00451")
get_code_for_paper("2310.00451")
have("2310.00451")

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

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

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

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

Connect an agent — have() is free.