SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1703.01925 · 2017

Grammar Variational Autoencoder

arXiv · PDF · Open in the Atlas

Code that ran

8 of 19 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; 0 honoured the contract we drafted, 1 violated it and 4 have no contract verdict; 3 failures of our instrument; 11 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/1703.01925.json · badge: /api/ran/1703.01925.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
mkusner/grammarVAE canonical (classifier label)
classifier basis: classifier_2025
2 ran · 1 no recorded run
ZmeiGorynych/generative_playground community (classifier label)
classifier basis not recorded on the link
4 ran · 10 no recorded run
dbkgroup/GVAE4Smiles reimplementation (classifier label)
classifier basis: classifier_2025
2 ran · 0 no recorded run
FunctionStatusWhere it lives
binarize Ran
ran on a synthesized input
ZmeiGorynych/generative_playground/src/generative_playground/codec/cyk.py
code served (permissive licence) · get_code("bc3ae4805ca43d87")
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 list, ndim 1, dtype family float; 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.

from nltk.grammar import Nonterminal, Production

# Create a simple production rule with 3 RHS elements to test binarization
lhs = Nonterminal('S')
rhs = [Nonterminal('NP'), Nonterminal('VP'), Nonterminal('PP')]
p = Production(lhs, rhs)

ARGS = {
    'p': p
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
nltk — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list 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
getFileList Ran
ran; our contract draft was wrong, not the code
dbkgroup/GVAE4Smiles/doGVAE_genHPO.py
code served (permissive licence) · get_code("316ca309f1ba9cdf")
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) and returned list, ndim 1, dtype family float; 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 tempfile
import os

# Create a temporary directory with some test files
temp_dir = tempfile.mkdtemp()

# Create some test files in the temporary directory
test_files = ['file1.txt', 'file2.py', 'file3.md']
for filename in test_files:
    filepath = os.path.join(temp_dir, filename)
    with open(filepath, 'w') as f:
        f.write('test content')

# Also create a subdirectory to ensure it's not included in results
subdir = os.path.join(temp_dir, 'subdir')
os.makedirs(subdir)

