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
Diffusion models have revolutionized generative AI, but they face a significant "speed tax" when applied to discrete language data. Because text is composed of individual tokens, models like Diffusion LM (DLM) must first map text into a continuous latent space and then perform thousands of iterative denoising steps to generate a sample. This process relies on Stochastic Differential Equations (SDEs), which are computationally expensive and follow erratic, non-linear paths from noise to data.
Furthermore, "controllable" generation—forcing a model to follow specific constraints like sentence length, parts-of-speech patterns, or sentiment—often requires a delicate, manual balancing act between following the constraint and maintaining natural-sounding language. Language Rectified Flow (LF) addresses these challenges by straightening the generation path.
Methodology
The authors propose Language Rectified Flow (LF), which shifts the paradigm from SDEs to Ordinary Differential Equations (ODEs). The core idea is "rectification": ensuring the model learns to transport the source distribution (noise) to the target distribution (text) along the shortest possible path—a straight line.
Key technical components include:
- VAE Latent Space: A Variational Auto-Encoder (VAE) maps discrete text into a continuous, differentiable space where the flow can happen.
- Neural Velocity Field: Instead of predicting "noise," the model learns a velocity field ($v_\theta$) that drives the flow along a straight-line path between two points.
- Lexicographic Optimization: To solve the trade-off problem between reconstruction and flow matching, the authors use a lexicographic (order-based) optimization strategy. This treats the reconstruction of the text as the primary goal and the flow matching as a constraint, avoiding the need for manual hyper-parameter tuning of loss weights.
- Euler Solver: Because the paths are straightened, the model can use a simple Euler solver to generate text in as few as 10 steps, compared to the 1000+ steps often required by standard diffusion.
Experimental Results
The model was evaluated across several diverse benchmarks, including the E2E dataset for fine-grained control (Parts-of-Speech and Length), Abductive NLG for infilling, and Yelp/Amazon reviews for sequential text editing.
Performance and Control
LF demonstrates superior precision in controllable tasks. On the Parts-of-Speech task, LF achieved a 94.2% success rate, outperforming Diffusion LM (90.0%). In the aNLG infilling task, LF reached a BERTScore of 92.1, significantly higher than the 89.0 achieved by standard diffusion models. Qualitative analysis further shows that while other models often miss target lengths by several words, LF consistently hits the exact word count requested while maintaining higher semantic coherence.
Efficiency Gains
A primary advantage of LF is its massive speedup. By straightening the transport trajectory, the simulation becomes mathematically simpler. LF is 27x faster than Diffusion LM and 16.7x faster than FUDGE during inference, reducing generation time from 80 seconds to just 3 seconds for comparable tasks.
Conclusion
Language Rectified Flow provides a unified and effective solution for generative modeling and domain transfer in NLP. By utilizing straight paths in a continuous latent space, LF achieves high-quality results with significantly lower inference latency. Future work will explore scaling LF to massive, open-domain datasets and handling more complex, composite constraints.
Summary updated