Introduction
State-of-the-art text-to-image (T2I) models like SDXL and Flux produce visually impressive results but often struggle with "literacy" tasks. When prompts involve multiple objects, these models frequently fail to maintain correct counts, suffer from attribute leakage (where traits of one object bleed into another), and exhibit spatial confusion. InstanceGen is a training-free, inference-time technique designed to overcome these limitations by using Large Language Models (LLMs) to guide the generation process at an instance level.
Methodology: A Four-Stage Pipeline
InstanceGen operates by leveraging the model's own internal "rough draft" rather than forcing it into predefined bounding boxes. The process follows four key stages:
- Prompt Parsing: An LLM (Llama 3.3) decomposes the user prompt into a structured JSON format, identifying specific objects, quantities, and attributes.
- Instance Layout Generation: The system generates an initial "anchor" image and extracts cross-attention maps. Off-the-shelf segmentation tools (Mask R-CNN and SAM2) then create a precise map of every object instance.
- Instance Assignment: The LLM performs a logic check, mapping parsed prompt attributes to specific segments in the layout (e.g., "the person on the far left is a doctor").
- Assignment Conditioned Generation: The model restarts generation using specialized Attention Losses and Masking to ensure "word energy" is confined to the correct segments.
Key Insights and Results
By using the model's natural composition as a starting point, InstanceGen achieves higher realism than methods relying on external layout generation. The LLM acts as a spatial reasoner, coordinating complex logic like "the second bird from the left."
Evaluation on benchmarks like DrawBench, GenEval, and the new CompoundPrompts shows significant improvements:
- Spatial Accuracy: InstanceGen achieved 0.67 on DrawBench, far surpassing SDXL's 0.19.
- Complex Composition: On the most difficult tier of CompoundPrompts (Tier C), InstanceGen reached a VQA Accuracy of 0.50, outperforming Flux1-dev (0.38) and SDXL (0.11).
Limitations and Future Work
While effective, InstanceGen is computationally intensive, requiring approximately 5 minutes per image on an NVIDIA H100 due to the inference-time optimization loop. Additionally, the current 2D logic can struggle with depth-based instructions (front vs. back). Future work aims to incorporate depth estimation and improve optimization speed.
Summary updated