SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2405.17767 · NeurIPS · 2024

Linguistic Collapse: Neural Collapse in (Large) Language Models

Vardan Papyan, Robert Wu

arXiv · PDF · Open in the Atlas

Code that ran

12 of 14 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; 3 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 8 failures of our instrument; 2 no recorded run), measured 2026-11-23; 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/2405.17767.json · badge: /api/ran/2405.17767.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
rhubarbwu/linguistic-collapse canonical (classifier label)
classifier basis: census
9 ran · 2 no recorded run
rhubarbwu/neural-collapse extension (classifier label)
classifier basis: classifier_2025
3 ran · 0 no recorded run
FunctionStatusWhere it lives
covariance_ratio Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
rhubarbwu/neural-collapse/neural_collapse/measure.py
code served (permissive licence) · get_code("23ee2dc74782210f")
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 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

torch.manual_seed(0)

# V_intra: within-class covariance matrix (d x d)
V_intra = torch.randn(4, 4)
V_intra = V_intra @ V_intra.T  # Make it symmetric positive semi-definite

# M: matrix of feature embeddings (K x d), where K is number of classes
M = torch.randn(3, 4)

# m_G: global mean vector (d,) or scalar
m_G = torch.randn(4)

# metric: one of 'pinv', 'svd', or 'quotient'
metric = 'pinv'

