TL;DR
FlowLM introduces an efficient fine-tuning method that transforms pre-trained diffusion language models into flow matching models by straightening their curved sampling trajectories. This allows FlowLM to achieve high-quality text generation in as few as 1 to 5 steps, matching or even outperforming traditional 2,000-step diffusion models while delivering a massive inference speedup.
What Problem Does This Paper Address?
While autoregressive language models (like GPT-4) dominate natural language processing, their token-by-token generation mechanism creates a significant latency bottleneck. Diffusion Language Models (DLMs) offer a promising parallel alternative by generating entire sequences simultaneously. However, DLMs suffer from a severe trade-off between speed and quality: they typically require hundreds or thousands of sequential denoising steps to produce coherent text.
In continuous DLMs, this bottleneck stems from the highly curved, stochastic paths learned during training. If you try to accelerate inference by taking larger steps, the generation quality degrades catastrophically. The authors of FlowLM set out to solve this mismatch by straightening these curved trajectories into direct, linear paths, enabling ultra-fast, few-step text generation without sacrificing quality.
Methods
Instead of training a flow matching model from scratch, FlowLM initializes its weights from a pre-trained continuous diffusion model (specifically, DiffuSeq). It then employs a "Diffusion-to-Flow" adaptation process:
- Straight-Line Trajectories: The model is fine-tuned using linear interpolation between noise ($z_1$) and clean data ($z_0$), forcing the generation path to be straight.
- Clean Data Prediction ($x$-pred): Unlike standard flow matching models that predict velocity ($v$), FlowLM is trained to directly predict the clean data distribution ($z_0$).
- Average Velocity Sampling: During inference, FlowLM samples using an average velocity approximation ($v_{average} = \frac{z_t - z_0}{t}$) rather than instantaneous velocity. This acts as a global "shooting" method that anchors the generation process directly toward the target data manifold.
- Training-Inference Alignment: The authors reduce the number of discrete training timesteps from the standard 2,000 down to just $T=20$, aligning the training granularity with the target few-step inference budget.
- Regularization Loss: To prevent the model from forgetting its pre-trained capabilities (policy collapse), a regularization term keeps the fine-tuned model's predictions close to the original reference diffusion model.
Datasets
The authors evaluated FlowLM across three standard sequence-to-sequence (Seq2Seq) tasks using established datasets:
- Question Generation (QG): The Quasar-T dataset (117k training, 2k validation, 10k test).
- Text Simplification (TS): The Wiki-Auto dataset (678k training, 2k validation, 5k test).
- Paraphrase Generation (PP): The Quora Question Pairs (QQP) dataset (145k training, 2k validation, 2k test).
Key Insights and Ideas
- The Discrete Advantage ($x$-loss vs. $v$-loss): In image generation, predicting velocity with a $v$-loss is typically superior because images require high-precision, fine-grained details. For text, however, the authors discovered that an $x$-loss (predicting clean data) is significantly better. Because text generation concludes with a discrete rounding/decoding step, the model is inherently tolerant of minor latent deviations, making the late-stage high-precision focus of $v$-loss unnecessary.
- Coarser Training Yields Better Few-Step Inference: Training with fewer timesteps ($T=20$ instead of $T=2,000$) concentrates the model's capacity on learning the global trajectory rather than local fluctuations. This alignment is crucial for maintaining stability when taking large strides during fast sampling.
- Self-Correcting Paths: By re-estimating the final clean data endpoint at every single iteration, the average velocity sampling method provides global anchoring. Even if early steps at high noise levels introduce bias, subsequent steps effectively self-correct toward the true data distribution.
Key Results
FlowLM achieves remarkable performance and efficiency gains:
- Massive Speedup: On a single NVIDIA H100 GPU, the inference time per sample drops from 0.7264 seconds (DiffuSeq with 2,000 steps) to just 0.00014 seconds (FlowLM with 1 step) or 0.00057 seconds (FlowLM with 5 steps).
- Quality Preservation: Across all three tasks, FlowLM operating at 3 to 5 steps achieved BLEU, ROUGE-L, and BERTScore results that rivaled or outperformed the 2,000-step diffusion baseline.
- Faster Convergence: The fine-tuned FlowLM reached performance saturation in less than half the training epochs required to train a flow matching model from scratch.
Limitations and Future Work
Despite its success, the authors note a couple of key limitations:
- Fine-Grained Edits: For complex tasks requiring highly precise text editing, few-step generation can still struggle to capture subtle dependencies, which might be a constraint of the relatively small model size used in the paper (0.1B parameters). Testing on larger scales is required.
- Continuous vs. Discrete: This method is currently only applicable to continuous diffusion language models. It cannot be directly applied to discrete or masked diffusion language models.
Future work will focus on overcoming these boundaries, particularly extending few-step generation capabilities to discrete diffusion frameworks.
Summary updated