Prompt Guided Diffusion for Controllable Text Generation

Mohaddeseh Mirbeygi, Hamid BeigyNAACL 2025

TL;DR

This paper introduces "PromptDiffusion," a novel framework that leverages structured prompts and cross-attention mechanisms within diffusion models to achieve highly controllable and fluent text generation. By integrating target attributes and example sentences into the diffusion process, PromptDiffusion offers a flexible and powerful way to steer text generation for various tasks, outperforming existing methods in controllability and quality.

What Problem Does This Paper Address?

Generating text that is not only coherent and fluent but also adheres to specific user-defined characteristics (like sentiment, topic, or style) is a significant challenge in Natural Language Processing (NLP). Existing methods often struggle to balance control fidelity with fluency. Autoregressive models, while fluent, can be rigid, while classifier-guided diffusion models can produce less coherent text due to gradient-based updates. Diffusion models themselves show great promise in diversity and iteration but often require complex, task-specific modules to inject control, making them less adaptable. This paper aims to bridge this gap by providing a unified, flexible, and effective approach to controllable text generation using diffusion models.

Methods

The core of PromptDiffusion lies in its innovative use of structured prompts and cross-attention. The framework takes a target attribute (e.g., "positive sentiment") and a corresponding example sentence (e.g., a positive review) to form a prompt. This prompt is then encoded by a large pre-trained language model, such as BART, to generate embeddings that capture the prompt's semantic content. These embeddings are then integrated into the diffusion model's denoising process through cross-attention mechanisms. This allows the model to condition its generation at each step, guiding the diffusion process to produce text that aligns with the desired attributes. The diffusion model itself operates through a forward process of gradually adding noise to text embeddings and a reverse process of iteratively denoising these embeddings to reconstruct coherent text. The training objective is to maximize the likelihood of the generated text, which is achieved by minimizing a variational lower bound.

Datasets

The authors evaluated PromptDiffusion on three benchmark datasets:

  • IMDB: A dataset of 50,000 movie reviews used for sentiment analysis.
  • AG News: A dataset of 120,000 news articles covering four topics (World, Sports, Business, Sci/Tech) used for topic coherence.
  • E2E: A data-to-text dataset containing restaurant descriptions with structured attribute-value pairs, used for evaluating structured semantic fidelity.

Key Insights and Ideas

  • Structured Prompts for Granular Control: The paper demonstrates that combining a target attribute with an in-class example in a structured prompt provides a powerful and intuitive way to guide text generation, offering more precise control than simple attribute tags alone.
  • Cross-Attention as a Control Mechanism: Integrating prompt embeddings via cross-attention into the diffusion model's denoising steps is a key innovation, allowing for dynamic conditioning throughout the generation process.
  • Balancing Controllability and Fluency: PromptDiffusion effectively navigates the trade-off between controllability and fluency, a persistent challenge in text generation, by leveraging the iterative nature of diffusion models.
  • Versatility of a Single Model: The framework's ability to handle diverse tasks (sentiment, topic, structured output) with a single pre-trained model by simply changing the prompt highlights its efficiency and adaptability.
  • Leveraging Pre-trained Language Models: The synergy between large pre-trained models like BART for prompt encoding and diffusion models for generation is crucial for achieving high-quality, semantically aligned outputs.

Key Results

PromptDiffusion achieved state-of-the-art performance across the evaluated tasks:

  • E2E Dataset: Outperformed prior controllable text generation methods in semantic content accuracy (83%), part-of-speech accuracy (92.5%), and text length accuracy (99.9%), while maintaining low perplexity.
  • IMDB and AG News Datasets: Showed superior performance compared to PPLM, FUDGE, and DiffusionLM in terms of generation quality, as measured by BLEU-4, ROUGE-L, and BERTScore. For instance, on IMDB, PromptDiffusion achieved a BERTScore of 92, outperforming DiffusionLM and GPT-2.

Limitations and Future Work

The authors acknowledge that writing effective prompts can be challenging, and poorly written prompts can lead to suboptimal results. The encoding of prompts also adds to the generation time.

Future work directions suggested include:

  • Investigating hybrid models that combine PromptDiffusion with retrieval-augmented generation or few-shot learning.
  • Extending the framework to multimodal tasks.
  • Further exploring the potential of intuitive prompting for bridging human intention with generative AI.

Summary updated

BibTeX
@inproceedings{mirbeygi2025prompt,
  author = {Mohaddeseh Mirbeygi and Hamid Beigy},
  title = {{Prompt Guided Diffusion for Controllable Text Generation}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2025},
}
Figure