SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2004.00221 · ICLR · 2021

NBDT: NEURAL-BACKED DECISION TREE

U Berkeley, Joseph Gonzalez, Alvin Wan, Lisa Dunlap, Daniel Ho, Jihan Yin, Scott Lee, Suzanne Petryk, Sarah Bargal

arXiv · PDF · Open in the Atlas

Code that ran

18 of 29 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (2 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 3 have no contract verdict; 14 failures of our instrument; 11 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/2004.00221.json · badge: /api/ran/2004.00221.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
alvinwan/neural-backed-decision-trees canonical (classifier label)
classifier basis: classifier_2025
1 ran · 5 no recorded run
XAVILLA/nbdt community
Papers with Code archive
17 ran · 6 no recorded run
FunctionStatusWhere it lives
Colors Ran
ran on a synthesized input · constructed an object; no result was computed
XAVILLA/nbdt/nbdt/model.py
code served (permissive licence) · get_code("1020d5e79c4766de")
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, Colors: 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

torch.manual_seed(0)

ARGS = {}
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 Colors — 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 Colors 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
FakeSynset Ran
ran on a synthesized input · constructed an object; no result was computed
XAVILLA/nbdt/nbdt/model.py
code served (permissive licence) · get_code("52cf40b8aae2967f")
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, FakeSynset: 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

class FakeSynset:

    def __init__(self, wnid):
        self.wnid = wnid
        assert isinstance(wnid, str)

    @staticmethod
    def create_from_offset(offset):
        return FakeSynset('f{:08d}'.format(offset))

    def offset(self):
        return int(self.wnid[1:])

    def pos(self):
        return 'f'

    def name(self):
        return '(generated)'

    def definition(self):
        return '(generated)'


ARGS = {
    'wnid': 'f00000042'
}
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 FakeSynset — 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 FakeSynset 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
coerce_state_dict Ran
ran; our contract draft was wrong, not the code
XAVILLA/nbdt/nbdt/model.py
code served (permissive licence) · get_code("303cf42ae5edc004")
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 dict. 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 simple state dict that represents model weights
# The function checks if keys start with 'module.' and manipulates them
state_dict = {
    'module.layer1.weight': torch.randn(4, 3),
    'module.layer1.bias': torch.randn(4),
    'module.layer2.weight': torch.randn(5, 4),
}

# Create a reference state dict without 'module.' prefix
reference_state_dict = {
    'layer1.weight': torch.randn(4, 3),
    'layer1.bias': torch.randn(4),
    'layer2.weight': torch.randn(5, 4),
}

ARGS = {
    'state_dict': state_dict,
    'reference_state_dict': reference_state_dict,
}
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 dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
dataset_to_default_path_graph Ran
ran; our contract draft was wrong, not the code
XAVILLA/nbdt/nbdt/model.py
code served (permissive licence) · get_code("23b18dbf212e73e9")
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 str. 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 os
from pathlib import Path

# The function dataset_to_default_path_graph takes one parameter: dataset
# It's used as a string in os.path.join and f-string formatting
# No complex objects needed, just a string

ARGS = {
    'dataset': 'cifar10'
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
dataset_to_default_path_wnids Ran
ran; our contract draft was wrong, not the code
XAVILLA/nbdt/nbdt/model.py
code served (permissive licence) · get_code("e081d64f5cad1cd9")
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 str. 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 os
from pathlib import Path

# The function dataset_to_default_path_wnids takes a dataset parameter
# and constructs a path string using os.path.join
# The parameter is used as a string in an f-string: f'wnids/{dataset}.txt'

# We need to provide a dataset argument - it should be a string
dataset_value = "imagenet"

ARGS = {
    "dataset": dataset_value
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
dataset_to_dummy_classes Ran
ran; our contract draft was wrong, not the code
XAVILLA/nbdt/nbdt/model.py
code served (permissive licence) · get_code("4625fb450d4c7b8c")
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 list, 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 torch
import numpy as np

DATASETS = ('CIFAR10', 'CIFAR100', 'TinyImagenet200', 'Imagenet1000', 'Cityscapes', 'PascalContext', 'LookIntoPerson', 'ADE20K', 'Office_Home_Art', 'Office_Home_Clipart', 'Office_Home_Product', 'Office_Home_Real')

DATASET_TO_NUM_CLASSES = {'CIFAR10': 10, 'CIFAR100': 100, 'TinyImagenet200': 200, 'Imagenet1000': 1000, 'Cityscapes': 19, 'PascalContext': 59, 'LookIntoPerson': 20, 'ADE20K': 150, 'Office_Home': 65}

class FakeSynset:

    def __init__(self, wnid):
        self.wnid = wnid
        assert isinstance(wnid, str)

    @staticmethod
    def create_from_offset(offset):
        return FakeSynset('f{:08d}'.format(offset))

    def offset(self):
        return int(self.wnid[1:])

    def pos(self):
        return 'f'

    def name(self):
        return '(generated)'

    def definition(self):
        return '(generated)'

def dataset_to_dummy_classes(dataset):
    assert dataset in DATASETS
    num_classes = DATASET_TO_NUM_CLASSES[dataset]
    return [FakeSynset.create_from_offset(i).wnid for i in range(num_classes)]

ARGS = {
    'dataset': 'CIFAR10'
}
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 list, ndim 1, dtype family float — a list 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
dataset_to_dummy_classes Ran
ran; our contract draft was wrong, not the code
alvinwan/neural-backed-decision-trees/nbdt/model.py
code served (permissive licence) · get_code("a32351468906ce8a")
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 list, 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 torch
import numpy as np

DATASETS = ('CIFAR10', 'CIFAR100', 'TinyImagenet200', 'Imagenet1000', 'Cityscapes', 'PascalContext', 'LookIntoPerson', 'ADE20K')

DATASET_TO_NUM_CLASSES = {'CIFAR10': 10, 'CIFAR100': 100, 'TinyImagenet200': 200, 'Imagenet1000': 1000, 'Cityscapes': 19, 'PascalContext': 59, 'LookIntoPerson': 20, 'ADE20K': 150}

class FakeSynset:

    def __init__(self, wnid):
        self.wnid = wnid
        assert isinstance(wnid, str)

    @staticmethod
    def create_from_offset(offset):
        return FakeSynset('f{:08d}'.format(offset))

    def offset(self):
        return int(self.wnid[1:])

    def pos(self):
        return 'f'

    def name(self):
        return '(generated)'

    def definition(self):
        return '(generated)'

def dataset_to_dummy_classes(dataset):
    assert dataset in DATASETS
    num_classes = DATASET_TO_NUM_CLASSES[dataset]
    return [FakeSynset.create_from_offset(i).wnid for i in range(num_classes)]

ARGS = {
    'dataset': 'CIFAR10'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list 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
fwd Ran
ran on a synthesized input
XAVILLA/nbdt/nbdt/model.py
code served (permissive licence) · get_code("8497ac1255b3b1a5")
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 PosixPath. 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
from pathlib import Path

# The function fwd() takes no parameters and returns Path(__file__).parent.absolute()
# It simply uses Path from pathlib to get the parent directory of the current file

ARGS = {}
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 PosixPath — a PosixPath output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a PosixPath 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
get_leaf_to_path Ran
ran; our contract draft was wrong, not the code
XAVILLA/nbdt/nbdt/model.py
code served (permissive licence) · get_code("642244caa777143c")
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 dict. 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 networkx as nx

# Create a simple directed acyclic graph (DAG) for testing
G = nx.DiGraph()

# Add nodes
G.add_nodes_from([0, 1, 2, 3, 4, 5])

# Add edges to create a DAG structure:
# 0 (root) -> 1, 2
# 1 -> 3, 4
# 2 -> 5
# 3, 4, 5 are leaves
G.add_edges_from([
    (0, 1),
    (0, 2),
    (1, 3),
    (1, 4),
    (2, 5)
])

ARGS = {
    "G": G
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
networkx — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
get_leaves Ran
ran; our contract draft was wrong, not the code
XAVILLA/nbdt/nbdt/model.py
code served (permissive licence) · get_code("6cbac319834ba8ae")
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 generator. 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 networkx as nx

# Create a directed graph with some leaf nodes
G = nx.DiGraph()

# Add nodes
G.add_nodes_from([1, 2, 3, 4, 5, 6])

# Add edges to create a tree structure
# 1 -> 2, 1 -> 3
# 2 -> 4
# 3 -> 5
# 4, 5, 6 are leaves (no successors)
G.add_edges_from([
    (1, 2),
    (1, 3),
    (2, 4),
    (3, 5)
])

# Node 6 is isolated and will also be a leaf
# Nodes 4, 5, 6 have no successors, so they are leaves

ARGS = {
    "G": G,
    "root": None
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
networkx — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type generator — a generator output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a generator 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
get_roots Ran
ran; our contract draft was wrong, not the code
XAVILLA/nbdt/nbdt/model.py
code served (permissive licence) · get_code("e31c7cca6d6133a2")
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 generator. 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 networkx as nx

# Create a directed graph with some nodes
G = nx.DiGraph()

# Add nodes
G.add_nodes_from([0, 1, 2, 3, 4])

# Add edges to create a structure where node 0 and node 1 are roots (no predecessors)
# node 0 -> node 2
# node 1 -> node 3
# node 2 -> node 4
G.add_edges_from([(0, 2), (1, 3), (2, 4)])

ARGS = {
    "G": G
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
networkx — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type generator — a generator output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a generator 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
get_wnids Ran
ran; our contract draft was wrong, not the code
XAVILLA/nbdt/nbdt/model.py
code served (permissive licence) · get_code("e270d7f9006e5c50")
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 list, 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 os
from pathlib import Path

# Create a temporary directory and file for testing
temp_dir = tempfile.mkdtemp()
wnids_file = os.path.join(temp_dir, "wnids.txt")

# Write some sample WordNet IDs to the file
with open(wnids_file, "w") as f:
    f.write("n00000001\n")
    f.write("n00000002\n")
    f.write("n00000003\n")

ARGS = {
    "path_wnids": wnids_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 list, ndim 1, dtype family float — a list 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
hierarchy_to_path_graph Ran
ran; our contract draft was wrong, not the code
XAVILLA/nbdt/nbdt/model.py
code served (permissive licence) · get_code("8c79e86eb84f0948")
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 str. 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 numpy as np
from pathlib import Path
import os

# The function hierarchy_to_path_graph takes two parameters: dataset and hierarchy
# Both are used in string formatting/os.path.join, so they should be strings

ARGS = {
    "dataset": "mnist",
    "hierarchy": "v1"
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
is_leaf Ran
ran; our contract draft was wrong, not the code
XAVILLA/nbdt/nbdt/model.py
code served (permissive licence) · get_code("626c774cdb0ecdea")
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 bool, 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 networkx as nx

# Create a directed graph using networkx
G = nx.DiGraph()

# Add some nodes
G.add_nodes_from([0, 1, 2, 3])

# Add edges to create a structure where some nodes are leaves and some are not
# Node 0 -> Node 1
# Node 0 -> Node 2
# Node 3 has no outgoing edges (is a leaf)
G.add_edge(0, 1)
G.add_edge(0, 2)

# Define ARGS
ARGS = {
    "G": G,
    "node": 3
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
networkx, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, 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_graph Ran
ran, honoured the contract we drafted
XAVILLA/nbdt/nbdt/model.py
code served (permissive licence) · get_code("7ef704b1f90df1c8")
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 Graph. 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 json
import tempfile
from pathlib import Path
import networkx as nx
from networkx.readwrite.json_graph import node_link_data

# Create a temporary directory and file for testing
temp_dir = tempfile.mkdtemp()
temp_path = Path(temp_dir) / "test_graph.json"

# Create a simple graph and serialize it to JSON
graph = nx.Graph()
graph.add_edges_from([(0, 1), (1, 2), (2, 3)])
graph_data = node_link_data(graph)

with open(temp_path, 'w') as f:
    json.dump(graph_data, f)

# Define ARGS with the path to the created graph file
ARGS = {
    'path': str(temp_path)
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
networkx — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Graph — a Graph output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Graph output the recorded ndim 1 and dtype family int 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
synset_to_name Ran
ran; our contract draft was wrong, not the code
XAVILLA/nbdt/nbdt/model.py
code served (permissive licence) · get_code("8d5c8808f6873339")
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 str. 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.

class MockSynset:
    def __init__(self, name_str):
        self._name = name_str
    
    def name(self):
        return self._name

synset = MockSynset("dog.n.01")

ARGS = {
    "synset": synset
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
wnid_to_name Ran
ran; our contract draft was wrong, not the code
XAVILLA/nbdt/nbdt/model.py
code served (permissive licence) · get_code("71ff6b40cffae955")
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 str. 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 nltk
from nltk.corpus import wordnet as wn

# Try to ensure wordnet data is available (may fail silently in sandbox)
try:
    wn.synsets('dog')
except:
    pass

# Define ARGS dict with the wnid parameter for wnid_to_name function
ARGS = {
    'wnid': 'n00001740'  # A valid WordNet ID format (pos='n', offset=1740)
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
nltk, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
wnid_to_synset Ran
ran; our contract draft was wrong, not the code
XAVILLA/nbdt/nbdt/model.py
code served (permissive licence) · get_code("1743b41d3adb91a6")
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 FakeSynset. 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 numpy as np
from unittest.mock import Mock, MagicMock

torch.manual_seed(0)

# The function wnid_to_synset takes a wnid (string) parameter
# It uses:
# - int(wnid[1:]) to extract offset from position 1 onwards
# - wnid[0] to get the first character (pos)
# - Attempts to call wn.synset_from_pos_and_offset(wnid[0], offset)
# - Falls back to creating FakeSynset(wnid) if that fails

# Valid wnid format appears to be: first char is POS, followed by digits
# Example: 'n00001740' where 'n' is POS and '00001740' is offset

ARGS = {
    'wnid': 'n00001740'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
nltk, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type FakeSynset — a FakeSynset output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a FakeSynset 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
EmbeddedDecisionRules Not yet run
unverified (harvested, no recorded run)
XAVILLA/nbdt/nbdt/model.py
code served (permissive licence) · get_code("95c098426e5a427f")
How it ran

no invocation recorded.

EmbeddedDecisionRules Not yet run
unverified (harvested, no recorded run)
alvinwan/neural-backed-decision-trees/nbdt/model.py
code served (permissive licence) · get_code("55ce848c52ee5cb8")
How it ran

no invocation recorded.

HardEmbeddedDecisionRules Not yet run
unverified (harvested, no recorded run)
XAVILLA/nbdt/nbdt/model.py
code served (permissive licence) · get_code("e9189fbf051e129d")
How it ran

no invocation recorded.

HardEmbeddedDecisionRules Not yet run
unverified (harvested, no recorded run)
alvinwan/neural-backed-decision-trees/nbdt/model.py
code served (permissive licence) · get_code("be59a6ad0e2ddec0")
How it ran

no invocation recorded.

NBDT Not yet run
unverified (harvested, no recorded run)
XAVILLA/nbdt/nbdt/model.py
code served (permissive licence) · get_code("13e0602b87690b50")
How it ran

no invocation recorded.

NBDT Not yet run
unverified (harvested, no recorded run)
alvinwan/neural-backed-decision-trees/nbdt/model.py
code served (permissive licence) · get_code("899f401f38f1fd83")
How it ran

no invocation recorded.

Node Not yet run
unverified (harvested, no recorded run)
XAVILLA/nbdt/nbdt/model.py
code served (permissive licence) · get_code("20d642b846aa125d")
How it ran

no invocation recorded.

Tree Not yet run
unverified (harvested, no recorded run)
XAVILLA/nbdt/nbdt/model.py
code served (permissive licence) · get_code("4553e20f251d19cb")
How it ran

no invocation recorded.

Tree Not yet run
unverified (harvested, no recorded run)
alvinwan/neural-backed-decision-trees/nbdt/model.py
code served (permissive licence) · get_code("fbc1d6876bb0df31")
How it ran

no invocation recorded.

load_state_dict_from_key Not yet run
unverified (harvested, no recorded run)
XAVILLA/nbdt/nbdt/model.py
code served (permissive licence) · get_code("e33501c9d70eab4b")
How it ran

no invocation recorded.

load_state_dict_from_key Not yet run
unverified (harvested, no recorded run)
alvinwan/neural-backed-decision-trees/nbdt/model.py
code served (permissive licence) · get_code("14f8f9f850c7e428")
How it ran

no invocation recorded.

Also present in other papers' code

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

Machine learning applications such as finance and medicine demand accurate and justifiable predictions, barring most deep learning methods from use. In response, previous work combines decision trees with deep learning, yielding models that (1) sacrifice interpretability for accuracy or (2) sacrifice accuracy for interpretability. We forgo this dilemma by jointly improving accuracy and interpretability using Neural-Backed Decision Trees (NBDTs). NBDTs replace a neural network's final linear layer with a differentiable sequence of decisions and a surrogate loss. This forces the model to learn high-level concepts and lessens reliance on highlyuncertain decisions, yielding (1) accuracy: NBDTs match or outperform modern neural networks on CIFAR, ImageNet and better generalize to unseen classes by up to 16%. Furthermore, our surrogate loss improves the original model's accuracy by up to 2%. NBDTs also afford (2) interpretability: improving human trust by clearly identifying model mistakes and assisting in dataset debugging. Code and pretrained NBDTs are at github.com/alvinwan/neural-backed-decision-trees. * denotes equal contribution

For agents

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

get_harvested_code_for_paper("2004.00221")
get_code_for_paper("2004.00221")
have("2004.00221")

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

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

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

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

Connect an agent — have() is free.