Why Settle for Mid: A Probabilistic Viewpoint to Spatial Relationship Alignment in Text-to-image Models

Parham Rezaei, Arash Marioriyad, Mahdieh Soleymani Baghshah, Mohammad Hossein Rohban

Abstract

Despite the ability of text-to-image models to generate high-quality, realistic, and diverse images, they face challenges in compositional generation, often struggling to accurately represent details specified in the input prompt. A prevalent issue in compositional generation is the misalignment of spatial relationships, as models often fail to faithfully generate images that reflect the spatial configurations specified between objects in the input prompts. To address this challenge, we propose a novel probabilistic framework for modeling the relative spatial positioning of objects in a scene, leveraging the concept of Probability of Superiority (PoS). Building on this insight, we make two key contributions. First, we introduce a novel evaluation metric, PoS-based Evaluation (PSE), designed to assess the alignment of 2D and 3D spatial relationships between text and image, with improved adherence to human judgment. Second, we propose PoS-based Generation (PSG), an inference-time method that improves the alignment of 2D and 3D spatial relationships in T2I models without requiring fine-tuning. PSG employs a PoS-based reward function that can be utilized in two distinct ways: (1) as a gradient-based guidance mechanism applied to the cross-attention maps during the denoising steps, or (2) as a search-based strategy that evaluates a set of initial noise vectors to select the best one. Extensive experiments demonstrate that the PSE metric exhibits stronger alignment with human judgment compared to traditional center-based metrics, providing a more nuanced and reliable measure of complex spatial relationship accuracy in text-image alignment. Furthermore, PSG significantly enhances the ability of text-to-image models to generate images with specified spatial configurations, outperforming state-of-the-art methods across multiple evaluation metrics and benchmarks.

Introduction

Modern text-to-image (T2I) diffusion models, such as Stable Diffusion and DALL-E 3, have achieved remarkable success in generating high-fidelity images. However, these models frequently struggle with "compositional generation," where the spatial relationships between multiple objects must be precisely maintained. A common failure mode involves the model misinterpreting prompts like "a cat to the left of a bowl," either omitting objects or placing them in incorrect relative positions.

The Probability of Superiority (PoS) Framework

A primary obstacle in addressing spatial misalignment is the limitation of current evaluation metrics. Traditional metrics, such as VISOR, rely on "center-based" logic, checking if the center of one object's bounding box satisfies a spatial constraint relative to another. This approach is often a crude approximation that fails for objects with non-uniform shapes or varying sizes. Moreover, these discrete, non-differentiable rules cannot easily serve as reward signals to guide the generative process.

Comparison of spatial alignment between baseline SDXL and SDXL + PSG for the prompt "a sheep behind a plate".

To overcome this, we introduce a framework based on the Probability of Superiority (PoS). By treating objects as probability distributions over space rather than single points, we can calculate the likelihood that one object is "superior" to another along a specific axis. This provides a continuous, differentiable measure of spatial alignment.

Methods: PSE and PSG

Leveraging the PoS framework, we propose two primary tools:

  1. PoS-based Evaluation (PSE): A metric that uses Grounded SAM for segmentation and Depth Anything for 3D depth estimation. PSE calculates spatial alignment by sampling points across the entire object mask, resulting in a metric that aligns more closely with human perception.
  2. PoS-based Generation (PSG): A training-free inference-time method. PSG can be implemented as Generative Semantic Nursing, which uses PoS gradients to nudge cross-attention maps during denoising, or as a Search-Based strategy that selects the best initial noise vector from a candidate set.

Experimental Results

Our experiments demonstrate that PSE achieves a Spearman correlation of approximately 0.75 with human judgment, significantly higher than the 0.55 achieved by center-based metrics. In terms of generation, applying PSG to SDXL yielded a 15% improvement on the T2I-CompBench benchmark and a 30% boost on the VISOR uncond metric.

Comparison of spatial alignment between baseline SDXL and SDXL + PSG for the prompt "a cow behind a computer monitor".

Crucially, these improvements in spatial accuracy do not come at the cost of image quality or diversity, as confirmed by FID and CMMD scores. PSG allows existing models to achieve state-of-the-art spatial reasoning without the need for expensive fine-tuning.

Conclusion and Future Work

While PSG significantly enhances spatial alignment, it remains dependent on the accuracy of external segmentation and depth models. Furthermore, the underlying CLIP text encoder remains a bottleneck for understanding highly complex spatial prompts. Future research will explore applying the PoS framework directly to text encoders to improve foundational spatial understanding.

Summary updated

BibTeX
@article{rezaei2025why,
  author = {Parham Rezaei and Arash Marioriyad and Mahdieh Soleymani Baghshah and Mohammad Hossein Rohban},
  title = {{Why Settle for Mid: A Probabilistic Viewpoint to Spatial Relationship Alignment in Text-to-image Models}},
  journal = {Accepted by TMLR},
  year = {2025},
  url = {https://openreview.net/forum?id=mFlanJKVFD},
}
Figure