SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2203.08031 · ICLR · 2022

Data-Efficient Graph Grammar Learning for Molecular Generation

Payel Das, Wojciech Matusik, Mit-Ibm Watson, A Lab, Jie Chen, Veronika Thost, Minghao Guo, Beichen Li

arXiv · PDF · Open in the Atlas

Code that ran

5 of 7 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (2 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 3 violated it and 2 have no contract verdict; 0 failures of our instrument; 2 no recorded run), measured 2026-11-21; 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/2203.08031.json · badge: /api/ran/2203.08031.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
gmh14/data_efficient_grammar canonical (classifier label)
classifier basis: classifier_2025
5 ran · 2 no recorded run
FunctionStatusWhere it lives
Hypergraph Ran
ran on a synthesized input · constructed an object; no result was computed
gmh14/data_efficient_grammar/private/grammar.py
code served (permissive licence) · get_code("f65787c52fff08ca")
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, Hypergraph: 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 numpy as np
import networkx as nx
from collections import Counter
from functools import partial

torch.manual_seed(0)

# The Hypergraph class is initialized with no required parameters
# Based on the __init__ method, it only initializes internal data structures

ARGS = {}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
graphviz, networkx, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Hypergraph — 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 Hypergraph 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
NTSymbol Ran
ran on a synthesized input · constructed an object; no result was computed
gmh14/data_efficient_grammar/private/grammar.py
code served (permissive licence) · get_code("4bd898c2c8604b75")
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, NTSymbol: 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 numpy as np

class BondSymbol(object):
    """Mock bond symbol class with bond_type attribute"""
    def __init__(self, bond_type: int):
        self.bond_type = bond_type
    
    def __eq__(self, other) -> bool:
        if not isinstance(other, BondSymbol):
            return False
        return self.bond_type == other.bond_type
    
    def __str__(self) -> str:
        return f'BondSymbol(type={self.bond_type})'

# Create bond symbols with different bond types
bond_symbol_1 = BondSymbol(bond_type=1)
bond_symbol_2 = BondSymbol(bond_type=2)
bond_symbol_3 = BondSymbol(bond_type=3)

ARGS = {
    'degree': 3,
    'is_aromatic': True,
    'bond_symbol_list': [bond_symbol_2, bond_symbol_1, bond_symbol_3],
    'for_ring': False
}
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 NTSymbol — 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 NTSymbol 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
_edge_match Ran
ran, violated the contract we drafted
gmh14/data_efficient_grammar/private/grammar.py
code served (permissive licence) · get_code("e1d75d0ae7106f94")
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

torch.manual_seed(0)

# edge1 and edge2 are dictionaries with an 'order' key
edge1 = {'order': 1}
edge2 = {'order': 1}
ignore_order = False

ARGS = {
    'edge1': edge1,
    'edge2': edge2,
    'ignore_order': ignore_order
}
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
_node_match_prod_rule Ran
ran, violated the contract we drafted
gmh14/data_efficient_grammar/private/grammar.py
code served (permissive licence) · get_code("ba84d0d9074bee9d")
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

# Define test nodes matching the structure expected by _node_match_prod_rule
# Each node is a dict with 'bipartite' and 'attr_dict' keys

node1_edge = {
    'bipartite': 'edge',
    'attr_dict': {
        'symbol': 'edge_symbol_1',
        'ext_id': 0
    }
}

node2_edge = {
    'bipartite': 'edge',
    'attr_dict': {
        'symbol': 'edge_symbol_1',
        'ext_id': 1
    }
}

node1_node = {
    'bipartite': 'node',
    'attr_dict': {
        'symbol': 'node_symbol_1',
        'ext_id': 5
    }
}

node2_node = {
    'bipartite': 'node',
    'attr_dict': {
        'symbol': 'node_symbol_1',
        'ext_id': 5
    }
}

ARGS = {
    'node1': node1_edge,
    'node2': node2_edge,
    'ignore_order': 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 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
masked_softmax Ran
ran, violated the contract we drafted
gmh14/data_efficient_grammar/private/grammar.py
code served (permissive licence) · get_code("fd360cf9f53416f8")
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 1, dtype family float, shape (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 numpy as np

# Create small test arrays for the masked_softmax function
logit = np.array([1.0, 2.0, 3.0, 0.5])
mask = np.array([1, 1, 0, 1])

ARGS = {
    'logit': logit,
    'mask': mask
}
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 ndarray, ndim 1, dtype family float, shape (4,) — shape (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
ProductionRule Not yet run
unverified (harvested, no recorded run)
gmh14/data_efficient_grammar/private/grammar.py
code served (permissive licence) · get_code("ff5d6c146a5ade9c")
How it ran

no invocation recorded.

ProductionRuleCorpus Not yet run
unverified (harvested, no recorded run)
gmh14/data_efficient_grammar/private/grammar.py
code served (permissive licence) · get_code("b0f86e5d03641a4d")
How it ran

no invocation recorded.

Also present in other papers' code

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

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-21.

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 problem of molecular generation has received significant attention recently. Existing methods are typically based on deep neural networks and require training on large datasets with tens of thousands of samples. In practice, however, the size of class-specific chemical datasets is usually limited (e.g., dozens of samples) due to labor-intensive experimentation and data collection. This presents a considerable challenge for the deep learning generative models to comprehensively describe the molecular design space. Another major challenge is to generate only physically synthesizable molecules. This is a non-trivial task for neural network-based generative models since the relevant chemical knowledge can only be extracted and generalized from the limited training data. In this work, we propose a data-efficient generative model that can be learned from datasets with orders of magnitude smaller sizes than common benchmarks. At the heart of this method is a learnable graph grammar that generates molecules from a sequence of production rules. Without any human assistance, these production rules are automatically constructed from training data. Furthermore, additional chemical knowledge can be incorporated in the model by further grammar optimization. Our learned graph grammar yields state-of-the-art results on generating high-quality molecules for three monomer datasets that contain only ∼20 samples each. Our approach also achieves remarkable performance in a challenging polymer generation task with only 117 training samples and is competitive against existing methods using 81k data points. Code is available at https://github.com/gmh14/data_efficient_grammar.

For agents

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

get_harvested_code_for_paper("2203.08031")
get_code_for_paper("2203.08031")
have("2203.08031")

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

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

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

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

Connect an agent — have() is free.