SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2021.findings-emnlp.347 · EMNLP Findings · 2021

Attend, Memorize and Generate: Towards Faithful Table-to-Text Generation in Few Shots

Philip Yu, Yao Wan, Wenting Zhao, Ye Liu

Open in the Atlas

Code that ran

9 of 11 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, 0 violated it and 2 have no contract verdict; 5 failures of our instrument; 2 no recorded run); 1 of them was also run on the host, not in the jail, by the peer-agreement lane that set its level, measured 2026-11-24; 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/2021.findings-emnlp.347.json · badge: /api/ran/2021.findings-emnlp.347.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
wentinghome/AMG canonical (classifier label)
classifier basis: census
9 ran · 2 no recorded run
FunctionStatusWhere it lives
swish Ran
ran; our contract draft was wrong, not the code
wentinghome/AMG/pytorch_pretrained_bert/modeling.py
code served (permissive licence) · get_code("0f786c407fb1ee4c")
How it ran

Ran in Syntology's jail on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned Tensor, ndim 2, dtype family float, shape (2, 4) as a later run recorded it. The image it ran in was not recorded. The comparison behind this sample's level is a different run: the peer-agreement lane ran it again on the host, not in the jail (report dated 2026-09-04T22:33:52Z). 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)

# The function swish takes a single parameter 'x' which is used with:
# - torch.sigmoid(x) - requires a tensor
# - x * ... - requires a tensor that supports multiplication
# So x should be a tensor

x = torch.randn(2, 4)

