TL;DR
This paper introduces a novel framework that leverages Diffusion Language Models (DLMs) to automatically optimize system prompts through iterative, span-level masked denoising. By conditioning on interaction traces (queries, responses, and feedback), the method consistently boosts the performance of frozen downstream LLMs like GPT-4o-mini across diverse benchmarks without requiring gradient access.
What Problem Does This Paper Address?
LLM performance is highly sensitive to prompt engineering, prompting significant interest in automated prompt optimization. However, existing methods typically rely on autoregressive (AR) language models, which generate text strictly from left to right. This makes it difficult to dynamically revise or adapt specific parts of a prompt based on downstream model outputs and user feedback. While gradient-based methods (like TextGrad) exist, they require access to model gradients and task-specific supervision, limiting their applicability to black-box or frozen models.
Methods
The authors propose using Diffusion Language Models (DLMs)—specifically Dream-7B—for prompt optimization. Unlike AR models, DLMs generate text via a bidirectional "mask-and-refine" process.
The framework constructs an interaction trace containing [system prompt, user query, model output, feedback]. Instead of randomly masking the entire sequence, it selectively inserts mask tokens (<|mask|>) into the system prompt section targeted for optimization. The DLM then iteratively denoises and fills in these masked spans, conditioning its predictions on the global context of the user query, model output, and optional feedback. This allows for flexible, targeted prompt updates without modifying the downstream target model's parameters or requiring gradient access.
Datasets
The framework was evaluated across a diverse set of benchmarks:
- $\tau$-bench (Tau-bench-airline and Tau-bench-retail): Simulates realistic, task-oriented dialogues requiring accurate structured function/tool calls.
- SST-2 and SST-5: Stanford Sentiment Treebank benchmarks for binary and fine-grained sentiment classification.
- MRPC: Microsoft Research Paraphrase Corpus for assessing semantic equivalence.
- SNLI: Stanford Natural Language Inference dataset for predicting sentence relationships (entailment, contradiction, neutrality).
Key Insights and Ideas
- Bidirectionality is a Superpower for Prompts: Because DLMs look at context bidirectionally, they can naturally optimize a system prompt located at the beginning of a chat log while conditioning on the conversation history and feedback that follow it.
- The Diffusion Step Sweet Spot: More refinement isn't always better. The authors discovered a clear trade-off between refinement depth and over-editing. Increasing diffusion steps improves prompt quality up to a point (around 64 steps), after which performance plateaus or slightly declines due to the introduction of unnecessary perturbations or repetitive content.
Key Results
Using Dream-7B as the prompt optimizer, the framework consistently improved the performance of a frozen GPT-4o-mini target model:
- Structured Tool Use: On Tau-bench-airline and Tau-bench-retail, success rates jumped from baselines of 0.43 and 0.42 to 0.50 and 0.46, respectively.
- Sentiment Analysis: Fine-grained sentiment classification (SST-5) saw a massive leap from 0.55 to 0.67.
- Comparison to Alternatives: The DLM approach outperformed AR optimizers (Llama3-8B and Qwen3-8B) and performed comparably to the gradient-based TextGrad, all while remaining entirely gradient-free and model-agnostic.
Limitations and Future Work
The authors note that excessive diffusion steps (beyond 128) can lead to diminishing returns and cause the DLM to generate repeated content or drift away from the target intent. Additionally, while the method is highly flexible and gradient-free, it relies on the availability of high-quality interaction traces or LLM-based evaluators to provide feedback during the optimization loop. Future work could explore scaling this approach to larger DLMs or optimizing prompts dynamically in real-time deployment scenarios.
Summary updated