SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2307.02129 · 2023

How Deep Neural Networks Learn Compositional Data: The Random Hierarchy Model

arXiv · PDF · Open in the Atlas

Code that ran

6 of 11 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 0 have no contract verdict; 6 failures of our instrument; 5 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/2307.02129.json · badge: /api/ran/2307.02129.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
pcsl-epfl/hierarchy-learning canonical (classifier label)
classifier basis: census
6 ran · 5 no recorded run
FunctionStatusWhere it lives
bincount Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
pcsl-epfl/hierarchy-learning/measure_correlations.py
code served (permissive licence) · get_code("37ea32a587a28954")
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 3, dtype family int, shape (2, 3, 5) 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 int64 tensor with shape (2, 3, 4)
# The last dimension contains indices to be binned
x = torch.tensor(
    [
        [[0, 1, 2, 1], [1, 0, 3, 2], [2, 3, 0, 1]],
        [[3, 2, 1, 0], [0, 1, 2, 3], [1, 1, 1, 1]],
    ],
    dtype=torch.int64,
)

max_val = 5

ARGS = {
    "x": x,
    "max_val": max_val,
}
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 3, dtype family int, shape (2, 3, 5) — shape (2, 3, 5) 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
global_unfold Ran
ran; our contract draft was wrong, not the code
pcsl-epfl/hierarchy-learning/models/gcnn.py
code served (permissive licence) · get_code("afbf939ccf041c0c")
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 3, dtype family float, shape (2, 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)

# global_unfold takes a single parameter 'x' which should be a tensor
# Looking at the function:
# - x.shape[-1] is accessed, so x needs at least 1 dimension
# - x[..., None, :] is called, so x needs proper shape
# - x.expand(*x.shape[:-2], d // 2, d) suggests x should have at least 2 dimensions
# - tensor_roll is called on the result, which expects a tensor
# - The function accesses x.shape[-2], so x needs at least 2 dimensions

# Create a small tensor with shape (batch=2, seq=4)
# This satisfies the requirements: 2D tensor, d=4 (last dim), d//2=2 (for expand)
x = torch.randn(2, 4)

