SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2608.18982 · 2026

Monroe: A Molecular Foundation Model for In-Context Probabilistic Inference

Andrew Fitzgibbon, Błażej Banaszewski

arXiv · PDF

Code that ran

8 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; 2 honoured the contract we drafted, 2 violated it and 0 have no contract verdict; 4 failures of our instrument; 1 no recorded run), measured 2026-11-23; 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/2608.18982.json · badge: /api/ran/2608.18982.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
blazejba/monroe canonical (classifier label)
classifier basis: census
8 ran · 1 no recorded run
FunctionStatusWhere it lives
build_dataset_heads Ran
ran; our contract draft was wrong, not the code
blazejba/monroe/monroe/model/heads.py
code served (permissive licence) · get_code("5b6975b6b6b3b071")
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 ModuleDict. 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)

# Build a task_dict with various dataset tasks
task_dict = {
    'pcba': {
        'n_outputs': 128,
    },
    'pm6': {
        'n_outputs': 5,
    },
    'other_task': {
        'n_outputs': 3,
    }
}

# Alternative task_dict for per-assay PCBA mode (commented out as example)
# task_dict = {
#     'pcba/assay_1': {
#         'n_outputs': 1,
#         'pcba_assay_idx': 0,
#     },
#     'pcba/assay_2': {
#         'n_outputs': 1,
#         'pcba_assay_idx': 1,
#     },
# }

