Research
Enhancing Spatial Understanding in Image Generation via Reward Modeling
Overview Research area: Computer vision / generative modeling — specifically reinforcement learning (RL) post-training of text-to-image diffusion models, with a focus on reward modeling for spatial re
- arXiv
- 2602.24233
- Published
- 2026-02-27
- Authors
- Zhenyu Tang, Chaoran Feng, Yufan Deng, Jie Wu, Xiaojie Li, Rui Wang, Yunpeng Chen, Daquan Zhou
AI summary
Overview
Research area: Computer vision / generative modeling — specifically reinforcement learning (RL) post-training of text-to-image diffusion models, with a focus on reward modeling for spatial reasoning.
Technical level: Intermediate. The paper assumes familiarity with diffusion/flow-matching sampling, GRPO-style policy optimization, and vision-language model architectures, though the core ideas are explained clearly enough for readers with a machine learning background.
Scope: The paper builds a human-verified preference dataset and a specialized reward model (SpatialScore) that judges whether generated images correctly render complex multi-object spatial relationships, then uses that reward model to run online RL on a text-to-image base model.
What This Paper Is About
Text-to-image models produce visually impressive results but frequently fail on prompts describing intricate spatial arrangements among several objects, often requiring many sampling attempts to get a correct layout. Reinforcement learning could fix this, but only if something can reliably score whether an image got the spatial relationships right — and the authors show that existing reward models and even strong open-source vision-language models do this poorly. The paper's goal is to build a trustworthy spatial reward signal and demonstrate that online RL driven by it measurably improves spatial understanding in generated images.
Key Contributions
-
SpatialReward-Dataset — 80,000 adversarial preference pairs covering diverse real-world scenes, built by having GPT-5 generate prompts with complex multi-object spatial relations and then create perturbed versions that alter one or more of those relations. Images are produced by Qwen-Image, HunyuanImage-2.1, and Seedream 4.0, with every pair manually reviewed and filtered.
-
SpatialScore — a reward model built by fine-tuning Qwen2.5-VL-7B with LoRA. A special
<reward>token's final-layer embedding is projected by a reward head into the mean and standard deviation of a Gaussian, trained with a Bradley-Terry pairwise preference loss. It reaches 95.8% pairwise accuracy, exceeding GPT-5 and Gemini-2.5 Pro on this spatial benchmark. -
A top-k filtering strategy for GRPO — during online RL, the group's mean and standard deviation are computed only from the top-k and bottom-k scoring samples (a balanced subset of 2k out of a group of 24). This counters advantage bias, where easy prompts assign negative advantages to genuinely good samples, and cuts function evaluations during policy updates from 24×6 to 12×6.
-
Empirical validation of reward-guided RL — applying SpatialScore to FLUX.1-dev produces large in-domain gains and consistent out-of-domain gains on DPG-Bench, TIIF-Bench, and UniGenBench++, while a Flow-GRPO baseline trained on the rule-based GenEval reward degrades on long, complex prompts.
Main Findings
-
Existing reward models cannot judge spatial correctness. Human-preference reward models (ImageReward, PickScore, HPSv2.1, UnifiedReward, HPSv3) and VQA-style models (VQAScore) hover around 0.46–0.65 pairwise accuracy on the authors' 365-pair benchmark — below chance-level usefulness for spatially complex prompts. Several assign higher scores to spatially wrong images than correct ones.
-
Open-source VLMs scale but remain unreliable. Qwen2.5-VL improves with size (0.572 at 7B, 0.644 at 32B, 0.764 at 72B) yet still trails proprietary models and exhibits hallucinations on multi-object spatial reasoning.
-
SpatialScore outperforms proprietary models at 7B scale. Overall preference accuracy: SpatialScore 0.958, Gemini-2.5 Pro 0.951, GPT-5 0.890. On the harder 2–3 perturbation subset the gap widens (0.978 vs 0.968 and 0.924). It is also cheap enough for the frequent queries online RL requires.
-
Reward-guided RL substantially improves generation. On in-domain SpatialScore evaluation, FLUX.1-dev rises from 2.18 to 7.81. DPG-Bench relation-spatial goes 0.871 to 0.932; TIIF-Bench long-prompt attribute+relation goes 0.584 to 0.647; UniGenBench++ long layout-2D goes 0.819 to 0.891. Flow-GRPO trained on GenEval, by contrast, collapses on long prompts (e.g., 0.445 and 0.405 on UniGenBench++ long).
-
Generalization beyond spatial sub-dimensions. On full DPG-Bench, the method scores 85.03 overall versus 82.91 for base FLUX.1-dev, approaching the proprietary GPT-Image-1 (85.15), while the GenEval-trained variant falls to 57.02.
-
Top-k filtering with k=6 is the sweet spot. k=4 improves early training but stalls from reduced diversity; k=6 gives the best final score (7.81) and matches or beats unfiltered training while halving policy-update compute. Scaling the reward backbone from 3B to 7B lifts accuracy from 89.1% to 95.8%.
-
The reward model transfers across generators. Applying it to Qwen-Image also improves spatial understanding, from 6.74 to 8.25 on the in-domain metric.
Methodology in Plain English
The researchers first needed training data that isolates spatial correctness from aesthetic quality. They used GPT-5 to write prompts containing several objects arranged in specific relative positions, then asked GPT-5 to rewrite each prompt while flipping or moving one or more of those spatial relations and leaving everything else intact. Both prompts were rendered by the same image generation model, so any visible difference between the two images comes from the spatial change rather than from a different generator's style. Human annotators then discarded any pair where the "correct" image did not actually match its prompt, or where the perturbed image looked spatially identical to the correct one. This yields a preference pair: a winner image that respects the spatial constraints, and a loser that violates some of them.
To build the reward model, they took a pretrained vision-language model (Qwen2.5-VL-7B) and attached a small prediction head that reads a special reward token's embedding and outputs the mean and spread of a score distribution. The model is trained so that, given a prompt and two candidate images, it assigns a higher score to the spatially correct one — the standard pairwise preference objective from the Bradley-Terry framework, with the score sampled from the Gaussian to make rankings more robust.
Finally, they plugged this reward model into an online reinforcement learning loop. Because flow-matching generation is normally deterministic, they converted it into an equivalent stochastic sampler so the model could explore multiple candidate images per prompt. A group of 24 images is generated for each prompt, SpatialScore ranks them, and only the best k and worst k are kept. That filtered subset provides the relative advantage signals used to push the policy toward correct spatial layouts and away from incorrect ones. The whole pipeline is trained with LoRA adapters on LoRA adapters, keeping GPU costs manageable (roughly one day for the reward model on eight H20 GPUs, and 32 H20 GPUs for the RL stage).
Why This Matters
Impact on research. The paper reframes spatial reasoning in image generation as a reward-modeling problem rather than a prompt-engineering or architecture problem, and shows that a small, domain-specialized 7B reward model can beat much larger general-purpose proprietary systems at this specific task. It also documents a concrete failure mode of rule-based benchmarks like GenEval — template-bound prompts and detector-sensitive rewards that do not generalize and can actively harm the base model's long-prompt ability. The top-k filtering trick is a general fix for advantage bias in group-relative RL that likely applies beyond image generation.
Real-world applications:
- Advertising and e-commerce imagery, where prompts like "the watch on the left of the box, the card to its right" must be rendered exactly for legal or branding reasons.
- Game and film previsualization, where concept art must match precise scene blocking across many objects and characters.
- Architectural and interior design visualization, where furniture and fixtures must occupy specified positions relative to walls and each other.
- Educational and technical illustration, where diagrams must place labeled elements in the correct relative arrangement to be pedagogically valid.
Industry relevance. Any company running RL post-training on image generators needs a reward signal cheap enough to query thousands of times per training run and accurate enough not to reward the wrong thing. This work delivers an open 80K-pair dataset, an open 7B reward model that outperforms paid APIs on spatial evaluation, and a compute-reduction strategy for the RL loop — all directly usable components rather than only a research demonstration.
Future Directions
-
Scaling and distilling the reward model. The paper reports only a 3B-to-7B reward backbone comparison; whether larger backbones, or distillation from proprietary VLMs into smaller open models, push accuracy further remains untested.
-
Beyond relative position. The evaluation template covers relative positioning between objects, positioning against background, and attribute consistency, but not depth, occlusion, 3D layout, or physically plausible contact between objects. Extending both dataset and reward to these dimensions is a natural next step.
-
Generalizing to non-spatial compositional attributes. Spatial understanding is one axis of prompt following; numeracy, negation, text rendering, and action verbs likely need their own specialized reward models, and whether one unified compositional reward is feasible is an open question.
-
Interaction with base-model capability. The method is demonstrated on FLUX.1-dev (chosen partly because it has not undergone post-training) and Qwen-Image; how much headroom remains on already heavily aligned or proprietary generators, and whether RL on this reward degrades aesthetic quality over long training runs, are unresolved.
Target Audience
Researchers and engineers working on diffusion/flow-based image generation, RLHF-style post-training for multimodal models, or reward model design. It is also relevant to practitioners building production image generation pipelines that must satisfy precise compositional constraints, and to benchmark designers interested in why rule-based evaluation like GenEval fails to capture real-world prompt complexity. Readers without background in RL or vision-language models will find the dataset and evaluation results accessible but will need to consult the references for GRPO and flow-matching details.
Authors’ abstract
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.