Exploring Representation-Aligned Latent Space for Better Generation

Wanghan Xu, Xiaoyu Yue, Zidong Wang, Yao Teng, Wenlong Zhang, Xihui Liu, Luping Zhou, Wanli Ouyang, Lei BaiarXiv 2025 · DOI

Introduction

Latent Diffusion Models (LDMs) have revolutionized image generation by operating in a compressed latent space rather than raw pixels. This compression is typically handled by a Variational Autoencoder (VAE). However, standard VAEs, such as the one used in Stable Diffusion (SD-VAE), are primarily optimized for pixel-level reconstruction. They act as efficient compression tools for local textures but often fail to capture the global semantic structure of an image. This lack of semantic grounding forces the diffusion model to learn complex generative priors from a disorganized latent space, limiting overall generation quality.

Figure 1: Comparison of latent space organization and semantic heatmaps between standard SD-VAE and the proposed ReaLS method.

To address this, we introduce ReaLS (Representation-Aligned Latent Space), a method that injects semantic priors directly into the VAE's latent space. By aligning latents with features from a pre-trained vision model (DINOv2), ReaLS creates a semantically structured space that significantly enhances the performance of downstream diffusion models.

Methodology: Representation Alignment

The core innovation of ReaLS is the Representation Alignment loss. While a standard VAE uses an encoder-decoder architecture with reconstruction and KL divergence losses, ReaLS adds a supervision signal from a frozen DINOv2 model.

Figure 4: The ReaLS training framework (left) aligns VAE latents with DINOv2 features using MLP heads, while the inference pipeline (right) supports both image generation and downstream perception tasks.

As shown in the architecture diagram, the training process involves:

  1. Feature Extraction: A frozen DINOv2 model extracts local patch features and global class (cls) features from the input image.
  2. Alignment Heads: Lightweight MLPs map the VAE's latent grid to match these DINOv2 features.
  3. Loss Functions: An alignment loss (combining Cosine Similarity and Smooth MSE) is optimized alongside traditional VAE losses.
  4. The KL Balance: A critical hyperparameter is the weight of the KL divergence loss. It must be carefully tuned to ensure the latent space remains normally distributed for diffusion while preserving the injected semantic information.

Once the ReaLS VAE is trained, it can be used as a drop-in replacement for standard VAEs in models like DiT (Diffusion Transformer) or SiT (Scalable Interpolant Transformers) without any architectural changes to the diffusion backbone.

Key Insights and Results

The shift from pixel-centric to semantic-centric compression yields several significant advantages:

  • Generation Quality vs. Reconstruction: Interestingly, ReaLS VAEs often show slightly lower pixel-level reconstruction metrics (like PSNR) than standard VAEs. However, the diffusion models trained on ReaLS latents achieve much better image quality. This suggests that for generative modeling, a semantically coherent latent space is more valuable than perfect pixel fidelity.
  • Quantitative Performance: On the ImageNet 256x256 benchmark, diffusion models trained with ReaLS achieved an average 15% improvement in Frechet Inception Distance (FID). For instance, a SiT-XL/2 model reached a state-of-the-art FID of 1.82.
  • Unified Generation and Perception: Because the latent space is aligned with DINOv2, it inherently contains semantic information. This allows the generated latents to be used directly for downstream tasks like semantic segmentation or depth estimation using simple, lightweight task heads, bypassing the need for full image decoding.

Conclusion and Future Directions

ReaLS demonstrates that the bottleneck in current generative models often lies in the latent space itself. By aligning this space with rich semantic representations, we can achieve superior generation quality and enable multi-task capabilities. Future work will focus on further unifying perception and generation, as well as exploring the synergy between latent-space alignment and feature-space alignment within the diffusion process itself.

Summary updated

BibTeX
@misc{xu2025exploring,
  author = {Wanghan Xu and Xiaoyu Yue and Zidong Wang and Yao Teng and Wenlong Zhang and Xihui Liu and Luping Zhou and Wanli Ouyang and Lei Bai},
  title = {{Exploring Representation-Aligned Latent Space for Better Generation}},
  year = {2025},
  eprint = {2502.00359},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2502.00359},
}
Figure