SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2301.04257 · ICML · 2024

ODIM: Outlier Detection via Likelihood of Under-Fitted Generative Models

Yongdai Kim, Dongha Kim, Jaesung Hwang, Jongjin Lee, Kunwoong Kim

arXiv · PDF · Open in the Atlas

Code that ran

7 of 9 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 5 have no contract verdict; 2 failures of our instrument; 2 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/2301.04257.json · badge: /api/ran/2301.04257.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
Minqi824/ADBench community
Papers with Code archive
7 ran · 2 no recorded run
FunctionStatusWhere it lives
Classifier Ran
ran on a synthesized input
Minqi824/ADBench/adbench/baseline/DeepSAD/src/networks/dgm.py
code served (permissive licence) · get_code("426d4daa1deb0dbe")
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, 2) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

# Simple stand-in network with rep_dim attribute
class SimpleNet(nn.Module):
    def __init__(self):
        super(SimpleNet, self).__init__()
        self.rep_dim = 5
        self.fc = nn.Linear(4, self.rep_dim)
    
    def forward(self, x):
        return self.fc(x)

INIT_ARGS = {
    'net': SimpleNet,
    'dims': None
}

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

# Construct and call
classifier = nn.Module.__new__(type('Classifier', (nn.Module,), {
    '__init__': lambda self, net, dims=None: (
        super(type(self), self).__init__(),
        setattr(self, 'dims', dims),
        (
            setattr(self, 'net', net()),
            setattr(self, 'logits', nn.Linear(self.net.rep_dim, 2))
        ) if dims is None else (
            setattr(self, 'dense', nn.Linear(dims[0], dims[1])),
            setattr(self, 'logits', nn.Linear(dims[1], dims[2]))
        )
    ),
    'forward': lambda self, x: (
        (x := self.net(x)) if self.dims is None else (x := torch.nn.functional.relu(self.dense(x))),
        torch.nn.functional.softmax(self.logits(x), dim=-1)
    )[-1]
}))

classifier.__init__(INIT_ARGS['net'], INIT_ARGS['dims'])
output = classifier(ARGS['x'])
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, 2) — shape (2, 2) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
Decoder Ran
ran on a synthesized input
Minqi824/ADBench/adbench/baseline/DeepSAD/src/networks/dgm.py
code served (permissive licence) · get_code("a7ee7f1da3b3b8f6")
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, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

INIT_ARGS = {
    'dims': [8, [16, 12], 4]
}

