AgentComp: From Agentic Reasoning to Compositional Mastery in Text-to-Image Models

Arman Zarei, Jiacheng Pan, Matthew Gwilliam, Soheil Feizi, Zhenheng YangarXiv 2025 · DOI

Introduction

Modern text-to-image (T2I) models like FLUX and Stable Diffusion have reached unprecedented levels of visual fidelity. However, they frequently struggle with compositionality—the ability to correctly bind attributes (like color or texture) to specific objects and manage spatial relationships or numerical constraints. For instance, a prompt for "a green cow and a brown banana" often results in a brown cow or a green banana due to "attribute binding" errors.

AgentComp introduces a novel framework that addresses these failures by teaching models to distinguish between correct generations and "near-miss" errors. By leveraging an LLM-based agentic workflow to curate high-quality contrastive datasets and applying a distance-aware preference optimization, AgentComp achieves state-of-the-art results in compositional accuracy without compromising aesthetic quality.

Comparison of base models (FLUX, SDv3.5) vs. AgentComp-enhanced versions across complex compositional prompts.

The Challenge of Compositionality

The researchers argue that the root cause of compositional failure is a lack of explicit training signals. Standard training focuses on what an image should look like, but it does not teach the model to avoid "visually similar but compositionally incorrect" outputs. During the denoising process, a model's trajectory can easily drift toward these near-miss errors because it has never been penalized for them. To solve this, AgentComp focuses on generating and training on "hard negatives"—images that are almost correct but fail on a specific, subtle detail.

The AgentComp Framework

The framework consists of two primary components: Agentic Contrastive Dataset Generation and Agentic Preference Optimization (APO).

1. Agentic Contrastive Dataset Generation

Instead of relying on noisy web-scraped data, the authors use a GPT-4 "orchestrator" to manage three specialized tools:

  • Image Generation Agent: Iteratively creates and edits an initial image using Visual Question Answering (VQA) feedback until it perfectly matches the prompt.
  • Contrastive Prompt/Image Agent: Deliberately creates "negative" prompts (e.g., changing a color or removing an object) and uses image-editing tools to produce a corresponding negative image that is visually nearly identical to the positive one.
  • Distance Estimator: Ranks these negatives based on the number of "atomic edits" separating them from the original, identifying the most challenging samples for the model.

2. Agentic Preference Optimization (APO)

The authors adapted Direct Preference Optimization (DPO) for diffusion models, introducing a distance-aware scaling function. This function weights the training loss to prioritize "hard negatives." By focusing on samples near the decision boundary, the model is forced to learn the fine-grained boundaries of the prompt, similar to how Support Vector Machines (SVMs) utilize support vectors.

Experimental Results

AgentComp was evaluated on several industry-standard benchmarks, including T2I-CompBench, GenEval, and TIFA. When applied to the FLUX-dev model, the framework yielded significant improvements:

  • Attribute Binding: Color alignment improved from 0.77 to 0.87, and shape alignment rose from 0.51 to 0.66 on T2I-CompBench.
  • Numeracy: The ability to count objects correctly increased from 0.61 to 0.73.
  • Text Rendering: Performance on OCR tasks jumped from 0.60 to 0.76, despite no explicit text-rendering training.
Detailed view of the 'Three glass bottles' prompt, demonstrating precise attribute binding, internal object placement, and text rendering.

Crucially, the method proved to be model-agnostic, showing consistent gains across various architectures including SDv2, SDXL, and SDv3.5. Unlike many fine-tuning methods that sacrifice aesthetic quality for alignment, AgentComp actually improved aesthetic scores (e.g., PickScore), likely due to the high-fidelity nature of the agent-curated training data.

Conclusion

AgentComp demonstrates that the path to compositional mastery in T2I models lies in high-quality, agent-curated contrastive data and preference optimization that respects the distance between "correct" and "near-miss" samples. By focusing on the most difficult-to-classify examples, AgentComp pushes the boundaries of how faithfully AI can translate complex human language into precise visual representations.

Summary updated

BibTeX
@misc{zarei2025agentcomp,
  author = {Arman Zarei and Jiacheng Pan and Matthew Gwilliam and Soheil Feizi and Zhenheng Yang},
  title = {{AgentComp: From Agentic Reasoning to Compositional Mastery in Text-to-Image Models}},
  year = {2025},
  eprint = {2512.09081},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2512.09081},
}
Figure