Re-Align: Structured Reasoning-guided Alignment for In-Context Image Generation and Editing

Runze He, Yiji Cheng, Tiankai Hang, Zhimin Li, Yu Xu, Zijin Yin, Shiyi Zhang, Wenxun Dai, Penghui Du, Ao Ma, Chunyu Wang, Qinglin Lu, Jizhong Han, Jiao Dai

Abstract

In-context image generation and editing (ICGE) enables users to specify visual concepts through interleaved image-text prompts, demanding precise understanding and faithful execution of user intent. Although recent unified multimodal models exhibit promising understanding capabilities, these strengths often fail to transfer effectively to image generation. We introduce Re-Align, a unified framework that bridges the gap between understanding and generation through structured reasoning-guided alignment. At its core lies the In-Context Chain-of-Thought (IC-CoT), a structured reasoning paradigm that decouples semantic guidance and reference association, providing clear textual target and mitigating confusion among reference images. Furthermore, Re-Align introduces an effective RL training scheme that leverages a surrogate reward to measure the alignment between structured reasoning text and the generated image, thereby improving the model's overall performance on ICGE tasks. Extensive experiments verify that Re-Align outperforms competitive methods of comparable model scale and resources on both in-context image generation and editing tasks.

Introduction: The Understanding-Generation Gap

In-Context Image Generation and Editing (ICGE) represents a significant frontier in creative AI, allowing users to define complex visual tasks using a mix of reference images and text instructions. A typical prompt might involve taking a subject from one image and placing it into a scene described in another.

Figure 4: Demonstration of In-Context Image Generation (ICGE) combining multiple reference subjects and backgrounds into a single output.

While modern multimodal models are adept at parsing these instructions, they often struggle with "reference confusion" during the generation phase—mixing up attributes between input images or failing to maintain subject identity. Re-Align addresses this by introducing a structured reasoning layer that forces the model to "think" before it generates pixels.

Methodology: In-Context Chain-of-Thought (IC-CoT)

The core innovation of Re-Align is the In-Context Chain-of-Thought (IC-CoT). Instead of generating an image directly from a prompt, the model first produces a structured textual plan consisting of two parts:

  1. Semantic Guidance: A detailed <out_caption> that describes the final target image in natural language.
  2. Reference Association: Explicit <relation_i> tags that link specific elements of the target description to the provided input reference images (e.g., "The man's face is derived from image_1").

By using these XML-like tags, the model decouples the complex task of visual synthesis into manageable steps, significantly reducing confusion among multiple reference subjects.

Reinforcement Learning via Surrogate Rewards

To further align the model's reasoning with its generative output, Re-Align employs Group Relative Policy Optimization (GRPO). A key challenge in RL for image generation is the lack of a universal reward model for diverse editing tasks. The authors solve this by using a surrogate reward: measuring the CLIP similarity between the model's own predicted reasoning caption and the final generated image. If the image faithfully reflects the model's internal plan, it receives a higher reward. This "self-consistency" mechanism ensures the model learns to be faithful to its own logical reasoning.

The Re-Align-410K Dataset

To train this framework, the researchers developed Re-Align-410K, a high-quality dataset of 410,000 samples. This was constructed using a teacher-student approach where Gemini 2.5 generated instructions and GPT-4o synthesized target images. A multi-dimensional filtering pipeline was then applied to ensure high aesthetic quality and strict adherence to instructions.

Experimental Results

Re-Align was evaluated against competitive open-source models including BAGEL, OmniGen2, and Qwen-Image-Edit across major benchmarks:

  • OmniContext Benchmark: Re-Align achieved a state-of-the-art average score of 8.21, showing particular strength in "Multiple Subject" and "Scene" tasks where traditional models often fail due to reference confusion.
  • Qualitative Performance: The model excels at complex operations like material replacement and object addition while maintaining the precise identity of reference subjects.
Figure 6: A generation result demonstrating the model's ability to handle complex scene composition and object placement.

Conclusion

Re-Align demonstrates that structured reasoning is a powerful tool for bridging the gap between multimodal understanding and image generation. By forcing models to explicitly associate references and follow a textual plan, Re-Align achieves superior performance in complex, multi-subject generation and editing tasks. Future work may explore "Visual Chain-of-Thought" processes, such as intermediate sketches, to further enhance spatial reasoning capabilities.

Summary updated

BibTeX
@inproceedings{he2026re,
  author = {Runze He and Yiji Cheng and Tiankai Hang and Zhimin Li and Yu Xu and Zijin Yin and Shiyi Zhang and Wenxun Dai and Penghui Du and Ao Ma and Chunyu Wang and Qinglin Lu and Jizhong Han and Jiao Dai},
  title = {{Re-Align: Structured Reasoning-guided Alignment for In-Context Image Generation and Editing}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2026},
  url = {https://openreview.net/forum?id=CpwcjUGKz0},
}
Figure