Divide and Conquer: Language Models can Plan and Self-Correct for Compositional Text-to-Image Generation

Zhenyu Wang, Enze Xie, Aoxue Li, Zhongdao Wang, Xihui Liu, Zhenguo LiarXiv 2024

Abstract

Despite significant advancements in text-to-image models for generating high-quality images, these methods still struggle to ensure the controllability of text prompts over images in the context of complex text prompts, especially when it comes to retaining object attributes and relationships. In this paper, we propose CompAgent, a training-free approach for compositional text-to-image generation, with a large language model (LLM) agent as its core. The fundamental idea underlying CompAgent is premised on a divide-and-conquer methodology. Given a complex text prompt containing multiple concepts including objects, attributes, and relationships, the LLM agent initially decomposes it, which entails the extraction of individual objects, their associated attributes, and the prediction of a coherent scene layout. These individual objects can then be independently conquered. Subsequently, the agent performs reasoning by analyzing the text, plans and employs the tools to compose these isolated objects. The verification and human feedback mechanism is finally incorporated into our agent to further correct the potential attribute errors and refine the generated images. Guided by the LLM agent, we propose a tuning-free multi-concept customization model and a layout-to-image generation model as the tools for concept composition, and a local image editing method as the tool to interact with the agent for verification. The scene layout controls the image generation process among these tools to prevent confusion among multiple objects. Extensive experiments demonstrate the superiority of our approach for compositional text-to-image generation: CompAgent achieves more than 10% improvement on T2I-CompBench, a comprehensive benchmark for open-world compositional T2I generation.

The Problem: Compositional Failures in T2I

Current text-to-image (T2I) powerhouses like Stable Diffusion and Midjourney are incredible at generating high-quality art, but they often stumble when prompts get "compositional"—meaning they involve multiple objects with specific attributes and relationships.

Common failures include:

  1. Attribute Leakage: If you ask for "a yellow book and a red vase," the model might give you a red book or a yellow vase.
  2. Missing Objects: In crowded scenes, the model simply forgets to include certain requested items.
  3. Relationship Confusion: Models struggle to place objects accurately in space (e.g., "on the left of") or handle interactions (e.g., "holding").

The authors argue that these models fail because they try to generate the entire complex scene in a single, "one-shot" step.

CompAgent prevents attribute leakage, ensuring objects like a red vase and a yellow vase maintain their intended colors independently.

Methodology: The Divide-and-Conquer Strategy

The authors propose CompAgent, which adopts a divide-and-conquer strategy coordinated by an LLM agent (like GPT-4). The process follows four main stages:

  1. Decomposition: The LLM "brain" parses the prompt into a structured list of individual objects, their specific attributes (color, shape, texture), and a predicted scene layout (bounding boxes).
  2. Planning and Tool Use: Instead of one model doing everything, the agent selects the best tool for the job from a library, including tuning-free multi-concept customization to ensure attribute fidelity and layout-to-image generation for spatial priority.
  3. Verification: A Vision-Language Model (VLM) like GPT-4V acts as a critic, looking at the generated image and checking if the attributes match the original prompt.
  4. Self-Correction: If the critic finds an error, the agent invokes a Local Image Editing tool using Grounding DINO and SAM to segment the incorrect object and replace it with the correct version via DDIM inversion.

Key Insights: LLMs as Architects and Critics

  • LLMs as Scene Architects: The paper demonstrates that LLMs are surprisingly good at translating text into spatial coordinates (bounding boxes), providing a much-needed "blueprint" that diffusion models struggle to create internally.
  • The Power of the Critic: The "self-correct" loop is the "aha moment." By mimicking a human workflow—look at the draft, find the mistake, fix just that spot—the system overcomes the inherent stochasticity of diffusion models.
  • Training-Free Flexibility: Because CompAgent is a modular framework using pre-trained models, it doesn't require expensive fine-tuning.

Performance and Results

CompAgent achieved over 10% improvement on the T2I-CompBench benchmark compared to previous state-of-the-art methods. In specific categories like "Color" and "Shape" attribute binding, CompAgent outperformed DALL-E 3, which is widely considered the industry gold standard for prompt following. Ablation studies showed that adding the "Verification" step alone improved the "Complex" prompt score by nearly 5%, proving that the self-correction loop is vital.

A complex scene generated by CompAgent, demonstrating precise control over multiple objects, colors, and spatial relationships.

Limitations and Future Directions

Despite its success, CompAgent faces challenges with inference latency due to the multi-step pipeline and heavy agent dependency on the underlying LLM's reasoning capabilities. Very complex non-spatial interactions (e.g., "a cat knitting a sweater") also remain difficult. Future work will focus on optimizing pipeline speed and expanding the tool library for more nuanced physical interactions.

Summary updated

BibTeX
@misc{wang2024divide,
  author = {Zhenyu Wang and Enze Xie and Aoxue Li and Zhongdao Wang and Xihui Liu and Zhenguo Li},
  title = {{Divide and Conquer: Language Models can Plan and Self-Correct for Compositional Text-to-Image Generation}},
  year = {2024},
  eprint = {2401.15688},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2401.15688},
}
Figure