ARGS = {
    "x": x
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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 2, dtype family float, shape (2, 4) — shape (2, 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
batch_list_to_batch_tensors Ran
ran; our contract draft was wrong, not the code
wentinghome/AMG/biunilm/loader_utils.py
code served (permissive licence) · get_code("0185bc550948bb9e")
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
import torch.nn as nn

torch.manual_seed(0)

# The function expects a batch which is a list of tuples/sequences
# Each element of the batch should be a tuple where corresponding indices can be zipped together
# The function processes each zipped column and either:
# 1. Returns None if the first element is None
# 2. Stacks tensors if the first element is a torch.Tensor
# 3. Converts to long tensor otherwise

# Create a sample batch with mixed types
batch = [
    # First sample: (tensor, int, None)
    (torch.tensor([1, 2, 3, 4], dtype=torch.float32), 5, None),
    # Second sample: (tensor, int, None)
    (torch.tensor([5, 6, 7, 8], dtype=torch.float32), 10, None),
]

ARGS = {
    "batch": batch
}
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
detokenize Ran
ran; our contract draft was wrong, not the code
wentinghome/AMG/biunilm/decode_all_domains.py
code served (permissive licence) · get_code("633d1e424a09eb70")
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 detokenize(tk_list):
    r_list = []
    for tk in tk_list:
        if tk.startswith('##') and len(r_list) > 0:
            r_list[-1] = r_list[-1] + tk[2:]
        else:
            r_list.append(tk)
    return r_list

ARGS = {
    'tk_list': ['hello', '##world', 'foo', '##bar', '##baz']
}
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
gelu Ran
ran, honoured the contract we drafted
wentinghome/AMG/pytorch_pretrained_bert/modeling.py
pointer only (licence: MIT); the stored copy get_code serves, from shmsw25/qa-hard-em, is pointer only (licence: NONE) · get_code("40e9fee2e0b7e278")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from shmsw25/qa-hard-em, and GitHub detected no licence in that repository 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_best_sequence Ran
ran, honoured the contract we drafted
wentinghome/AMG/biunilm/gen_seq_from_trace.py
pointer only (licence: MIT); the stored copy get_code serves, from tianhuizhang/concept_ordering, is pointer only (licence: NONE) · get_code("8130ddbbba17f308")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from tianhuizhang/concept_ordering, and GitHub detected no licence in that repository 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_random_word Ran
ran; our contract draft was wrong, not the code
wentinghome/AMG/biunilm/loader_utils.py
code served (permissive licence) · get_code("0dc4252bed90db68")
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
from random import randint, shuffle

# Create a small vocabulary list
vocab_words = ["hello", "world", "python", "code", "test", "function"]

ARGS = {
    "vocab_words": vocab_words
}
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
read_traces_from_file Ran
ran; our contract draft was wrong, not the code
wentinghome/AMG/biunilm/gen_seq_from_trace.py
pointer only (licence: MIT); the stored copy get_code serves, from tianhuizhang/concept_ordering, is pointer only (licence: NONE) · get_code("ba6e66dc83d560e4")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from tianhuizhang/concept_ordering, and GitHub detected no licence in that repository 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.

truncate_tokens_pair Ran
ran on a synthesized input
wentinghome/AMG/biunilm/seq2seq_loader.py
code served (permissive licence) · get_code("3a2d3befeeec4315")
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.

from random import random as rand

# Construct arguments for truncate_tokens_pair
# The function expects lists of tokens and parameters for truncation logic

tokens_a = [101, 2054, 2003, 1045, 102]  # List of token IDs
tokens_b = [2054, 2003, 1045, 102]       # List of token IDs
tokens_c = [1045, 102, 2054]             # List of token IDs
tokens_d = [102, 2054, 2003]             # List of token IDs

max_len = 10                              # Maximum total length
max_len_a = 0                             # No max limit for tokens_a
max_len_b = 0                             # No max limit for tokens_b
trunc_seg = None                          # No specific segment to truncate
always_truncate_tail = False              # Allow random truncation from head/tail

ARGS = {
    'tokens_a': tokens_a,
    'tokens_b': tokens_b,
    'tokens_c': tokens_c,
    'tokens_d': tokens_d,
    'max_len': max_len,
    'max_len_a': max_len_a,
    'max_len_b': max_len_b,
    'trunc_seg': trunc_seg,
    'always_truncate_tail': always_truncate_tail,
}
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, 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
truncate_tokens_pair Ran
ran on a synthesized input
wentinghome/AMG/biunilm/seq2seq_loader_mlm.py
code served (permissive licence) · get_code("900f8d4b7c3c4f40")
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.

from random import random as rand

# Construct valid arguments for truncate_tokens_pair
# The function takes two token lists and truncates them to fit within max_len

# Simple token lists (using strings as tokens)
tokens_a = ['hello', 'world', 'foo', 'bar', 'baz', 'qux']
tokens_b = ['test', 'example', 'data', 'set']

# Maximum total length for both sequences combined
max_len = 6

# Optional: maximum length for sequence a (0 means no limit)
max_len_a = 0

# Optional: maximum length for sequence b (0 means no limit)
max_len_b = 0

# Optional: which segment to truncate ('a', 'b', or None for auto)
trunc_seg = None

# Whether to always truncate from tail (True) or randomly from head/tail (False)
always_truncate_tail = False

ARGS = {
    'tokens_a': tokens_a,
    'tokens_b': tokens_b,
    'max_len': max_len,
    'max_len_a': max_len_a,
    'max_len_b': max_len_b,
    'trunc_seg': trunc_seg,
    'always_truncate_tail': always_truncate_tail,
}
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, 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
scatter_imbalance Not yet run
unverified (harvested, no recorded run)
wentinghome/AMG/nn/data_parallel.py
code served (permissive licence) · get_code("1d701b58c83a0a64")
How it ran

no invocation recorded.

scatter_kwargs_imbalance Not yet run
unverified (harvested, no recorded run)
wentinghome/AMG/nn/data_parallel.py
code served (permissive licence) · get_code("c52061be77efb44d")
How it ran

no invocation recorded.

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 11 distinct functions with an identity, 9 are also present in other papers whose code we hold (6 with at least one paper dated earlier, 0 the same month, 5 later) and 2 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
swish 206 other papers
56 dated earlier, 117 later, 33 same year, order not determinable · 44 only as an assembly brick
1408.5882 (2014-08)
Convolutional Neural Networks for Sentence Classification
1805.12114 (2018-05)
Deep Reinforcement Learning in a Handful of Trials using Probabilistic Dynamics Models
1809.01357 (2018-09)
Zero Shot Learning for Code Education: Rubric Sampling with Deep Learning Inference
and 203 more not named here
gelu 198 other papers
67 dated earlier, 103 later, 28 same year, order not determinable · 32 only as an assembly brick
1408.5882 (2014-08)
Convolutional Neural Networks for Sentence Classification
1810.04805 (2018-10)
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
1901.10125 (2019-01)
Glyce: Glyph-vectors for Chinese Character Representations
and 195 more not named here
detokenize 4 other papers
2 dated earlier, 2 later
1909.11059 (2019-09)
Unified Vision-Language Pre-Training for Image Captioning and VQA
2009.07032 (2020-09)
Noisy Self-Knowledge Distillation for Text Summarization
aaai_21432 (2022 (year only))
DIALOGLM: Pre-trained Model for Long Dialogue Understanding and Summarization
and 1 more not named here
get_best_sequence 2 other papers
2 later
aaai_21432 (2022 (year only))
DIALOGLM: Pre-trained Model for Long Dialogue Understanding and Summarization
2309.06363 (2023-09)
Learning to Predict Concept Ordering for Common Sense Generation
get_random_word 2 other papers
1 dated earlier, 1 same year, order not determinable
1909.11059 (2019-09)
Unified Vision-Language Pre-Training for Image Captioning and VQA
2105.02605 (2021-05)
GraphFormers: GNN-nested Transformers for Representation Learning on Textual Graph
read_traces_from_file 2 other papers
2 later
aaai_21432 (2022 (year only))
DIALOGLM: Pre-trained Model for Long Dialogue Understanding and Summarization
2309.06363 (2023-09)
Learning to Predict Concept Ordering for Common Sense Generation
scatter_kwargs_imbalance 2 other papers
1 dated earlier, 1 same year, order not determinable
1909.11059 (2019-09)
Unified Vision-Language Pre-Training for Image Captioning and VQA
2109.00590 (2021-09)
WebQA: Multihop and Multimodal QA
batch_list_to_batch_tensors 1 other paper
1 same year, order not determinable
2105.02605 (2021-05)
GraphFormers: GNN-nested Transformers for Representation Learning on Textual Graph
truncate_tokens_pair 1 other paper
1 dated earlier
1909.11059 (2019-09)
Unified Vision-Language Pre-Training for Image Captioning and VQA

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

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Few-shot table-to-text generation is a task of composing fluent and faithful sentences to convey table content using limited data. Despite many efforts having been made towards generating impressive fluent sentences by finetuning powerful pre-trained language models, the faithfulness of generated content still needs to be improved. To this end, this paper proposes a novel approach Attend, Memorize and Generate (called AMG), inspired by the text generation process of humans. In particular, AMG (1) attends over the multi-granularity of context using a novel strategy based on table slot level and traditional token-by-token level attention to exploit both the table structure and natural linguistic information; (2) dynamically memorizes the table slot allocation states; and (3) generates faithful sentences according to both the context and memory allocation states. Comprehensive experiments with human evaluation on three domains (i.e., humans, songs, and books) of the Wiki dataset show that our model can generate higher qualified texts when compared with several state-ofthe-art baselines, in both fluency and faithfulness. 1

For agents

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

get_harvested_code_for_paper("2021.findings-emnlp.347")
get_code_for_paper("2021.findings-emnlp.347")
have("2021.findings-emnlp.347")

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

curl https://syntology.ai/api/ran/2021.findings-emnlp.347.json

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

[![Syntology run record](https://syntology.ai/api/ran/2021.findings-emnlp.347.svg)](https://syntology.ai/paper/2021.findings-emnlp.347)

Connect an agent — have() is free.