SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2304.09426 · ICLR · 2023

Decoupled Training for Long-Tailed Classification With Stochastic Representations

Juho Lee, Giung Nam, Sunguk Jang

arXiv · PDF · Open in the Atlas

Code that ran

10 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; 0 honoured the contract we drafted, 0 violated it and 5 have no contract verdict; 5 failures of our instrument; 4 no recorded run), measured 2026-11-22; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2304.09426.json · badge: /api/ran/2304.09426.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
zhmiao/OpenLongTailRecognition-OLTR canonical (classifier label)
classifier basis: census
6 ran · 3 no recorded run
kaidic/LDAM-DRW canonical (classifier label)
classifier basis: census
4 ran · 1 no recorded run
FunctionStatusWhere it lives
accuracy Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
kaidic/LDAM-DRW/utils.py
code served (permissive licence) · get_code("1e369e39c90cada6")
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 list, ndim 2, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Create small tensors for testing
batch_size = 2
num_classes = 4

# output: logits tensor of shape (batch_size, num_classes)
output = torch.randn(batch_size, num_classes)

# target: class indices tensor of shape (batch_size,)
target = torch.tensor([0, 2])

# topk: tuple of k values to compute accuracy for
topk = (1, 2)

ARGS = {
    "output": output,
    "target": target,
    "topk": topk,
}
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 list, ndim 2, dtype family float — a list 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
conv3x3 Ran
ran; our contract draft was wrong, not the code
zhmiao/OpenLongTailRecognition-OLTR/models/ResNetFeature.py
pointer only (licence: BSD-3-Clause); 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 (BSD-3-Clause), 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.

create_loss Ran
ran on a synthesized input
zhmiao/OpenLongTailRecognition-OLTR/loss/DiscCentroidsLoss.py
code served (permissive licence) · get_code("84954cc67863b073")
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 DiscCentroidsLoss. 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 torch.nn as nn

torch.manual_seed(0)

ARGS = {
    'feat_dim': 4,
    'num_classes': 3
}
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 DiscCentroidsLoss — a DiscCentroidsLoss output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DiscCentroidsLoss 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
create_model Ran
ran on a synthesized input
zhmiao/OpenLongTailRecognition-OLTR/models/CosNormClassifier.py
code served (permissive licence) · get_code("a50d9d62804228f2")
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 CosNorm_Classifier. 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 math
import torch.nn as nn
from torch.nn.parameter import Parameter

torch.manual_seed(0)

class CosNorm_Classifier(nn.Module):

    def __init__(self, in_dims, out_dims, scale=16, margin=0.5, init_std=0.001):
        super(CosNorm_Classifier, self).__init__()
        self.in_dims = in_dims
        self.out_dims = out_dims
        self.scale = scale
        self.margin = margin
        self.weight = Parameter(torch.Tensor(out_dims, in_dims))
        self.reset_parameters()

    def reset_parameters(self):
        stdv = 1.0 / math.sqrt(self.weight.size(1))
        self.weight.data.uniform_(-stdv, stdv)

    def forward(self, input, *args):
        norm_x = torch.norm(input.clone(), 2, 1, keepdim=True)
        ex = norm_x / (1 + norm_x) * (input / norm_x)
        ew = self.weight / torch.norm(self.weight, 2, 1, keepdim=True)
        return torch.mm(self.scale * ex, ew.t())

def create_model(in_dims=512, out_dims=1000):
    print('Loading Cosine Norm Classifier.')
    return CosNorm_Classifier(in_dims=in_dims, out_dims=out_dims)

ARGS = {
    'in_dims': 4,
    'out_dims': 3,
}
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 CosNorm_Classifier — a CosNorm_Classifier output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a CosNorm_Classifier 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
create_model Ran
ran on a synthesized input
zhmiao/OpenLongTailRecognition-OLTR/models/DotProductClassifier.py
code served (permissive licence) · get_code("a2ab1cdb1975f18e")
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 DotProduct_Classifier. 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)

# Since the function calls init_weights with a weights_path that doesn't exist,
# we need to mock init_weights to avoid file I/O
import sys
from unittest.mock import MagicMock

def init_weights(model, weights_path, classifier=False):
    """Mock init_weights function that returns the model unchanged"""
    return model

# Inject the mock into the module scope
sys.modules['__main__'].init_weights = init_weights

