Insertion-Deletion Transformer

Laura Ruis, Mitchell Stern, Julia Proskurnia, William ChanarXiv 2020

Abstract

We propose the Insertion-Deletion Transformer, a novel transformer-based neural architecture and training method for sequence generation. The model consists of two phases that are executed iteratively, 1) an insertion phase and 2) a deletion phase. The insertion phase parameterizes a distribution of insertions on the current output hypothesis, while the deletion phase parameterizes a distribution of deletions over the current output hypothesis. The training method is a principled and simple algorithm, where the deletion model obtains its signal directly on-policy from the insertion model output. We demonstrate the effectiveness of our Insertion-Deletion Transformer on synthetic translation tasks, obtaining significant BLEU score improvement over an insertion-only model.

Introduction

Most standard neural sequence models, such as those used in machine translation, are autoregressive: they generate text one token at a time in a strict left-to-right order. While effective, this approach is inherently slow and inflexible. Recently, "insertion-based" models have emerged to allow for parallel generation and arbitrary ordering. However, these models suffer from a significant drawback: if an error is made during an early insertion, the model has no mechanism to correct it, leading to error propagation.

The Insertion-Deletion Transformer addresses this lack of "editability" by introducing a dedicated deletion phase. This creates a more robust, iterative framework for sequence generation, effectively giving the neural network an "undo" button.

Methods

The proposed framework consists of two stacked Transformer decoders that execute in two distinct phases:

  1. The Insertion Phase: Based on the existing Insertion Transformer, this phase predicts which tokens to add and their specific positions within the current sequence.
  2. The Deletion Phase: This phase evaluates the updated sequence and predicts a probability distribution over which tokens should be removed.
Overview of the Insertion-Deletion Transformer architecture and its two-phase iterative process.

Key Innovations

  • On-Policy Training: Unlike models that rely on complex "expert policies," the deletion model learns directly from the insertion model's output. By observing the actual mistakes made by the insertion model, it learns specifically how to correct them.
  • Adversarial Sampling: To maintain the deletion model's utility as the insertion model improves, the authors occasionally mask ground-truth tokens during training. This forces the insertion model to make predictions, providing a continuous training signal for the deletion model.
  • Structural Simplicity: The model utilizes a straightforward two-stage process without requiring explicit predictions for the number of tokens to be inserted, simplifying the architecture compared to concurrent models like the Levenshtein Transformer.

Experimental Setup

The model was evaluated on two synthetic, character-based translation tasks designed to test sequence manipulation logic:

  • Shifted Alphabetic Sequences: Translating a sequence of consecutive letters to another sequence shifted by a fixed amount (e.g., c d e f g → m n o p q).
  • Caesar’s Cipher: A more complex task where input letters are randomly sampled, requiring the model to learn a specific encryption mapping.

Results

The addition of the deletion phase provided a significant boost in accuracy across both tasks. In the Alphabetic Shifting task, the Insertion-Deletion Transformer achieved a BLEU score of 91.49, a substantial improvement over the 70.15 achieved by the insertion-only baseline (KERMIT). For Caesar’s Cipher, the BLEU score improved from 35.55 to 37.57.

Example of the model performing insertions and a corrective deletion on an alphabetic sequence task.

The example above illustrates the model's ability to refine its output. During the insertion phase, an extra 'u' is predicted. The deletion model identifies this redundancy and removes it, resulting in the correct final output.

Discussion and Future Work

The results demonstrate that the ability to "undo" and refine is a significant architectural advantage, even on relatively simple tasks. By allowing the model to refine its output through multiple passes, it can converge on a better final result. Furthermore, because the model can insert multiple tokens simultaneously across different locations, it can theoretically generate a sequence of length $n$ in $O(\log n)$ iterations, offering a potential speedup over traditional $O(n)$ autoregressive models.

While these synthetic datasets provide a strong proof of concept, future work will focus on scaling this on-policy training to large-scale, real-world tasks such as machine translation and document summarization. Additionally, the model's iterative nature makes it a promising candidate for text editing tasks like paraphrasing or style transfer.

Summary updated

BibTeX
@misc{ruis2020insertion,
  author = {Laura Ruis and Mitchell Stern and Julia Proskurnia and William Chan},
  title = {{Insertion-Deletion Transformer}},
  year = {2020},
  eprint = {2001.05540},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2001.05540},
}
Figure