SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2004.13912 · NeurIPS · 2021

Neural Additive Models: Interpretable Machine Learning with Neural Nets

Geoffrey Hinton, Rishabh Agarwal, Levi Melnick, Nicholas Frosst, Xuezhou Zhang, Ben Lengerich, Rich Caruana

arXiv · PDF · Open in the Atlas

Code that ran

26 of 33 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (14 of them constructed an object rather than computing a result; 5 honoured the contract we drafted, 0 violated it and 21 have no contract verdict; 0 failures of our instrument; 7 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.13912.json · badge: /api/ran/2004.13912.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
nickfrosst/neural_additive_models canonical (classifier label)
classifier basis: classifier_2025
5 ran · 1 no recorded run
kherud/neural-additive-models-pt port (classifier label)
classifier basis: classifier_2025
5 ran · 1 no recorded run
AmrMKayid/nam community
Papers with Code archive
5 ran · 0 no recorded run
Habush/nam_jax community
Papers with Code archive
4 ran · 1 no recorded run
fortuinlab/la-nam community
Papers with Code archive
3 ran · 1 no recorded run
saipradeep-peri/Neural_Additive_Models_Walkthrough community
Papers with Code archive
2 ran · 0 no recorded run
google-research/google-research community
Papers with Code archive
1 ran · 2 no recorded run
lemeln/nam marked official in Papers with Code
Papers with Code archive
1 ran · 1 no recorded run
FunctionStatusWhere it lives
ActivationLayer Ran
ran on a synthesized input · constructed an object; no result was computed
kherud/neural-additive-models-pt/nam/model.py
pointer only (licence: NONE) · get_code("51c75dde5a5a0f26")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, kherud/neural-additive-models-pt 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.

ActivationLayer Ran
ran on a synthesized input · constructed an object; no result was computed
nickfrosst/neural_additive_models/models.py
pointer only (licence: NONE) · get_code("546b56723399f9fe")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, nickfrosst/neural_additive_models 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.

Categorical Ran
ran on a synthesized input
fortuinlab/la-nam/src/laplace_skorch/modules.py
code served (permissive licence) · get_code("2c6a77de4277d87c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 2, dtype family float, shape (2, 8) 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
import functools
import operator
from collections.abc import Sequence

class Categorical(nn.Sequential):
    """A feature network attending to one or more categorical features.s"""
    _cumprod: torch.LongTensor
    in_features: int
    in_features_encoded: int
    out_features: int

    def __init__(self, num_classes: int | Sequence[int], out_features: int) -> None:
        super().__init__()
        if isinstance(num_classes, int):
            num_classes = [num_classes]
        self._register_cumprod(num_classes)
        self.in_features = len(num_classes)
        self.in_features_encoded = functools.reduce(operator.mul, num_classes)
        self.out_features = out_features
        self.append(nn.Linear(in_features=self.in_features_encoded, out_features=self.out_features))

    def _register_cumprod(self, num_classes: Sequence[int]) -> None:
        cumprod = torch.cat([torch.tensor([1], dtype=torch.int64), torch.cumprod(torch.tensor(num_classes[:-1], dtype=torch.int64), dim=0)])
        self.register_buffer('_cumprod', cumprod.long())

    def forward(self, input: torch.Tensor) -> torch.Tensor:
        encoded = torch.sum(input.long() * self._cumprod, dim=1)
        import torch.nn.functional as F
        encoded = F.one_hot(encoded, num_classes=self.in_features_encoded).float()
        return super().forward(encoded)


INIT_ARGS = {
    'num_classes': [3, 4, 5],
    'out_features': 8
}

ARGS = {
    'input': torch.randint(0, 5, (2, 3), dtype=torch.long)
}

if __name__ == '__main__':
    model = Categorical(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Output: {output}")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
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, 8) — shape (2, 8) 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
ExU Ran
ran on a synthesized input
AmrMKayid/nam/nam/models/nam.py
code served (permissive licence) · get_code("4906a2527041456e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 2, 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 torch.nn.functional as F
from torch.nn.parameter import Parameter

class ExU(torch.nn.Module):

    def __init__(self, in_features: int, out_features: int) -> None:
        super(ExU, self).__init__()
        self.in_features = in_features
        self.out_features = out_features
        self.weights = Parameter(torch.Tensor(in_features, out_features))
        self.bias = Parameter(torch.Tensor(in_features))
        self.reset_parameters()

    def reset_parameters(self) -> None:
        torch.nn.init.trunc_normal_(self.weights, mean=4.0, std=0.5)
        torch.nn.init.trunc_normal_(self.bias, std=0.5)

    def forward(self, inputs: torch.Tensor, n: int=1) -> torch.Tensor:
        output = (inputs - self.bias).matmul(torch.exp(self.weights))
        output = F.relu(output)
        output = torch.clamp(output, 0, n)
        return output

    def extra_repr(self):
        return f'in_features={self.in_features}, out_features={self.out_features}'


INIT_ARGS = {
    'in_features': 4,
    'out_features': 3,
}

ARGS = {
    'inputs': torch.randn(2, 4),
    'n': 1,
}

if __name__ == '__main__':
    model = ExU(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Output: {output}")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
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 — no output shape is stated: observe_signature.py observed this class with its constructor sizes canonicalised where it could, which the node does not record, so its shape is not stated as this setup block's
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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
ExULayer Ran
ran on a synthesized input · constructed an object; no result was computed
kherud/neural-additive-models-pt/nam/model.py
pointer only (licence: NONE) · get_code("2d8839407b350dc9")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, kherud/neural-additive-models-pt 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.

FeatureNN Ran
ran on a synthesized input
kherud/neural-additive-models-pt/nam/model.py
pointer only (licence: NONE) · get_code("8c55bd802f9906ca")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, kherud/neural-additive-models-pt 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.

FeatureNN Ran
ran on a synthesized input · constructed an object; no result was computed
AmrMKayid/nam/nam/models/nam.py
code served (permissive licence) · get_code("dd231b4d8f71426e")
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, FeatureNN: 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

torch.manual_seed(0)

# Create a minimal config object with the required attributes
class Config:
    def __init__(self):
        self.dropout = 0.1
        self.hidden_sizes = [8, 6]
        self.activation = 'exu'

config = Config()

# Define ARGS dictionary with all parameters for FeatureNN
ARGS = {
    'config': config,
    'name': 'feature_nn_0',
    'input_shape': 4,
    'num_units': 5,
    'feature_num': 0
}
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 FeatureNN — 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 FeatureNN 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
FeatureNN Ran
ran on a synthesized input · constructed an object; no result was computed
nickfrosst/neural_additive_models/models.py
pointer only (licence: NONE) · get_code("053cdbd7b148f0cc")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, nickfrosst/neural_additive_models 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.

FeatureNN Ran
ran on a synthesized input · constructed an object; no result was computed
saipradeep-peri/Neural_Additive_Models_Walkthrough/nam/models/nam.py
pointer only (licence: NONE) · get_code("243e71c28636308b")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, saipradeep-peri/Neural_Additive_Models_Walkthrough 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.

FeatureNN Ran
ran on a synthesized input · constructed an object; no result was computed
google-research/google-research/neural_additive_models/models.py
code served (permissive licence) · get_code("7a5f01663e901790")
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, FeatureNN: 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 tensorflow as tf
import numpy as np

# Set random seed for reproducibility
tf.random.set_seed(0)
np.random.seed(0)

# Create small input tensor for testing
# Shape: (batch_size=2, feature_dim=4)
x_input = tf.constant([[1.0, 2.0, 3.0, 4.0], [5.0, 6.0, 7.0, 8.0]], dtype=tf.float32)

# Define ARGS dict with all parameters for FeatureNN
ARGS = {
    'num_units': 8,
    'dropout': 0.5,
    'trainable': True,
    'shallow': True,
    'feature_num': 0,
    'name_scope': 'model',
    'activation': 'exu'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type FeatureNN — 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 FeatureNN 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
FeatureNN Ran
ran on a synthesized input
lemeln/nam/nam/models/nam.py
code served (permissive licence) · get_code("b0e0374e9293aa60")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 3, 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 torch.nn as nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter

class ExU(torch.nn.Module):

    def __init__(self, in_features: int, out_features: int) -> None:
        super(ExU, self).__init__()
        self.in_features = in_features
        self.out_features = out_features
        self.weights = Parameter(torch.Tensor(in_features, out_features))
        self.bias = Parameter(torch.Tensor(in_features))
        self.reset_parameters()

    def reset_parameters(self) -> None:
        torch.nn.init.trunc_normal_(self.weights, mean=4.0, std=0.5)
        torch.nn.init.trunc_normal_(self.bias, std=0.5)

    def forward(self, inputs: torch.Tensor, n: int=1) -> torch.Tensor:
        output = (inputs - self.bias).matmul(torch.exp(self.weights))
        output = F.relu(output)
        output = torch.clamp(output, 0, n)
        return output

    def extra_repr(self):
        return f'in_features={self.in_features}, out_features={self.out_features}'

class LinReLU(torch.nn.Module):
    __constants__ = ['bias']

    def __init__(self, in_features: int, out_features: int) -> None:
        super(LinReLU, self).__init__()
        self.in_features = in_features
        self.out_features = out_features
        self.weights = Parameter(torch.Tensor(in_features, out_features))
        self.bias = Parameter(torch.Tensor(in_features))
        self.reset_parameters()

    def reset_parameters(self) -> None:
        nn.init.xavier_uniform_(self.weights)
        torch.nn.init.trunc_normal_(self.bias, std=0.5)

    def forward(self, inputs: torch.Tensor) -> torch.Tensor:
        output = (inputs - self.bias) @ self.weights
        output = F.relu(output)
        return output

    def extra_repr(self):
        return f'in_features={self.in_features}, out_features={self.out_features}'

class FeatureNN(torch.nn.Module):
    """Neural Network model for each individual feature."""

    def __init__(self, input_shape: int, num_units: int, dropout: float, hidden_sizes: list=[64, 32], activation: str='relu') -> None:
        """Initializes FeatureNN hyperparameters.

        Args:
          input_shape: Dimensionality of input data.
          num_units: Number of hidden units in first hidden layer.
          dropout: Coefficient for dropout regularization.
          hidden_sizes: List of hidden dimensions for each layer.
          activation: Activation function of first layer (relu or exu).
        """
        super(FeatureNN, self).__init__()
        self.input_shape = input_shape
        self.num_units = num_units
        self.hidden_sizes = hidden_sizes
        self.activation = activation
        all_hidden_sizes = [self.num_units] + self.hidden_sizes
        layers = []
        self.dropout = nn.Dropout(p=dropout)
        if self.activation == 'exu':
            layers.append(ExU(in_features=input_shape, out_features=num_units))
        else:
            layers.append(LinReLU(in_features=input_shape, out_features=num_units))
        for in_features, out_features in zip(all_hidden_sizes, all_hidden_sizes[1:]):
            layers.append(nn.Linear(in_features, out_features))
            layers.append(nn.ReLU())
        layers.append(nn.Linear(in_features=all_hidden_sizes[-1], out_features=1, bias=False))
        self.model = nn.ModuleList(layers)

    def forward(self, inputs) -> torch.Tensor:
        """Computes FeatureNN output with either evaluation or training
        mode."""
        outputs = inputs.unsqueeze(1)
        for layer in self.model:
            outputs = self.dropout(layer(outputs))
        return outputs


INIT_ARGS = {
    'input_shape': 5,
    'num_units': 8,
    'dropout': 0.1,
    'hidden_sizes': [6, 4],
    'activation': 'relu'
}

ARGS = {
    'inputs': torch.randn(2, 5)
}
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
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 — no output shape is stated: observe_signature.py observed this class with its constructor sizes canonicalised where it could, which the node does not record, so its shape is not stated as this setup block's
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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
LinReLU Ran
ran on a synthesized input · constructed an object; no result was computed
AmrMKayid/nam/nam/models/nam.py
code served (permissive licence) · get_code("80fc1bfd32c3dd88")
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, LinReLU: 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

torch.manual_seed(0)

ARGS = {
    'in_features': 4,
    'out_features': 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 LinReLU — 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 LinReLU 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
Mixed Ran
ran on a synthesized input
fortuinlab/la-nam/src/laplace_skorch/modules.py
code served (permissive licence) · get_code("a3bc285602224f16")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 2, 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 torch.nn as nn

# INIT_ARGS for Mixed.__init__
# num_classes: Sequence[int] - number of classes for each categorical feature
# out_features: int - output dimension
# **kwargs can include hidden_dims and activation_cls

INIT_ARGS = {
    'num_classes': [3, 5, 1, 4],  # 4 features: 3 categorical (3, 5, 4 classes) and 1 numerical (1 means continuous)
    'out_features': 7,
    'hidden_dims': [16, 12],
    'activation_cls': nn.GELU
}

# ARGS for Mixed.forward
# input: torch.Tensor of shape (batch_size, num_features)
# Each column corresponds to a feature:
# - For categorical features (num_classes > 1): integer class indices
# - For numerical features (num_classes == 1): continuous values

batch_size = 2
num_features = len(INIT_ARGS['num_classes'])

input_tensor = torch.tensor([
    [0, 2, 0.5, 1],  # batch item 1: cat=0, cat=2, num=0.5, cat=1
    [2, 4, -1.2, 3]  # batch item 2: cat=2, cat=4, num=-1.2, cat=3
], dtype=torch.float32)

ARGS = {
    'input': input_tensor
}
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
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 — no output shape is stated: observe_signature.py observed this class with its constructor sizes canonicalised where it could, which the node does not record, so its shape is not stated as this setup block's
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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
Model Ran
ran on a synthesized input · constructed an object; no result was computed
AmrMKayid/nam/nam/models/nam.py
code served (permissive licence) · get_code("d3617b2e6bdec534")
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, Model: 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

torch.manual_seed(0)

# Create a minimal config dict
config = {
    "hidden_dim": 64,
    "num_layers": 2,
    "dropout": 0.1
}

# The Model class takes config and name as parameters
name = "test_model"

# Construct the ARGS dictionary
ARGS = {
    "config": config,
    "name": name
}
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 Model — 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 Model 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
NAM Ran
ran on a synthesized input · constructed an object; no result was computed
Habush/nam_jax/models.py
code served (permissive licence) · get_code("4a9811b70594bfe1")
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, NAM: 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 jax
import jax.numpy as jnp
import haiku as hk
import optax
from typing import NamedTuple

# Define activation functions
def exu(x, weight, bias):
    """ExU hidden unit modification."""
    return (x - bias) @ jnp.exp(weight)

def relu(x, weight, bias):
    """ReLU activation."""
    return jax.nn.relu((x - bias) @ weight)

# Define a simple loss function
def simple_loss_fn(y_pred, y_true):
    """Simple MSE loss."""
    return jnp.mean((y_pred - y_true) ** 2)

# Define step size schedule
def step_size_schedule(step):
    """Simple step size schedule."""
    return 0.001

# Construct ARGS
ARGS = {
    'num_inputs': 4,
    'num_units': 16,
    'step_size_fn': step_size_schedule,
    'loss_fn': simple_loss_fn,
    'shallow': True,
    'feature_dropout': 0.0,
    'dropout': 0.5,
    'output_reg': 0.0,
    'l2_reg': 0.0,
    'activation': 'exu'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
haiku, jax, optax — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type NAM — 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 NAM 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
NAM Ran
ran on a synthesized input · constructed an object; no result was computed
AmrMKayid/nam/nam/models/nam.py
code served (permissive licence) · get_code("a38b31cb2b4023e6")
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, NAM: 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

torch.manual_seed(0)

class Config:
    def __init__(self):
        self.dropout = 0.1
        self.hidden_sizes = [8]
        self.activation = 'exu'

config = Config()
name = 'test_nam'
num_inputs = 4
num_units = 3

ARGS = {
    'config': config,
    'name': name,
    'num_inputs': num_inputs,
    'num_units': num_units,
}
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 NAM — 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 NAM 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
NAM Ran
ran on a synthesized input · constructed an object; no result was computed
saipradeep-peri/Neural_Additive_Models_Walkthrough/nam/models/nam.py
pointer only (licence: NONE) · get_code("9c956ecf224f6108")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, saipradeep-peri/Neural_Additive_Models_Walkthrough 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.

NeuralAdditiveModel Ran
ran on a synthesized input
kherud/neural-additive-models-pt/nam/model.py
pointer only (licence: NONE) · get_code("cae4311ff1f77d90")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, kherud/neural-additive-models-pt 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.

Numerical Ran
ran on a synthesized input
fortuinlab/la-nam/src/laplace_skorch/modules.py
code served (permissive licence) · get_code("929c1f2bcaed27ca")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 2, dtype family float, shape (2, 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
import torch.nn as nn
import itertools
from collections.abc import Sequence
from typing import cast

class Numerical(nn.Sequential):
    """A feature network attending to one or more numerical features."""

    def __init__(self, in_features: int, out_features: int, *, hidden_dims: Sequence[int]=[64], activation_cls: type[nn.Module]=nn.GELU) -> None:
        super().__init__()
        self.append(nn.Linear(in_features, hidden_dims[0]))
        self.append(activation_cls())
        for in_hidden, out_hidden in itertools.pairwise(hidden_dims):
            self.append(nn.Linear(in_hidden, out_hidden))
            self.append(activation_cls())
        self.append(nn.Linear(hidden_dims[-1], out_features))

    @property
    def in_features(self) -> int:
        return cast(nn.Linear, self[0]).in_features

    @property
    def out_features(self) -> int:
        return cast(nn.Linear, self[-1]).out_features


INIT_ARGS = {
    'in_features': 4,
    'out_features': 3,
    'hidden_dims': [64, 32],
    'activation_cls': nn.GELU,
}

ARGS = {
    'input': torch.randn(2, 4),
}

if __name__ == '__main__':
    model = Numerical(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Input shape: {ARGS['input'].shape}")
    print(f"Output shape: {output.shape}")
    print(f"Model in_features: {model.in_features}")
    print(f"Model out_features: {model.out_features}")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
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, 3) — shape (2, 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
ReLULayer Ran
ran on a synthesized input · constructed an object; no result was computed
kherud/neural-additive-models-pt/nam/model.py
pointer only (licence: NONE) · get_code("108769e8a1a48493")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, kherud/neural-additive-models-pt 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.

TrainingState Ran
ran on a synthesized input · constructed an object; no result was computed
Habush/nam_jax/models.py
code served (permissive licence) · get_code("22b5675b6955ad08")
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, TrainingState: 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 haiku as hk
import optax
import jax
import jax.numpy as jnp

# Create a simple Haiku network to generate params
def simple_network(x):
    return hk.Linear(4)(x)

# Initialize the network to get params
rng = jax.random.PRNGKey(0)
dummy_input = jnp.ones((2, 3))
init_fn = hk.transform(simple_network).init
params = init_fn(rng, dummy_input)

# Create avg_params with the same structure as params
avg_params = jax.tree_util.tree_map(lambda x: x * 0.9, params)

# Create an optimizer and its initial state
optimizer = optax.adam(learning_rate=0.001)
opt_state = optimizer.init(params)

ARGS = {
    "params": params,
    "avg_params": avg_params,
    "opt_state": opt_state,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
haiku, jax, optax — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type TrainingState — the run constructed an instance of its own class and did not call it; no shape is 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
exu Ran
ran, honoured the contract we drafted
Habush/nam_jax/models.py
code served (permissive licence) · get_code("efd59dcfa39ea264")
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 ArrayImpl, ndim 2, dtype family float, shape (2, 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 jax.numpy as jnp
import numpy as np

# Create small test tensors for the exu function
# x: input tensor - shape (2, 4) for batch_size=2, feature_dim=4
x = jnp.array([[1.0, 2.0, 3.0, 4.0],
               [5.0, 6.0, 7.0, 8.0]])

# weight: parameter tensor - shape (4, 3) for feature_dim=4, output_dim=3
weight = jnp.array([[0.1, 0.2, 0.3],
                    [0.4, 0.5, 0.6],
                    [0.7, 0.8, 0.9],
                    [1.0, 1.1, 1.2]])

# bias: parameter tensor - shape (4,) matching input feature dimension
bias = jnp.array([0.5, 1.0, 1.5, 2.0])

ARGS = {
    "x": x,
    "weight": weight,
    "bias": bias
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ArrayImpl, ndim 2, dtype family float, shape (2, 3) — shape (2, 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
exu Ran
ran, honoured the contract we drafted
nickfrosst/neural_additive_models/models.py
pointer only (licence: NONE) · get_code("8a597de16bdccb7a")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, nickfrosst/neural_additive_models 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.

relu Ran
ran, honoured the contract we drafted
Habush/nam_jax/models.py
code served (permissive licence) · get_code("454cfa9b8b9aed47")
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 ArrayImpl, ndim 2, dtype family float, shape (2, 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 jax
import jax.numpy as jnp

# Create small test arrays for the relu function
# The function computes: jax.nn.relu((x - bias) @ weight)
# So x should be compatible for subtraction with bias, and then matrix multiplication with weight

# Let's say x has shape (2, 4) - batch size 2, feature dim 4
# bias should be shape (4,) to broadcast with x
# weight should be shape (4, 3) so that (x - bias) @ weight gives (2, 3)

x = jnp.array([
    [1.0, 2.0, 3.0, 4.0],
    [5.0, 6.0, 7.0, 8.0]
], dtype=jnp.float32)

bias = jnp.array([0.1, 0.2, 0.3, 0.4], dtype=jnp.float32)

weight = jnp.array([
    [1.0, 0.5, -0.2],
    [0.3, -0.1, 0.8],
    [0.2, 0.9, -0.3],
    [-0.5, 0.1, 0.6]
], dtype=jnp.float32)

ARGS = {
    "x": x,
    "weight": weight,
    "bias": bias
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ArrayImpl, ndim 2, dtype family float, shape (2, 3) — shape (2, 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
relu Ran
ran, honoured the contract we drafted
nickfrosst/neural_additive_models/models.py
pointer only (licence: NONE) · get_code("207a3a66ecdc0f2f")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, nickfrosst/neural_additive_models 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.

relu_n Ran
ran, honoured the contract we drafted
nickfrosst/neural_additive_models/models.py
pointer only (licence: NONE) · get_code("2c40ca3eaec98f16")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, nickfrosst/neural_additive_models 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.

ActivationLayer Not yet run
unverified (harvested, no recorded run)
google-research/google-research/neural_additive_models/models.py
code served (permissive licence) · get_code("9e20b229f2c0a6a3")
How it ran

no invocation recorded.

FeatureNet Not yet run
unverified (harvested, no recorded run)
Habush/nam_jax/models.py
code served (permissive licence) · get_code("8deb3a12b331286f")
How it ran

no invocation recorded.

NAM Not yet run
unverified (harvested, no recorded run)
nickfrosst/neural_additive_models/models.py
pointer only (licence: NONE) · get_code("2c18cadeb8c1c012")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, nickfrosst/neural_additive_models 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. No invocation recorded.

NAM Not yet run
unverified (harvested, no recorded run)
google-research/google-research/neural_additive_models/models.py
code served (permissive licence) · get_code("d362a52791a5c0e9")
How it ran

no invocation recorded.

NAM Not yet run
unverified (harvested, no recorded run)
lemeln/nam/nam/models/nam.py
code served (permissive licence) · get_code("8ef351ea39fd6b03")
How it ran

no invocation recorded.

Router Not yet run
unverified (harvested, no recorded run)
fortuinlab/la-nam/src/laplace_skorch/modules.py
code served (permissive licence) · get_code("9e7fc6cfe97a24f2")
How it ran

no invocation recorded.

truncated_normal_ Not yet run
unverified (harvested, no recorded run)
kherud/neural-additive-models-pt/nam/model.py
pointer only (licence: NONE) · get_code("9ea962308449a4bb")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, kherud/neural-additive-models-pt 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. No invocation recorded.

Also present in other papers' code

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

Deep neural networks (DNNs) are powerful black-box predictors that have achieved impressive performance on a wide variety of tasks. However, their accuracy comes at the cost of intelligibility: it is usually unclear how they make their decisions. This hinders their applicability to high stakes decision-making domains such as healthcare. We propose Neural Additive Models (NAMs) which combine some of the expressivity of DNNs with the inherent intelligibility of generalized additive models. NAMs learn a linear combination of neural networks that each attend to a single input feature. These networks are trained jointly and can learn arbitrarily complex relationships between their input feature and the output. Our experiments on regression and classification datasets show that NAMs are more accurate than widely used intelligible models such as logistic regression and shallow decision trees. They perform similarly to existing state-of-the-art generalized additive models in accuracy, but are more flexible because they are based on neural nets instead of boosted trees. To demonstrate this, we show how NAMs can be used for multitask learning on synthetic data and on the COMPAS recidivism data due to their composability, and demonstrate that the differentiability of NAMs allows them to train more complex interpretable models for COVID-19. Source code is available at neural-additive-models.github.io.

For agents

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

get_harvested_code_for_paper("2004.13912")
get_code_for_paper("2004.13912")
have("2004.13912")

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

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

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

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

Connect an agent — have() is free.