ARGS = {
    'feat_dim': 2048,
    'num_classes': 1000,
    'stage1_weights': False,
    'dataset': None,
    'test': True,
}
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 DotProduct_Classifier — a DotProduct_Classifier output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DotProduct_Classifier 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
focal_loss Ran
ran; our contract draft was wrong, not the code
kaidic/LDAM-DRW/losses.py
pointer only (licence: MIT); the stored copy get_code serves, from tmlr-group/atol, is pointer only (licence: NONE) · get_code("4dcf06ba28983266")
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 tmlr-group/atol, 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.

plot_confusion_matrix Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
kaidic/LDAM-DRW/utils.py
code served (permissive licence) · get_code("e5ce72a1e8d9bc22")
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 Axes. 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
import matplotlib.pyplot as plt
from sklearn.metrics import confusion_matrix

# Create sample data for a multi-class classification problem
np.random.seed(0)

# True labels: 20 samples with 3 classes (0, 1, 2)
y_true = np.array([0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1])

# Predicted labels: 20 samples with some errors
y_pred = np.array([0, 1, 2, 0, 1, 1, 0, 2, 2, 0, 1, 2, 0, 0, 2, 1, 1, 2, 0, 1])

# Class names
classes = np.array(['Class A', 'Class B', 'Class C'])

ARGS = {
    'y_true': y_true,
    'y_pred': y_pred,
    'classes': classes,
    'normalize': False,
    'title': 'Test Confusion Matrix',
    'cmap': plt.cm.Blues
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
matplotlib, numpy, sklearn — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Axes — a Axes output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Axes 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
resnet32 Ran
ran; our contract draft was wrong, not the code
kaidic/LDAM-DRW/models/resnet_cifar.py
code served (permissive licence) · get_code("11d038f53d77a8d2")
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 ResNet_s. 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)

ARGS = {
    'num_classes': 10,
    'use_norm': False,
}
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 ResNet_s — a ResNet_s output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a ResNet_s 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
shot_acc Ran
ran on a synthesized input
zhmiao/OpenLongTailRecognition-OLTR/utils.py
code served (permissive licence) · get_code("ebb474138acbc60c")
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 float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np
from torch.utils.data import Dataset, DataLoader

torch.manual_seed(0)

# Create a minimal Dataset class with labels attribute
class DummyDataset(Dataset):
    def __init__(self, num_samples=10, num_classes=3):
        self.num_samples = num_samples
        self.num_classes = num_classes
        # Create labels with distribution: many_shot, median_shot, low_shot classes
        self.labels = []
        for i in range(num_classes):
            if i == 0:
                # Many shot class (>= 100)
                self.labels.extend([i] * 120)
            elif i == 1:
                # Low shot class (<= 20)
                self.labels.extend([i] * 15)
            else:
                # Median shot class (between 20 and 100)
                self.labels.extend([i] * 50)
        self.labels = np.array(self.labels)
    
    def __len__(self):
        return len(self.labels)
    
    def __getitem__(self, idx):
        return torch.randn(4), self.labels[idx]

# Create train_data object with dataset attribute
class DummyDataLoader:
    def __init__(self, dataset):
        self.dataset = dataset

# Construct test predictions and labels
# Create test set with some correct and some incorrect predictions
num_test_samples = 30
test_labels = np.array([0] * 10 + [1] * 10 + [2] * 10)
# Create predictions that mostly match labels (some accuracy)
test_preds = test_labels.copy()
test_preds[0] = 1  # One mistake in class 0
test_preds[10] = 2  # One mistake in class 1
test_preds[20] = 0  # One mistake in class 2

preds = torch.tensor(test_preds, dtype=torch.long)
labels = torch.tensor(test_labels, dtype=torch.long)

# Create training data
train_dataset = DummyDataset()
train_data = DummyDataLoader(train_dataset)

ARGS = {
    "preds": preds,
    "labels": labels,
    "train_data": train_data,
    "many_shot_thr": 100,
    "low_shot_thr": 20
}
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, ndim 1, dtype family float — 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
source_import Ran
ran on a synthesized input
zhmiao/OpenLongTailRecognition-OLTR/utils.py
code served (permissive licence) · get_code("07cca9631fe4f26a")
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 module. 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 importlib
import tempfile
import os

# Create a temporary Python module file to import
temp_dir = tempfile.mkdtemp()
module_file = os.path.join(temp_dir, "test_module.py")

with open(module_file, "w") as f:
    f.write("""
def hello_world():
    return "Hello from imported module"

class TestClass:
    def __init__(self):
        self.value = 42
""")

ARGS = {
    "file_path": module_file
}
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 module — a module output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a module 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
create_model Not yet run
unverified (harvested, no recorded run)
zhmiao/OpenLongTailRecognition-OLTR/models/ResNet10Feature.py
code served (permissive licence) · get_code("aec4f3ee8eb5c0e4")
How it ran

