Language Rectified Flow: Advancing Diffusion Language Generation with Probabilistic Flows

Shujian Zhang, Lemeng Wu, Chengyue Gong, Xingchao Liu

Abstract

Recent works have demonstrated success in controlling sentence attributes (e.g., sentiment) and structure (e.g., syntactic structure) based on the diffusion language model. A key component that drives the impressive performance for generating high-quality samples from noise is iteratively denoising for thousands of steps. While beneficial, the complexity of starting from the noise and the learning steps has limited its implementation to many NLP real-world applications. This paper proposes Language Rectified Flow (LF). Our method is based on the reformulation of the standard probabilistic flow models. Language rectified flow learns (neural) ordinary differential equation models to transport between the source distribution and the target distribution, hence providing a unified and effective solution to generative modeling and domain transfer. From the source distribution, our language rectified flow yields fast simulation and effectively decreases the inference time. Experiments on three challenging fine-grained control tasks and multiple high-quality text editing show that our method consistently outperforms its baselines. Extensive experiments and ablation studies demonstrate that our method can be general, effective, and beneficial for many NLP tasks.

Introduction

Generative AI has seen a massive shift toward diffusion models, which excel at creating high-quality, diverse samples from noise. However, applying diffusion to language is notoriously difficult. Text is discrete (tokens), while diffusion thrives in continuous spaces. Existing solutions like "Diffusion LM" map text into a continuous latent space, but they suffer from a major efficiency bottleneck: they rely on Stochastic Differential Equations (SDEs) that require thousands of iterative denoising steps to reach a final output. Furthermore, these models often require extensive hyperparameter tuning to balance the "guidance" (the control signal) with the "fluency" (the quality of the text). The authors of this paper introduce Language Rectified Flow (LF) to create a model that is both faster to sample from and easier to train.

Methodology

The authors introduce Language Rectified Flow (LF), which shifts the paradigm from SDEs to Ordinary Differential Equations (ODEs).

The LF architecture: Source text is encoded into a latent representation, processed through an N-step velocity field, and sampled to produce target output.
  1. Continuous Latent Space: First, a Variational Auto-Encoder (VAE) maps discrete text into a continuous latent representation.
  2. Rectified Flow (The "Straight Line" Trick): Instead of the wandering, noisy paths taken by standard diffusion, LF learns a "velocity field" that transports the source distribution to the target distribution along the straightest possible path. Mathematically, straight paths are the shortest distance between two points, allowing the model to reach the target in far fewer steps (typically 10–20) using a simple Euler solver.
  3. Lexicographic (Lexico) Optimization: To avoid manually balancing different loss functions (like reconstruction vs. flow matching), the authors use a bi-level optimization strategy. This treats the flow matching as a constraint while prioritizing text reconstruction, ensuring the model stays fluent while learning the transport mapping.

Experimental Setup

The researchers evaluated LF across several challenging NLP tasks using established benchmarks:

  • E2E Dataset: Used for fine-grained control tasks like generating sentences with specific Parts-of-Speech (POS) sequences or exact word counts.
  • Abductive NLG (ART): Used for "infilling" tasks, where the model must generate a logical bridge between a given beginning and end of a story.
  • Yelp & Amazon Reviews: Used for sequential text editing, specifically sentiment transfer (e.g., changing a negative review to a positive one while keeping the content intact).

Results

Language Rectified Flow demonstrates significant improvements in both efficiency and quality over existing baselines.

Inference time comparison: LF achieves a 26.7x speedup over Diffusion LM.
  • Massive Speedup: In generating 50 examples, LF took only 3 seconds, compared to 80 seconds for Diffusion LM and 50 seconds for FUDGE (an autoregressive baseline). This represents a 26.7x speedup over the state-of-the-art diffusion approach.
  • Superior Control: On the Parts-of-Speech (POS) task, LF achieved a success rate of 94.2%, outperforming Diffusion LM (90.0%) and FUDGE (27.0%).
  • Better Fluency: LF consistently achieved lower Perplexity (PPL) scores across tasks, indicating that the generated text was more natural and fluent than that of its competitors.
  • Rapid Convergence: Qualitative analysis showed that the model's output quality plateaus and converges well with as few as 10 steps, whereas standard diffusion models often require hundreds to look coherent.

Conclusion

Language Rectified Flow (LF) significantly accelerates controllable text generation by replacing the complex, stochastic paths of traditional diffusion models with straight-line trajectories in a continuous latent space. While the quality of generation remains tethered to the initial VAE bottleneck, LF treats both generation and editing as a unified transport problem, eliminating the need for complex SDE solvers and extensive hyperparameter tuning. Future work includes exploring the combination of multiple conflicting constraints and scaling the approach to massive Large Language Models (LLMs).

Summary updated

Abstract

Recent works have demonstrated success in controlling sentence attributes ($e.g.$, sentiment) and structure ($e.g.$, syntactic structure) based on the diffusion language model. A key component that drives theimpressive performance for generating high-quality samples from noise is iteratively denoise for thousands of steps. While beneficial, the complexity of starting from the noise and the learning steps has limited its implementation to many NLP real-world applications. This paper proposes Language Rectified Flow ({\ours}). Our method is based on the reformulation of the standard probabilistic flow models. Language rectified flow learns (neural) ordinary differential equation models to transport between the source distribution and the target distribution, hence providing a unified and effective solution to generative modeling and domain transfer. From the source distribution, our language rectified flow yields fast simulation and effectively decreases the inference time. Experiments on three challenging fine-grained control tasks and multiple high-quality text editing show that our method consistently outperforms its baselines. Extensive experiments and ablation studies demonstrate that our method can be general, effective, and beneficial for many NLP tasks.
BibTeX
@inproceedings{zhang2024language,
  author = {Shujian Zhang and Lemeng Wu and Chengyue Gong and Xingchao Liu},
  title = {{Language Rectified Flow: Advancing Diffusion Language Generation with Probabilistic Flows}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2024},
  url = {https://openreview.net/forum?id=j2s9sumiGc},
}
Figure