ARGS = {
    "x": x,
}
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 3, dtype family float, shape (2, 2, 4) — shape (2, 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
kernel_regression Ran
ran; our contract draft was wrong, not the code
pcsl-epfl/hierarchy-learning/main_kernel.py
code served (permissive licence) · get_code("601dcd53028064a8")
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

torch.manual_seed(0)

# Create small gram matrices and labels for kernel ridge regression
n_train = 2
n_test = 3

# train-train gram matrix (n_train x n_train)
ktrtr = torch.randn(n_train, n_train)
ktrtr = ktrtr @ ktrtr.T  # make it symmetric positive semi-definite

# test-train gram matrix (n_test x n_train)
ktetr = torch.randn(n_test, n_train)

# training labels (n_train,)
ytr = torch.randn(n_train)

# testing labels (n_test,)
yte = torch.randn(n_test)

# ridge parameter
ridge = 0.1

ARGS = {
    "ktrtr": ktrtr,
    "ktetr": ktetr,
    "ytr": ytr,
    "yte": yte,
    "ridge": ridge,
}
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 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
loss_func Ran
ran; our contract draft was wrong, not the code
pcsl-epfl/hierarchy-learning/optim_loss.py
code served (permissive licence) · get_code("c23da6206919edb5")
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 torch.nn as nn
from argparse import Namespace

torch.manual_seed(0)

# Create a simple args object with loss function specification
# The function uses: args.loss (string), args.alpha (numeric scalar)

class Args:
    def __init__(self, loss, alpha):
        self.loss = loss
        self.alpha = alpha

# Test with cross_entropy loss
# For cross_entropy: o should be logits (batch_size, num_classes), y should be class indices
batch_size = 2
num_classes = 4

o_cross_entropy = torch.randn(batch_size, num_classes)  # logits
y_cross_entropy = torch.tensor([0, 2], dtype=torch.long)  # class indices

args_cross_entropy = Args(loss='cross_entropy', alpha=0.5)

# Test with hinge loss
# For hinge loss: o and y should be same shape for element-wise operations
o_hinge = torch.randn(batch_size, num_classes)
y_hinge = torch.randn(batch_size, num_classes)

args_hinge = Args(loss='hinge', alpha=0.5)

# Use cross_entropy setup as the main ARGS
ARGS = {
    'args': args_cross_entropy,
    'o': o_cross_entropy,
    'y': y_cross_entropy
}
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 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
svc Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
pcsl-epfl/hierarchy-learning/main_kernel.py
code served (permissive licence) · get_code("6aa1dc0f32c1012c")
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
from sklearn.svm import SVC

torch.manual_seed(0)

# Create small gram matrices (train-train and test-train)
# Gram matrices are square for train-train, rectangular for test-train
# Using precomputed kernel, so values should be reasonable similarity scores
ktrtr = np.array([
    [1.0, 0.5, 0.3],
    [0.5, 1.0, 0.4],
    [0.3, 0.4, 1.0]
], dtype=np.float64)

ktetr = np.array([
    [0.6, 0.7, 0.2],
    [0.8, 0.3, 0.5]
], dtype=np.float64)

# Training labels (3 samples for training)
ytr = np.array([0, 1, 0], dtype=np.int64)

# Test labels (2 samples for testing)
yte = torch.tensor([1, 0], dtype=torch.int64)

# L2 penalty
l = 0.01

# Kernel type (precomputed for gram matrices)
kernel = 'precomputed'

ARGS = {
    'ktrtr': ktrtr,
    'ktetr': ktetr,
    'ytr': ytr,
    'yte': yte,
    'l': l,
    'kernel': kernel
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn, 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
unpickle Ran
ran; our contract draft was wrong, not the code
pcsl-epfl/hierarchy-learning/init.py
pointer only (licence: MIT); the stored copy get_code serves, from haiyunyao/diversemix, is pointer only (licence: NONE) · get_code("4ebc0e09cb353eac")
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 haiyunyao/diversemix, 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.

linear_svc Not yet run
unverified (harvested, no recorded run)
pcsl-epfl/hierarchy-learning/main_kernel.py
code served (permissive licence) · get_code("b3dc3634c2468bbf")
How it ran

no invocation recorded.

measure_accuracy Not yet run
unverified (harvested, no recorded run)
pcsl-epfl/hierarchy-learning/optim_loss.py
code served (permissive licence) · get_code("1679a6a10d313c08")
How it ran

no invocation recorded.

opt_algo Not yet run
unverified (harvested, no recorded run)
pcsl-epfl/hierarchy-learning/optim_loss.py
code served (permissive licence) · get_code("2350fd228840f8ab")
How it ran

no invocation recorded.

tensor_roll Not yet run
unverified (harvested, no recorded run)
pcsl-epfl/hierarchy-learning/models/gcnn.py
code served (permissive licence) · get_code("7abf45dc07ba9e5f")
How it ran

no invocation recorded.

two_layers Not yet run
unverified (harvested, no recorded run)
pcsl-epfl/hierarchy-learning/main_layerwise.py
code served (permissive licence) · get_code("20662162ea3dece1")
How it ran

no invocation recorded.

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 11 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 1 later) and 10 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
unpickle 7 other papers
3 dated earlier, 4 later
1911.07205 (2019-11)
REFIT: A Unified Watermark Removal Framework For Deep Learning Systems With Limited Data
2104.08984 (2021-04)
Contrastive Learning Improves Model Robustness Under Label Noise
2202.03299 (2022-02)
Training OOD Detectors in their Natural Habitats
and 4 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

Deep learning algorithms demonstrate a surprising ability to learn high-dimensional tasks from limited examples. This is commonly attributed to the depth of neural networks, enabling them to build a hierarchy of abstract, low-dimensional data representations. However, how many training examples are required to learn such representations remains unknown. To quantitatively study this question, we introduce the Random Hierarchy Model: a family of synthetic tasks inspired by the hierarchical structure of language and images. The model is a classification task where each class corresponds to a group of high-level features, chosen among several equivalent groups associated with the same class. In turn, each feature corresponds to a group of sub-features chosen among several equivalent ones and so on, following a hierarchy of composition rules. We find that deep networks learn the task by developing internal representations invariant to exchanging equivalent groups. Moreover, the number of data required corresponds to the point where correlations between low-level features and classes become detectable. Overall, our results indicate how deep networks overcome the curse of dimensionality by building invariant representations, and provide an estimate of the number of data required to learn a hierarchical task.

For agents

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

get_harvested_code_for_paper("2307.02129")
get_code_for_paper("2307.02129")
have("2307.02129")

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

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

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

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

Connect an agent — have() is free.