SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2306.03065 · 2023

LibAUC: A Deep Learning Library for X-Risk Optimization

arXiv · PDF · Open in the Atlas

Code that ran

5 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 4 have no contract verdict; 1 failure of our instrument; 4 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/2306.03065.json · badge: /api/ran/2306.03065.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
Optimization-AI/LibAUC canonical (classifier label)
classifier basis: census
5 ran · 4 no recorded run
FunctionStatusWhere it lives
ResNet20_stoc_att Ran
ran on a synthesized input
Optimization-AI/LibAUC/libauc/models/mil_models.py
code served (permissive licence) · get_code("01bef328fcb90223")
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_stoc_att. 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 torch.nn.functional as F

torch.manual_seed(0)

ARGS = {
    'activations': 'relu',
    'inchannels': 3,
    'num_classes': 1,
}
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_stoc_att — a ResNet_stoc_att output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a ResNet_stoc_att 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
concat_all_gather Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
Optimization-AI/LibAUC/libauc/losses/contrastive.py
code served (permissive licence) · get_code("8e658c85710c38c9")
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 2, dtype family float, shape (4, 4) 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 torch.distributed as dist
from unittest.mock import patch, MagicMock

torch.manual_seed(0)

# Mock torch.distributed functions since we're on CPU-only and not in a distributed setting
def mock_get_world_size():
    return 2

def mock_all_gather(tensors_gather, tensor, async_op=False):
    # Simulate all_gather by filling tensors_gather with copies of the input tensor
    for i in range(len(tensors_gather)):
        tensors_gather[i].copy_(tensor)

# Patch the distributed functions
dist.get_world_size = mock_get_world_size
dist.all_gather = mock_all_gather

# Create a small tensor for the function
tensor = torch.randn(2, 4)

ARGS = {
    "tensor": tensor
}
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 2, dtype family float, shape (4, 4) — shape (4, 4) 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
hinge_loss Ran
ran on a synthesized input
Optimization-AI/LibAUC/libauc/losses/surrogate.py
code served (permissive licence) · get_code("bce69fc779a88d80")
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 2, dtype family float, shape (2, 4) 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 hinge_loss function takes two parameters: margin and t
# Both are used with torch.max and torch.zeros_like, so they should be tensors
# margin: the margin hyperparameter (scalar or tensor)
# t: target/score tensor

# Create small tensors for testing
margin = torch.tensor(1.0)  # scalar margin value
t = torch.randn(2, 4)  # batch of 2 with dimension 4

ARGS = {
    "margin": margin,
    "t": t,
}
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 2, dtype family float, shape (2, 4) — shape (2, 4) 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
squared_hinge_loss Ran
ran on a synthesized input
Optimization-AI/LibAUC/libauc/losses/surrogate.py
code served (permissive licence) · get_code("169e9f577f80b9b9")
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 2, dtype family float, shape (2, 4) 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)

# margin: should be a scalar or tensor representing the margin hyperparameter
# t: should be a tensor of scores/predictions that we compare against the margin
# The function computes max(margin - t, 0)^2, so both should be numeric tensors

margin = torch.tensor(1.0)
t = torch.randn(2, 4)

ARGS = {
    "margin": margin,
    "t": t,
}
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 2, dtype family float, shape (2, 4) — shape (2, 4) 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
squared_loss Ran
ran on a synthesized input
Optimization-AI/LibAUC/libauc/losses/surrogate.py
code served (permissive licence) · get_code("7c4877fce871d8a6")
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 (4,) 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)

# The squared_loss function takes two parameters: margin and t
# Both are used in arithmetic operations (subtraction and squaring)
# They should be numeric types or tensors

# margin: a scalar hyperparameter value
margin = 0.5

# t: a tensor representing targets
# Using a small tensor with batch size 2
t = torch.tensor([0.1, 0.3, 0.2, 0.4])

ARGS = {
    "margin": margin,
    "t": t
}
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 1, dtype family float, shape (4,) — shape (4,) 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
DenseNet121 Not yet run
unverified (harvested, no recorded run)
Optimization-AI/LibAUC/libauc/models/densenet.py
code served (permissive licence) · get_code("8a4d4b5c6865a4b2")
How it ran

no invocation recorded.

DenseNet161 Not yet run
unverified (harvested, no recorded run)
Optimization-AI/LibAUC/libauc/models/densenet.py
code served (permissive licence) · get_code("6ef24032aeb13a90")
How it ran

no invocation recorded.

DenseNet169 Not yet run
unverified (harvested, no recorded run)
Optimization-AI/LibAUC/libauc/models/densenet.py
code served (permissive licence) · get_code("3f83d5288c64f414")
How it ran

no invocation recorded.

gather_features Not yet run
unverified (harvested, no recorded run)
Optimization-AI/LibAUC/libauc/losses/contrastive.py
code served (permissive licence) · get_code("0e719e1b1ed02c5a")
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, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 1 the same month, 1 later) and 8 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
concat_all_gather 138 other papers
76 dated earlier, 3 the same month, 58 later, 1 same year, order not determinable · 33 only as an assembly brick
1710.09412 (2017-10)
mixup: BEYOND EMPIRICAL RISK MINIMIZATION
1905.04899 (2019-05)
CutMix: Regularization Strategy to Train Strong Classifiers with Localizable Features
1905.12794 (2019-05)
Fashion IQ: A New Dataset Towards Retrieving Images by Natural Language Feedback
and 135 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-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

This paper introduces the award-winning deep learning (DL) library called LibAUC for implementing state-of-the-art algorithms towards optimizing a family of risk functions named X-risks. X-risks refer to a family of compositional functions in which the loss function of each data point is defined in a way that contrasts the data point with a large number of others. They have broad applications in AI for solving classical and emerging problems, including but not limited to classification for imbalanced data (CID), learning to rank (LTR), and contrastive learning of representations (CLR). The motivation of developing LibAUC is to address the convergence issues of existing libraries for solving these problems. In particular, existing libraries may not converge or require very large mini-batch sizes in order to attain good performance for these problems, due to the usage of the standard mini-batch technique in the empirical risk minimization (ERM) framework. Our library is for deep X-risk optimization (DXO) that has achieved great success in solving a variety of tasks for CID, LTR and CLR. The contributions of this paper include: (1) It introduces a new mini-batch based pipeline for implementing DXO algorithms, which differs from existing DL pipeline in the design of controlled data samplers and dynamic mini-batch losses; (2) It provides extensive benchmarking experiments for ablation studies and comparison with existing libraries. The LibAUC library features scalable performance for millions of items to be contrasted, faster and better convergence than existing libraries for optimizing X-risks, seamless PyTorch deployment and versatile APIs for various loss optimization. Our library is available to the open source community at https://github.com/Optimization-AI/LibAUC, to facilitate further academic research and industrial applications.

For agents

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

get_harvested_code_for_paper("2306.03065")
get_code_for_paper("2306.03065")
have("2306.03065")

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

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

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

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

Connect an agent — have() is free.