SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2403.18910 · ICML · 2024

A Geometric Explanation of the Likelihood OOD Detection Paradox

Gabriel Loaiza-Ganem, Anthony Caterini, Jesse Cresswell, Rahul Krishnan, Brendan Ross, Hamidreza Kamkari

arXiv · PDF · Open in the Atlas

Code that ran

3 of 4 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; 1 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 1 failure of our instrument; 1 no recorded run), measured 2026-11-23; 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/2403.18910.json · badge: /api/ran/2403.18910.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
layer6ai-labs/dgm_ood_detection canonical (classifier label)
classifier basis: census
3 ran · 1 no recorded run
FunctionStatusWhere it lives
float_to_str Ran
ran; our contract draft was wrong, not the code
layer6ai-labs/dgm_ood_detection/ood/wandb_visualization.py
code served (permissive licence) · get_code("cd42036d4fe7601c")
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 decimal
import torch

torch.manual_seed(0)

ctx = decimal.Context()

def float_to_str(f):
    """
    Convert the given float to a string,
    without resorting to scientific notation
    """
    global ctx
    d1 = ctx.create_decimal(repr(f))
    return format(d1, 'f')

ARGS = {
    "f": 3.14159265359
}
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
plot_likelihood_ood_histogram Ran
ran, honoured the contract we drafted
layer6ai-labs/dgm_ood_detection/main_ood.py
code served (permissive licence) · get_code("baf97703298b1c79")
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 ndarray, ndim 3, dtype family int, shape (480, 640, 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
from torch.utils.data import DataLoader, TensorDataset
import numpy as np

torch.manual_seed(0)

# Create a simple likelihood model with a log_prob method
class SimpleLikelihoodModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 1)
    
    def log_prob(self, x, **kwargs):
        # Return a simple log probability based on the input
        # x should be a batch of data
        if isinstance(x, (tuple, list)):
            x = x[0]
        # Simple log prob: just sum of linear transformation
        return self.linear(x).squeeze(-1)

# Create model instance
model = SimpleLikelihoodModel()

# Create small in-distribution dataset
x_in = torch.randn(4, 4)  # 4 samples, 4 features
y_in = torch.zeros(4)
dataset_in = TensorDataset(x_in, y_in)
data_loader_in = DataLoader(dataset_in, batch_size=2)

# Create small out-of-distribution dataset (different distribution)
x_out = torch.randn(4, 4) + 5.0  # shifted distribution
y_out = torch.ones(4)
dataset_out = TensorDataset(x_out, y_out)
data_loader_out = DataLoader(dataset_out, batch_size=2)

# Build ARGS dictionary
ARGS = {
    'model': model,
    'data_loader_in': data_loader_in,
    'data_loader_out': data_loader_out,
    'limit': None,
    'log_prob_kwargs': None
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, matplotlib, numpy, torch, tqdm — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 3, dtype family int, shape (480, 640, 4) — shape (480, 640, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
standardize_sample_visualizing_format Ran
ran, violated the contract we drafted
layer6ai-labs/dgm_ood_detection/main_ood.py
code served (permissive licence) · get_code("dca541016c7ced0d")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 4, dtype family float, shape (3, 1, 3, 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
from math import sqrt

torch.manual_seed(0)

# The function takes a single parameter 'sample' which should be a torch tensor
# The function reshapes it to a square format for visualization

# Test case 1: 1D tensor with non-square number of elements
sample_1d = torch.randn(7)

# Test case 2: 2D tensor with non-square last dimensions
sample_2d = torch.randn(3, 5)

# Test case 3: 3D tensor with non-square last dimension
sample_3d = torch.randn(2, 3, 6)

ARGS = {
    "sample": sample_2d
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 4, dtype family float, shape (3, 1, 3, 3) — shape (3, 1, 3, 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
visualize_trends Not yet run
unverified (harvested, no recorded run)
layer6ai-labs/dgm_ood_detection/ood/wandb_visualization.py
code served (permissive licence) · get_code("4cd8e5143aa1adef")
How it ran

no invocation recorded.

Also present in other papers' code

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

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Likelihood-based deep generative models (DGMs) commonly exhibit a puzzling behaviour: when trained on a relatively complex dataset, they assign higher likelihood values to out-ofdistribution (OOD) data from simpler sources. Adding to the mystery, OOD samples are never generated by these DGMs despite having higher likelihoods. This two-pronged paradox has yet to be conclusively explained, making likelihood-based OOD detection unreliable. Our primary observation is that high-likelihood regions will not be generated if they contain minimal probability mass. We demonstrate how this seeming contradiction of large densities yet low probability mass can occur around data confined to low-dimensional manifolds. We also show that this scenario can be identified through local intrinsic dimension (LID) estimation, and propose a method for OOD detection which pairs the likelihoods and LID estimates obtained from a pre-trained DGM. Our method can be applied to normalizing flows and score-based diffusion models, and obtains results which match or surpass state-of-the-art OOD detection benchmarks using the same DGM backbones. Our code is available at https://github.com/ layer6ai-labs/dgm_ood_detection.

For agents

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

get_harvested_code_for_paper("2403.18910")
get_code_for_paper("2403.18910")
have("2403.18910")

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

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

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

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

Connect an agent — have() is free.