SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2405.03987 · NeurIPS · 2024

Navigating Chemical Space with Latent Flows

Yuanqi Du, Yue Song, Guanghao Wei, Yining Huang, Chenru Duan

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 (6 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 6 have no contract verdict; 1 failure of our instrument; 2 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/2405.03987.json · badge: /api/ran/2405.03987.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
garywei944/ChemFlow canonical (classifier label)
classifier basis: census
1 ran · 0 no recorded run
garywei944/chemflow community
Papers with Code archive
6 ran · 2 no recorded run
FunctionStatusWhere it lives
AuxClassifier Ran
ran on a synthesized input · constructed an object; no result was computed
garywei944/chemflow/src/pinn/pde/wavepde.py
code served (permissive licence) · get_code("2632f545ceefa6ef")
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, AuxClassifier: 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
from torch import nn, Tensor

torch.manual_seed(0)

class AuxClassifier(nn.Module):

    def __init__(self, latent_size: int, num_classes: int, hidden_sizes: list[int]=None):
        super().__init__()
        if hidden_sizes is None:
            hidden_sizes = [512, 256]
        layers = [nn.Linear(latent_size * 2, hidden_sizes[0]), nn.ReLU()]
        for i in range(1, len(hidden_sizes)):
            layers.append(nn.Linear(hidden_sizes[i - 1], hidden_sizes[i]))
            layers.append(nn.ReLU())
        layers.append(nn.Linear(hidden_sizes[-1], num_classes))
        self.mlp = nn.Sequential(*layers)

    def forward(self, x: Tensor):
        """

        :param x: concatenated representation of [m_origin, m2_transformed]
        :return:
        """
        return self.mlp(x)


ARGS = {
    "latent_size": 4,
    "num_classes": 3,
    "hidden_sizes": [16, 8]
}
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 AuxClassifier — 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 AuxClassifier 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
MLP Ran
ran on a synthesized input · constructed an object; no result was computed
garywei944/chemflow/src/pinn/pde/wavepde.py
code served (permissive licence) · get_code("3f3fab87fe727d67")
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, MLP: 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
from torch import nn
import math

torch.manual_seed(0)

# First, define the SinusoidalPositionEmbeddings and MLP classes
log1e4 = math.log(10000)

class SinusoidalPositionEmbeddings(nn.Module):

    def __init__(self, dim: int):
        assert dim % 2 == 0, 'SinusoidalPositionEmbeddings only returns even number of dimensions'
        super(SinusoidalPositionEmbeddings, self).__init__()
        self.half_dim = dim // 2
        scale = log1e4 / (self.half_dim - 1)
        self.embedding = nn.Parameter(torch.arange(self.half_dim).float() * -scale)

    def forward(self, t):
        x = torch.outer(t, self.embedding)
        x = torch.cat((x.sin(), x.cos()), dim=-1)
        return x

class MLP(nn.Module):

    def __init__(self, n_in: int, n_out: int=1, h: int=512):
        super(MLP, self).__init__()
        self.x_embedding = nn.Sequential(nn.Linear(n_in, h), nn.ReLU())
        self.t_embedding = nn.Sequential(SinusoidalPositionEmbeddings(n_in), nn.Linear(n_in, h), nn.ReLU(), nn.Linear(h, h))
        dims = [h, h, n_out]
        layers = []
        for i in range(len(dims) - 1):
            layers.append(nn.Linear(dims[i], dims[i + 1]))
            if i < len(dims) - 2:
                layers.append(nn.ReLU())
        self.mlp = nn.Sequential(*layers)

    def forward(self, x, t):
        """
        Parametrized potential energy function u(x, t)
        :param x: (b, n_in)
        :param t: (b,)
        :return: (b, n_out) the potential energy u(x, t)
        """
        x = self.x_embedding(x)
        t = self.t_embedding(t)
        return self.mlp(x + t)

# Now define ARGS for MLP constructor
ARGS = {
    'n_in': 4,
    'n_out': 1,
    'h': 512
}
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 MLP — 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 MLP 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
SinusoidalPositionEmbeddings Ran
ran on a synthesized input · constructed an object; no result was computed
garywei944/chemflow/src/pinn/pde/wavepde.py
code served (permissive licence) · get_code("0847b98175b96a63")
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, SinusoidalPositionEmbeddings: 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
from torch import nn, Tensor
import math

torch.manual_seed(0)

log1e4 = math.log(10000)

class SinusoidalPositionEmbeddings(nn.Module):

    def __init__(self, dim: int):
        assert dim % 2 == 0, 'SinusoidalPositionEmbeddings only returns even number of dimensions'
        super(SinusoidalPositionEmbeddings, self).__init__()
        self.half_dim = dim // 2
        scale = log1e4 / (self.half_dim - 1)
        self.embedding = nn.Parameter(torch.arange(self.half_dim).float() * -scale)

    def forward(self, t: Tensor):
        x = torch.outer(t, self.embedding)
        x = torch.cat((x.sin(), x.cos()), dim=-1)
        return x

# Test setup
ARGS = {
    'dim': 4,
}

# Verify setup works
model = SinusoidalPositionEmbeddings(**ARGS)
t = torch.tensor([0.0, 1.0, 2.0])
output = model(t)
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 SinusoidalPositionEmbeddings — 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 SinusoidalPositionEmbeddings 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
WavePDE Ran
ran on a synthesized input · constructed an object; no result was computed
garywei944/chemflow/src/pinn/pde/wavepde.py
code served (permissive licence) · get_code("5270b12b26730833")
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, WavePDE: 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
from torch import nn, Tensor
import math

torch.manual_seed(0)

class SinusoidalPositionEmbeddings(nn.Module):
    def __init__(self, dim: int):
        assert dim % 2 == 0, 'SinusoidalPositionEmbeddings only returns even number of dimensions'
        super(SinusoidalPositionEmbeddings, self).__init__()
        self.half_dim = dim // 2
        log1e4 = math.log(10000)
        scale = log1e4 / (self.half_dim - 1)
        self.embedding = nn.Parameter(torch.arange(self.half_dim).float() * -scale)

    def forward(self, t: Tensor):
        x = torch.outer(t, self.embedding)
        x = torch.cat((x.sin(), x.cos()), dim=-1)
        return x


class MLP(nn.Module):
    def __init__(self, n_in: int, n_out: int=1, h: int=512):
        super(MLP, self).__init__()
        self.x_embedding = nn.Sequential(nn.Linear(n_in, h), nn.ReLU())
        self.t_embedding = nn.Sequential(SinusoidalPositionEmbeddings(n_in), nn.Linear(n_in, h), nn.ReLU(), nn.Linear(h, h))
        dims = [h, h, n_out]
        layers = []
        for i in range(len(dims) - 1):
            layers.append(nn.Linear(dims[i], dims[i + 1]))
            if i < len(dims) - 2:
                layers.append(nn.ReLU())
        self.mlp = nn.Sequential(*layers)

    def forward(self, x: Tensor, t: Tensor) -> Tensor:
        x = self.x_embedding(x)
        t = self.t_embedding(t)
        return self.mlp(x + t)


class SimpleGenerator(nn.Module):
    def __init__(self, latent_size: int, output_size: int):
        super().__init__()
        self.latent_size = latent_size
        self.reverse_size = output_size
        self.linear = nn.Linear(latent_size, output_size)

    def forward(self, z: Tensor) -> Tensor:
        return self.linear(z)


ARGS = {
    "k": 2,
    "generator": SimpleGenerator(latent_size=4, output_size=4),
    "time_steps": 10,
    "n_in": 4,
    "pde_function": "wave",
    "normalize": None,
    "minimize_jvp": False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
attrs, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type WavePDE — 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 WavePDE 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
WavePDEModel Ran
ran on a synthesized input · constructed an object; no result was computed
garywei944/chemflow/src/pinn/pde/wavepde.py
code served (permissive licence) · get_code("158883b1dd4ec254")
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, WavePDEModel: 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
import math
from attrs import define

torch.manual_seed(0)

class SinusoidalPositionEmbeddings(nn.Module):
    def __init__(self, dim: int):
        assert dim % 2 == 0, 'SinusoidalPositionEmbeddings only returns even number of dimensions'
        super(SinusoidalPositionEmbeddings, self).__init__()
        self.half_dim = dim // 2
        log1e4 = math.log(10000)
        scale = log1e4 / (self.half_dim - 1)
        self.embedding = nn.Parameter(torch.arange(self.half_dim).float() * -scale)

    def forward(self, t):
        x = torch.outer(t, self.embedding)
        x = torch.cat((x.sin(), x.cos()), dim=-1)
        return x

class MLP(nn.Module):
    def __init__(self, n_in: int, n_out: int=1, h: int=512):
        super(MLP, self).__init__()
        self.x_embedding = nn.Sequential(nn.Linear(n_in, h), nn.ReLU())
        self.t_embedding = nn.Sequential(SinusoidalPositionEmbeddings(n_in), nn.Linear(n_in, h), nn.ReLU(), nn.Linear(h, h))
        dims = [h, h, n_out]
        layers = []
        for i in range(len(dims) - 1):
            layers.append(nn.Linear(dims[i], dims[i + 1]))
            if i < len(dims) - 2:
                layers.append(nn.ReLU())
        self.mlp = nn.Sequential(*layers)

    def forward(self, x, t):
        x = self.x_embedding(x)
        t = self.t_embedding(t)
        return self.mlp(x + t)

class SimpleGenerator(nn.Module):
    def __init__(self, latent_size: int=4, output_size: int=4):
        super().__init__()
        self.latent_size = latent_size
        self.reverse_size = output_size
        self.fc = nn.Linear(latent_size, output_size)

    def forward(self, z):
        return self.fc(z)

class AuxClassifier(nn.Module):
    def __init__(self, latent_size: int, num_classes: int, hidden_sizes: list=None):
        super().__init__()
        if hidden_sizes is None:
            hidden_sizes = [512, 256]
        layers = [nn.Linear(latent_size * 2, hidden_sizes[0]), nn.ReLU()]
        for i in range(1, len(hidden_sizes)):
            layers.append(nn.Linear(hidden_sizes[i - 1], hidden_sizes[i]))
            layers.append(nn.ReLU())
        layers.append(nn.Linear(hidden_sizes[-1], num_classes))
        self.mlp = nn.Sequential(*layers)

    def forward(self, x):
        return self.mlp(x)

@define
class WavePDEResult:
    loss: torch.Tensor
    energy: torch.Tensor
    latent1: torch.Tensor
    latent2: torch.Tensor
    loss_ic: torch.Tensor
    loss_pde: torch.Tensor
    loss_jvp: torch.Tensor
    loss_cls: torch.Tensor = None

class WavePDE(nn.Module):
    def __init__(self, k: int, generator=None, time_steps: int=20, n_in: int=1024, pde_function: str='wave', normalize: float=None, minimize_jvp: bool=False):
        assert time_steps > 0
        assert pde_function in {'wave', 'hj'}
        super().__init__()
        self.k = k
        self.time_steps = time_steps
        self.half_range = time_steps // 2
        self.pde_function = pde_function
        self.normalize = normalize
        self.minimize_jvp = minimize_jvp
        self.generator = generator
        self.mlp = nn.ModuleList([MLP(n_in=n_in, n_out=1) for _ in range(k)])
        self.c = nn.Parameter(torch.ones(k))

    def forward(self, idx: int, z: torch.Tensor, t: int):
        return None

# Minimal setup for WavePDE initialization
k = 2
n_in = 4
generator = SimpleGenerator(latent_size=4, output_size=4)
time_steps = 20

ARGS = {
    'k': k,
    'generator': generator,
    'time_steps': time_steps,
    'n_in': n_in,
    'pde_function': 'wave',
    'normalize': None,
    'minimize_jvp': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
attrs, lightning, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type WavePDEModel — 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 WavePDEModel 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
WavePDEResult Ran
ran on a synthesized input · constructed an object; no result was computed
garywei944/chemflow/src/pinn/pde/wavepde.py
code served (permissive licence) · get_code("22d9e6138fcba0e8")
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, WavePDEResult: 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
from torch import nn, Tensor
from attrs import define, asdict

torch.manual_seed(0)

ARGS = {
    "loss": torch.randn(2),
    "energy": torch.randn(2),
    "latent1": torch.randn(2, 4),
    "latent2": torch.randn(2, 3),
    "loss_ic": torch.randn(2),
    "loss_pde": torch.randn(2),
    "loss_jvp": torch.randn(2),
    "loss_cls": torch.randn(2),
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
attrs, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type WavePDEResult — 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 WavePDEResult 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
normalize Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
garywei944/ChemFlow/src/utils/scores.py
code served (permissive licence) · get_code("261d315ab81e63c3")
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, 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

torch.manual_seed(0)

# Create a small tensor with distinct dimensions (batch=2, feature_dim=4)
x = torch.randn(2, 4)

# Test with different parameter combinations
ARGS = {
    "x": x,
    "step_size": 2.0,
    "relative": False
}
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, 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: none by the harness; any seed is in the setup block
Generator Not yet run
unverified (harvested, no recorded run)
garywei944/chemflow/src/pinn/pde/wavepde.py
code served (permissive licence) · get_code("5a20550f1372e68e")
How it ran

no invocation recorded.

PDE Not yet run
unverified (harvested, no recorded run)
garywei944/chemflow/src/pinn/pde/wavepde.py
code served (permissive licence) · get_code("1b4dafcbf13d4e3f")
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, 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 9 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

Recent progress of deep generative models in the vision and language domain has stimulated significant interest in more structured data generation such as molecules. However, beyond generating new random molecules, efficient exploration and a comprehensive understanding of the vast chemical space are of great importance to molecular science and applications in drug design and materials discovery. In this paper, we propose a new framework, ChemFlow, to traverse chemical space through navigating the latent space learned by molecule generative models through flows. We introduce a dynamical system perspective that formulates the problem as learning a vector field that transports the mass of the molecular distribution to the region with desired molecular properties or structure diversity. Under this framework, we unify previous approaches on molecule latent space traversal and optimization and propose alternative competing methods incorporating different physical priors. We validate the efficacy of ChemFlow on molecule manipulation and single-and multi-objective molecule optimization tasks under both supervised and unsupervised molecular discovery settings. Codes and demos are publicly available on GitHub at https://github.com/garywei944/ChemFlow. * Equal Contribution. † Equal Supervision.

For agents

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

get_harvested_code_for_paper("2405.03987")
get_code_for_paper("2405.03987")
have("2405.03987")

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

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

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

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

Connect an agent — have() is free.