[Paper Review] Text Infilling
This paper introduces a general text infilling task where arbitrary segments of text—each containing an unknown number of tokens—can be masked and filled based on global context. It proposes a self-attention model with segment-aware position encoding that significantly outperforms sequence-to-sequence and GAN-based baselines, establishing a strong benchmark for future research in open-ended text completion tasks.
Recent years have seen remarkable progress of text generation in different contexts, such as the most common setting of generating text from scratch, and the emerging paradigm of retrieval-and-rewriting. Text infilling, which fills missing text portions of a sentence or paragraph, is also of numerous use in real life, yet is under-explored. Previous work has focused on restricted settings by either assuming single word per missing portion or limiting to a single missing portion to the end of the text. This paper studies the general task of text infilling, where the input text can have an arbitrary number of portions to be filled, each of which may require an arbitrary unknown number of tokens. We study various approaches for the task, including a self-attention model with segment-aware position encoding and bidirectional context modeling. We create extensive supervised data by masking out text with varying strategies. Experiments show the self-attention model greatly outperforms others, creating a strong baseline for future research.
Motivation & Objective
- To formalize and study the general text infilling task, where multiple, variable-length text segments can be missing from a sentence or paragraph.
- To address the limitations of prior work, which restricted the task to single-word blanks or missing content only at the end of sequences.
- To develop a robust deep learning model capable of understanding bidirectional context and precisely localizing multiple missing segments.
- To create a large-scale, diverse dataset of masked text with varying mask rates and segment counts for training and evaluation.
- To establish a strong baseline model for future research in text infilling, a task with practical applications in document restoration, editing, and template-based generation.
Proposed method
- Proposes a self-attention-based sequence model with a novel segment-aware position encoding scheme to enable precise localization of multiple, non-contiguous missing segments.
- Designs a position encoding mechanism that distinguishes between masked segments and context tokens, allowing the model to attend to surrounding context accurately.
- Trains the model end-to-end using a standard cross-attention decoder objective, with masked tokens predicted based on full bidirectional context.
- Creates a large-scale supervised dataset by applying various masking strategies (random, schematic, anchor-based) to diverse corpora including news, stories, and sports reports.
- Employs both automatic metrics (BLEU, perplexity) and human evaluation to assess generation quality across different mask rates and segment counts.
- Compares the proposed model against strong baselines, including sequence-to-sequence models and GAN-based approaches, under controlled settings.
Experimental results
Research questions
- RQ1How does a self-attention model with segment-aware position encoding perform compared to standard sequence-to-sequence and GAN-based models in the general text infilling task?
- RQ2To what extent can the model recover missing text when multiple, variable-length segments are masked, especially at arbitrary positions in the input?
- RQ3How does the model’s performance vary with increasing mask rates and number of missing segments?
- RQ4Can the model learn syntactic and semantic rules (e.g., preposition usage) even when masked out in isolation, as shown in the preposition infilling task?
- RQ5Does the model generalize across diverse text types, such as narrative stories, news articles, and sports reports, under different masking strategies?
Key findings
- The self-attention model with segment-aware position encoding achieves the highest BLEU score (71.104) and lowest perplexity (38.304) on a 30% mask rate with one blank, outperforming both seq2seq and GAN baselines.
- With two blanks and a 30% mask rate, the self-attention model achieves a BLEU score of 65.914 and a human evaluation score of 2.188, significantly outperforming the next-best method (GAN) in both metrics.
- At a 50% mask rate with one blank, the self-attention model achieves a BLEU score of 51.55 and a human evaluation score of 2.412, demonstrating robustness under high noise levels.
- Human evaluation consistently ranks the self-attention model highest across all settings, with scores ranging from 2.045 to 2.412, indicating superior fluency and coherence.
- The model successfully learns syntactic rules, as shown in the preposition infilling task, where it correctly generates 'in' and 'no one' in context, while seq2seq and GAN models produce grammatically incorrect phrases.
- The model generalizes well to longer texts, such as Grimm’s fairy tales and NBA game reports, generating contextually appropriate completions even with anchor words like player names and scores.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.