TL;DR
Diffusion-LM is a non-autoregressive language model that treats text generation as an iterative denoising process in a continuous embedding space. By moving away from standard left-to-right token prediction, it enables fine-grained, gradient-based control over complex structures like syntax trees and specific semantic content, significantly outperforming existing "plug-and-play" controllable generation methods.
The Challenge of Controlling Language Models
Large Language Models (LLMs) are masters of fluency, but steering them to follow specific, complex constraints remains notoriously difficult. While guiding a model to generate a sentence with a specific sentiment is manageable, forcing it to follow a strict syntactic structure (e.g., a complex parse tree) or perform infilling (filling in the middle of a sentence) is a major challenge for standard autoregressive models.
The core issue lies in their "left-to-right" nature. Once an autoregressive model commits to a word, it cannot easily backtrack to fix structural issues that arise later. Furthermore, these models are often used in a "frozen" state, making it hard to apply external constraints without expensive fine-tuning for every new task. This paper seeks a way to perform "plug-and-play" control—steering a pre-trained model using an external classifier—on complex, global constraints that require looking at the whole sentence at once.
Enter Diffusion-LM
The authors introduce Diffusion-LM, adapting the continuous diffusion models that have revolutionized image generation for the discrete world of text.
The approach relies on several key innovations:
- Continuous Diffusion for Discrete Text: Because diffusion requires a continuous space, the authors map discrete words into a high-dimensional embedding space. The model starts with a sequence of Gaussian noise vectors and iteratively denoises them into a sequence of word vectors.
- End-to-End Training: Unlike previous attempts that used fixed embeddings, Diffusion-LM learns its word embeddings jointly with the denoising model. This allows the model to organize the embedding space in a way that naturally facilitates the diffusion process.
- The Clamping Trick: To bridge the gap between continuous vectors and discrete words during decoding, the authors use a "clamping" technique. At each denoising step, they map the predicted vector to its nearest word embedding, forcing the model to gradually "commit" to actual words.
- Gradient-Based Control: Because the entire sequence exists in a continuous latent space at every step, a separate classifier (e.g., a syntax checker) can be used to calculate gradients. These gradients "steer" the denoising process toward a sequence that satisfies the desired constraint.
Key Insights
- Global Planning vs. Local Prediction: Autoregressive models are "blind" to the future. Diffusion-LM, however, sees the entire sequence from step one. This allows it to "plan" global structures and "repair" earlier mistakes as the noise clears—much like a sculptor refining a block of marble.
- Syntax in the Embeddings: Visualizations of the learned embedding space show that the model naturally clusters words by Part-of-Speech (POS) tags. This highly structured linguistic space explains why gradient-based control works so effectively for syntax.
- The Power of Iteration: Breaking generation into hundreds of small steps allows the model to balance the competing demands of "fluency" (from the LM) and "control" (from the classifier) much more effectively than one-pass methods.
Experimental Results
The model was trained and evaluated on the E2E dataset (restaurant reviews) and ROCStories (five-sentence stories). Diffusion-LM shines in complex, fine-grained control tasks where traditional methods fail.
- Syntax Tree Control: Diffusion-LM achieved an impressive 86.0% success rate for syntax tree control, compared to just 17.9% for FUDGE (a leading autoregressive baseline). In some scenarios, it even outperformed a "fine-tuning oracle."
- Infilling: In sentence completion tasks, Diffusion-LM significantly outperformed specialized models, matching the performance of models explicitly trained for infilling.
- Composition: The model can easily combine multiple constraints (e.g., "make this sentence about Italian food" AND "follow this specific parse tree") by simply summing the gradients from different classifiers.
Limitations and Future Work
While powerful, Diffusion-LM has a few notable limitations:
- Fluency Gap: In terms of raw language modeling performance (Negative Log-Likelihood), Diffusion-LM still slightly underperforms standard Transformers. It is vastly superior at being controlled, but slightly worse at being a pure, unconstrained language model.
- Speed: Generating text via hundreds of denoising steps is significantly slower than the single pass required by autoregressive models, though it remains faster than older gradient-heavy methods like PPLM.
Future work will likely focus on closing this perplexity gap and optimizing the number of diffusion steps to make the model more competitive for real-time applications.
Summary updated