Data-Driven Loss Functions for Inference-Time Optimization in Text-to-Image
On the map: Diffusion models → Image generation, text-to-image and editing
Abstract (arXiv)
Text-to-image diffusion models can generate stunning visuals, yet they often fail at tasks children find trivial--like placing a dog to the right of a teddy bear rather than to the left. When combinations get more unusual--a giraffe above an airplane--these failures become even more pronounced. Existing methods attempt to fix these spatial reasoning failures through model fine-tuning or test-time optimization with handcrafted losses that are suboptimal. Rather than imposing our assumptions about spatial encoding, we propose learning these objectives directly from the model's internal representations. We introduce Learn-to-Steer, a novel framework that learns data-driven objectives for test-time optimization rather than handcrafting them. Our key insight is to train a lightweight classifier that decodes spatial relationships from the diffusion model's cross-attention maps, then deploy this classifier as a learned loss function during inference. Training such classifiers poses a surprising challenge: they can take shortcuts by detecting linguistic traces in the cross-attention maps, rather than learning true spatial patterns. We solve this by augmenting our training data with samples generated using prompts with incorrect relation words, which encourages the classifier to avoid linguistic shortcuts and learn spatial patterns from the attention maps. Our method dramatically improves spatial accuracy: from 20% to 61% on FLUX.1-dev and from 7% to 54% on SD2.1 across standard benchmarks. It also generalizes to multiple relations with significantly improved accuracy.
Key facts. Cited by 3 papers in the map (data through 14 Oct 2026). Placed in Image generation, text-to-image and editing, one of 14 directions in Diffusion models. Builds on 41 of its 59 references that are in the map. First posted on arXiv 2 Sep 2025.
Builds on
41 of 59 references.
Closest ancestors · 24
Same direction, newest first
- 2025Spatial Transport Optimization by Repositioning Attention Map for Training-Free Text-to-Image Synthesis28 Mar
- 2025Reflect-DiT: Inference-Time Scaling for Text-to-Image Diffusion Transformers via In-Context Reflection15 Mar
- 2024CoMPaSS: Enhancing Spatial Understanding in Text-to-Image Diffusion Models17 Dec
- 2024Progressive Compositionality in Text-to-Image Generative Models22 Oct
- 2024Semantic Image Inversion and Editing using Rectified Stochastic Differential Equations14 Oct
- 2024Make It Count: Text-to-Image Generation with an Accurate Number of Objects14 Jun
- 2024InitNO: Boosting Text-to-Image Diffusion Models via Initial Noise Optimization6 Apr
- 2024Relation Rectification in Diffusion Model29 Mar
- 2023Lightning-Fast Image Inversion and Editing for Text-to-Image Diffusion Models19 Dec
- 2023CONFORM: Contrast is All You Need For High-Fidelity Text-to-Image Diffusion Models11 Dec
- 2023Reason out Your Layout: Evoking the Layout Master from Large Language Models for Text-to-Image Synthesis28 Nov
- 2023GenEval: An Object-Focused Framework for Evaluating Text-to-Image Alignment17 Oct
12 more
- 2023Divide & Bind Your Attention for Improved Generative Semantic Nursing20 Jul
- 2023Divide, Evaluate, and Refine: Evaluating and Improving Text-to-Image Alignment with Iterative VQA Feedback10 Jul
- 2023A-STAR: Test-time Attention Segregation and Retention for Text-to-image Synthesis26 Jun
- 2023Linguistic Binding in Diffusion Models: Enhancing Attribute Correspondence through Attention Map Alignment15 Jun
- 2023Grounded Text-to-Image Synthesis with Attention Refocusing8 Jun
- 2023SceneGenie: Scene Graph Guided Diffusion Models for Image Synthesis28 Apr
- 2023Harnessing the Spatial-Temporal Attention of Diffusion Models for High-Fidelity Text-to-Image Synthesis7 Apr
- 2023Adding Conditional Control to Text-to-Image Diffusion Models10 Feb
- 2023Attend-and-Excite: Attention-Based Semantic Guidance for Text-to-Image Diffusion Models31 Jan
- 2023GLIGEN: Open-Set Grounded Text-to-Image Generation17 Jan
- 2022DreamBooth: Fine Tuning Text-to-Image Diffusion Models for Subject-Driven Generation25 Aug
- 2022Compositional Visual Generation with Composable Diffusion Models3 Jun
Other references · 17
- 2017Attention Is All You Needcited by 60,361
- 2021Learning Transferable Visual Models From Natural Language Supervisioncited by 33,744
- 2021High-Resolution Image Synthesis with Latent Diffusion Modelscited by 18,863
- 2015Domain-Adversarial Training of Neural Networkscited by 3,044
- 2025Flow-GRPO: Training Flow Matching Models via Online RLcited by 661
- 2021Image Segmentation Using Text and Image Promptscited by 512
- 2023Training-Free Layout Control with Cross-Attention Guidancecited by 313
- 2024MIGC: Multi-Instance Generation Controller for Text-to-Image Synthesiscited by 124
- 2024ReNO: Enhancing One-step Text-to-Image Models through Reward-based Noise Optimizationcited by 119
- 2024Golden Noise for Diffusion Models: A Learning Frameworkcited by 92
- 2020A causal view of compositional zero-shot recognitioncited by 78
- 2019Learning Canonical Representations for Scene Graph to Image Generationcited by 60
5 more
- 2020Compositional Video Synthesis with Action Graphscited by 34
- 2024Getting it Right: Improving Spatial Consistency in Text-to-Image Modelscited by 30
- 2024Evaluating the Generation of Spatial Relations in Text and Image Generative Modelscited by 6
- 2025InstanceGen: Image Generation with Instance-level Instructionscited by 6
- 2025Fine-Grained Alignment and Noise Refinement for Compositional Text-to-Image Generationcited by 4
Built on by
Citing papers per year: 2026: 3.
3 papers.
- 2026Advances in GRPO for Generation Models: A Surveycited by 2
- 2026Rethinking Global Text Conditioning in Diffusion Transformerscited by 0
- 2026Compositional Video Generation via Inference-Time Guidancecited by 0
- 2026Compositional Video Generation via Inference-Time Guidance14 May 2026
- 2026Advances in GRPO for Generation Models: A Survey21 Feb 2026
- 2026Rethinking Global Text Conditioning in Diffusion Transformers9 Feb 2026
Similar, not cited
Close in wording, no citation either way
- 2024Enhancing Semantic Fidelity in Text-to-Image Synthesis: Attention Regulation in Diffusion Models
- 2025InfSplign: Inference-Time Spatial Alignment of Text-to-Image Diffusion Models
- 2023Semantic Guidance Tuning for Text-To-Image Diffusion Models
- 2024Enhancing Image Layout Control with Loss-Guided Diffusion Models
- 2025Universal Few-Shot Spatial Control for Diffusion Models
- 2026Not all tokens contribute equally to diffusion learning
- 2022Sketch-Guided Text-to-Image Diffusion Models
- 2024Training-Free Layout-to-Image Generation with Marginal Attention Constraints