SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2106.03993 · ACL · 2021

Lexicon Learning for Few-Shot Neural Sequence Modeling

Jacob Andreas, Ekin Akyürek

arXiv · PDF · Open in the Atlas

Code that ran

8 of 8 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 4 have no contract verdict; 3 failures 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/2106.03993.json · badge: /api/ran/2106.03993.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
ekinakyurek/lexical canonical (classifier label)
classifier basis: census
8 ran · 0 no recorded run
FunctionStatusWhere it lives
batch_seqs Ran
ran on a synthesized input
ekinakyurek/lexical/src/utils.py
code served (permissive licence) · get_code("7841344d2c132f93")
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 int, shape (4, 3) 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
import torch

torch.manual_seed(0)

# Construct valid arguments for batch_seqs
# The function expects 'seqs' - a sequence of sequences (iterables with len())
# Each sequence will be converted to a numpy array and padded

seq1 = np.array([1, 2, 3, 4], dtype=np.int64)
seq2 = np.array([5, 6], dtype=np.int64)
seq3 = np.array([7, 8, 9], dtype=np.int64)

seqs = [seq1, seq2, seq3]

ARGS = {
    "seqs": seqs
}
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 Tensor, ndim 2, dtype family int, shape (4, 3) — shape (4, 3) 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
encode Ran
ran; our contract draft was wrong, not the code
ekinakyurek/lexical/data.py
code served (permissive licence) · get_code("839530fa476fdb3b")
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 torch

class SimpleVocab:
    def __init__(self, size=10):
        self.size = size
        self._sos_token = 1
        self._eos_token = 2
    
    def sos(self):
        return self._sos_token
    
    def eos(self):
        return self._eos_token
    
    def encode(self, text):
        # Simple mock encoding: return a list of token ids
        if isinstance(text, str):
            tokens = [3 + (ord(c) % 7) for c in text]
        else:
            tokens = [3, 4, 5]
        return tokens

vocab_x = SimpleVocab(size=10)
vocab_y = SimpleVocab(size=10)

data = [
    ("hello", "world"),
    ("foo", "bar")
]

ARGS = {
    "data": data,
    "vocab_x": vocab_x,
    "vocab_y": vocab_y
}
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 — 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
encode_io Ran
ran, honoured the contract we drafted
ekinakyurek/lexical/data.py
code served (permissive licence) · get_code("82101630969e5b8e")
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 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

class SimpleVocab:
    def __init__(self, token_set):
        self.token_set = token_set
        self.token_to_id = {t: i for i, t in enumerate(token_set)}
        self._sos_token = "<SOS>"
        self._eos_token = "<EOS>"
    
    def sos(self):
        return 0  # Special token ID for start-of-sequence
    
    def eos(self):
        return 1  # Special token ID for end-of-sequence
    
    def encode(self, text):
        # Encode text as a list of token IDs
        if isinstance(text, str):
            tokens = text.split()
        else:
            tokens = text
        return [self.token_to_id.get(t, 2) for t in tokens]

# Create two simple vocabularies
vocab_x = SimpleVocab(["<SOS>", "<EOS>", "hello", "world", "foo"])
vocab_y = SimpleVocab(["<SOS>", "<EOS>", "goodbye", "earth", "bar"])

# Create a datum (input, output) pair
datum = ("hello world", "goodbye earth")

ARGS = {
    "datum": datum,
    "vocab_x": vocab_x,
    "vocab_y": vocab_y,
}
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 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
eval_format Ran
ran on a synthesized input
ekinakyurek/lexical/data.py
code served (permissive licence) · get_code("4e04ec15da964ec6")
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 str. 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)

class MockVocab:
    def __init__(self):
        self.eos_token = 2
        self.token_to_word = {0: "<start>", 1: "hello", 2: "<eos>", 3: "world"}
    
    def eos(self):
        return self.eos_token
    
    def decode(self, seq):
        words = [self.token_to_word.get(int(token), f"<unk:{token}>") for token in seq]
        return " ".join(words)

vocab = MockVocab()
seq = [0, 1, 3, 2, 3, 3]

