Energy-Based Diffusion Language Models for Text Generation

Minkai Xu, Tomas Geffner, Karsten Kreis, Weili Nie, Yilun Xu, Jure Leskovec, Stefano Ermon, Arash Vahdat

Introduction

Most modern Large Language Models (LLMs) rely on an autoregressive (AR) paradigm, generating text sequentially from left to right. While highly effective, this approach has notable drawbacks: it is computationally slow for long sequences and suffers from "exposure bias," where early generation errors compound over time.

Discrete Diffusion Models (DMs) have emerged as a promising alternative, offering the ability to generate entire sequences in parallel from a fully masked state. However, they have historically underperformed their AR counterparts. The authors of this paper identify a critical flaw causing this performance gap: standard DMs assume that during each denoising step, every token can be predicted independently. Because natural language is highly correlated—where the choice of one word depends heavily on the surrounding context—ignoring sequence-level correlations results in "noisy" denoising steps and degraded text quality.

To bridge this gap, the authors introduce the Energy-based Diffusion Language Model (EDLM). By incorporating a sequence-level energy function into the denoising process, EDLM captures complex token dependencies, achieving state-of-the-art text generation quality and a 1.3x sampling speedup over existing diffusion baselines.

Methodology

EDLM addresses the independent token assumption by adding an Energy-Based Model (EBM) as a "residual" correction to a standard diffusion model.

  1. Residual EBM Formulation: Instead of relying on simple token-wise probabilities, EDLM defines the denoising step as a joint distribution over the entire sequence. A base diffusion model provides a "proposal," and an energy function "corrects" it based on how cohesively the tokens fit together as a sequence.
  2. Obtaining the Energy Function: Training an EBM from scratch on high-dimensional text data is notoriously difficult due to the "partition function" problem. The authors bypass this by either:
  3. Leveraging Pretrained AR Models: Using a standard AR model's likelihood directly as the energy function.
  4. NCE Finetuning: Finetuning a bidirectional transformer using Noise Contrastive Estimation (NCE), teaching the model to distinguish "real" text from the "noisy" proposals generated by the base diffusion model.
  5. Parallel Importance Sampling: During generation, EDLM samples multiple candidate sequences in parallel from the base model, ranks them using the energy function, and selects the best candidate to proceed to the next step.
  6. The Importance Sampling Window: The authors discovered that most generation errors occur early in the diffusion process. By restricting the energy-based correction to these early stages (the "window"), EDLM maintains high text quality while significantly reducing total computation time.

Results and Evaluation

The researchers evaluated EDLM across several standard benchmarks, including Text8 (character-level modeling), OpenWebText (large-scale text), and seven unseen datasets for zero-shot generalization.

EDLM achieved state-of-the-art results for diffusion-based language modeling across the board:

  • Performance: On the Text8 benchmark, EDLM achieved a Bits Per Character (BPC) of 1.24. This nearly matches the performance of top-tier AR models and significantly outperforms all other diffusion methods.
Table 1: Bits Per Character (BPC) on Text8 test set. EDLM outperforms all previous diffusion and any-order AR models.
  • Perplexity: On OpenWebText, EDLM consistently reached lower perplexity (indicating better prediction accuracy) than highly competitive baselines like SEDD and MDLM.
  • Speed: Thanks to the targeted importance sampling window, EDLM achieved a 1.3x speedup over existing diffusion models without sacrificing generation quality.
  • Quality: EDLM demonstrated up to a 49% improvement in "Generative Perplexity" (a metric for how realistic the generated text is) compared to the most competitive diffusion baselines.

Key Insights and Limitations

Key Insights

  • The Independence Trap: The primary bottleneck for diffusion models in NLP has been the "independent token" assumption. Language requires holistic, sequence-level modeling.
  • Residuals are Efficient: Formulating the EBM as a residual on top of a pretrained model elegantly sidesteps the mathematical hurdles that usually make EBMs intractable for text.
  • Early Correction is the "Sweet Spot": Applying energy-based corrections primarily in the early stages of denoising offers a "best of both worlds" scenario: the accuracy of sequence-level modeling combined with the speed of parallel diffusion.

Limitations and Future Work

While EDLM represents a significant leap forward for non-autoregressive generation, it has a few limitations:

  • Memory Overhead: Parallel importance sampling requires generating multiple candidates simultaneously, which can be memory-intensive. Experiments were limited to a sample size of 16.
  • Hyperparameter Tuning: The "importance sampling window" introduces a new hyperparameter that must be carefully tuned for different tasks to perfectly balance speed and quality.
  • Scaling: The next major frontier for EDLM is scaling the approach to the multi-billion parameter regimes typical of the largest modern LLMs.

Summary updated

BibTeX
@inproceedings{xu2025energy,
  author = {Minkai Xu and Tomas Geffner and Karsten Kreis and Weili Nie and Yilun Xu and Jure Leskovec and Stefano Ermon and Arash Vahdat},
  title = {{Energy-Based Diffusion Language Models for Text Generation}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=sL2F9YCMXf},
}
Figure