Exposing the Implicit Energy Networks behind Masked Language Models via Metropolis--Hastings
Kartik Goyal, Chris Dyer, Taylor Berg-Kirkpatrick
Abstract
While recent work has shown that scores from models trained by the ubiquitous masked language modeling (MLM) objective effectively discriminate probable from improbable sequences, it is still an open question if these MLMs specify a principled probability distribution over the space of possible sequences. In this paper, we interpret MLMs as energy-based sequence models and propose two energy parametrizations derivable from the trained MLMs. In order to draw samples correctly from these models, we develop a tractable sampling scheme based on the Metropolis--Hastings Monte Carlo algorithm. In our approach, samples are proposed from the same masked conditionals used for training the masked language models, and they are accepted or rejected based on their energy values according to the target distribution. We validate the effectiveness of the proposed parametrizations by exploring the quality of samples drawn from these energy-based models for both open-ended unconditional generation and a conditional generation task of machine translation. We theoretically and empirically justify our sampling algorithm by showing that the masked conditionals on their own do not yield a Markov chain whose stationary distribution is that of our target distribution, and our approach generates higher quality samples than other recently proposed undirected generation approaches (Wang et al., 2019, Ghazvininejad et al., 2019).
Ask Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
22 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- COLD Decoding: Energy-based Constrained Text Generation with Langevin Dynamics cites Language Models are Few-Shot Learners
- COLD Decoding: Energy-based Constrained Text Generation with Langevin Dynamics cites Residual Energy-Based Models for Text Generation
- COLD Decoding: Energy-based Constrained Text Generation with Langevin Dynamics cites Mix and Match: Learning-free Controllable Text Generationusing Energy Language Models
- COLD Decoding: Energy-based Constrained Text Generation with Langevin Dynamics cites The Curious Case of Neural Text Degeneration
- Oops I Took A Gradient: Scalable Sampling for Discrete Distributions cites Residual Energy-Based Models for Text Generation
- Language Models are Few-Shot Learners cites The Curious Case of Neural Text Degeneration
- Residual Energy-Based Models for Text Generation cites The Curious Case of Neural Text Degeneration
- Amortizing intractable inference in large language models cites The Curious Case of Neural Text Degeneration
- Aligning Language Models with Preferences through f-divergence Minimization cites COLD Decoding: Energy-based Constrained Text Generation with Langevin Dynamics
- Aligning Language Models with Preferences through f-divergence Minimization cites Language Models are Few-Shot Learners
- Mix and Match: Learning-free Controllable Text Generationusing Energy Language Models cites Masked Language Model Scoring
Cited by top-tier papers22
- COLD Decoding: Energy-based Constrained Text Generation with Langevin DynamicsLianhui Qin, Sean Welleck, Daniel Khashabi, Yejin ChoiNeurIPS 2022 · 217 citations
- Aligning Language Models with Preferences through f-divergence MinimizationDongyoung Go, Tomasz Korbak, Germán Kruszewski, Jos Rozen et al.ICML 2023 · 119 citations
- Amortizing intractable inference in large language modelsEdward J. Hu, Moksh Jain, Eric Elmoznino, Younesse Kaddar et al.ICLR 2024 · 91 citations
- Mix and Match: Learning-free Controllable Text Generationusing Energy Language ModelsFatemehsadat Mireshghallah, Kartik Goyal, Taylor Berg-KirkpatrickACL 2022 · 90 citations
- Quantifying Privacy Risks of Masked Language Models Using Membership Inference AttacksFatemehsadat Mireshghallah, Kartik Goyal, Archit Uniyal, Taylor Berg-Kirkpatrick et al.EMNLP 2022 · 72 citations
Builds on5
- Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
- The Curious Case of Neural Text DegenerationAri Holtzman, Jan Buys, Li Du, Maxwell Forbes et al.ICLR 2020 · 4,112 citations
- Masked Language Model ScoringJulian Salazar, Davis Liang, Toan Q. Nguyen, Katrin KirchhoffACL 2020 · 167 citations
- Residual Energy-Based Models for Text GenerationYuntian Deng, Anton Bakhtin, Myle Ott, Arthur Szlam et al.ICLR 2020 · 147 citations
- Oops I Took A Gradient: Scalable Sampling for Discrete DistributionsWill Grathwohl, Kevin Swersky, Milad Hashemi, David Duvenaud et al.ICML 2021 · 113 citations
Related papers
- Principled Gradient-Based MCMC for Conditional Sampling of TextLi Du, Afra Amini, Lucas Torroba Hennigen, Xinyan Velocity Yu et al.ICML 2024 · 6 citations
- ETS: Energy-Guided Test-Time Scaling for Training-Free RL AlignmentXiuyu Li, Jinkai Zhang, Mingyang Yi, Yu Li et al.ICML 2026 · 4 citations
- Probing BERT's priors with serial reproduction chainsTakateru Yamakoshi, Thomas L. Griffiths, Robert D. HawkinsACL Findings 2022 · 7 citations
- MLE-Guided Parameter Search for Task Loss Minimization in Neural Sequence ModelingSean Welleck, Kyunghyun ChoAAAI 2021 · 8 citations
- Energy-Based Diffusion Language Models for Text GenerationMinkai Xu, Tomas Geffner, Karsten Kreis, Weili Nie et al.ICLR 2025
