Aligning Text to Image in Diffusion Models is Easier Than You Think

Jaa-Yeon Lee, ByungHee Cha, Jeongsol Kim, Jong Chul Ye

Introduction

While recent advancements in generative modeling have significantly improved text-to-image (T2I) generation, residual misalignment between text prompts and generated images remains a persistent challenge. Models often struggle to perfectly align generated visuals with complex text prompts, sometimes ignoring parts of a prompt or misinterpreting the relationship between text and visual concepts. To address this, researchers introduce SoftREPA (Soft REPresentation Alignment), a lightweight fine-tuning strategy. By utilizing contrastive learning to optimize a tiny set of "soft text tokens" (under 1M parameters) while keeping the base model frozen, SoftREPA drastically improves prompt adherence and image editing quality across models like Stable Diffusion 1.5, XL, and 3.

The Challenge of Text-Image Misalignment

Even state-of-the-art T2I diffusion models can fail to capture the full semantic intent of a user's prompt. To fix this, researchers typically rely on expensive preference optimization techniques (like RLHF for images) or full-model fine-tuning, both of which require massive, specially curated datasets.

Furthermore, standard diffusion models are trained exclusively on "positive pairs" (an image and its exact matching caption) by minimizing a denoising score matching loss. This approach is suboptimal for learning a robust joint representation space. The authors argue that explicitly teaching the model what doesn't match—leveraging negative pairs—can significantly improve alignment without the heavy computational burden of existing methods.

SoftREPA: Lightweight Contrastive Fine-Tuning

Instead of fine-tuning the entire diffusion model or relying on external reward models, the proposed SoftREPA method freezes the pretrained model and introduces a small set of learnable soft text tokens.

  • Soft Tokens: These are learnable embedding vectors prepended to the standard text features in the early layers of the diffusion model, where text-image alignment primarily occurs.
  • Contrastive Score Matching Loss: To train these tokens, the authors adapt contrastive learning for diffusion. Instead of just minimizing the denoising error for a matching image-text pair, the loss function encourages the model's predicted noise to align with the true noise for the correct text, while actively pushing it away from the predicted noise of mismatched text (negative pairs drawn from the same training batch).

This approach sharpens the conditional probability distribution, explicitly increasing the mutual information between the image and text representations.

Key Insights

  • Contrastive Learning Fits Diffusion: Applying contrastive learning directly to the diffusion denoising objective is a highly effective, stable way to separate aligned and unaligned concepts.
  • Early Layers Matter Most: Inserting soft tokens only in the early layers (e.g., layers 2–5 in Stable Diffusion 3) yields the best results. Early layers handle semantic alignment, while later layers focus on visual fidelity. Adding tokens too deep into the network can actually degrade image quality.
  • Superior to LoRA: When compared to standard LoRA fine-tuning with a similar parameter count, the combination of soft tokens and contrastive loss achieved significantly better text-image alignment, proving that exploring the text feature space directly is highly efficient.
  • Complementary to RL: SoftREPA is not a competitor to diffusion reinforcement learning methods (like Diffusion-DPO); it is complementary. Plugging SoftREPA's trained tokens into RL-aligned models further boosts their performance.

Results and Efficiency

SoftREPA is extremely efficient, adding fewer than 1 million trainable parameters to the model. It requires zero extra peak GPU memory during inference and adds a negligible fraction of a second to generation latency.

Qualitative results comparing baseline models with SoftREPA on generation and editing tasks.
  • Generation Quality: Across SD1.5, SDXL, and SD3, SoftREPA consistently improved human preference and alignment scores. For example, on SD3, the ImageReward score jumped from 94.27 to 108.5, and the CLIP score improved from 26.30 to 26.91.
  • Image Editing: When applied to text-guided editing frameworks (like FlowEdit or PnP), SoftREPA allowed models to better execute requested edits (e.g., changing a "car" to a "motorcycle" or a "stone building" to a "wooden lighthouse") while preserving the original image structure. It yielded higher CLIP scores, better background preservation, and even reduced the number of steps required for FlowEdit from 33 to 30.

Limitations and Future Work

While highly effective, the authors note that soft tokens can sometimes follow the text too aggressively. For instance, in the GenEval benchmark, the "counting" metric dropped slightly because the model's eagerness to align with the text sometimes caused it to over-generate instances of an object. They mitigated this in an ablation by restricting tokens to even fewer layers or adding a lightweight counting loss during training.

Future work will explore regularization techniques to balance textual guidance with the preservation of the user's original prompt intent, preventing the over-generation issue while maintaining high semantic alignment.

Summary updated

BibTeX
@inproceedings{lee2025aligning,
  author = {Jaa-Yeon Lee and ByungHee Cha and Jeongsol Kim and Jong Chul Ye},
  title = {{Aligning Text to Image in Diffusion Models is Easier Than You Think}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=ToMjBgXwhw},
}
Figure