ARGS = {
    'mypath': temp_dir
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list 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
get_terminals_nonterminals Ran
ran on a synthesized input
ZmeiGorynych/generative_playground/src/generative_playground/codec/cyk.py
code served (permissive licence) · get_code("c872f1c087b0e4e9")
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.

class MockProduction:
    def __init__(self, lhs_symbol, rhs_symbols):
        self._lhs = lhs_symbol
        self._rhs = rhs_symbols
    
    def lhs(self):
        return self._lhs
    
    def rhs(self):
        return self._rhs


prods = [
    MockProduction('S', ['NP', 'VP']),
    MockProduction('NP', ['Det', 'N']),
    MockProduction('VP', ['V', 'NP']),
    MockProduction('Det', ['the']),
    MockProduction('N', ['dog']),
    MockProduction('V', ['chased']),
]

ARGS = {
    'prods': prods
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — 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
get_zinc_tokenizer Ran
ran on a synthesized input
ZmeiGorynych/generative_playground/src/generative_playground/codec/grammar_codec.py
code served (permissive licence) · get_code("840377e5c6d40a66")
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 function. 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

class MockConfig:
    def __init__(self):
        self._lexical_index = {
            'Cl': 0,
            'Br': 1,
            'C': 2,
            'N': 3,
            'O': 4,
            'S': 5,
            '(': 6,
            ')': 7,
            '=': 8,
            '#': 9,
        }

cfg = MockConfig()

ARGS = {
    'cfg': cfg
}
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 function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
jac Ran
ran, violated the contract we drafted
dbkgroup/GVAE4Smiles/GVAE.py
code served (permissive licence) · get_code("8ac1771f54eb5485")
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) and returned float64, 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

# Construct small numpy arrays for the function parameters
# The function reshapes inputs to 1D and computes a Jaccard-like metric

yt = np.array([[1.0, 2.0, 3.0, 4.0],
               [5.0, 6.0, 7.0, 8.0]])

yp = np.array([[1.5, 2.5, 3.5, 4.5],
               [5.5, 6.5, 7.5, 8.5]])

sm = 1e-06

ARGS = {
    "yt": yt,
    "yp": yp,
    "sm": sm
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float64, 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
pop_or_nothing Ran
ran; our contract draft was wrong, not the code
mkusner/grammarVAE/molecule_vae.py
pointer only (licence: NONE) · get_code("16eaf789c4a4401d")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, mkusner/grammarVAE when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

prods_to_eq Ran
ran; our contract draft was wrong, not the code
mkusner/grammarVAE/molecule_vae.py
pointer only (licence: NONE) · get_code("0bf41e0b28d9835c")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, mkusner/grammarVAE when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

terminal_distance Ran
ran on a synthesized input
ZmeiGorynych/generative_playground/src/generative_playground/codec/____mask_gen_new.py
code served (permissive licence) · get_code("b2a256f2bda78c93")
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 int, ndim 0, dtype family int; no output shape is stated. It ran in syntology-harvest-sandbox:v5-deps (sha256:6a292aa1aed1) at 2026-09-26T21:51:12Z. 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.

from nltk.grammar import Nonterminal, CFG, Production
from nltk import Nonterminal as NT

class MockGrammar:
    def terminal_dist(self, token):
        # Return a distance value for any token not explicitly handled
        return 5

# Create a small mock grammar
grammar = MockGrammar()

# Create test cases for x parameter
# Case 1: aliphatic_ring token
x_aliphatic = {
    'token': Nonterminal('aliphatic_ring'),
    'ring_size': 5
}

# Case 2: cycle_bond token with ring_size
x_cycle_bond = {
    'token': Nonterminal('cycle_bond'),
    'ring_size': 3
}

# Case 3: cycle_double_bond token with ring_size
x_cycle_double_bond = {
    'token': Nonterminal('cycle_double_bond'),
    'ring_size': 4
}

# Case 4: other token
x_other = {
    'token': Nonterminal('some_other_rule'),
    'ring_size': 6
}

# We'll test with the aliphatic_ring case
x = x_aliphatic

ARGS = {
    'grammar': grammar,
    'x': x
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
nltk — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int — no output shape is stated: no later run recorded an output shape for this sample (observed_output and metamorphic_properties carry none; shape_contract and output_contract record ndim only)
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 syntology-harvest-sandbox:v5-deps (sha256:6a292aa1aed1); 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
apply_rule Not yet run
unverified (harvested, no recorded run)
ZmeiGorynych/generative_playground/src/generative_playground/codec/____mask_gen_new.py
code served (permissive licence) · get_code("3faecaf57e145016")
How it ran

no invocation recorded.

bond_to_properties Not yet run
unverified (harvested, no recorded run)
ZmeiGorynych/generative_playground/src/generative_playground/codec/hypergraph.py
code served (permissive licence) · get_code("1e29ad9a8377becb")
How it ran

no invocation recorded.

cyk_parser Not yet run
unverified (harvested, no recorded run)
ZmeiGorynych/generative_playground/src/generative_playground/codec/cyk.py
code served (permissive licence) · get_code("20bd268acd9f9e89")
How it ran

no invocation recorded.

eq_tokenizer Not yet run
unverified (harvested, no recorded run)
ZmeiGorynych/generative_playground/src/generative_playground/codec/grammar_codec.py
code served (permissive licence) · get_code("9ac868c2c5da2396")
How it ran

no invocation recorded.

get_zinc_tokenizer Not yet run
unverified (harvested, no recorded run)
mkusner/grammarVAE/molecule_vae.py
pointer only (licence: NONE) · get_code("bd5df031b64e57d3")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, mkusner/grammarVAE when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

graph_tree_to_rules_list Not yet run
unverified (harvested, no recorded run)
ZmeiGorynych/generative_playground/src/generative_playground/codec/hypergraph.py
code served (permissive licence) · get_code("d6375326f73fec04")
How it ran

no invocation recorded.

normalize_frequencies Not yet run
unverified (harvested, no recorded run)
ZmeiGorynych/generative_playground/src/generative_playground/codec/hypergraph_grammar.py
code served (permissive licence) · get_code("d442fe47e76ee11d")
How it ran

no invocation recorded.

pop_or_nothing Not yet run
unverified (harvested, no recorded run)
ZmeiGorynych/generative_playground/src/generative_playground/codec/grammar_mask_gen.py
code served (permissive licence) · get_code("8b8b890289f16b07")
How it ran

no invocation recorded.

prods_to_eq Not yet run
unverified (harvested, no recorded run)
ZmeiGorynych/generative_playground/src/generative_playground/codec/grammar_codec.py
code served (permissive licence) · get_code("be8874e2b946911f")
How it ran

no invocation recorded.

properties_to_bond Not yet run
unverified (harvested, no recorded run)
ZmeiGorynych/generative_playground/src/generative_playground/codec/hypergraph.py
code served (permissive licence) · get_code("f158928111217e25")
How it ran

no invocation recorded.

rule_d_term_dist Not yet run
unverified (harvested, no recorded run)
ZmeiGorynych/generative_playground/src/generative_playground/codec/____mask_gen_new.py
code served (permissive licence) · get_code("6a2f91d9a7114208")
How it ran

no invocation recorded.

Also present in other papers' code

Of 19 samples lifted from this paper's linked repositories, 19 carry a function identity and 0 do not. Of the 19 distinct functions with an identity, 3 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 3 later) and 16 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.

FunctionAlso present inEarliest-datedOthers named
get_zinc_tokenizer 1 other paper
1 later
2006.09191 (2020-06)
Sample-Efficient Optimization in the Latent Space of Deep Generative Models via Weighted Retraining
pop_or_nothing 1 other paper
1 later
2006.09191 (2020-06)
Sample-Efficient Optimization in the Latent Space of Deep Generative Models via Weighted Retraining
prods_to_eq 1 other paper
1 later
2006.09191 (2020-06)
Sample-Efficient Optimization in the Latent Space of Deep Generative Models via Weighted Retraining

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

Deep generative models have been wildly successful at learning coherent latent representations for continuous data such as video and audio. However, generative modeling of discrete data such as arithmetic expressions and molecular structures still poses significant challenges. Crucially, state-of-the-art methods often produce outputs that are not valid. We make the key observation that frequently, discrete data can be represented as a parse tree from a context-free grammar. We propose a variational autoencoder which encodes and decodes directly to and from these parse trees, ensuring the generated outputs are always valid. Surprisingly, we show that not only does our model more often generate valid outputs, it also learns a more coherent latent space in which nearby points decode to similar discrete outputs. We demonstrate the effectiveness of our learned models by showing their improved performance in Bayesian optimization for symbolic regression and molecular synthesis.

For agents

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

get_harvested_code_for_paper("1703.01925")
get_code_for_paper("1703.01925")
have("1703.01925")

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

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

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

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

Connect an agent — have() is free.