DiffChat: Learning to Chat with Text-to-Image Synthesis Models for Interactive Image Creation

Jiapeng Wang, Chengyu Wang, Tingfeng Cao, Jun Huang, Lianwen Jin

Abstract

Text-to-image synthesis (TIS) models have revolutionized digital content creation, yet they often require expert-level "prompt engineering" to produce specific, high-quality results. We present DiffChat, a framework that aligns Large Language Models (LLMs) to act as interactive prompt engineers. By treating image creation as a conversational process, DiffChat allows users to refine images through iterative natural language instructions. Our approach utilizes a novel dataset, InstructPE, and a reinforcement learning pipeline optimized for aesthetics, user preference, and content integrity. Experimental results demonstrate that DiffChat consistently outperforms existing end-to-end models and general-purpose LLMs in generating high-fidelity, instruction-aligned images.

Introduction

While models like Stable Diffusion and SDXL are powerful, achieving a precise visual outcome often involves a tedious trial-and-error process. For non-expert users, there exists a significant "semantic gap" between simple human intent (e.g., "make her hair yellow") and the descriptive, technical prompts required by TIS models to execute those changes effectively.

Existing solutions typically rely on specialized image-to-image models, which are computationally expensive to train and often tied to a specific generator architecture. DiffChat addresses this by positioning the LLM as a model-agnostic intermediary. Instead of generating pixels, the LLM generates a refined target prompt that incorporates the user's instructions while maintaining the context of the original image.

The DiffChat framework enables iterative image creation through natural language dialogue. (a) shows the iterative pipeline; (b) demonstrates a multi-turn conversation.

Methodology

DiffChat follows a "prompt-as-intermediary" philosophy. The system takes a raw image, its corresponding raw prompt, and a user instruction to produce a target prompt, which is then fed into an off-the-shelf TIS model. The training process is divided into three distinct stages:

1. Dataset Construction (InstructPE)

The authors developed InstructPE, a large-scale dataset containing 234,786 training samples. It was built by taking the InstructPix2Pix dataset and "beautifying" the prompts using ChatGPT and specialized models to make them more descriptive and compatible with modern TIS generators.

2. Supervised Fine-Tuning (SFT)

A BLOOM-1.1B model was fine-tuned on InstructPE to establish a baseline capability for following instructions and generating descriptive image prompts.

3. Reinforcement Learning with Feedback (RLHF)

To optimize for human-centric qualities, the model underwent Proximal Policy Optimization (PPO) guided by three reward criteria:

  • Aesthetics: Measured via the LAION-Aesthetics predictor.
  • User Preference: Measured via PickScore to align with human visual choices.
  • Content Integrity: A heuristic keyword-matching approach ensuring the model does not omit critical parts of the user's request.
Overview of the DiffChat training pipeline, illustrating the transition from InstructPix2Pix data to the InstructPE dataset, followed by SFT and RLHF optimization.

Novel Optimization Techniques

DiffChat introduces two key technical innovations to improve RLHF performance:

  • Action-space Dynamic Modification (ADM): During sampling, the model dynamically filters out low-information tokens and utilizes "hard negatives" (intentionally corrupted prompts) to help the model learn from errors and focus on essential keywords.
  • Value Estimation with Content Integrity (VCI): The PPO value function is modified to explicitly account for whether the generated prompt contains the required semantic changes, preventing the model from sacrificing instruction following for pure aesthetic gain.

Key Results

DiffChat was evaluated against strong baselines, including ChatGPT (as a prompt modifier) and InstructPix2Pix, across multiple TIS models like Stable Diffusion 1.5 and SDXL 1.0.

  • Automated Metrics: DiffChat achieved superior PickScore and Aesthetic Scores, indicating that the generated images were both more visually pleasing and better aligned with human preferences.
  • Human Evaluation: In head-to-head comparisons, human raters preferred DiffChat's results 49% of the time against InstructPix2Pix and 38% of the time against ChatGPT-based prompting.
  • Qualitative Performance: Unlike models that simply "paste" objects into a scene, DiffChat modifies the entire prompt context. For example, when asked to add "boxing gloves" to a subject, DiffChat adjusts the subject's posture in the prompt, leading to a more natural and integrated visual result.

Conclusion and Future Work

DiffChat demonstrates that aligning LLMs for prompt engineering is a highly effective, model-agnostic strategy for interactive image creation. By focusing on the text interface, the system remains "plug-and-play," allowing users to benefit from the latest TIS models without retraining the core alignment model.

Future work will focus on addressing information loss—where the model may occasionally overlook minor details of the original prompt—and improving the robustness of automated reward models to further raise the ceiling of generated image quality.

Summary updated

BibTeX
@inproceedings{wang2024diffchat,
  author = {Jiapeng Wang and Chengyu Wang and Tingfeng Cao and Jun Huang and Lianwen Jin},
  title = {{DiffChat: Learning to Chat with Text-to-Image Synthesis Models for Interactive Image Creation}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2024},
  doi = {10.18653/v1/2024.findings-acl.522},
}
Figure