Abstract
Blank Language Models (BLM) represent a significant shift from traditional autoregressive text generation. By treating sentences as dynamic canvases where blanks can be iteratively expanded, BLM provides a flexible framework for text infilling, editing, and restoration. This model architecture allows for fine-grained control over generation without requiring prior knowledge of the number of missing tokens, outperforming existing masked and insertion-based models in both fluency and accuracy.
Introduction
Traditional neural language models typically operate in a strict left-to-right fashion. While highly effective for predicting the next word in a sequence, these models struggle with text infilling—the task of filling in gaps within an existing sentence. Existing solutions often rely on Masked Language Models (like BERT), which usually require a fixed number of mask tokens, or complex inference algorithms that attempt to force left-to-right models to fit specific gaps. These approaches are often computationally expensive or result in non-fluent text.
To address these challenges, researchers from MIT CSAIL introduced Blank Language Models (BLM). BLM is designed to handle an unknown number of missing tokens while maintaining global fluency by considering context both before and after a gap.
The BLM Framework
The fundamental innovation of BLM is its "canvas" approach. Rather than a static sequence, the model treats a sentence as a collection of words and special "blank" symbols (_). The generation process is governed by a specific grammar where the model performs a three-part action at each step.
As illustrated in Figure 1, the process involves:
- Choosing a blank: Selecting an existing blank on the canvas for expansion.
- Predicting a word: Choosing a vocabulary word to occupy that position.
- Creating new blanks: Deciding whether to insert new blanks to the left or right of the newly placed word.
This recursive structure allows a single blank to grow into a phrase of arbitrary length. The architecture utilizes a Transformer encoder to represent the canvas, followed by a multi-layer perceptron (MLP) to determine blank-creation actions. Training involves maximizing a lower bound of the marginal data likelihood, ensuring the model can fill blanks in any order.
Experimental Evaluation
The authors evaluated BLM across a variety of challenging text generation and restoration tasks:
- Text Infilling: Using the Yahoo Answers dataset, the model was tasked with recovering randomly deleted spans of text.
- Ancient Text Restoration: Using the PHI-ML dataset, BLM was applied to restore fragments of Ancient Greek inscriptions where characters were missing due to physical damage.
- Style Transfer: On Yelp and Amazon review datasets, the model performed sentiment transfer (e.g., negative to positive) by masking sentiment-laden words and infilling them with contextually appropriate alternatives.
- Language Modeling: Standard benchmarks like Penn Treebank (PTB) and WikiText-103 tested the model's general generative capabilities.
Key Results
BLM demonstrated superior performance across all primary metrics. On the Yahoo Answers infilling task, it significantly outperformed baselines such as the Insertion Transformer (InsT) and BERT-based models.
As shown in Figure 6, BLM consistently achieves higher BLEU scores than competing models across different mask ratios (10% to 50%). In the domain of Ancient Greek restoration, BLM reduced the character error rate (CER) by 3.3 points compared to the previous state-of-the-art (Pythia), notably without requiring the exact length of the missing text. Furthermore, it achieved 92.5% accuracy on Amazon sentiment transfer, validating the "mask-and-infill" strategy for controlled rewriting.
Discussion and Future Work
BLM's strength lies in treating blanks as non-terminal symbols, allowing for dependencies between inserted words to be modeled iteratively. This leads to higher fluency in long gaps compared to independent prediction models like BERT.
However, the authors noted that "free-order" generation remains inherently more difficult to optimize than pure left-to-right generation, with BLM slightly lagging behind specialized models like Transformer-XL in unconstrained language modeling. Future work may focus on improving inference speed for very long sequences and exploring "human-in-the-loop" writing tools where BLM can assist users in refining drafts or expanding templates.
Summary updated