ARGS = {
    'x': torch.randn(2, 8)
}
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, 4) — shape (2, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
Encoder Ran
ran on a synthesized input
Minqi824/ADBench/adbench/baseline/DeepSAD/src/networks/dgm.py
code served (permissive licence) · get_code("ed0b2f571ce60cee")
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 tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable

class Stochastic(nn.Module):
    """
    Base stochastic layer that uses the reparametrization trick (Kingma and Welling, 2013) to draw a sample from a
    distribution parametrized by mu and log_var.
    """

    def __init__(self):
        super(Stochastic, self).__init__()

    def reparametrize(self, mu, log_var):
        epsilon = Variable(torch.randn(mu.size()), requires_grad=False)
        if mu.is_cuda:
            epsilon = epsilon.to(mu.device)
        std = log_var.mul(0.5).exp_()
        z = mu.addcmul(std, epsilon)
        return z

    def forward(self, x):
        raise NotImplementedError

class GaussianSample(Stochastic):
    """
    Layer that represents a sample from a Gaussian distribution.
    """

    def __init__(self, in_features, out_features):
        super(GaussianSample, self).__init__()
        self.in_features = in_features
        self.out_features = out_features
        self.mu = nn.Linear(in_features, out_features)
        self.log_var = nn.Linear(in_features, out_features)

    def forward(self, x):
        mu = self.mu(x)
        log_var = F.softplus(self.log_var(x))
        return (self.reparametrize(mu, log_var), mu, log_var)

class Encoder(nn.Module):
    """
    Encoder, i.e. the inference network.

    Attempts to infer the latent probability distribution p(z|x) from the data x by fitting a
    variational distribution q_φ(z|x). Returns the two parameters of the distribution (µ, log σ²).

    :param dims: dimensions of the network given by [input_dim, [hidden_dims], latent_dim].
    """

    def __init__(self, dims, sample_layer=GaussianSample):
        super(Encoder, self).__init__()
        [x_dim, h_dim, z_dim] = dims
        neurons = [x_dim, *h_dim]
        linear_layers = [nn.Linear(neurons[i - 1], neurons[i]) for i in range(1, len(neurons))]
        self.hidden = nn.ModuleList(linear_layers)
        self.sample = sample_layer(h_dim[-1], z_dim)

    def forward(self, x):
        for layer in self.hidden:
            x = F.relu(layer(x))
        return self.sample(x)


INIT_ARGS = {
    'dims': [4, [8, 6], 3],
    'sample_layer': GaussianSample
}

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

if __name__ == '__main__':
    encoder = Encoder(**INIT_ARGS)
    output = encoder(**ARGS)
    print("Output tuple length:", len(output))
    print("Sample shape:", output[0].shape)
    print("Mu shape:", output[1].shape)
    print("Log var shape:", output[2].shape)
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 tuple — a tuple output has no array shape of its own; none 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
GaussianSample Ran
ran on a synthesized input
Minqi824/ADBench/adbench/baseline/DeepSAD/src/networks/dgm.py
code served (permissive licence) · get_code("2863da6de5091a22")
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 tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable

class Stochastic(nn.Module):
    """
    Base stochastic layer that uses the reparametrization trick (Kingma and Welling, 2013) to draw a sample from a
    distribution parametrized by mu and log_var.
    """

    def __init__(self):
        super(Stochastic, self).__init__()

    def reparametrize(self, mu, log_var):
        epsilon = Variable(torch.randn(mu.size()), requires_grad=False)
        if mu.is_cuda:
            epsilon = epsilon.to(mu.device)
        std = log_var.mul(0.5).exp_()
        z = mu.addcmul(std, epsilon)
        return z

    def forward(self, x):
        raise NotImplementedError

class GaussianSample(Stochastic):
    """
    Layer that represents a sample from a Gaussian distribution.
    """

    def __init__(self, in_features, out_features):
        super(GaussianSample, self).__init__()
        self.in_features = in_features
        self.out_features = out_features
        self.mu = nn.Linear(in_features, out_features)
        self.log_var = nn.Linear(in_features, out_features)

    def forward(self, x):
        mu = self.mu(x)
        log_var = F.softplus(self.log_var(x))
        return (self.reparametrize(mu, log_var), mu, log_var)


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

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

if __name__ == '__main__':
    model = GaussianSample(**INIT_ARGS)
    output = model(**ARGS)
    print("Output shapes:")
    print(f"  Sample z: {output[0].shape}")
    print(f"  Mu: {output[1].shape}")
    print(f"  Log_var: {output[2].shape}")
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 tuple — a tuple output has no array shape of its own; none 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
VariationalAutoencoder Ran
ran on a synthesized input
Minqi824/ADBench/adbench/baseline/DeepSAD/src/networks/dgm.py
code served (permissive licence) · get_code("37b74137fd328d3f")
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
import torch.nn.functional as F
from torch.nn import init
from torch.autograd import Variable
import math

class Decoder(nn.Module):
    def __init__(self, dims):
        super(Decoder, self).__init__()
        [z_dim, h_dim, x_dim] = dims
        neurons = [z_dim, *h_dim]
        linear_layers = [nn.Linear(neurons[i - 1], neurons[i]) for i in range(1, len(neurons))]
        self.hidden = nn.ModuleList(linear_layers)
        self.reconstruction = nn.Linear(h_dim[-1], x_dim)
        self.output_activation = nn.Sigmoid()

    def forward(self, x):
        for layer in self.hidden:
            x = F.relu(layer(x))
        return self.output_activation(self.reconstruction(x))

class Stochastic(nn.Module):
    def __init__(self):
        super(Stochastic, self).__init__()

    def reparametrize(self, mu, log_var):
        epsilon = Variable(torch.randn(mu.size()), requires_grad=False)
        if mu.is_cuda:
            epsilon = epsilon.to(mu.device)
        std = log_var.mul(0.5).exp_()
        z = mu.addcmul(std, epsilon)
        return z

    def forward(self, x):
        raise NotImplementedError

def log_gaussian(x, mu, log_var):
    log_pdf = -0.5 * math.log(2 * math.pi) - log_var / 2 - (x - mu) ** 2 / (2 * torch.exp(log_var))
    return torch.sum(log_pdf, dim=-1)

def log_standard_gaussian(x):
    return torch.sum(-0.5 * math.log(2 * math.pi) - x ** 2 / 2, dim=-1)

class GaussianSample(Stochastic):
    def __init__(self, in_features, out_features):
        super(GaussianSample, self).__init__()
        self.in_features = in_features
        self.out_features = out_features
        self.mu = nn.Linear(in_features, out_features)
        self.log_var = nn.Linear(in_features, out_features)

    def forward(self, x):
        mu = self.mu(x)
        log_var = F.softplus(self.log_var(x))
        return (self.reparametrize(mu, log_var), mu, log_var)

class Encoder(nn.Module):
    def __init__(self, dims, sample_layer=GaussianSample):
        super(Encoder, self).__init__()
        [x_dim, h_dim, z_dim] = dims
        neurons = [x_dim, *h_dim]
        linear_layers = [nn.Linear(neurons[i - 1], neurons[i]) for i in range(1, len(neurons))]
        self.hidden = nn.ModuleList(linear_layers)
        self.sample = sample_layer(h_dim[-1], z_dim)

    def forward(self, x):
        for layer in self.hidden:
            x = F.relu(layer(x))
        return self.sample(x)

class VariationalAutoencoder(nn.Module):
    def __init__(self, dims):
        super(VariationalAutoencoder, self).__init__()
        [x_dim, z_dim, h_dim] = dims
        self.z_dim = z_dim
        self.flow = None
        self.encoder = Encoder([x_dim, h_dim, z_dim])
        self.decoder = Decoder([z_dim, list(reversed(h_dim)), x_dim])
        self.kl_divergence = 0
        for m in self.modules():
            if isinstance(m, nn.Linear):
                init.xavier_normal_(m.weight.data)
                if m.bias is not None:
                    m.bias.data.zero_()

    def forward(self, x):
        z, mu, log_var = self.encoder(x)
        self.kl_divergence = -0.5 * torch.sum(1 + log_var - mu.pow(2) - log_var.exp(), dim=-1)
        x_recon = self.decoder(z)
        return x_recon

INIT_ARGS = {
    'dims': [10, 3, [8, 6]]
}

ARGS = {
    'x': torch.randn(2, 10)
}
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)
log_gaussian Ran
ran; our contract draft was wrong, not the code
Minqi824/ADBench/adbench/baseline/DeepSAD/src/networks/dgm.py
code served (permissive licence) · get_code("6f56073807e8da9c")
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 Tensor, ndim 1, dtype family float, shape (2,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import math

torch.manual_seed(0)

# Create small tensors for the function parameters
# x: point to evaluate - shape (batch_size, feature_dim)
x = torch.randn(2, 4)

# mu: mean - shape (batch_size, feature_dim)
mu = torch.randn(2, 4)

# log_var: log variance - shape (batch_size, feature_dim)
log_var = torch.randn(2, 4)

ARGS = {
    "x": x,
    "mu": mu,
    "log_var": log_var,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 1, dtype family float, shape (2,) — shape (2,) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
log_standard_gaussian Ran
ran; our contract draft was wrong, not the code
Minqi824/ADBench/adbench/baseline/DeepSAD/src/networks/dgm.py
code served (permissive licence) · get_code("1fc32514c7f37ae0")
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 Tensor, ndim 1, dtype family float, shape (2,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import math

torch.manual_seed(0)

# The function takes a single parameter 'x' which is a tensor
# It computes log pdf of standard normal by:
# 1. Squaring x
# 2. Summing over the last dimension (dim=-1)
# So x should be a tensor with at least 1 dimension

# Create a small tensor: batch size 2, feature dimension 4
x = torch.randn(2, 4)

ARGS = {
    "x": x
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 1, dtype family float, shape (2,) — shape (2,) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
DeepGenerativeModel Not yet run
unverified (harvested, no recorded run)
Minqi824/ADBench/adbench/baseline/DeepSAD/src/networks/dgm.py
code served (permissive licence) · get_code("5d30f1733c240064")
How it ran

no invocation recorded.

Stochastic Not yet run
unverified (harvested, no recorded run)
Minqi824/ADBench/adbench/baseline/DeepSAD/src/networks/dgm.py
code served (permissive licence) · get_code("a65a9bcc19311e25")
How it ran

no invocation recorded.

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 distinct functions with an identity, 2 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 0 the same month, 0 later) and 7 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
log_gaussian
brick of this paper's assembly: helper
1 other paper
1 dated earlier
2105.14083 (2021-05)
Rethinking Noisy Label Models: Labeler-Dependent Noise with Adversarial Awareness
log_standard_gaussian
brick of this paper's assembly: helper
1 other paper
1 dated earlier
2105.14083 (2021-05)
Rethinking Noisy Label Models: Labeler-Dependent Noise with Adversarial Awareness

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

The unsupervised outlier detection (UOD) problem refers to a task to identify inliers given training data which contain outliers as well as inliers, without any labeled information about inliers and outliers. It has been widely recognized that using fully-trained likelihood-based deep generative models (DGMs) often results in poor performance in distinguishing inliers from outliers. In this study, we claim that the likelihood itself could serve as powerful evidence for identifying inliers in UOD tasks, provided that DGMs are carefully under-fitted. Our approach begins with a novel observation called the inlier-memorization (IM) effect-when training a deep generative model with data including outliers, the model initially memorizes inliers before outliers. Based on this finding, we develop a new method called the outlier detection via the IM effect (ODIM). Remarkably, the ODIM requires only a few updates, making it computationally efficient-at least tens of times faster than other deep-learning-based algorithms. Also, the ODIM filters out outliers excellently, regardless of the data type, including tabular, image, and text data. To validate the superiority and efficiency of our method, we provide extensive empirical analyses on close to 60 datasets.

For agents

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

get_harvested_code_for_paper("2301.04257")
get_code_for_paper("2301.04257")
have("2301.04257")

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

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

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

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

Connect an agent — have() is free.