ARGS = {
    "vocab": vocab,
    "seq": seq,
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
fn Ran
ran; our contract draft was wrong, not the code
ekinakyurek/lexical/hlog.py
code served (permissive licence) · get_code("7cb6c55af2773820")
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 logging
import threading
import time

# Set up logging to avoid warnings
logging.basicConfig(level=logging.INFO)

# Initialize thread-local state with path list
state = threading.local()
state.path = []

# Define a simple test function to wrap
def test_function(x, y):
    """A simple function that takes two arguments."""
    time.sleep(0.01)  # Small delay to measure
    return x + y

ARGS = {
    'name': 'test_operation',
    'timer': True,
}
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 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
group Ran
ran; our contract draft was wrong, not the code
ekinakyurek/lexical/hlog.py
code served (permissive licence) · get_code("f672aab27d220c13")
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 _GeneratorContextManager. 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 logging
import threading
import time
from contextlib import contextmanager

logger = logging.getLogger('hlog')
state = threading.local()

# Initialize the threading.local state with an empty path list
state.path = []

@contextmanager
def task(name, timer=True):
    state.path.append(str(name))
    begin = time.time()
    yield
    end = time.time()
    if timer:
        logger.info('%s{%0.2fs}' % ('/'.join(state.path), end - begin))
    state.path.pop()

def group(name):
    return task(name, timer=False)

ARGS = {
    'name': 'test_group'
}
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 _GeneratorContextManager — a _GeneratorContextManager output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a _GeneratorContextManager 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
trim Ran
ran on a synthesized input
ekinakyurek/lexical/src/utils.py
code served (permissive licence) · get_code("0ff22e14159fcfd0")
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 trim(L, obj) takes a list L and an object obj
# It returns L up to and including the first occurrence of obj if obj is in L
# Otherwise returns L unchanged
# So we need a list L and an object obj

# Create a simple list with various objects
L = [1, 2, 3, "target", 4, 5]
obj = "target"

ARGS = {
    "L": L,
    "obj": obj
}
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
weight_top_p Ran
ran on a synthesized input
ekinakyurek/lexical/src/utils.py
code served (permissive licence) · get_code("eedb78f0f2e7f4e9")
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 a simple probability distribution vector
vec = np.array([0.1, 0.3, 0.4, 0.2])

# Set p to a threshold value between 0 and 1
p = 0.7

ARGS = {
    "vec": vec,
    "p": p,
}
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

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 distinct functions with an identity, 7 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 7 later) and 1 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
batch_seqs 1 other paper
1 later
2303.13716 (2023-03)
ReCOGS: How Incidental Details of a Logical Form Overshadow an Evaluation of Semantic Interpretation
encode 1 other paper
1 later
2311.04420 (2023-11)
Data Factors for Better Compositional Generalization
encode_io 1 other paper
1 later
2311.04420 (2023-11)
Data Factors for Better Compositional Generalization
fn 1 other paper
1 later
2311.04420 (2023-11)
Data Factors for Better Compositional Generalization
group 1 other paper
1 later
2311.04420 (2023-11)
Data Factors for Better Compositional Generalization
trim 1 other paper
1 later
2303.13716 (2023-03)
ReCOGS: How Incidental Details of a Logical Form Overshadow an Evaluation of Semantic Interpretation
weight_top_p 1 other paper
1 later
2303.13716 (2023-03)
ReCOGS: How Incidental Details of a Logical Form Overshadow an Evaluation of Semantic Interpretation

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 transduction is the core problem in language processing applications as diverse as semantic parsing, machine translation, and instruction following. The neural network models that provide the dominant solution to these problems are brittle, especially in low-resource settings: they fail to generalize correctly or systematically from small datasets. Past work has shown that many failures of systematic generalization arise from neural models' inability to disentangle lexical phenomena from syntactic ones. To address this, we augment neural decoders with a lexical translation mechanism that generalizes existing copy mechanisms to incorporate learned, decontextualized, token-level translation rules. We describe how to initialize this mechanism using a variety of lexicon learning algorithms, and show that it improves systematic generalization on a diverse set of sequence modeling tasks drawn from cognitive science, formal semantics, and machine translation. 1

For agents

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

get_harvested_code_for_paper("2106.03993")
get_code_for_paper("2106.03993")
have("2106.03993")

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

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

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

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

Connect an agent — have() is free.