SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2109.01135 · NeurIPS · 2021

Sequence-to-Sequence Learning with Latent Neural Grammars

Yoon Kim

arXiv · PDF · Open in the Atlas

Code that ran

9 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; 1 honoured the contract we drafted, 0 violated it and 7 have no contract verdict; 1 failure of our instrument; 0 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/2109.01135.json · badge: /api/ran/2109.01135.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
yli1/CGPS canonical (classifier label)
classifier basis: census
7 ran · 0 no recorded run
yoonkim/neural-qcfg canonical (classifier label)
classifier basis: classifier_2025
2 ran · 0 no recorded run
FunctionStatusWhere it lives
clip_gradient_norms Ran
ran on a synthesized input
yli1/CGPS/simple_model.py
code served (permissive licence) · get_code("7c681c304ce98b5e")
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. 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 tensorflow as tf
import numpy as np

# Set random seed for reproducibility
tf.random.set_seed(0)

# Create test gradients - a mix of regular tensors and IndexedSlices
regular_grad_1 = tf.Variable(np.random.randn(2, 4).astype(np.float32))
regular_grad_2 = tf.Variable(np.random.randn(3, 5).astype(np.float32))

# Create an IndexedSlices object
indices = tf.constant([0, 2, 5], dtype=tf.int64)
values = tf.Variable(np.random.randn(3, 4).astype(np.float32))
dense_shape = tf.constant([10, 4], dtype=tf.int64)
indexed_slices_grad = tf.IndexedSlices(values, indices, dense_shape)

# Create a list of gradients including None values
gradients = [
    regular_grad_1,
    None,
    regular_grad_2,
    indexed_slices_grad,
    None
]

# Define max_norm parameter
max_norm = 1.0

ARGS = {
    "gradients": gradients,
    "max_norm": max_norm
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list — a list 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
eval Ran
ran, honoured the contract we drafted
yoonkim/neural-qcfg/train_scan.py
pointer only (licence: NONE) · get_code("aa6ca10cb935fd60")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, yoonkim/neural-qcfg 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.

filter Ran
ran on a synthesized input
yli1/CGPS/adj_data_generator.py
code served (permissive licence) · get_code("eebdf51e5b834f99")
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 3, 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 torch
import numpy as np

torch.manual_seed(0)

# The function filter() expects:
# - train: iterable of entries, where each entry has [0] and [1] indexable items
# - test: iterable of entries, where each entry has [0] and [1] indexable items
# Each entry[0] and entry[1] should be sequences that can be joined with ' '.join()
# So they should be iterables of strings

# Create sample training data
train_data = [
    (["hello", "world"], ["foo", "bar"]),
    (["test", "input"], ["test", "output"]),
    (["cat", "dog"], ["animal", "pet"]),
]

# Create sample test data with some duplicates and some new entries
test_data = [
    (["hello", "world"], ["foo", "bar"]),  # duplicate from train
    (["new", "sequence"], ["new", "output"]),  # new entry
    (["another", "test"], ["another", "result"]),  # new entry
]

ARGS = {
    "train": train_data,
    "test": test_data,
}
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 list, ndim 3, 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
filter_actions Ran
ran on a synthesized input
yli1/CGPS/attention_visualization.py
code served (permissive licence) · get_code("313e5178bdef7bfc")
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.

import torch

torch.manual_seed(0)

# The function filter_actions takes a single parameter 'actions' which is iterated over.
# Each element is checked as a string and transformed based on various conditions.
# We need to provide a list of action strings.

actions = [
    'EOS_Y',
    'switch',
    'I_MOVE',
    'TURN_RIGHT',
    'TURN_LEFT',
    'STOP',
    'I_ACTION'
]

ARGS = {
    'actions': actions
}
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 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
filter_words Ran
ran on a synthesized input
yli1/CGPS/attention_visualization.py
code served (permissive licence) · get_code("efe28f7dd3f19e7f")
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.

import torch

def filter_words(words):
    result = []
    for word in words:
        if word == 'EOS_X':
            result.append('<EOS>')
        else:
            result.append(word)
    return result

ARGS = {
    'words': ['hello', 'EOS_X', 'world', 'EOS_X', 'test']
}
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 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_data Ran
ran; our contract draft was wrong, not the code
yoonkim/neural-qcfg/train_scan.py
pointer only (licence: NONE) · get_code("1e93c709a6443925")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, yoonkim/neural-qcfg 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.

get_data_generator Ran
ran on a synthesized input
yli1/CGPS/data_generator.py
code served (permissive licence) · get_code("d7a865546b1fb0ce")
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 FewShotDataGenerator. 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 collections import namedtuple
import tempfile
import os

torch.manual_seed(0)

# Create a minimal args class for FewShotDataGenerator
class FewShotArgs:
    def __init__(self):
        self.simple_data = False

# Create a minimal args class for ToyDataGenerator
class ToyArgs:
    def __init__(self):
        self.simple_data = False

# Create temporary SCAN files for SCANGenerator
temp_dir = tempfile.mkdtemp()

# Create a minimal train file
train_file = os.path.join(temp_dir, 'train.txt')
with open(train_file, 'w') as f:
    f.write("0 : jump : JUMP\n")
    f.write("1 : walk : WALK\n")

# Create a minimal test file
test_file = os.path.join(temp_dir, 'test.txt')
with open(test_file, 'w') as f:
    f.write("0 : run : RUN\n")

# Create a minimal args class for SCANGenerator
class SCANArgs:
    def __init__(self):
        self.train_file = train_file
        self.test_file = test_file

ARGS = {
    'name': 'fewshot',
    'args': FewShotArgs()
}
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 FewShotDataGenerator — a FewShotDataGenerator output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a FewShotDataGenerator 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
get_sample Ran
ran on a synthesized input
yli1/CGPS/adj_data_generator.py
code served (permissive licence) · get_code("ad335e7ef703cc26")
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 2, 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 torch

torch.manual_seed(0)

ARGS = {
    'TV': 'hello',
    'A1': 'world',
    'A2': 'foo',
    'A3': 'bar',
    'N': 'name',
    'L1': 'label1',
    'L2': 'label2',
    'L3': 'label3',
}
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 2, dtype family float — 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
get_voc_full Ran
ran on a synthesized input
yli1/CGPS/adj_data_generator.py
code served (permissive licence) · get_code("6f3676e93255b14c")
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 numpy as np

torch.manual_seed(0)

ARGS = {
    'is_train': True
}
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 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

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

Sequence-to-sequence learning with neural networks has become the de facto standard for sequence prediction tasks. This approach typically models the local distribution over the next word with a powerful neural network that can condition on arbitrary context. While flexible and performant, these models often require large datasets for training and can fail spectacularly on benchmarks designed to test for compositional generalization. This work explores an alternative, hierarchical approach to sequence-to-sequence learning with quasi-synchronous grammars, where each node in the target tree is transduced by a node in the source tree. Both the source and target trees are treated as latent and induced during training. We develop a neural parameterization of the grammar which enables parameter sharing over the combinatorial space of derivation rules without the need for manual feature engineering. We apply this latent neural grammar to various domains-a diagnostic language navigation task designed to test for compositional generalization (SCAN), style transfer, and small-scale machine translation-and find that it performs respectably compared to standard baselines.

For agents

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

get_harvested_code_for_paper("2109.01135")
get_code_for_paper("2109.01135")
have("2109.01135")

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

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

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

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

Connect an agent — have() is free.