ARGS = {
    'task_dict': task_dict,
    'in_dim': 64,
    'hidden_dim': 32,
    'num_layers': 2,
    'dropout': 0.1,
    'dataset_task_names': ('pcba', 'pm6'),
    'pcba_num_layers': 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 ModuleDict — a ModuleDict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a ModuleDict output the recorded ndim 1 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
count_parameters Ran
ran, honoured the contract we drafted
blazejba/monroe/monroe/utils.py
code served (permissive licence) · get_code("584fb941774c80b1")
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, ndim 1, dtype family int; 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

torch.manual_seed(0)

# Build a minimal encoder
class MinimalEncoder(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 8)
    
    def forward(self, x):
        return self.linear(x)

# Build minimal decoders with num_tasks attribute
class MinimalDecoders(nn.Module):
    def __init__(self, num_tasks=3):
        super().__init__()
        self.num_tasks = num_tasks
        self.decoder_head = nn.Linear(8, 2)
    
    def forward(self, x):
        return self.decoder_head(x)

# Build the full model
class Model(nn.Module):
    def __init__(self, include_decoders=True):
        super().__init__()
        self.encoder = MinimalEncoder()
        if include_decoders:
            self.decoders = MinimalDecoders(num_tasks=3)
        else:
            self.decoders = None
    
    def forward(self, x):
        enc_out = self.encoder(x)
        if self.decoders is not None:
            return self.decoders(enc_out)
        return enc_out

# Create model instance with decoders
model_with_decoders = Model(include_decoders=True)

ARGS = {
    "model": model_with_decoders
}
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, ndim 1, dtype family int — a tuple output has no array shape of its own; none is stated
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
dict_to_namespace Ran
ran; our contract draft was wrong, not the code
blazejba/monroe/monroe/config.py
code served (permissive licence) · get_code("96e3b86b749f8844")
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 SimpleNamespace. 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 numpy as np
from types import SimpleNamespace

torch.manual_seed(0)

# The function dict_to_namespace recursively converts dictionaries to SimpleNamespace objects
# It takes one parameter: d (a dict or other value)
# The function checks isinstance(d, dict) and recursively processes dict values

# Create a nested dictionary with various types of values
nested_dict = {
    "simple_key": 42,
    "string_key": "test_value",
    "tensor_key": torch.randn(2, 4),
    "numpy_key": np.array([1, 2, 3]),
    "nested_dict": {
        "inner_key": 3.14,
        "inner_tensor": torch.randn(2, 4),
        "deeply_nested": {
            "deep_value": "hello",
            "deep_tensor": torch.randn(2, 4)
        }
    },
    "list_key": [1, 2, 3],
    "none_key": None
}

ARGS = {
    "d": nested_dict
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type SimpleNamespace — a SimpleNamespace output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a SimpleNamespace 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
encode_code Ran
ran, honoured the contract we drafted
blazejba/monroe/monroe/model/featurizer.py
code served (permissive licence) · get_code("c338b309c53d50dc")
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 uint8, ndim 0, dtype family int, shape () 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 numpy as np
from typing import Any, Dict, Iterable, List, Optional, Tuple

# Set up test values for encode_code function
val = "apple"
classes = ["apple", "banana", "orange"]

ARGS = {
    "val": val,
    "classes": classes,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type uint8, ndim 0, dtype family int, shape () — shape () 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
is_flat Ran
ran, violated the contract we drafted
blazejba/monroe/monroe/run_inference.py
code served (permissive licence) · get_code("ecf6bb5764215221")
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 bool, ndim 0, dtype family float, shape () 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 numpy as np

# Test case 1: valid flat 2D layout with all z=0
pos_flat = np.array([
    [0.0, 0.0, 0.0],
    [1.0, 2.0, 0.0],
    [3.0, 4.0, 0.0]
])

ARGS = {
    "pos": pos_flat
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () 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
off_diag_cov_loss Ran
ran; our contract draft was wrong, not the code
blazejba/monroe/monroe/train/loss.py
code served (permissive licence) · get_code("06dd13a19745696b")
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 0, dtype family float, shape () 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 batch of graph-level embeddings
# Shape: [B=2, D=4] - batch size 2, embedding dimension 4
emb = torch.randn(2, 4)

ARGS = {
    "emb": emb,
}
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 0, dtype family float, shape () — shape () 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
str2bool Ran
ran, violated the contract we drafted
blazejba/monroe/monroe/utils.py
code served (permissive licence) · get_code("eef57ea43171033d")
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 bool, ndim 0, dtype family float, shape () 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 argparse

torch.manual_seed(0)

ARGS = {
    "v": "true"
}
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 bool, ndim 0, dtype family float, shape () — shape () 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
to_dict Ran
ran; our contract draft was wrong, not the code
blazejba/monroe/monroe/config.py
code served (permissive licence) · get_code("13bbeae9ca468095")
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 dict. 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 types import SimpleNamespace

torch.manual_seed(0)

# Test case 1: SimpleNamespace with nested structure
ns = SimpleNamespace(
    name="test",
    value=42,
    nested=SimpleNamespace(
        inner_name="nested_test",
        inner_value=3.14
    ),
    items=[1, 2, 3],
    tensor=torch.randn(2, 4)
)

ARGS = {
    "obj": ns
}
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 dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
load_training_ckpt Not yet run
unverified (harvested, no recorded run)
blazejba/monroe/monroe/model/ckpt.py
code served (permissive licence) · get_code("b5d78e8e5f5150f2")
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

Bioassay activity prediction is often data-limited because drug-discovery datasets rely on time-consuming and expensive wet-lab experiments for data generation and evaluation. This challenge has inspired recent research into molecular foundation models (MFMs), which aim to encode general-purpose chemical knowledge into molecular representations that generalize well in data-constrained scenarios. This paper presents Monroe, a new MFM with several innovations over the existing state of the art: increased scale allowing pre-training on over 81 million molecules from the PM6 quantum chemistry dataset; improved graph representation of stereochemistry; improved training losses including conformer denoising and embedding decorrelation; improved multi-task learning; and the use of a prior-data-fitted model (TabPFNv3) for downstream in-context prediction. Our evaluations use a principled pairwise comparison framework that measures statistically significant performance differences. Across established Polaris benchmarks, Monroe matches or exceeds existing MFMs, while on activity cliff benchmarks, designed to assess utility for molecular discovery, it achieves significant improvements over prior methods. Finally, ablation and transfer experiments show that PFN-based downstream predictors also substantially improve two leading existing models, MiniMol and CheMeleon, yielding new state-of-the-art variants we call MiniMol PFN and CheMeleon PFN , suggesting that our downstream adaptation strategy generalizes beyond Monroe. Source code is at github.com/blazejba/monroe. In this paper, we introduce a new MFM, called Monroe, 1 based on a number of innovations over the current state of the art: 1. improved multitask learning using uncertainty-weighted (UW) loss balancing; 2. improved training losses including conformer denoising and embedding decorrelation; 3. improved graph representation of stereochemistry; 4. replacing standard fine-tuning with downstream in-context prediction using a prior-data-fitted model; and 5. scaling training to allow pretraining 1 Named after the computational quantum chemistry pioneer Elizabeth Monroe Boggs.

For agents

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

get_harvested_code_for_paper("2608.18982")
get_code_for_paper("2608.18982")
have("2608.18982")

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

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

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

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

Connect an agent — have() is free.