Getting it Right: Improving Spatial Consistency in Text-to-Image Models

Agneet Chatterjee, Gabriela Ben Melech Stan, Estelle Aflalo, Sayak Paul, Dhruba Ghosh, Tejas Gokhale, Ludwig Schmidt, Hannaneh Hajishirzi, Vasudev Lal, Chitta Baral, Yezhou Yang

Abstract

Current text-to-image (T2I) models frequently fail at basic spatial reasoning, often ignoring prepositional phrases like "left of" or "behind." This paper introduces SPRIGHT, the first large-scale dataset (6 million images) focused on spatial relationships. By leveraging synthetic re-captioning and object-centric filtering, the authors demonstrate that fine-tuning on as few as 500 high-quality images can achieve state-of-the-art spatial consistency without degrading image quality.

Introduction: The Spatial Hallucination Problem

Despite the impressive photorealism of models like Stable Diffusion and DALL-E 3, they suffer from persistent "spatial hallucinations." When prompted for a specific arrangement of objects, models often fail to correctly place them. The authors argue this is a data bottleneck: standard vision-language datasets (e.g., LAION, COCO) use captions that describe what is in an image but rarely where objects are located relative to one another. Because models rarely encounter consistent spatial logic during training, they fail to learn it.

The SPRIGHT Dataset

To solve this, the researchers developed SPRIGHT (Spatially RIGHT). They utilized a large multimodal model (LLaVA-1.5-13B) to re-caption 6 million images from existing datasets, specifically instructing the model to describe spatial relationships and relative sizes.

Comparison between original COCO captions (red) and spatially-dense SPRIGHT captions (green).

As illustrated in the comparison above, SPRIGHT captions provide a much denser signal regarding object positioning (e.g., "between," "next to," "behind") compared to the brief, object-centric descriptions found in original datasets.

Overcoming the Data Bottleneck

The quantitative impact of this re-captioning is significant. In standard datasets, spatial terms like "left," "right," or "above" appear in a negligible fraction of captions. By applying the SPRIGHT pipeline, the prevalence of these terms increases by orders of magnitude across multiple data sources.

Percentage of spatial phrases across major datasets before and after SPRIGHT re-captioning.

This increase in spatial phrase density allows models to learn the underlying logic of prepositions that were previously treated as noise during training.

Methodology and Key Insights

The researchers employed a three-step pipeline: synthetic re-captioning, object-centric filtering, and efficient fine-tuning of Stable Diffusion v2.1.

The "Many-Object" Cheat Code

A pivotal discovery was that training on images with a high object count (>18) significantly boosts spatial reasoning. Complex scenes force the model to manage "crowded" latent spaces, which improves its ability to handle even simple spatial prompts.

Quality and Efficiency

The study found that massive scale isn't always necessary. Using just 0.25% of the SPRIGHT dataset—specifically high-quality, object-dense images—resulted in a 22% improvement in spatial accuracy. Furthermore, fine-tuning the CLIP text encoder alongside the U-Net proved essential for helping the model differentiate between spatially swapped prompts (e.g., "A above B" vs. "B above A").

Results and Performance

By fine-tuning on only 444 images with high object counts, the authors achieved a spatial score of 0.2133 on T2I-CompBench, surpassing much larger models. Overall, the best-performing model showed a 41% improvement in spatial consistency over the baseline. Notably, these gains did not come at the cost of image quality; both FID and CMMD scores improved, indicating that the models became more accurate without losing photorealism.

Limitations and Future Outlook

While SPRIGHT represents a major step forward, challenges remain. Models still struggle with negative constraints (e.g., "a dog not to the left of a cat"). Additionally, because the dataset relies on synthetic captions, any inherent model hallucinations from the captioner are present in the training data. Future research will focus on scaling these spatial improvements to larger foundational models like SDXL.

Project Page: https://spright-t2i.github.io/

Summary updated

BibTeX
@inproceedings{chatterjee2024getting,
  author = {Agneet Chatterjee and Gabriela Ben Melech Stan and Estelle Aflalo and Sayak Paul and Dhruba Ghosh and Tejas Gokhale and Ludwig Schmidt and Hannaneh Hajishirzi and Vasudev Lal and Chitta Baral and Yezhou Yang},
  title = {{Getting it Right: Improving Spatial Consistency in Text-to-Image Models}},
  booktitle = {European Conference on Computer Vision},
  year = {2024},
  doi = {10.1007/978-3-031-72670-5\_12},
}
Figure