Probabilistically Masked Language Model Capable of Autoregressive Generation in Arbitrary Word Order

Yi Liao, Xin Jiang, Qun Liu

Introduction

In Natural Language Processing (NLP), a long-standing divide exists between models optimized for understanding and those optimized for generation. Masked Language Models (MLMs) like BERT excel at bidirectional context comprehension, making them ideal for classification and extraction tasks. However, they are generally poor at text generation. Conversely, Autoregressive Models (ARMs) like GPT are powerful generators that produce text token-by-token from left to right, but they struggle with tasks requiring "cloze-style" filling, where context from both the left and right must be considered simultaneously.

Researchers have introduced the Probabilistically Masked Language Model (PMLM) to bridge this gap. This new architecture retains the deep bidirectional understanding of BERT while enabling high-quality, fluent text generation in any arbitrary order.

Methodology: The PMLM Framework

The core innovation of PMLM lies in its training objective, which transforms a standard bidirectional Transformer into a flexible generator through two primary mechanisms:

  1. Uniform Masking (u-PMLM): Unlike standard BERT, which uses a fixed 15% masking ratio, u-PMLM employs a random masking ratio sampled uniformly between 0% and 100% for every training instance. This forces the model to learn how to predict missing tokens regardless of whether it has minimal context (high mask ratio) or nearly complete context (low mask ratio).
  2. Mathematical Equivalence: The authors demonstrate that training an MLM with a uniform masking ratio is mathematically equivalent to training an Autoregressive Permutated Language Model (APLM). This allows the model to effectively learn every possible "path" or sequence in which a sentence could be constructed.

Arbitrary-Order Generation

Because the backbone is a bidirectional Transformer, the model can generate words by considering all previously generated tokens, regardless of their relative position (before or after). This enables "arbitrary-order generation," where a model can start with a skeleton of a sentence and fill in the blanks in any sequence.

Example of the model generating a sentence in a non-sequential, arbitrary order.

Experimental Results

The model was evaluated on standard NLU benchmarks (GLUE, SQuAD 2.0) and generative tasks (Wikitext103).

Performance in Understanding and Generation

u-PMLM-R (using relative positional embeddings) achieved an average score of 80.0 on the GLUE benchmark, outperforming the BERT-base baseline of 78.3. It also showed a significant 5-point improvement in F1 score on SQuAD 2.0.

In terms of generation quality, the model proved highly competitive. On the Wikitext103 dataset, u-PMLM achieved a sequential perplexity (PPL) of 19.32, outperforming the GPT baseline (21.23) trained under identical conditions. Crucially, as shown in the table below, PMLM maintains stable performance even when generating in random orders, a task where traditional autoregressive models like GPT cannot function.

Comparison of sequential and random perplexity (PPL) across BERT, GPT, and PMLM variants.

Discussion and Future Work

PMLM successfully breaks the traditional trade-off between NLU and NLG. By moving from a fixed masking ratio to a probabilistic distribution, the model evolves from a simple denoiser into a flexible generator.

While the model can generate in any order, the authors note that it does not yet inherently know which specific order is "optimal" for a given task. Future research may focus on identifying these optimal generation sequences. Additionally, while bidirectional generation is slightly slower than the unidirectional approach of GPT (approximately 20% slower on modern GPUs), the added flexibility for constrained text generation makes it a practical tool for complex NLP applications.

Summary updated

BibTeX
@inproceedings{liao2020probabilistically,
  author = {Yi Liao and Xin Jiang and Qun Liu},
  title = {{Probabilistically Masked Language Model Capable of Autoregressive Generation in Arbitrary Word Order}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2020},
  doi = {10.18653/v1/2020.acl-main.24},
}
Figure