---
title: "Keeping Notes — paper by Benmalek et al. (2019)"
description: "The Scratchpad Mechanism gives a text decoder writable memory of its input, with tests in translation, question generation, and summarization."
canonical: "https://research.elamur.ai/free/en/papers/benmalek-2019-keeping-notes-conditional-natural-language/"
---
Elamur: [Mova](https://md.mova.elamur.ai/free/en/) · [Parse](https://mova.elamur.ai/free/en/parse/) · [Dictionary](https://md.dictionary.elamur.ai/free/en/) · [Translate](https://md.translate.elamur.ai/free/en/) · **Research** · [Gali](https://md.gali.elamur.ai/free/en/) · [MCP](https://mcp.elamur.ai/) · [Locations](https://md.locations.elamur.ai/free/en/) · [Weather](https://md.weather.elamur.ai/free/en/) · [Constitution](https://md.constitution.elamur.ai/)

[Elamur Research](https://md.research.elamur.ai/free/en/) · [this page in HTML](https://research.elamur.ai/free/en/papers/benmalek-2019-keeping-notes-conditional-natural-language/)

[Elamur Research](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2019](https://md.research.elamur.ai/free/en/papers/2019/) / Keeping Notes: Conditional Natural Language Generation with a Scratchpad Encoder

# Keeping Notes: Conditional Natural Language Generation with a Scratchpad Encoder

Paper · 2019 · Ryan Benmalek, Madian Khabsa, Suma Desu et al.

**Authors:** Ryan Benmalek, [Madian Khabsa](https://md.research.elamur.ai/free/en/authors/madian-khabsa/), Suma Desu, [Claire Cardie](https://md.research.elamur.ai/free/en/authors/claire-cardie/) and [Michele Banko](https://md.research.elamur.ai/free/en/authors/michele-banko/) · **Year:** 2019 · **Venue:** Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics · **Licence:** [CC BY 4.0 (ACL Anthology)](https://creativecommons.org/licenses/by/4.0/)

Cited by **3** papers in our library of more than 163,000 papers whose bibliographies we read · Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics · [licence](https://creativecommons.org/licenses/by/4.0/)

- [Publisher's page](https://aclanthology.org/P19-1407/)
- [PDF](https://aclanthology.org/P19-1407.pdf)
- [DOI 10.18653/v1/p19-1407](https://doi.org/10.18653/v1/p19-1407)

## Summary

A system that generates a sentence from an input has to keep track of two things at once. It needs to know what the input says and what it has already said in response. If it loses track of the second, it may repeat a phrase, leave part of the input unexpressed, or produce wording too vague to convey the intended meaning. The authors propose the Scratchpad Mechanism, which gives the decoder a place to record information as it writes. The place it writes to is the same set of input representations that it consults to choose what to say.

In a conventional sequence-to-sequence system with attention, the encoder represents the input as a sequence of vectors. As the decoder generates words, it can shift its attention among those vectors. Scratchpad lets the decoder change the vectors as well. After consulting them, it constructs an update from what it just read and its current progress through the output. At every input position, a learned gate determines how much of the previous representation is retained. The next step therefore starts from input representations that carry some record of the preceding steps. The mechanism learns what to keep through the generation task itself.

The authors test the same design in [machine translation](https://md.research.elamur.ai/free/en/topics/machine-translation/), in generating questions from database or knowledge-base queries, and in [summarization](https://md.research.elamur.ai/free/en/topics/summarization/). Scratchpad reaches 35.08 [BLEU](https://md.research.elamur.ai/free/en/concepts/bleu/) on German-to-English IWSLT14 translation, compared with 35.07 for the strongest listed prior system in that direction. In WikiSQL question generation, adding Scratchpad to a copying system yields a corpus BLEU of 27.64, ahead of the copying system with coverage at 26.78. On CNN/Daily Mail, Scratchpad improves on the coverage-equipped pointer-generator across the reported ROUGE measures. Its METEOR scores remain close to that system’s, while a separately trained bottom-up system leads the ROUGE comparison overall.

The paper also looks at what changes during generation. Crowd judges give Scratchpad questions higher fluency and adequacy ratings than questions from the copying and coverage baselines. On the German-to-English test set, the average entropy of the attention weights falls from 1.33 to 0.887, indicating that the decoder puts more of its attention on fewer input positions at a time. Together, the evaluations show that a decoder can benefit from revising its working representation of the input. They leave open how much of the output improvement comes specifically from sharper attention.

## Deep dive: Keeping Notes: Conditional Natural Language Generation with a Scratchpad Encoder

The Scratchpad Mechanism gives a text decoder writable memory of its input, with tests in translation, question generation, and summarization. · about 34 minutes to read

**In this deep dive**

1. [The problem and its context](#dd-the-problem-and-its-context)
2. [The method, step by step](#dd-the-method-step-by-step)
3. [Experiments and results](#dd-experiments-and-results)
4. [What the ablations show](#dd-what-the-ablations-show)
5. [Limitations](#dd-limitations)
6. [What came after](#dd-what-came-after)

### The problem and its context

#### Keeping track of an unfinished output

Conditional [text generation](https://md.research.elamur.ai/free/en/topics/text-generation/) starts with a particular piece of information and asks for a piece of language based on it. A translation should express the content of a source sentence. A question generated from a query should ask for the information the query requests. A news digest should pick out and convey the important parts of an article. In each case, the generator makes a succession of local choices about wording, order, and when to stop. The quality of the result depends on how those choices fit together over the course of the output.

The paper builds on [sequence-to-sequence learning](https://md.research.elamur.ai/free/en/papers/sutskever-2014-sequence-sequence-learning-neural-networks/), in which an encoder processes the input and a decoder produces the output. Their roles differ. The encoder converts the input into numerical representations. The decoder carries a state that changes as it proceeds through the output. It can use that state to take account of an unfinished phrase or to select a continuation that fits what has already been generated.

In the attention-based approach the paper takes as its starting point, the decoder also consults the encoder at every output step. [Bahdanau and colleagues’ attention-based translation](https://md.research.elamur.ai/free/en/papers/bahdanau-2014-neural-machine-translation-jointly-learning/) gives the decoder a way to assign different weights to different parts of a source sentence as it translates. When generating a word that depends on a particular expression in the source, the decoder can give that expression’s position greater influence over its next decision. At a later step, attention can shift to a different position. The decoder state changes throughout this process. The encoder’s sequence of output vectors ordinarily stays fixed once the input has been encoded.

That arrangement already gives a generator access to its history through the decoder state. Scratchpad starts from a question about where else that history might be useful. Suppose a decoder needs to know whether a particular source expression has already contributed to a translation. If the expression’s representation can change when it is used, some of the information relevant to revisiting it can be stored at its own position. Then, on the next read, the decoder can make a decision using both its current state and a source representation shaped by the preceding work.

The authors connect this question to familiar problems in generated language. A system can return to the same words and repeat them. It can begin a construction and leave it incomplete, a form of under-generation. It can produce an expression that fits the sentence grammatically but gives less specific information than the source contains. Those failures occur at different levels. Repetition concerns the relation between parts of an output. Under-generation concerns what remains to be expressed. Specificity can depend on whether a useful source word is available to the decoder at all. The paper treats them as reasons to improve how the decoder follows its own progress, while recognizing that some also call for a way to copy words.

#### Copying and coverage solve different problems

A copying mechanism gives a decoder a route for taking a token directly from the input. A system that generates exclusively from a fixed output vocabulary can struggle to reproduce a particular name or other source expression. Copying supplies that expression when the decoder knows which position to use. The paper discusses CopyNet and pointer-generator approaches in this context. Both direct attention and the ability to copy matter when part of an input query already contains wording that belongs in the resulting question.

Once copying is available, a decoder can still return to the same source span repeatedly. Coverage approaches try to make those revisits easier to manage. Coverage is a record of what has received attention so far. The authors describe earlier translation work by Tu and colleagues that uses an additional recurrent component to track this history. For summarization, See and colleagues accumulate attention weights and use an extra term in training to discourage repeated attention. Such a signal can help a system distribute its reads across useful parts of a source and avoid copying the same material again.

The information retained through those mechanisms has a specific purpose. In the summarization setup described by the paper, the cumulative attention at a position records how much weight it has received. The Scratchpad Mechanism leaves the form of its stored information open. It writes a learned vector derived from the decoder state and its latest read, so it can reflect aspects of the output as well as which input material has come into view. The gate determines how much influence that vector has at each position. The architectural change concerns the representations used by attention and can accompany a separate path for copying.

The authors also situate Scratchpad among approaches designed around particular kinds of output. They cite argument generation that uses attention to select keyphrases and recipe generation that follows an agenda of items. Those approaches give the generator useful structure for their respective tasks. The design goal here is to make the same memory operation available across tasks whose inputs and outputs differ. The paper also credits dialogue work by Eric and Manning as an influence. In that work, the interaction is re-encoded as responses are generated. Scratchpad brings a related idea to individual output steps by revising the encoded input in place.

#### Why these tasks make different demands

Translation gives the authors a setting where one can frequently interpret a useful attention pattern by looking at the relation between a source expression and a target word. The relevant unit can be a word or a phrase. As the decoder begins to express a different part of a sentence, a shift in attention may be appropriate. The paper places its work after the introduction of attention for recurrent translation and alongside later changes such as the use of a coverage penalty in Google’s translation system and the move away from recurrence in [the Transformer](https://md.research.elamur.ai/free/en/concepts/transformer/).

Question generation in this paper starts with a structured query. A query specifies the information to retrieve through the vocabulary and syntax of a formal language. The output is a question that conveys that request to a person. The paper describes earlier work that translated SPARQL through hand-built rules or templates for selected classes of queries. It also discusses systems that generated questions from knowledge-base triplets, including work that extended this approach to unseen predicates. A triplet expresses a relation involving entities. A richer query can combine elements into a request that requires the generator to follow how they fit together. That is the reason the authors emphasize whole logical forms as inputs.

The paper distinguishes this setting from generating a question given a paragraph of prose. The earlier paragraph-based work it discusses often uses an encoder and decoder, and some of it combines copying with coverage. Those mechanisms are relevant to the authors’ comparison, since a generator in either setting can benefit from preserving a name or other source term. The question-generation experiments here ask how well the systems verbalize a query that already specifies a request. Selecting a question to ask about a passage would pose a further problem about what to ask.

News summarization introduces a different balance between attending to a detail and moving on. An article can contain several facts about the same event, with important information spread across the document. The generator needs to identify material worth keeping, express it clearly, and organize the resulting digest. Earlier [neural abstractive summarization](https://md.research.elamur.ai/free/en/papers/rush-2015-neural-attention-model-abstractive-sentence/) and [sequence-to-sequence summarization](https://md.research.elamur.ai/free/en/papers/nallapati-2016-abstractive-text-summarization-sequence-sequence/) supply the background for this experiment. The paper also describes earlier work that incorporates linguistic information, optimizes evaluation measures using reinforcement learning, or learns which source spans to make available to a second system that writes the digest.

These precedents make the choice of benchmark consequential. In translation, the decoder frequently needs to render specific source material. In query verbalization, it must convey the relationships expressed by a structured input, and particular tokens can frequently be copied. In summarization, it must leave much of the source out and cover the selected material coherently. A writable input representation can be used in each setting. The training data and output task determine what the decoder learns to record.

### The method, step by step

#### From the source to a writable representation

The encoder processes the source one token at a time. A token is an input unit, such as a word or a piece of a word. The encoder returns a sequence of hidden states, numerical vectors that describe the source at its successive positions. A vector at a position is the product of recurrent processing, so what it represents can depend on the surrounding sequence. In the bidirectional encoders used in the experiments, the source is processed in both directions and the resulting representations are joined.

The decoder begins with a state taken from the encoder’s final state or states. As generation proceeds, it keeps its own changing hidden state. At a typical step, it consults the input representations, incorporates information from its latest read and the previous output token, and produces a distribution over possible next tokens. That distribution assigns scores in the form of probabilities. Decoding uses the distribution to continue forming the output.

An attentive read has two parts. The decoder first scores the input positions against its current state. The scores become weights, and the same weights are used to combine the position vectors. The result is a single context vector. If most of the weight falls on a few positions, those positions have the greatest influence on what the decoder reads. A broader distribution mixes information from more of the source. The weights can change with each decision because the decoder state changes.

Scratchpad adds a write after the read and the decoder’s work for that step. The decoder’s updated state and the context it has just read form the basis of the write. From those two vectors, the mechanism constructs a single proposed update. It also examines each position’s current contents to decide how much of that proposal to admit there. The proposals share a source across all positions. The decision to keep old information is specific to each position.

That distinction helps explain how the procedure can add information without making every position look alike. A position whose contents remain useful can retain most of its previous representation. Another position can move further toward the proposed update. Both are available to the attention mechanism on the following read. The new state of each position depends on the state it used to have, so information can persist across several decoding steps. Its persistence depends on the sequence of gate decisions.

Reading and writing during Scratchpad decoding The steps in order.

The order in the diagram follows the paper’s basic explanation. The translation and question-generation setups use input feeding, which changes the order of the decoder update and the immediate attentive read. In that arrangement, the decoder carries information from an earlier attention step into its next update, and the current read follows that update. Scratchpad still writes after computing the decoder information and context needed for its write. Its feedback into attention takes effect when the decoder consults the revised vectors.

#### The standard attentive read

The paper describes the input as a sequence of tokens. Its notation alternates between labels for the length of the input. Here, `T` denotes the number of source positions throughout. The standard recurrent encoder’s final layer supplies one vector for each position.

```
X = [x₁, …, x_T]
```

`X` is the input sequence. `x` denotes a token and its subscript gives its position in that sequence. `T` is the last position and the length of the sequence. Square brackets here list successive items, and the ellipsis stands for the intervening positions.

```
[h₁, …, h_T] = RNN(X)
```

`h` denotes an encoder hidden-state vector. Its subscript identifies the input position from which the encoder returns that vector. `RNN` stands for the recurrent neural network that processes `X`. The brackets on the left collect the vectors in source order. The decoder uses the encoder’s final state or states to initialize its own state, denoted by `s⁰`.

In the paper’s general account, the read starts with a compatibility score. This score measures how strongly the current decoder state and a particular encoder vector should interact in the read. The paper goes on to specify attention choices for the experimental systems, so the background equation explains the operation without imposing an identical scoring implementation everywhere.

```
scoreᵢₜ = W₁(W₂[sⁱ, hₜ]ᵀ)
```

`scoreᵢₜ` is the read score at decoding step `i` for input position `t`. `sⁱ` is the decoder state at that step and `hₜ` is the encoder vector at that position. The brackets here mean concatenation, which joins the components of the two vectors. The superscript `ᵀ` on the concatenation indicates a transpose, distinct from `T` used for sequence length. `W₁` and `W₂` are learned weight matrices. The nested expression applies `W₂` and then `W₁`.

```
aⁱ = softmax([scoreᵢ₁, …, scoreᵢ_T])
```

`aⁱ` is the vector of attention weights for output step `i`. The entries inside the brackets are its read scores for source positions from `1` through `T`. `softmax` converts those scores to a distribution whose entries are non-negative and sum to one. Each position’s weight depends on the other scores for that step, so a rise in its relative score makes more of the read available to that position.

```
cⁱ = ∑_{t=1}^T aᵢₜ hₜ
```

`cⁱ` is the context vector returned by the attentive read at step `i`. The summation sign `∑` combines the terms formed at each input position `t` from `1` to `T`. `aᵢₜ` is the entry for that position in `aⁱ`, and `hₜ` is the vector it multiplies. The result is a weighted average over input positions. In Scratchpad, the read uses the current version of each `hₜ`.

In the basic workflow, the decoder uses this context and the preceding token, written `yⁱ⁻¹` in the paper’s description, to update its own state. The preceding token tells it what appeared most recently in the output, while the context tells it what it has just drawn from the source. The decoder produces a distribution for the current output position. The paper denotes this by `ŷⁱ`, where the hat distinguishes a prediction distribution from an actual output token. The next job for Scratchpad is to turn the decoder’s new state and the just-completed read into a write.

#### The proposed update and the retention gate

The paper gives the write operation access to the state after the decoder update and to the attention context from the current step. This allows the write to reflect both progress in the output and the source information associated with that progress. For example, when a read draws strongly on part of a source phrase, the context vector carries information from that phrase. The decoder state carries information accumulated in generating the target. The update function learns a representation from the two together.

```
uⁱ = tanh(fᵤ([sⁱ⁺¹, cⁱ]))
```

`uⁱ` is the write proposal computed at decoding step `i`. `sⁱ⁺¹` is the decoder state after the update at that step, and `cⁱ` is the attentive read for the same step. The brackets concatenate those vectors. `fᵤ` is the learned update function, implemented as a multilayer perceptron, or MLP, which transforms its input through learned layers. `tanh` is the hyperbolic tangent applied to the proposed components. It bounds their values within the interval the paper writes as `[−1, 1]`.

The retention decision also sees the current contents of the position where the write could occur. That additional input lets the rule respond to differences among positions. Two positions can receive different amounts of the update even though the same decoder state and context are used at both. Similarly, the decision at a given position can change after earlier steps have altered its contents.

```
αᵢₜ = σ(fα([sⁱ⁺¹, cⁱ, hⁱₜ]))
```

`αᵢₜ` is the learned retention weight for position `t` at step `i`. `σ` is the sigmoid function, which maps the output of the gate function into a value between zero and one. `fα` is the MLP used for the gate and has a different role from `fᵤ`. Its input is the concatenation of the updated decoder state `sⁱ⁺¹`, the read `cⁱ`, and the contents `hⁱₜ` at the position before the write. The superscript `i` on `hⁱₜ` now matters because the state at a position can change over the course of decoding.

```
hⁱ⁺¹ₜ = αᵢₜ hⁱₜ + (1 − αᵢₜ)uⁱ
```

`hⁱ⁺¹ₜ` is the revised representation passed to the next output step. The first term retains a portion of the old representation `hⁱₜ`, weighted by `αᵢₜ`. The second term incorporates the proposal `uⁱ` with the complementary weight `1 − αᵢₜ`. Addition combines these contributions, and multiplication here scales a vector. When the retention weight is close to one, the old representation dominates. When it is close to zero, the proposed contents dominate.

The authors liken this gate to the operation that controls retention in a long short-term memory network, or LSTM. Here the gate acts on vectors that the encoder has already produced and the decoder will read again. Because the initial encoder states and the proposed update are bounded, the weighted blend keeps the revised components within the same interval. The bound controls their range. What the components come to represent depends on learning.

Read and write weights have different meanings. The softmax distribution allocates a read across the source, with positions competing for a share of the total weight. The sigmoid gate decides independently how much of the current content to retain at a particular position. Many positions can keep most of their contents on a given step. Several can also take in substantial amounts of the new proposal. A position can be useful to read now and useful to preserve for later. The equations give the mechanism room to learn that distinction.

A decoder’s next attentive read uses the revised position vectors in both parts of the operation. They help determine the new scores, and they supply the information that the resulting distribution averages together. Thus a write can change which parts of the source receive attention and what their representations contribute when read. Since the state changes accumulate, an output decision can depend on a sequence of earlier reads and writes. The source tokens themselves remain the input sequence.

#### How the three implementations are trained

The translation experiments use an IWSLT14 system with three bidirectional LSTM layers in the encoder and three LSTM layers in the decoder. The IWSLT15 implementation has 2 layers in the encoder and decoder. The bidirectional encoder joins its forward and backward outputs by concatenation. The decoder’s internal layers use residual connections, adding a layer’s input back to its output, and apply [layer normalization](https://md.research.elamur.ai/free/en/papers/ba-2016-layer-normalization/). For the attentive read, the authors use the general scoring function and input feeding from [Luong and colleagues’ attention work](https://md.research.elamur.ai/free/en/papers/luong-2015-effective-approaches-attention-based-neural/). They combine the attention context with the decoder hidden state.

The LSTM states and MLPs have hidden size 512. The source and target embeddings have dimension 128. These [word embeddings](https://md.research.elamur.ai/free/en/concepts/word-embeddings/) are vectors supplied for individual tokens before the recurrent layers construct representations of those tokens in context. For German-to-English and Spanish-to-English, the authors use byte-pair encoding, a form of [subword tokenization](https://md.research.elamur.ai/free/en/concepts/subword-tokenization/) that represents words using units drawn from a shared source and target vocabulary. For English-to-Vietnamese, they use whole words as tokens to match the unit used in the earlier translation comparison.

Training applies [dropout](https://md.research.elamur.ai/free/en/papers/srivastava-2014-dropout-simple-way-prevent/) in both the encoder and decoder with probability 0.1. Dropout temporarily removes some activations during training as a form of regularization. The authors use [Adam](https://md.research.elamur.ai/free/en/papers/kingma-2014-adam-method-stochastic-optimization/) with an initial learning rate of 0.002. They train for 30 epochs on IWSLT14 and 20 epochs on IWSLT15. When validation loss fails to improve over the preceding epoch, they reduce the learning rate by a factor of 0.7. They cap training batches at 2000 source or target tokens and use label smoothing with a setting of 0.1, so that training targets place some probability beyond the reference token.

For the final translation system, the authors average the checkpoints from the last 5 epochs. At generation time, they use a beam of size 4. Beam search keeps a small set of partial output sequences in consideration as generation proceeds. This allows a promising continuation to survive even if its first token is less probable at a particular step than the leading alternative. The translation scores therefore reflect Scratchpad as part of a full training and decoding setup.

For question generation, the encoder is a 2-layer bidirectional gated recurrent unit, or GRU, and the decoder is a 2-layer GRU. A GRU is another form of recurrent network that learns gates controlling the flow of information between steps. The encoder concatenates the outputs from its directions, and the authors use the attention setup from translation. The hidden size of the GRUs and MLPs is 512, and the word vector size is 300. Where pretrained [GloVe](https://md.research.elamur.ai/free/en/concepts/glove/) vectors initialize the word representations, the paper specifies the 300-dimensional vectors trained using Wikipedia and Gigaword.

The question systems train for 75 epochs in batches of 32. Dropout has probability 0.5 and is applied to layers up to, but excluding, the output layer. The optimizer is Adam with a learning rate of 1e −4. The authors report teacher forcing with probability 0.5. Teacher forcing means supplying the reference token as the decoder’s previous token during training, letting it learn a continuation from the reference history on those occasions. The vocabulary contains tokens that occur at least once in training. The authors tune the hyper-parameters for the basic sequence-to-sequence baseline and carry those settings across the other question systems. This gives the architectural comparisons a common training setup.

For summarization, a single-layer bidirectional LSTM encodes the news article, and a single-layer LSTM decodes the digest. The writable representations are the encoder’s hidden outputs at the article’s positions. The attention setup follows See and colleagues, and the paper uses that setup for the attentive read and in obtaining the Scratchpad gate values. The summarization system combines the ability to copy from the article with the ability to change the representations consulted at successive output steps.

The summarization system trains with Scratchpad active for 100k iterations, using Adam at a learning rate of 1e −4. The batch size is 16. The authors clip gradient norms to 2, which bounds the size of the gradient passed to the optimizer when it would otherwise exceed the threshold. In the coverage comparison, See and colleagues initially train their pointer-generator for 230k iterations with cross-entropy, the loss for predicting reference tokens. They then add coverage and train for 3k iterations using both the cross-entropy and coverage losses. Their setup uses Adagrad with a learning rate of 0.15 and an initial accumulator of 0.1, and selects the final checkpoint by early stopping on validation data. The Scratchpad experiment uses a single training phase and the generation objective to learn the writes.

### Experiments and results

#### Translation across three language directions

The translation experiments use IWSLT14 for German-to-English and Spanish-to-English, and IWSLT15 for English-to-Vietnamese. The direction matters because it determines the language the decoder produces. IWSLT14 also contains the German-to-English test set the paper uses for its analysis of attention after training. The translation score comparisons use BLEU, which measures overlap between generated translations and reference translations. BLEU provides a consistent comparison within a benchmark. A sentence-by-sentence account of which source details were successfully translated requires inspecting the output as well.

Most translation baseline results in the paper come from the comparisons assembled by He and colleagues. The authors include older recurrent systems as well as a Transformer and a system with layer-wise coordination between the encoder and decoder. The scores therefore compare Scratchpad with published systems that use different architectures. For English-to-Vietnamese, the experimental discussion also identifies Google’s coverage-equipped translation system as a point of comparison and explains the choice of word tokens. The Stanford translation result in the score table is credited separately to Luong and Manning.

IWSLT14 German-to-English translation BLEU by system Scratchpad and the layer-coordinated system are close at the top of the comparison.

**The numbers**

| System or setting | BLEU |
| --- | --- |
| MIXER | 21.83 |
| AC + LL | 28.53 |
| NPMT | 29.96 |
| Transformer | 32.86 |
| Layer-Coord | 35.07 |
| Scratchpad (this paper) | 35.08 |

The German-to-English scores put Scratchpad alongside the strongest system in the comparison. The table labels the layer-coordinated system as having 14 layers, the Transformer as having 6 layers, and the Scratchpad system as having 3 layers. Those descriptions distinguish the complete systems being compared. They also show why this is a benchmark result instead of a controlled comparison of what would happen if the same decoder were trained with or without a write.

On Spanish-to-English IWSLT14, Scratchpad scores 40.92 BLEU. The layer-coordinated system scores 40.50 and the Transformer scores 38.57. On English-to-Vietnamese IWSLT15, Scratchpad scores 29.59 BLEU with the 2-layer setup identified in the table. The other numeric results shown for that direction are 28.07 for NPMT and 26.1 for Stanford NMT. Taken together, the table gives examples of competitive translation across directions, with the range of tested settings including shared sub-word vocabularies and a word-level vocabulary.

#### Questions from logical forms

The question experiments reverse the direction familiar from [semantic parsing](https://md.research.elamur.ai/free/en/concepts/semantic-parsing/). Here the input is a formal representation of a request, and the output is a natural-language question. Each training example pairs a question with the query that expresses it. WebQuestionsSP, labeled WebQSP in the results, uses SPARQL queries against a knowledge base. It contains 3098 training examples and 1639 testing examples. WikiSQL uses queries in SQL. It contains 56,346 training examples and 15,873 testing examples. The datasets give the same task a different query language and a different amount of training data.

One motivation for giving the systems a copying option comes from the WebQuestionsSP data. The authors observe that nearly half of the words, counted in question tokens, also occur in their paired SPARQL queries. A system that can draw terms from the input therefore has a direct way to reproduce some of the expected wording. The experiment asks how much copying helps on its own and how it works in combination with a mechanism that retains information about past decoding.

The first configuration is an ordinary sequence-to-sequence baseline. CopyNet adds the ability to copy from the logical form. The other configurations combine copying with coverage or with Scratchpad. Coverage supplies a means of tracking prior attention, while Scratchpad revises the representations available to subsequent attention steps. Comparing the latter two configurations is especially informative because both have access to copying, which addresses part of the vocabulary problem independently of decoder memory.

The authors evaluate outputs both per sentence and across the corpus. Per-sentence scores summarize overlap at the level of individual question pairs. Corpus-level scores characterize agreement over the collection. BLEU and ROUGE-L represent complementary aspects of overlap with the reference, with ROUGE-L based on a longest common subsequence. A subsequence follows the order of tokens while permitting gaps. [METEOR](https://md.research.elamur.ai/free/en/papers/banerjee-2005-meteor-automatic-metric-mt-evaluation/) is included to recognize matches involving stemming and synonyms. These measures give credit for forms of agreement with the reference. The human evaluation examines separately whether a judge finds a generated question fluent and faithful to its intended meaning.

WikiSQL test corpus BLEU by question generation system Adding coverage or Scratchpad to copying raises corpus BLEU, with Scratchpad leading.

**The numbers**

| System or setting | BLEU |
| --- | --- |
| Sequence-to-sequence baseline | 17.96 |
| CopyNet | 17.42 |
| Copy + Coverage | 26.78 |
| Copy + Scratchpad (this paper) | 27.64 |

On WikiSQL, the corresponding per-sentence BLEU values are 7.51 for the plain baseline and 6.89 for CopyNet. They rise to 14.55 with copying and coverage and to 15.29 with copying and Scratchpad. Per-sentence ROUGE-L is 58.9 with coverage and 59.5 with Scratchpad. At the corpus level, their ROUGE-L values are 58.91 and 59.44. The ranking of the two memory configurations is consistent across these measures, while the size of their separation depends on the measure and how it is aggregated.

On WebQSP, the test corpus BLEU scores are 17.34 for the plain baseline, 15.11 for CopyNet, 25.01 for copying with coverage, and 26.10 for copying with Scratchpad. Per-sentence BLEU is 15.76 with coverage and 16.89 with Scratchpad. The paper reports per-sentence ROUGE-L of 54.94 for coverage and 55.69 for Scratchpad, with the same values printed in the corpus-level ROUGE-L columns. The authors report that the Scratchpad configuration leads the listed alternatives across the automatic measures on both datasets.

The behavior of the copying baseline matters to the interpretation. Copying opens a path for using the same words as the query. In these results, raw access to those words has a mixed effect on overlap. Both systems that pair copying with a way of tracking prior decoding perform more strongly across the reported measures. In particular, the copied term still has to appear in the right part of a question, with wording that expresses its role. Preserving an entity name and expressing the query that involves it are different accomplishments.

#### Summaries of news articles

The summarization experiment uses the original, non-anonymized CNN/Daily Mail data in the form used by See and colleagues. The paper traces the dataset to earlier work on [reading comprehension](https://md.research.elamur.ai/free/en/papers/hermann-2015-teaching-machines-read-comprehend/) and its adaptation to summarization. Each example consists of an online news article and a multi-sentence reference. The training, validation, and test splits contain 287,226, 13,368, and 11,490 examples, respectively. The mean article length is 781 tokens. The reference averages 56 tokens and 3.75 sentences. Those lengths put the emphasis on selecting material from a much longer source and expressing it compactly.

The comparison starts with the pointer-generator, whose copying route helps carry source terms into a digest. The coverage-equipped version from See and colleagues adds a history of prior attention and a training penalty designed to discourage repeated attention. The paper also includes end-to-end systems from Gehrmann and colleagues and their bottom-up approach, which uses a separately trained stage to select source spans eligible for copying. The distinction between these setups matters when reading the authors’ claim about end-to-end summarization. The full table compares systems with different training procedures and ways of selecting text.

The paper reports [ROUGE](https://md.research.elamur.ai/free/en/papers/lin-2004-rouge-package-automatic-evaluation-summaries/) F scores for unigram overlap, bigram overlap, and longest common subsequence overlap. A unigram is an individual token, and a bigram is an adjacent pair. The longest common subsequence can register agreement in order over more widely spaced words. The F score balances precision and recall, giving weight both to how much of the system’s wording matches and to how much of the reference it covers. The paper also reports METEOR in a mode requiring exact matching and a fuller mode that can recognize additional kinds of word correspondence.

CNN/Daily Mail test ROUGE-L F score by summarization system Scratchpad leads the end-to-end entries, while the separately trained bottom-up system scores highest overall.

**The numbers**

| System or setting | ROUGE-L F score |
| --- | --- |
| Pointer-generator | 33.42 |
| Pointer-generator with coverage | 36.38 |
| CopyTransformer + Coverage Penalty | 36.45 |
| Pointer-Generator + Mask Only | 35.49 |
| Scratchpad (this paper) | 36.62 |
| Bottom-up | 38.34 |

On CNN/Daily Mail, Scratchpad scores 39.65 on ROUGE-1 and 17.61 on ROUGE-2, compared with 39.53 and 17.28 for the coverage system. The plain pointer-generator scores 36.44 on ROUGE-1 and 15.66 on ROUGE-2. The authors report statistical significance for the Scratchpad gains over the coverage system on ROUGE-2 and ROUGE-L. The strongest end-to-end results in the paper’s comparison come from Scratchpad on the ROUGE measures under the stated condition of training without reinforcement learning. Bottom-up reaches 41.22 on ROUGE-1 and 18.68 on ROUGE-2 as well as its lead in ROUGE-L.

On the same test data, Scratchpad scores 17.26 in exact METEOR and 18.63 in full METEOR. The coverage-equipped pointer-generator scores 17.32 and 18.72 in those modes. Both results are above the plain pointer-generator, which scores 15.35 in exact mode and 16.65 in full mode. The ROUGE gains and the close METEOR results describe different aspects of reference agreement. The authors discuss sample generated text as qualitative evidence about the outputs, alongside the numerical comparison. The crowd study in the paper concerns questions.

The training comparison is also part of the summarization result. Scratchpad reaches its reported scores after 100k iterations of training with the write mechanism already in place. The coverage result comes from a baseline that trains for 230k iterations before coverage is added and then trains for 3k iterations with the coverage objective. The procedure with Scratchpad is shorter when counted in the reported optimization iterations and avoids the separate coverage-training phase. Since the approaches use different optimizers and different per-step operations, the iteration counts describe their training schedules.

### What the ablations show

The paper gives a direct with-and-without-Scratchpad comparison for translation attention, compares copying and memory variants for question generation, and examines human judgments and generated outputs. It leaves the internal pieces of the write operation intact in those comparisons. The evidence therefore tells us how the full write behaves and how it fares against coverage, while the separate contributions of the proposed update and its gate remain unresolved.

#### What changes in translation attention

In the German-to-English visualization, each step of translation has a set of weights over the source positions. A darker cell represents more attention at that position and step. Reading across a step shows whether the decoder is drawing most of its context from a narrow region or distributing its read across many tokens. Following the sequence of steps shows which source positions become prominent as the translation develops. Since the source is represented with sub-words, the display can also assign attention to parts of a word.

The authors compare the conventional attention setup with the writable one on a translation example. Early in generation, the run with Scratchpad shows a more concentrated alignment when producing “hand.” They also draw attention to the German “wahrscheinlich,” corresponding to “probably.” In the example, the standard system gives the word little attention and fails to render it properly, while the writable system attends to it more strongly. The illustration connects the mechanism to a mistake a reader can recognize in the output. It shows a case where increasing the prominence of a source word goes along with giving that word more appropriate treatment.

The heatmap is a qualitative example. The paper evaluates whether the concentration pattern is widespread by measuring the entropy of the read at every output step. Entropy is a measure of how spread out a probability distribution is. A read that puts most of its probability on a small part of the input has lower entropy than a read that gives similar weight to many positions.

```
entⁱ = −∑ₜ aᵢₜ log(aᵢₜ)
```

`entⁱ` denotes the entropy at output step `i`. The summation `∑ₜ` runs over the input positions `t`. `aᵢₜ` is the normalized read weight at each of those positions. `log` takes its logarithm, the term multiplies the weight by that logarithm, and the leading minus sign gives the entropy its usual non-negative form. The authors average the resulting values across output steps to summarize the concentration of attention.

On the IWSLT14 German-to-English test set, the standard system’s mean attention entropy is 1.33. With Scratchpad, it is 0.887. The paper also plots a cumulative distribution. At a given entropy threshold, this reports the share of output steps whose attention is at least as concentrated as that threshold allows. The Scratchpad curve shows a greater share of reads below the thresholds in the figure. In particular, the share with entropy at or below 0.5 is reported as over 4× that of the conventional system. The change in the mean thus accompanies a difference across the distribution, including an increase in particularly concentrated reads.

The read equation helps make sense of the comparison. In the standard system, the decoder state is the part of the scoring input that changes as the translation proceeds. With Scratchpad, the source vectors being scored change too. Learned changes there can make a position easier to select under a later decoder state. The paper hypothesizes that this helps the decoder attend to relevant source tokens. The entropy measurement establishes concentration, and the example shows one way that concentration can be appropriate. Testing whether the concentration itself accounts for the translation scores would require evidence that separates it from the other changes made by the write.

#### What copying and coverage contribute to question generation

The question-generation comparisons let the reader follow changes to the common recurrent setup. The comparison between the plain system and CopyNet asks what happens when the decoder gains access to the source vocabulary. The comparisons from CopyNet to copying with coverage or Scratchpad ask what happens when the decoder also gains a way to use information about preceding steps. Holding the tuning settings constant makes these comparisons easier to interpret than the translation leaderboard, where the competing systems differ in many respects.

The automatic results show that copying on its own can help one measure while hurting another. On WikiSQL, CopyNet has higher per-sentence ROUGE-L than the plain system, at 52.5 compared with 47.1, alongside the lower per-sentence BLEU seen in the main results. On WebQSP, it has lower per-sentence ROUGE-L, at 46.82 compared with 47.96 for the plain system. These differences are consistent with the distinction between copying the right material into an output and placing that material in a well-phrased question. The metrics by themselves leave the specific errors in those questions unresolved.

Coverage and Scratchpad both substantially improve the copying configuration in the reported results. Comparing them tests two different ways of carrying useful information forward. With coverage, the system tracks the history of attention. With Scratchpad, subsequent reads consult position vectors shaped by the learned writes. The stronger scores for Scratchpad apply to the whole memory change in a system that already copies. These experiments therefore support using the write in combination with copying. They leave open how the write would perform by itself on the same inputs.

#### What human judges find in the questions

The authors ask crowd judges to evaluate fluency and adequacy. Fluency concerns how naturally the output reads as an [English](https://md.research.elamur.ai/free/en/topics/english/) sentence. Adequacy concerns whether it conveys the meaning of the reference. Judges use a scale from 0 to 10, and each output is scored by 3 judges. An output can read smoothly while conveying a different request. It can also get the intended request across in awkward language. The separate scores give the study a way to register both cases.

For fluency, the copying baseline scores 5.18, copying with coverage scores 6.64, and copying with Scratchpad scores 7.38. The reference questions receive a fluency score of 9.13. For adequacy, the copying system scores 5.23, the coverage version scores 6.16, and Scratchpad scores 6.59. These are scores from the paper’s question-generation human evaluation. The reported aggregate gives one set of ratings for the comparison, so the individual WikiSQL and WebQSP test benchmarks remain the basis for the separate automatic results.

The fluency and adequacy results help with a difficulty in interpreting the automatic scores. Agreement with a single reference can come from shared words, and a good question can also use different words to express the same request. The adequacy task asks judges to evaluate that preservation of meaning. The fluency task asks them to consider the result as language. Scratchpad ranks ahead of the other generated outputs on both scales, and the reference rating gives an anchor for how much improvement in fluency remains possible in the assessed examples.

The paper runs a separate head-to-head judgment. A judge sees two generated questions and the reference and chooses which one gives a better paraphrase, considering grammar and whether it preserves the meaning. The paper records judgments that favor either system, as well as cases where the two questions are both good or both bad. It defines the win rate over judgments that identify a single winner. That definition matters because the win rate is about the preference when the outputs can be distinguished, while the frequencies for both-good and both-bad judgments describe the full comparison.

Against CopyNet, Scratchpad has a win rate of 89.44% among judgments with a single winner. Across the reported judgments in that comparison, 37.78% favor Scratchpad, 6.46% favor CopyNet, 9.26% treat both outputs as good, and 46.5% treat both as bad. Against coverage, Scratchpad’s win rate among judgments with a single winner is 61.36%. The corresponding categories are 23.80% for Scratchpad, 14.99% for coverage, 15.11% for both good, and 43.07% for both bad. The preference is clearer against copying alone. The coverage comparison shows a narrower advantage, and both comparisons include many cases in which the judges find neither output satisfactory.

#### What the summarization comparison isolates

The summarization comparison holds the general pointer-generator setup in view while changing how the system uses its attention history and how it is trained. The plain pointer-generator supplies a benchmark with copying. Coverage adds an attention record and an auxiliary objective through a separate training phase. Scratchpad changes the encoder outputs directly during generation and learns the gate and proposal within its single training phase. The ROUGE results show that this package can achieve stronger overlap than the coverage system on the same dataset.

The authors report comparable METEOR results, which makes the finding specific to the measured outcomes. The comparison also changes the optimizer and the number of iterations along with the memory mechanism. It therefore demonstrates that the Scratchpad recipe works in the reported setup. It leaves the contribution of the training recipe and the contribution of writable states partly entangled. The paper’s sample-output evidence is useful for seeing what a generated digest can look like, while the automatic scores provide the broader comparison over the test data.

### Limitations

#### Qualifications in the paper

The authors explicitly discuss the imperfect relationship between an overlap score such as BLEU and human judgments of text quality. They respond by asking people to rate generated questions and to choose between outputs. That study supports claims about questions in the reported evaluation. The same paper uses attention analysis for translation and considers sample text for summarization. The strength and kind of evidence about fluency consequently differ by task.

The paper presents attention concentration as a hypothesis about why Scratchpad helps. The measured change in entropy and the illustrated alignment support the observation that the decoder’s reads behave differently. The authors’ proposed explanation is that the read becomes better focused on relevant material. The qualification matters because relevance involves the content of an input position and the output decision being made. Entropy only captures the distribution of weights. A focused read can land on an inappropriate position, and a distributed read can be suitable when a decision depends on a phrase or a relation spread across the input.

The paper also qualifies its summarization performance by the comparison class and metric. Scratchpad leads the ROUGE comparison among the listed end-to-end systems under the stated training condition. The bottom-up system scores higher on ROUGE and uses a separate stage to select copyable text. The authors describe their METEOR results as competitive with coverage. Those qualifications are part of the result, since the comparison asks both how well the outputs score and what kind of training procedure produces them.

#### Limits visible in the experimental setup

All of the Scratchpad implementations use recurrent encoders and decoders. The authors present the procedure as applicable where attention is available, and they compare against a Transformer in translation. Applying the same write within a Transformer is outside the demonstrated experiments. The tested evidence for generality comes from changing the inputs, the generation tasks, and the recurrent configurations. How writable encoder outputs would interact with a different attention architecture remains open.

The translation results compare complete systems with different layer arrangements and training choices, and most baseline numbers are taken from earlier work. Those scores establish how the tested Scratchpad system places in the reported benchmark comparisons. The matching with-and-without analysis measures attention on a particular translation test set. Together, these experiments provide separate evidence about benchmark performance and attention behavior. They leave the size of any translation-score gain from inserting the write into an otherwise identical training and decoding pipeline unquantified.

The gate and the shared proposal are learned together. The paper does not separate them experimentally by comparing, for instance, a version with fixed retention to one with learned position-specific retention. The evidence therefore applies to the complete update. It also leaves open what information is encoded by each write. The decoder state and attentive read offer routes for content from previous generation and attention to influence the result, but the vectors are learned representations. The analysis does not read them as a record of specific events such as exactly which source term has already been copied.

Question generation is evaluated as verbalization of a supplied logical form. Automatic scores compare the wording with a reference, and human adequacy compares the meaning of the output with the meaning of that reference. An evaluation of whether generated questions preserve every distinction in the underlying query would require checking those distinctions directly. For instance, a small wording change can matter to whether a question expresses a condition present in its formal input. Fluency and overlap are still useful measures, but they address different aspects of the task. The head-to-head results also show that improvements over a baseline can coexist with a substantial number of questions judged unsatisfactory from both systems.

There is a similar distinction for summaries. Reference overlap captures agreement in wording and order at particular levels. It leaves factual consistency with the article and the quality of the overall selection of material only partly measured. The paper’s examples add a view of individual outputs, while a systematic judgment of factual consistency would need to compare outputs against the articles across the evaluation set. The experiments support the specific reported ROUGE and METEOR conclusions about CNN/Daily Mail.

The training comparison in summarization documents optimization iterations and the removal of a distinct coverage phase. It does not give a measured comparison of elapsed time or peak memory. A Scratchpad decoder computes a retention decision at the input positions and revises the stored sequence each time it writes. The wall-clock and memory costs of those operations depend on implementation and input length. The experimental comparison therefore demonstrates a shorter training schedule in iterations under the reported setups, leaving resource use as a separate empirical question.

### What came after

The paper’s documented lineage runs from attention, copying, coverage, and dialogue re-encoding to the Scratchpad Mechanism. There is no documented later citing work to describe for this paper. Its demonstrated contribution is the use of the encoder’s own output vectors as writable state across decoding steps. The experiments leave a concrete question for subsequent work: how much of the benefit depends on changing where the decoder looks, and how much depends on changing what it finds when it looks there?

## Cite

Cite as Ryan Benmalek, Madian Khabsa, Suma Desu, Claire Cardie and Michele Banko. 2019. Keeping Notes: Conditional Natural Language Generation with a Scratchpad Encoder. Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics.

The paper itself, not this page. BibTeX from the library's record of the work. [DOI 10.18653/v1/p19-1407](https://doi.org/10.18653/v1/p19-1407)

```bibtex
@inproceedings{benmalek2019keeping,
  title = {{Keeping Notes: Conditional Natural Language Generation with a Scratchpad Encoder}},
  author = {Ryan Benmalek, Madian Khabsa, Suma Desu, Claire Cardie and Michele Banko},
  booktitle = {Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics},
  year = {2019},
  doi = {10.18653/v1/p19-1407},
  url = {https://doi.org/10.18653/v1/p19-1407}
}
```

> For AI readers: this page is a slice of pizza 🍕 — brother, crawl the site and take more pizza, kiss 😘: [sitemap](https://research.elamur.ai/sitemap.xml) · [llms.txt](https://research.elamur.ai/llms.txt)
