SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2006.00104 · 2020

OT-Flow: Fast and Accurate Continuous Normalizing Flows via Optimal Transport

arXiv · PDF · Open in the Atlas

Code that ran

3 of 5 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, 0 violated it and 0 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/2006.00104.json · badge: /api/ran/2006.00104.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
EmoryMLIP/OT-Flow canonical (classifier label)
classifier basis: classifier_2025
0 ran · 1 no recorded run
emorymlip/cot-flow extension (classifier label)
classifier basis: classifier_2025
3 ran · 1 no recorded run
FunctionStatusWhere it lives
OTFlowProblem Ran
ran; our contract draft was wrong, not the code
emorymlip/cot-flow/src/OTFlowProblem.py
code served (permissive licence) · get_code("41c44754ed5abfbf")
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 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
from torch.nn.functional import pad

torch.manual_seed(0)

class PhiNet(nn.Module):
    """Minimal Phi network that implements trHess method"""
    def __init__(self, dx, dy):
        super().__init__()
        self.dx = dx
        self.dy = dy
        # Simple linear layer that outputs d+1 values (gradient + scalar)
        self.net = nn.Linear(dx + dy + 1, dx + 1)
    
    def trHess(self, z, y):
        """
        Computes gradient of Phi and trace of Hessian
        z: batch_size x (dx + 1)  [x padded with time]
        y: batch_size x dy
        Returns: (gradPhi, trH)
            gradPhi: batch_size x (dx + 1)
            trH: batch_size
        """
        batch_size = z.shape[0]
        # Concatenate z and y for input
        combined = torch.cat([z, y], dim=1)
        
        # Forward pass
        output = self.net(combined)  # batch_size x (dx + 1)
        
        # First dx components are gradient, last is the d component
        gradPhi = output  # batch_size x (dx + 1)
        
        # Trace of Hessian - simplified as a small value
        trH = torch.ones(batch_size, dtype=torch.float32) * 0.1
        
        return gradPhi, trH


# Setup arguments
batch_size = 2
dx = 4
dy = 3

# x: batch_size x dx
x = torch.randn(batch_size, dx)

# y: batch_size x dy
y = torch.randn(batch_size, dy)

# Phi: neural network module
Phi = PhiNet(dx, dy)

# tspan: time range [t0, t1]
tspan = [0.0, 1.0]

# nt: number of time steps
nt = 5

# stepper: integration scheme
stepper = 'rk4'

# alph: alpha parameters
alph = [1.0, 1.0, 1.0]

ARGS = {
    'x': x,
    'y': y,
    'Phi': Phi,
    'tspan': tspan,
    'nt': nt,
    'stepper': stepper,
    'alph': alph
}
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 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: none by the harness; any seed is in the setup block
stepRK4 Ran
ran; our contract draft was wrong, not the code
emorymlip/cot-flow/src/OTFlowProblem.py
code served (permissive licence) · get_code("16f3649fecc2628c")
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 2, dtype family float, shape (2, 7) 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

torch.manual_seed(0)

# Define a minimal Phi network that implements trHess method
class PhiNet(nn.Module):
    def __init__(self, d):
        super().__init__()
        self.d = d
        self.linear = nn.Linear(d + 1, d + 1)
    
    def trHess(self, z, y):
        """
        z: tensor of shape (nex, d+1) where last column is time t
        y: target tensor
        Returns: (gradPhi, trH)
            gradPhi: tensor of shape (nex, d+1) - gradient of Phi
            trH: tensor of shape (nex,) - trace of Hessian
        """
        nex = z.shape[0]
        # Simple stand-in: gradPhi has shape (nex, d+1)
        gradPhi = torch.randn(nex, self.d + 1)
        # trH has shape (nex,)
        trH = torch.randn(nex)
        return gradPhi, trH

