Organizations: Tianyu Wang is with the Zhiyuan College, Shanghai Jiao Tong University · Zhiyuan Ma is with the Huazhong University of Science and Technology · Qian Wang is with the National University of Singapore · Xinyi Zhang is with the Shanghai Jiao Tong University · Xinwei Long is with the Tsinghua University · Bowen Zhou is with the Tsinghua University & Shanghai AI Laboratory
Recent advancements in image generation have achieved impressive results in producing high-quality images. However, existing image generation models still generally struggle with a spatial reasoning dilemma, lacking the ability to accurately capture fine-grained spatial relationships from the prompt and correctly generate scenes with structural integrity. To mitigate this dilemma, we propose RL-RIG, a Reinforcement Learning framework for Reflection-based Image Generation. Our architecture comprises four primary components: Diffuser, Checker, Actor, and Inverse Diffuser, following a Generate-Reflect-Edit paradigm to spark the Chain of Thought reasoning ability in image generation for addressing the dilemma. To equip the model with better intuition over generation trajectories, we further develop Reflection-GRPO to train the VLM Actor for edit prompts and the Image Editor for better image quality under a given prompt, respectively. Unlike traditional approaches that solely produce visually stunning yet structurally unreasonable content, our evaluation metrics prioritize spatial accuracy, utilizing Scene Graph IoU and employing a VLM-as-a-Judge strategy to assess the spatial consistency of generated images on LAION-SG dataset. Experimental results show that RL-RIG outperforms existing state-of-the-art open-source models by up to 11% in terms of controllable and precise spatial reasoning in image generation.
Figures & tables
Fig. 1: Comparison of the generated image by Stable Diffusion 3.5 Large, Flux 1.0, RL-RIG (choosing Flux as base model) , and the ground truth image, given a sophisticated prompt with spatial relationships. Our method captures the relations in blue better, and compensates for the deficiencies in Flux’s results. Actually, even the ground truth image does not comply to all the given relationships in the annotation.
Fig. 2: The overview of RL-RIG. The generation phase abides a Generate-Reflect-Edit paradigm; the training phase aims at shifting trajectories, assigning greater probabilities for positive trajectories while discouraging negative trajectories.
Name
Overall
1 object
2 objects
Counting
Colors
Position
Color attribution
CLIP retrieval
0.35
0.89
0.22
0.37
0.62
0.03
0.00
minDALL-E
0.23
0.73
0.11
0.12
0.37
0.02
0.01
SD v1.5
0.43
0.97
0.38
0.35
0.76
0.04
0.06
SD v2.1
0.50
0.98
0.51
0.44
0.85
0.07
0.17
SD-XL
0.55
0.98
0.74
0.39
0.85
0.15
0.23
IF-XL
0.61
0.97
0.74
0.66
0.81
0.13
0.35
TABLE I: Comparison of different models on GenEval dataset. The highest score for each metric is bolded .
Method
SG-IoU
Ent-IoU
Rel-IoU
Qwen-Judge
GPT-Judge
SD3.5 Large
0.3135 ± 0.0071
0.8788 ± 0.0010
0.7650 ± 0.0056
0.7785 ± 0.0021
0.7747 ± 0.0046
Flux
0.3461 ± 0.0078
0.9079 ± 0.0011
0.7695 ± 0.0074
0.8012 ± 0.0018
0.8100 ± 0.0045
Flux + RL
0.3445 ± 0.0057
0.9214 ± 0.0026
0.7937 ± 0.0047
0.6647 ± 0.0085
0.6484 ± 0.0034
LAION-SG
0.2693 ± 0.0060
0.7789 ± 0.0023
0.6811 ± 0.0069
0.6360 ± 0.0043
0.6331 ± 0.0032
RL-RIG (w/o RL)
0.3702 ± 0.0097
0.9319 ± 0.0033
0.8006 ± 0.0053
0.7931 ± 0.0048
0.7648 ± 0.0048
RL-RIG (w RL)
0.3644 ± 0.0077
0.9365 ± 0.0031
0.8015 ± 0.0065
0.8269 ± 0.0053
0.8401 ± 0.0063
TABLE II: Comparison of different models on LAION-SG dataset. The variance is obtained by running the judger 10 times. The highest score for each metric is bolded , and the second highest score is underlined .
Fig. 3: Ambiguous generation examples where judges disagree.
Fig. 4: The relationship between edit iterations, time, accuracy, and aesthetic quality.
Fig. 5: A succeeded trial of image generation by RL-RIG, with the input prompt (id=523378) and the reasoning process. After reflection, the actor successfully guides the Image Editor to add a two-wheeled vehicle in front of the black car.
Fig. 6: The Generate-Reflect-Edit framework, explained in a trajectory view. In each generation process, one of the possible trajectories is selected according to the random seeds. The VLM Checker will then reflect and check whether all parts of the prompt are satisfied. If not, the VLM Actor will provide an edit prompt and pass it to editor. Given the edit prompt, the Image Editor will perform inversion and reversion to explore a new possible trajectory. Dashed branches denote low - advantage trajectories pruned by GRPO. The ‘Inversion’ is actually performed in Edit stage.
Appendix figures & tables3 assets
Supplementary material from the paper’s appendix.
Appendix
Fig. 7: Illustration of two-phase training. For each phase a batch of responses are sampled, and group advantage is calculated by GRPO.
Fig. 8: A failure trial with the same prompt. In the first and second rounds, although the actor provides seemingly correct edit prompts based on feedback, the Image Editor fails to migrate old elements to the new prompts. In the third round, the Image Editor fails to make any changes, resulting in a vague image that it is unable to properly interpret or refine. From our observations, most failure cases are caused by the Image Editor’s inability to handle the vague outputs it produces itself.
Recent progress in text-to-image generation has greatly advanced visual fidelity and creativity, but it has also imposed higher demands on prompt complexity-particularly in encoding intricate spatial relationships. In such cases, achieving satisfactory results often requires multiple sampling attempts. To address this challenge, we introduce a novel method that strengthens the spatial understanding of current image generation models. We first construct the SpatialReward-Dataset with over 80k preference pairs. Building on this dataset, we build SpatialScore, a reward model designed to evaluate the accuracy of spatial relationships in text-to-image generation, achieving performance that even surpasses leading proprietary models on spatial evaluation. We further demonstrate that this reward model effectively enables online reinforcement learning for the complex spatial generation. Extensive experiments across multiple benchmarks show that our specialized reward model yields significant and consistent gains in spatial understanding for image generation.
Reinforcement learning (RL) is promising for spatial text-to-image generation, but existing work largely focuses on policy optimization, assuming accurate rewards and effective online rollouts. We observe in-domain gains with out-of-domain degradation, exposing two limitations: unreliable spatial rewards in open-world settings and rollouts lacking basic-to-complex progression. We propose a curriculum-guided RL framework. First, we introduce SpatialCritic, an agentic reward model equipped with a spatial perception harness that combines reusable verification guidance with specialized vision tools. We then construct spatial preference datasets through targeted counterfactual perturbations and perform agent-harness alignment to improve tool selection and evidence integration efficiently. Second, curriculum learning organizes shared foundational capabilities and their compositional dependencies in a capability graph for mastery-guided rollouts, periodic review, and targeted remediation. On SpaRW-Eval, SpatialCritic achieves 95.1% verification accuracy, outperforming 320B GLM-5.3-Flash with a 40x smaller 8B backbone and raising average baseline scores from 78.4 to 83.9 on SD3.5-Medium and 83.2 to 86.5 on BAGEL. Project page: https://xiaofeng-tan.github.io/projects/spatialcritic/
Recent advances in text-to-image (T2I) generation via reinforcement learning (RL) have benefited from reward models that assess semantic alignment and visual quality. However, most existing reward models pay limited attention to fine-grained spatial relationships, often producing images that appear plausible overall yet contain inaccuracies in object positioning. In this work, we present SpatialReward, a verifiable reward model explicitly designed to evaluate spatial layouts in generated images. SpatialReward adopts a multi-stage pipeline: a Prompt Decomposer extracts entities, attributes, and spatial metadata from free-form prompts; expert detectors provide accurate visual grounding of object positions and attributes; and a vision-language model applies chain-of-thought reasoning over grounded observations to assess complex spatial relations that are challenging for rule-based methods. To more comprehensively evaluate spatial relationships in generated images, we introduce SpatRelBench, a benchmark covering object attributes, orientation, inter-object relations, and rendered text placement. Experiments on Stable Diffusion and FLUX show that incorporating SpatialReward into RL training consistently improves spatial consistency and overall generation quality, with results aligned more closely to human judgments. These findings indicate that verifiable reward models hold considerable potential for enabling more accurate and controllable optimization in text-to-image generation models.
Sashuai Zhou, Qiang Zhou, Junpeng Ma +9
Zhejiang University · Alibaba Group · Fudan University