SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2004.03706 · 2020

Long-Tailed Recognition Using Class-Balanced Experts

arXiv · PDF · Open in the Atlas

Code that ran

4 of 9 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 3 have no contract verdict; 1 failure of our instrument; 5 no recorded run), measured 2026-11-21; 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/2004.03706.json · badge: /api/ran/2004.03706.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
ssfootball04/class-balanced-experts canonical (classifier label)
classifier basis: census
4 ran · 5 no recorded run
FunctionStatusWhere it lives
conv3x3 Ran
ran; our contract draft was wrong, not the code
ssfootball04/class-balanced-experts/models.py
pointer only (licence: Apache-2.0); 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 (Apache-2.0), 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.

gen_features_and_probs Ran
ran on a synthesized input
ssfootball04/class-balanced-experts/generate_features.py
code served (permissive licence) · get_code("f2095c01f04f3991")
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 torch.nn as nn

torch.manual_seed(0)

# Feature extractor model that returns (features, _)
class FeatureExtractor(nn.Module):
    def __init__(self):
        super().__init__()
        self.fc = nn.Linear(3, 512)
    
    def forward(self, x):
        features = self.fc(x)
        return features, None

# Classifier model with num_classes attribute
class Classifier(nn.Module):
    def __init__(self, num_classes=5):
        super().__init__()
        self.num_classes = num_classes
        self.fc = nn.Linear(512, num_classes)
    
    def forward(self, x):
        return self.fc(x)

# Create mock data loader
def create_mock_loader(num_batches=3, batch_size=2):
    loader = []
    for _ in range(num_batches):
        data = torch.randn(batch_size, 3)
        target = torch.randint(0, 5, (batch_size,))
        third_elem = None  # placeholder for the third element in tuple
        train_count = 1     # placeholder for train_count
        loader.append((data, target, third_elem, train_count))
    return loader

# Create mock loader with dataset attribute
class MockLoader:
    def __init__(self, data_list):
        self.data = data_list
    
    def __iter__(self):
        return iter(self.data)
    
    def __len__(self):
        return len(self.data)
    
    @property
    def dataset(self):
        return self

# Args configuration
ARGS = {
    'args': type('Args', (), {'log_interval': 2})(),
    'feature_extractor': FeatureExtractor(),
    'classifier': Classifier(num_classes=5),
    'device': torch.device('cpu'),
    'loader': MockLoader(create_mock_loader(num_batches=3, batch_size=2))
}
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 — 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
gen_logits Ran
ran on a synthesized input
ssfootball04/class-balanced-experts/gen_logits.py
code served (permissive licence) · get_code("5972fbbf620ba327")
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 torch.nn as nn

torch.manual_seed(0)

# Create a minimal feature extractor that returns (features, something)
class FeatureExtractor(nn.Module):
    def __init__(self):
        super().__init__()
        self.fc = nn.Linear(3, 512)
    
    def forward(self, x):
        features = self.fc(x)
        return features, None

# Create a minimal classifier with num_classes attribute
class Classifier(nn.Module):
    def __init__(self, num_classes=7):
        super().__init__()
        self.num_classes = num_classes
        self.fc = nn.Linear(512, num_classes)
    
    def forward(self, features):
        return self.fc(features)

# Create a minimal data loader (list of batches)
# Each batch is (data, target, something, train_count)
loader_data = []
for _ in range(3):
    data = torch.randn(2, 3)
    target = torch.randint(0, 7, (2,))
    extra = torch.tensor([0])
    train_count = 1
    loader_data.append((data, target, extra, train_count))

class MinimalLoader:
    def __init__(self, data):
        self.data = data
        self.dataset = type('Dataset', (), {'__len__': lambda self: 6})()
    
    def __iter__(self):
        return iter(self.data)
    
    def __len__(self):
        return len(self.data)

# Create args dict with required attributes
class Args:
    log_interval = 2

args = Args()
feature_extractor = FeatureExtractor()
classifier = Classifier(num_classes=7)
device = torch.device('cpu')
loader = MinimalLoader(loader_data)

ARGS = {
    'args': args,
    'feature_extractor': feature_extractor,
    'classifier': classifier,
    'device': device,
    'loader': loader
}
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 — 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
source_import Ran
ran on a synthesized input
ssfootball04/class-balanced-experts/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_resnet10 Not yet run
unverified (harvested, no recorded run)
ssfootball04/class-balanced-experts/models.py
code served (permissive licence) · get_code("80503a6a89030538")
How it ran

no invocation recorded.

create_model_resnet152 Not yet run
unverified (harvested, no recorded run)
ssfootball04/class-balanced-experts/models.py
code served (permissive licence) · get_code("fd8416b029ac1ee5")
How it ran

no invocation recorded.

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

no invocation recorded.

test Not yet run
unverified (harvested, no recorded run)
ssfootball04/class-balanced-experts/jointCalibration.py
code served (permissive licence) · get_code("6e5cdfaf59c333f7")
How it ran

no invocation recorded.

train Not yet run
unverified (harvested, no recorded run)
ssfootball04/class-balanced-experts/jointCalibration.py
code served (permissive licence) · get_code("077e42d8357a996a")
How it ran

no invocation recorded.

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 distinct functions with an identity, 3 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 1 the same month, 3 later) and 6 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
215 dated earlier, 5 the same month, 465 later, 1 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
init_weights 5 other papers
1 dated earlier, 4 later
2001.01385 (2020-01)
Identifying and Compensating for Feature Deviation in Imbalanced Deep Learning
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 2 more not named here
source_import 4 other papers
4 later
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
2207.13378 (2022-07)
Identifying Hard Noise in Long-Tailed Sample Distribution
and 1 more not named here

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-21.

Repositories linked to this paper

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

Abstract

Deep learning enables impressive performance in image recognition using large-scale artificially-balanced datasets. However, real-world datasets exhibit highly class-imbalanced distributions, yielding two main challenges: relative imbalance amongst the classes and data scarcity for mediumshot or fewshot classes. In this work, we address the problem of long-tailed recognition wherein the training set is highly imbalanced and the test set is kept balanced. Differently from existing paradigms relying on data-resampling, cost-sensitive learning, online hard example mining, loss objective reshaping, and/or memory-based modeling, we propose an ensemble of class-balanced experts that combines the strength of diverse classifiers. Our ensemble of class-balanced experts reaches results close to state-of-the-art and an extended ensemble establishes a new state-of-the-art on two benchmarks for long-tailed recognition. We conduct extensive experiments to analyse the performance of the ensembles, and discover that in modern large-scale datasets, relative imbalance is a harder problem than data scarcity. The training and evaluation code is available at https://github.com/ssfootball04/class-balanced-experts.

For agents

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

get_harvested_code_for_paper("2004.03706")
get_code_for_paper("2004.03706")
have("2004.03706")

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

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

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

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

Connect an agent — have() is free.