ARGS = {
    'V_intra': V_intra,
    'M': M,
    'm_G': m_G,
    'metric': metric,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, scipy, 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
create_df Ran
ran, honoured the contract we drafted
rhubarbwu/linguistic-collapse/lib/statistics.py
pointer only (licence: NONE) · get_code("2630c6d4643a1419")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, rhubarbwu/linguistic-collapse 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.

get_config Ran
ran; our contract draft was wrong, not the code
rhubarbwu/linguistic-collapse/lib/model.py
pointer only (licence: NONE) · get_code("ef684a857d2c2e99")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, rhubarbwu/linguistic-collapse 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.

is_float Ran
ran, violated the contract we drafted
rhubarbwu/linguistic-collapse/lib/utils.py
pointer only (licence: NONE) · get_code("cc0336c0a472132a")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, rhubarbwu/linguistic-collapse 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.

mean_norms Ran
ran; our contract draft was wrong, not the code
rhubarbwu/neural-collapse/neural_collapse/measure.py
code served (permissive licence) · get_code("7bfc97afc567d6e7")
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 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
from typing import List

torch.manual_seed(0)

# M is a Tensor of shape (num_classes, embedding_dim)
# We'll use 2 classes with 4-dimensional embeddings
M = torch.randn(2, 4)

# m_G is a Tensor (or scalar) representing global mean bias
# Shape should be (embedding_dim,) to broadcast with M
m_G = torch.randn(4)

# post_funcs is a list of callables that take Tensor -> Tensor
# We'll create simple post-processing functions
def post_func_1(x: torch.Tensor) -> torch.Tensor:
    return x * 2.0

def post_func_2(x: torch.Tensor) -> torch.Tensor:
    return torch.clamp(x, min=0.0)

post_funcs = [post_func_1, post_func_2]

ARGS = {
    "M": M,
    "m_G": m_G,
    "post_funcs": post_funcs,
}
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 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
numerate Ran
ran, honoured the contract we drafted
rhubarbwu/linguistic-collapse/lib/utils.py
pointer only (licence: NONE) · get_code("95008376dc4e1a67")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, rhubarbwu/linguistic-collapse 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.

process_batch Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
rhubarbwu/linguistic-collapse/lib/collection.py
pointer only (licence: NONE); the stored copy get_code serves, from Xujxyang/Fairness-NC-main, is pointer only (licence: NONE) · get_code("8ef531ec328be202")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, rhubarbwu/linguistic-collapse 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.

select_ckpt Ran
ran; our contract draft was wrong, not the code
rhubarbwu/linguistic-collapse/lib/model.py
pointer only (licence: NONE) · get_code("e24bcfffa5b6a278")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, rhubarbwu/linguistic-collapse 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.

select_int_type Ran
ran; our contract draft was wrong, not the code
rhubarbwu/linguistic-collapse/lib/utils.py
pointer only (licence: NONE) · get_code("509e214fe73e4295")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, rhubarbwu/linguistic-collapse 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.

shuffle Ran
ran, honoured the contract we drafted
rhubarbwu/linguistic-collapse/count.py
pointer only (licence: NONE) · get_code("07dd1a4ae14651c9")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, rhubarbwu/linguistic-collapse 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.

truncate_and_pad Ran
ran; our contract draft was wrong, not the code
rhubarbwu/linguistic-collapse/lib/collection.py
pointer only (licence: NONE); the stored copy get_code serves, from Xujxyang/Fairness-NC-main, is pointer only (licence: NONE) · get_code("cc361c2f7b68b11d")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, rhubarbwu/linguistic-collapse 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.

variability_cdnv Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
rhubarbwu/neural-collapse/neural_collapse/measure.py
code served (permissive licence) · get_code("238be78502fd3fae")
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 float, ndim 0, 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 as pt
import torch.nn as nn

pt.manual_seed(0)

# The function calls class_dist_norm_vars and symm_reduce
# We need to create stub implementations or mock them
# Looking at the signature, V_norms is a matrix of within-class variance norms
# M is a matrix of feature embeddings (class means)
# The function computes pairwise class distance normalized variances

# Create minimal stub functions that the main function depends on
def class_dist_norm_vars(V_norms, M, dist_exp, tile_size):
    """Stub: returns a tensor representing kernel grid of CDNVs"""
    # V_norms: shape (num_classes,) - variance norms per class
    # M: shape (num_classes, embedding_dim) - class mean embeddings
    num_classes = M.shape[0]
    # Return a symmetric matrix of shape (num_classes, num_classes)
    # representing pairwise class distance normalized variances
    return pt.randn(num_classes, num_classes)

def symm_reduce(kernel_grid, reduce_fn):
    """Stub: reduces symmetric matrix using provided function"""
    # For a symmetric matrix, reduce to a scalar
    return reduce_fn(kernel_grid)

# Inject stubs into the module namespace for the function to use
import sys
current_module = sys.modules[__name__]
current_module.class_dist_norm_vars = class_dist_norm_vars
current_module.symm_reduce = symm_reduce

# Now define the actual function
def variability_cdnv(V_norms: pt.Tensor, M: pt.Tensor, dist_exp: float=1.0, tile_size: int=None) -> float:
    """Compute the average class-distance normalized variances (CDNV)."""
    kernel_grid = class_dist_norm_vars(V_norms, M, dist_exp, tile_size)
    avg = symm_reduce(kernel_grid, pt.sum)
    return avg.item()

# Create test arguments
num_classes = 3
embedding_dim = 4

# V_norms: variance norms for each class, shape (num_classes,)
V_norms = pt.randn(num_classes).abs()

# M: class mean embeddings, shape (num_classes, embedding_dim)
M = pt.randn(num_classes, embedding_dim)

ARGS = {
    "V_norms": V_norms,
    "M": M,
    "dist_exp": 1.0,
    "tile_size": None
}
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 float, ndim 0, dtype family float — no output shape is stated: observe_signature.py could not observe it (fixture:KeyError)
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_data_as_chunks Not yet run
unverified (harvested, no recorded run)
rhubarbwu/linguistic-collapse/lib/data.py
pointer only (licence: NONE) · get_code("db4e45385bfd12df")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, rhubarbwu/linguistic-collapse 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. No invocation recorded.

get_tokenizer Not yet run
unverified (harvested, no recorded run)
rhubarbwu/linguistic-collapse/lib/model.py
pointer only (licence: NONE) · get_code("46a83c0ef5d4338f")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, rhubarbwu/linguistic-collapse 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. No invocation recorded.

Also present in other papers' code

Of 14 samples lifted from this paper's linked repositories, 14 carry a function identity and 0 do not. Of the 14 distinct functions with an identity, 2 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 2 later) and 12 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
process_batch 1 other paper
1 later
2410.04472 (2024-10)
Collapsed Language Models Promote Fairness
truncate_and_pad 1 other paper
1 later
2410.04472 (2024-10)
Collapsed Language Models Promote Fairness

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-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

For agents

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

get_harvested_code_for_paper("2405.17767")
get_code_for_paper("2405.17767")
have("2405.17767")

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

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

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

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

Connect an agent — have() is free.