Abstract
Masked Diffusion Models (MDMs) offer a non-causal alternative to traditional autoregressive language models, yet they often suffer from error propagation due to rigid, uniform sampling paths. We introduce Path Planning (P2), a novel inference strategy that treats sampling as a dynamic trajectory optimization problem. By incorporating a "planner" that can both unmask and re-mask tokens, P2 allows models to review and edit their generations. Our results demonstrate that P2 significantly enhances performance across protein design, RNA generation, and natural language tasks, enabling 1B-parameter models to surpass 7B-parameter autoregressive baselines.
The Autoregressive Bottleneck and the Diffusion Alternative
Modern Large Language Models (LLMs) primarily rely on autoregressive generation, predicting tokens sequentially from left to right. While successful, this "causal" approach is inherently limited for data types without a natural directionality, such as biological sequences or source code. In these domains, a decision made at the end of a sequence often necessitates a correction at the beginning.
Masked Diffusion Models (MDMs) address this by starting with a fully masked sequence and filling in tokens in any order. However, standard MDM sampling typically follows a fixed, uniform schedule. This assumes the model is perfect; in practice, early errors compound because the model has no mechanism to "undo" a poor prediction. The authors identify that uniform unmasking is only mathematically optimal if the model is perfect—which, in the real world, it never is.
Path Planning (P2): Sampling with an "Undo" Button
The P2 framework transforms MDM sampling from a static process into a dynamic, two-stage loop consisting of Planning and Denoising.
- The Planner ($G_\phi$): At each step, the planner evaluates the current partially-filled sequence. It identifies which masked positions are most "ready" to be revealed and, crucially, identifies previously unmasked tokens that appear erroneous. These suspect tokens are "re-masked," effectively giving the model an editing capability.
- The Denoiser ($D_\theta$): The underlying diffusion model then predicts the values for all currently masked positions, guided by the planner's selection.
The researchers explored three implementation strategies for the planner:
- Self-Planning: Leveraging the denoiser's internal confidence scores.
- BERT-Planning: Utilizing a pre-trained BERT model to judge sequence coherence.
- Trained-Planning: Optimizing a lightweight dedicated model to minimize a trajectory-aware Evidence Lower Bound (ELBO).
Theoretical Foundations: Why Uniformity Fails
A key contribution of this work is the theoretical proof that uniform unmasking is only optimal for a perfect model. For any real-world, imperfect denoiser, there exists a non-uniform path that yields a better ELBO. By allowing for re-masking, P2 expands the search space of possible generation paths, allowing the model to navigate toward higher-probability sequences. This mimics human cognitive processes like drafting and revision.
Experimental Results: Efficiency and Performance
P2 was evaluated across a wide range of benchmarks, including protein design (UniRef50), RNA generation (RNACentral), and standard NLP tasks.
Outperforming Larger Models
One of the most striking results is the performance of P2-enhanced models on mathematical reasoning and language understanding. As shown in the results table, a 1.1B-parameter MDM using P2-self planning achieved 60.9% accuracy on GSM8K, outperforming the 7B-parameter Llama 2 (58.6%). In code generation, P2 provided a 33% boost in the pass@1 metric on HumanEval.
Biological Sequence Design
In protein generation, P2 led to a 22% relative improvement in foldability, a metric measuring the likelihood that a generated sequence will form a stable 3D structure. Similar gains were observed in RNA generation, where P2-trained planners produced sequences with significantly higher structural quality compared to state-of-the-art baselines like DPLM.
Conclusion and Future Directions
Path Planning represents a significant shift in how we approach diffusion-based generation. By decoupling the "what to generate" (denoising) from the "how to generate" (planning), P2 provides a flexible and efficient way to improve model performance without retraining the core denoiser.
Future research may explore "Inference-Time Scaling," where additional compute is allocated to the planner for particularly difficult sequences, or extending P2 to continuous domains like video and 3D asset generation. The ability to "undo" and "revise" is a fundamental step toward more robust and human-like generative AI.
Summary updated