SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2410.03052 · ICLR · 2025

Learning Structured Representations by Embedding Class Hierarchy with Fast Optimal Transport

Han Zhao, Makoto Yamada, Siqi Zeng, Sixian Du

arXiv · PDF · Open in the Atlas

Code that ran

7 of 9 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (1 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 1 violated it and 1 has no contract verdict; 4 failures of our instrument; 2 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/2410.03052.json · badge: /api/ran/2410.03052.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
visipedia/inat_comp canonical (classifier label)
classifier basis: census
2 ran · 1 no recorded run
uiuctml/otcpcc canonical (classifier label)
classifier basis: classifier_2025
1 ran · 0 no recorded run
uiuctml/OTCPCC marked official in Papers with Code
Papers with Code archive
4 ran · 1 no recorded run
FunctionStatusWhere it lives
CPCCLoss Ran
ran on a synthesized input · constructed an object; no result was computed
uiuctml/OTCPCC/loss.py
code served (permissive licence) · get_code("95b937890ab5c187")
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 an instance of its own class, CPCCLoss: the run constructed the object and did not call it, so no result was computed. 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
import numpy as np

torch.manual_seed(0)

class StandInDataset:
    """Minimal dataset class with required attributes for CPCCLoss"""
    def __init__(self):
        self.dataset_name = 'CIFAR100'
        # Mapping from fine labels (0-99) to coarse labels (0-19)
        self.coarse_map = {i: i % 20 for i in range(100)}
        # Mapping from fine labels to mid labels
        self.mid_map = {i: i % 10 for i in range(100)}
        # Mapping from fine labels to coarsest labels
        self.coarsest_map = {i: i % 5 for i in range(100)}

dataset = StandInDataset()

ARGS = {
    'dataset': dataset,
    'metric': 'l2',
    'height': 2,
    'emd_weights': 0,
    'dist_weights': 1,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, ot, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type CPCCLoss — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a CPCCLoss 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
compute_top_k_accuracy Ran
ran, honoured the contract we drafted
visipedia/inat_comp/eval/top_k_accuracy.py
code served (permissive licence) · get_code("9efcc7150f27297b")
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

torch.manual_seed(0)

# Based on the function signature and body, we need:
# - labels: An iterable of ground truth labels (integers or comparable values)
# - predictions: A matrix where each row contains k label predictions
#   The function checks: if labels[i] in predictions[i]
#   So predictions[i] must be iterable and support the 'in' operator

# Create simple test data
labels = [0, 2, 1, 0]  # 4 samples with ground truth labels

# predictions should be a matrix (list of lists) where each row has k predictions
# For top-k accuracy, typically each row contains k candidate labels
# Let's create predictions with k=3 predictions per sample
predictions = [
    [0, 1, 2],      # sample 0: true label 0 is in this list -> correct
    [1, 2, 3],      # sample 1: true label 2 is in this list -> correct
    [0, 1, 3],      # sample 2: true label 1 is in this list -> correct
    [0, 2, 3],      # sample 3: true label 0 is in this list -> correct
]

ARGS = {
    'labels': labels,
    'predictions': predictions,
}
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
fft Ran
ran; our contract draft was wrong, not the code
uiuctml/OTCPCC/loss.py
code served (permissive licence) · get_code("c731bf6abcb63504")
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 numpy as np

torch.manual_seed(0)

# Create small sample tensors
# X_s: source distribution with shape (n, d) where n=4, d=3
X_s = torch.randn(4, 3)

# X_t: target distribution with shape (m, d) where m=5, d=3
X_t = torch.randn(5, 3)

# weightX and weightY are optional parameters
# When provided, they should be torch tensors that can be detached and converted to numpy
weightX = torch.tensor([0.25, 0.25, 0.25, 0.25])
weightY = torch.tensor([0.2, 0.2, 0.2, 0.2, 0.2])

ARGS = {
    "X_s": X_s,
    "X_t": X_t,
    "weightX": weightX,
    "weightY": weightY,
}
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 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
read_solution_file Ran
ran; our contract draft was wrong, not the code
visipedia/inat_comp/eval/top_k_accuracy.py
code served (permissive licence) · get_code("7087c62a38dfd451")
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 tempfile
import csv
import os

# Create a temporary CSV file with the expected format
temp_file = tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.csv', newline='')
temp_filename = temp_file.name

# Write CSV data with the correct column names: id, expected, usage
writer = csv.DictWriter(temp_file, fieldnames=['id', 'expected', 'usage'])
writer.writeheader()
writer.writerow({'id': '12345.jpg', 'expected': 'label1', 'usage': 'Public'})
writer.writerow({'id': '12346.jpg', 'expected': 'label2', 'usage': 'Private'})
writer.writerow({'id': '12347.jpg', 'expected': 'label3', 'usage': 'Public'})
writer.writerow({'id': '12348.jpg', 'expected': 'label4', 'usage': 'Private'})
temp_file.close()

ARGS = {
    'solution_file': temp_filename
}
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 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
simple Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
uiuctml/otcpcc/emd/emd_methods.py
code served (permissive licence) · get_code("9240aa557394825b")
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 ndarray, ndim 1, dtype family float, shape (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 numpy as np

# Analyze the function:
# - P: used in np.sum(P * comparison, axis=1)
#   P is multiplied element-wise with comparison (which has shape (len(x), len(y)))
#   and summed along axis=1, so P should have shape (len(x), len(y))
# - x: reshaped to (-1, 1), so 1D array
# - y: reshaped to (1, -1), so 1D array

# Create small test data
x = np.array([1.0, 3.0, 2.0])  # shape (3,)
y = np.array([2.0, 1.0])       # shape (2,)

# P should have shape (len(x), len(y)) = (3, 2)
P = np.array([[0.5, 0.3],
              [0.2, 0.8],
              [0.1, 0.9]])

ARGS = {
    "P": P,
    "x": x,
    "y": y
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family float, shape (3,) — shape (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
sinkhorn Ran
ran; our contract draft was wrong, not the code
uiuctml/OTCPCC/loss.py
code served (permissive licence) · get_code("8cf6df4a3ab3e2a1")
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 numpy as np

torch.manual_seed(0)

# Create a cost matrix M (2x3 for distinct dimensions)
M = torch.randn(2, 3, dtype=torch.float32)

# Create ARGS dict with all parameters for sinkhorn function
ARGS = {
    "M": M,
    "reg": 10,
    "numItermax": 10000
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, ot, 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
swd Ran
ran, violated the contract we drafted
uiuctml/OTCPCC/loss.py
code served (permissive licence) · get_code("126a198bfeb95550")
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 float64, 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
import numpy as np
import ot

torch.manual_seed(0)

# Create small sample data for Sliced Wasserstein Distance
# X_s and X_t should be 2D arrays/tensors of shape (n_samples, n_features)
X_s = np.random.randn(2, 4).astype(np.float32)
X_t = np.random.randn(2, 4).astype(np.float32)

ARGS = {
    'X_s': X_s,
    'X_t': X_t,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, ot, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
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
emd Not yet run
unverified (harvested, no recorded run)
uiuctml/OTCPCC/loss.py
code served (permissive licence) · get_code("c42471aa6b55a9b0")
How it ran

no invocation recorded.

read_submission_file Not yet run
unverified (harvested, no recorded run)
visipedia/inat_comp/eval/top_k_accuracy.py
code served (permissive licence) · get_code("5240ca231db3c363")
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, 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 9 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

To embed structured knowledge within labels into feature representations, prior work (Zeng et al., 2022) proposed to use the Cophenetic Correlation Coefficient (CPCC) as a regularizer during supervised learning. This regularizer calculates pairwise Euclidean distances of class means and aligns them with the corresponding shortest path distances derived from the label hierarchy tree. However, class means may not be good representatives of the class conditional distributions, especially when they are multi-mode in nature. To address this limitation, under the CPCC framework, we propose to use the Earth Mover's Distance (EMD) to measure the pairwise distances among classes in the feature space. We show that our exact EMD method generalizes previous work, and recovers the existing algorithm when class-conditional distributions are Gaussian. To further improve the computational efficiency of our method, we introduce the Optimal Transport-CPCC family by exploring four EMD approximation variants. Our most efficient OT-CPCC variant, the proposed Fast FlowTree algorithm, runs in linear time in the size of the dataset, while maintaining competitive performance across datasets and tasks. The code is available at https://github.com/uiuctml/OTCPCC.

For agents

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

get_harvested_code_for_paper("2410.03052")
get_code_for_paper("2410.03052")
have("2410.03052")

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

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

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

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

Connect an agent — have() is free.