no invocation recorded.

create_model Not yet run
unverified (harvested, no recorded run)
zhmiao/OpenLongTailRecognition-OLTR/models/ResNet152Feature.py
code served (permissive licence) · get_code("9b5c18aaeaac34a0")
How it ran

no invocation recorded.

init_weights Not yet run
unverified (harvested, no recorded run)
zhmiao/OpenLongTailRecognition-OLTR/utils.py
code served (permissive licence) · get_code("4826cd3596c12660")
How it ran

no invocation recorded.

validate Not yet run
unverified (harvested, no recorded run)
kaidic/LDAM-DRW/cifar_train.py
code served (permissive licence) · get_code("d9855945f564e8f2")
How it ran

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, 7 are also present in other papers whose code we hold (7 with at least one paper dated earlier, 2 the same month, 4 later) and 7 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

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

FunctionAlso present inEarliest-datedOthers named
conv3x3 686 other papers
470 dated earlier, 5 the same month, 204 later, 7 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
accuracy 116 other papers
68 dated earlier, 3 the same month, 43 later, 2 same year, order not determinable · 8 only as an assembly brick
1502.03044 (2015-02)
Show, Attend and Tell: Neural Image Caption Generation with Visual Attention
1610.05820 (2016-10)
Membership Inference Attacks Against Machine Learning Models
1905.03696 (2019-05)
HAWQ: Hessian AWare Quantization of Neural Networks with Mixed-Precision
and 113 more not named here
focal_loss 14 other papers
2 dated earlier, 11 later, 1 same year, order not determinable
1906.07413 (2019-06)
Learning Imbalanced Datasets with Label-Distribution-Aware Margin Loss
2107.09249 (2021-07)
Self-Supervised Aggregation of Diverse Experts for Test-Agnostic Long-Tailed Recognition
and 11 more not named here
resnet32 9 other papers
5 dated earlier, 3 later, 1 same year, order not determinable
1906.07413 (2019-06)
Learning Imbalanced Datasets with Label-Distribution-Aware Margin Loss
2104.00466 (2021-04)
Improving Calibration for Long-Tailed Recognition
2106.10891 (2021-06)
Open-set Label Noise Can Improve Robustness Against Inherent Label Noise
and 6 more not named here
init_weights 5 other papers
4 dated earlier, 1 same year, order not determinable
2001.01385 (2020-01)
Identifying and Compensating for Feature Deviation in Imbalanced Deep Learning
2004.03706 (2020-04)
Long-Tailed Recognition Using Class-Balanced Experts
2007.11978 (2020-07)
The Devil is in Classification: A Simple Framework for Long-tail Object Detection and Instance Segmentation
and 2 more not named here
source_import 4 other papers
4 dated earlier
2004.03706 (2020-04)
Long-Tailed Recognition Using Class-Balanced Experts
2007.11978 (2020-07)
The Devil is in Classification: A Simple Framework for Long-tail Object Detection and Instance Segmentation
2111.13998 (2021-11)
Targeted Supervised Contrastive Learning for Long-Tailed Recognition
and 1 more not named here
plot_confusion_matrix 3 other papers
2 dated earlier, 1 same year, order not determinable
1906.07413 (2019-06)
Learning Imbalanced Datasets with Label-Distribution-Aware Margin Loss
2111.03874 (2021-11)
Towards Calibrated Model for Long-Tailed Visual Recognition from Prior Perspective

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

Decoupling representation learning and classifier learning has been shown to be effective in classification with long-tailed data. There are two main ingredients in constructing a decoupled learning scheme; 1) how to train the feature extractor for representation learning so that it provides generalizable representations and 2) how to re-train the classifier that constructs proper decision boundaries by handling class imbalances in long-tailed data. In this work, we first apply Stochastic Weight Averaging (SWA), an optimization technique for improving the generalization of deep neural networks, to obtain better generalizing feature extractors for long-tailed classification. We then propose a novel classifier re-training algorithm based on stochastic representation obtained from the SWA-Gaussian, a Gaussian perturbed SWA, and a self-distillation strategy that can harness the diverse stochastic representations based on uncertainty estimates to build more robust classifiers. Extensive experiments on CIFAR10/100-LT, ImageNet-LT, and iNaturalist-2018 benchmarks show that our proposed method improves upon previous methods both in terms of prediction accuracy and uncertainty estimation. * Equal contribution † The work was done while the author was a graduate student at KAIST.

For agents

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

get_harvested_code_for_paper("2304.09426")
get_code_for_paper("2304.09426")
have("2304.09426")

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

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

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

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

Connect an agent — have() is free.