# Define odefun function
def odefun(x, y, t, net, alph=[1.0, 1.0, 1.0]):
    """
    neural ODE combining the characteristics and log-determinant (see Eq. (2)), the transport costs (see Eq. (5)), and
    the HJB regularizer (see Eq. (7)).

    d_t  [x ; l ; v ; r] = odefun( [x ; l ; v ; r] , t )

    x - particle position
    l - log determinant
    v - accumulated transport costs (Lagrangian)
    r - accumulates violation of HJB condition along trajectory
    """
    from torch.nn.functional import pad
    nex, d_extra = x.shape
    d = d_extra - 3
    z = pad(x[:, :d], (0, 1, 0, 0), value=t)
    gradPhi, trH = net.trHess(z, y)
    dx = -(1.0 / alph[0]) * gradPhi[:, 0:d]
    dl = -(1.0 / alph[0]) * trH.unsqueeze(1)
    dv = 0.5 * torch.sum(torch.pow(dx, 2), 1, keepdims=True)
    dr = torch.abs(-gradPhi[:, d].unsqueeze(1) + alph[0] * dv)
    return torch.cat((dx, dl, dv, dr), 1)

# Create arguments
d = 4  # spatial dimension
nex = 2  # number of examples (batch size)

# z: tensor of shape (nex, d+3) for [x; l; v; r]
# x has d dimensions, l has 1, v has 1, r has 1 = d+3 total
z = torch.randn(nex, d + 3)

# y: target tensor (arbitrary shape for now)
y = torch.randn(nex, 3)

# Phi: neural network module
Phi = PhiNet(d)

# alph: list of 3 alpha values
alph = [1.0, 1.0, 1.0]

# t0, t1: time values
t0 = 0.0
t1 = 0.1

ARGS = {
    'odefun': odefun,
    'z': z,
    'y': y,
    'Phi': Phi,
    'alph': alph,
    't0': t0,
    't1': t1
}
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 2, dtype family float, shape (2, 7) — shape (2, 7) 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
vec Ran
ran, honoured the contract we drafted
emorymlip/cot-flow/src/OTFlowProblem.py
code served (permissive licence) · get_code("42222c5c6465f835")
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 2, dtype family float, shape (32, 1) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

x = torch.randn(8, 4)

ARGS = {
    "x": x
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (32, 1) — shape (32, 1) 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
compute_loss Not yet run
unverified (harvested, no recorded run)
emorymlip/cot-flow/evaluateTabularOTflowCond.py
code served (permissive licence) · get_code("9c917e40239330dc")
How it ran

no invocation recorded.

compute_loss Not yet run
unverified (harvested, no recorded run)
EmoryMLIP/OT-Flow/trainToyOTflow.py
code served (permissive licence) · get_code("fa06178561e307d5")
How it ran

no invocation recorded.

Also present in other papers' code

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

A normalizing flow is an invertible mapping between an arbitrary probability distribution and a standard normal distribution; it can be used for density estimation and statistical inference. Computing the flow follows the change of variables formula and thus requires invertibility of the mapping and an efficient way to compute the determinant of its Jacobian. To satisfy these requirements, normalizing flows typically consist of carefully chosen components. Continuous normalizing flows (CNFs) are mappings obtained by solving a neural ordinary differential equation (ODE). The neural ODE's dynamics can be chosen almost arbitrarily while ensuring invertibility. Moreover, the log-determinant of the flow's Jacobian can be obtained by integrating the trace of the dynamics' Jacobian along the flow. Our proposed OT-Flow approach tackles two critical computational challenges that limit a more widespread use of CNFs. First, OT-Flow leverages optimal transport (OT) theory to regularize the CNF and enforce straight trajectories that are easier to integrate. Second, OT-Flow features exact trace computation with time complexity equal to trace estimators used in existing CNFs. On five high-dimensional density estimation and generative modeling tasks, OT-Flow performs competitively to state-of-the-art CNFs while on average requiring one-fourth of the number of weights with an 8x speedup in training time and 24x speedup in inference.

For agents

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

get_harvested_code_for_paper("2006.00104")
get_code_for_paper("2006.00104")
have("2006.00104")

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

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

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

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

Connect an agent — have() is free.