SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2110.05941 · 2021

Rank-based loss for learning hierarchical representations

arXiv · PDF · Open in the Atlas

Code that ran

6 of 7 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 6 have no contract verdict; 0 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/2110.05941.json · badge: /api/ran/2110.05941.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
inesnolas/Rank-based-loss_ICASSP22 canonical (classifier label)
classifier basis not recorded on the link
6 ran · 1 no recorded run
FunctionStatusWhere it lives
calc_euclidean Ran
ran on a synthesized input
inesnolas/Rank-based-loss_ICASSP22/loss_functions/quadruplet_loss.py
code served (permissive licence) · get_code("3457a7b58aa8856f")
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 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

torch.manual_seed(0)

x1 = torch.randn(2, 4)
x2 = torch.randn(2, 4)

ARGS = {
    "x1": x1,
    "x2": x2,
}
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 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
compute_cosine_distances Ran
ran on a synthesized input
inesnolas/Rank-based-loss_ICASSP22/loss_functions/quadruplet_loss.py
code served (permissive licence) · get_code("7d4360c8554ee21d")
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 1, dtype family float, shape (1,) 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 normalized rows (unit vectors) for cosine distance computation
# a: shape (2, 4) - 2 samples, 4 dimensions
# b: shape (3, 4) - 3 samples, 4 dimensions
a = torch.randn(2, 4)
a = a / torch.norm(a, dim=1, keepdim=True)

b = torch.randn(3, 4)
b = b / torch.norm(b, dim=1, keepdim=True)

ARGS = {
    "a": a,
    "b": b,
}
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 1, dtype family float, shape (1,) — shape (1,) 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_pair_gt_tree_distance Ran
ran on a synthesized input
inesnolas/Rank-based-loss_ICASSP22/loss_functions/rank_based_loss.py
code served (permissive licence) · get_code("e95589380484e2df")
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 int, ndim 0, dtype family int, 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

torch.manual_seed(0)

# Test case 1: 3-rank labels that match at first level
labels_pair_one_1 = "family_genus_species"
labels_pair_two_1 = "family_genus_species"
number_of_ranks_1 = 3

# Test case 2: 2-rank labels that match at first level
labels_pair_one_2 = "family_genus"
labels_pair_two_2 = "family_genus"
number_of_ranks_2 = 2

# Test case 3: 3-rank labels that don't match
labels_pair_one_3 = "family1_genus1_species1"
labels_pair_two_3 = "family2_genus2_species2"
number_of_ranks_3 = 3

# Use test case 1 for the main ARGS
ARGS = {
    "labels_pair_one": "family_genus_species",
    "labels_pair_two": "family_genus_species",
    "number_of_ranks": 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 int, ndim 0, dtype family int, 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_pairwise_cosine_distances Ran
ran on a synthesized input
inesnolas/Rank-based-loss_ICASSP22/utils/distance_functions.py
code served (permissive licence) · get_code("c842d0c2faa8437b")
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 1, dtype family float, shape (1,) 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 a small embedding matrix: 2 embeddings of dimension 4
# The embeddings should be normalized for cosine distance to make sense
minibatch_embeddings = torch.randn(2, 4)
# Normalize embeddings to unit norm for proper cosine similarity
minibatch_embeddings = torch.nn.functional.normalize(minibatch_embeddings, p=2, dim=1)

ARGS = {
    "minibatch_embeddings": minibatch_embeddings,
    "full_matrix": 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 Tensor, ndim 1, dtype family float, shape (1,) — shape (1,) 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_pairwise_euclidean_distances Ran
ran on a synthesized input
inesnolas/Rank-based-loss_ICASSP22/utils/distance_functions.py
code served (permissive licence) · get_code("384275dd3b9c3822")
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 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 torch

torch.manual_seed(0)

# The function expects:
# - minibatch_embeddings: a tensor of shape (d*n,) or similar that can be reshaped to (d, n, 1) and (d, 1, n)
# - d: number of dimensions/features
# - n: number of samples
# - full_matrix: boolean flag

d = 4
n = 3

# Create a minibatch_embeddings tensor of shape (d*n,) = (12,)
minibatch_embeddings = torch.randn(d * n)

ARGS = {
    "minibatch_embeddings": minibatch_embeddings,
    "d": d,
    "n": n,
    "full_matrix": 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 Tensor, 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
compute_triplet_loss Ran
ran on a synthesized input
inesnolas/Rank-based-loss_ICASSP22/loss_functions/quadruplet_loss.py
code served (permissive licence) · get_code("9eb7ab0b0e602198")
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 1, dtype family float, shape (1,) 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 small tensors for anchor, positive, and negative
# For euclidean distance: shape should be (batch_size, embedding_dim)
# For cosine distance: tensors should be normalized, shape (batch_size, embedding_dim)

batch_size = 2
embedding_dim = 4

# Create normalized tensors for cosine distance compatibility
anchor = torch.randn(batch_size, embedding_dim)
anchor = torch.nn.functional.normalize(anchor, p=2, dim=1)

pos = torch.randn(batch_size, embedding_dim)
pos = torch.nn.functional.normalize(pos, p=2, dim=1)

neg = torch.randn(batch_size, embedding_dim)
neg = torch.nn.functional.normalize(neg, p=2, dim=1)

margin = 0.5
distance = 'cosine'

ARGS = {
    'margin': margin,
    'anchor': anchor,
    'pos': pos,
    'neg': neg,
    'distance': distance
}
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 1, dtype family float, shape (1,) — shape (1,) 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
pre_compute_rank_map Not yet run
unverified (harvested, no recorded run)
inesnolas/Rank-based-loss_ICASSP22/loss_functions/rank_based_loss.py
code served (permissive licence) · get_code("c7f8555baf15925e")
How it ran

no invocation recorded.

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 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 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.

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

Hierarchical taxonomies are common in many contexts, and they are a very natural structure humans use to organise information. In machine learning, the family of methods that use the 'extra' information is called hierarchical classification. However, applied to audio classification, this remains relatively unexplored. Here we focus on how to integrate the hierarchical information of a problem to learn embeddings representative of the hierarchical relationships. Previously, triplet loss has been proposed to address this problem, however it presents some issues like requiring the careful construction of the triplets, and being limited in the extent of hierarchical information it uses at each iteration. In this work we propose a rank based loss function that uses hierarchical information and translates this into a rank ordering of target distances between the examples. We show that rank based loss is suitable to learn hierarchical representations of the data. By testing on unseen fine level classes we show that this method is also capable of learning hierarchically correct representations of the new classes. Rank based loss has two promising aspects, it is generalisable to hierarchies with any number of levels, and is capable of dealing with data with incomplete hierarchical labels.

For agents

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

get_harvested_code_for_paper("2110.05941")
get_code_for_paper("2110.05941")
have("2110.05941")

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

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

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

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

Connect an agent — have() is free.