[Paper Review] BERT has a Mouth, and It Must Speak: BERT as a Markov Random Field Language Model
The paper reframes BERT as a Markov random field language model and derives a Gibbs-sampling procedure to generate sentences, showing BERT can produce fluent yet more diverse text than left-to-right models, with some quality trade-offs.
We show that BERT (Devlin et al., 2018) is a Markov random field language model. This formulation gives way to a natural procedure to sample sentences from BERT. We generate from BERT and find that it can produce high-quality, fluent generations. Compared to the generations of a traditional left-to-right language model, BERT generates sentences that are more diverse but of slightly worse quality.
Motivation & Objective
- Motivate sampling and generation from BERT beyond its standard bidirectional pretraining.
- Formalize BERT as an MRF-LM with pseudo log-likelihood training.
- Propose Gibbs sampling and other MCMC techniques to generate sentences from BERT.
- Evaluate the trade-offs between diversity and quality in BERT-based generations.
- Provide practical guidance and code to enable BERT-based generation experiments.
Proposed method
- Define X as a fully-connected graph of token variables with a full-graph clique potential decomposing into a product of per-token log-potentials.
- Use log-potentials that depend on all other tokens when a token is masked, enabling a conditional p(x_t|X_{ackslash t}) with a softmax normalization.
- Adopt pseudo log-likelihood (PLL) learning to avoid intractable joint normalization, maximizing expected log-probability of each token given the rest.
- Implement stochastic PLL estimation by sampling token positions to mask and predict, related to denoising autoencoders.
- Develop Gibbs-sampling-based generation: iteratively mask a random position, sample a token from p(x_t|X_{ackslash t}), and update the sequence.
- Describe sequential and non-sequential (left-to-right) sampling schemes and practical choices (e.g., top-k=100 proposals).
- Compare BERT-based generations with GPT using automatic metrics (e.g., corpus-BLEU, perplexity) and human fluency judgments.
Experimental results
Research questions
- RQ1Can BERT be interpreted as a Markov random field language model with a tractable sampling procedure?
- RQ2How do BERT-based generations compare to left-to-right models in terms of quality and diversity?
- RQ3What sampling strategies (Gibbs, sequential) are effective for generating text from a bidirectional model like BERT?
- RQ4How does PLL-based training enable or constrain learning and sampling from BERT as an MRF-LM?
Key findings
- BERT can be treated as an MRF-LM, enabling a Gibbs-sampling generation procedure without extra training.
- Sampling from BERT yields fluent sentences that are generally well-formed and more diverse than GPT-based generations.
- Compared to GPT, BERT generations are more diverse but sometimes of slightly lower quality according to automatic metrics and human fluency judgments.
- The authors observe domain-related differences in perplexity and n-gram diversity, suggesting domain shift affects external language-model evaluation of BERT-generated text.
- BERT-based generations show lower n-gram overlap with the reference corpora, indicating higher diversity relative to GPT and the data distributions.
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.