CORAL: Disentangling Latent Representations in Long-Tailed Diffusion

Esther Rodriguez, Monica Welfert, Samuel McDowell, Nathan Stromberg, Julian Antolin Camarena, Lalitha Sankar

TL;DR

Diffusion models struggle to generate high-quality, diverse images for rare "tail" classes in long-tailed datasets because these classes become conceptually entangled with dominant "head" classes in the model's latent space. To fix this, the authors introduce CORAL (COntrastive Regularization for Aligning Latents), which applies a time-dependent supervised contrastive loss directly to the U-Net bottleneck during training. This forces the latent space to maintain clean class separation, significantly boosting tail-class generation quality and diversity with zero added computational cost at inference.

What Problem Does This Paper Address?

While diffusion models (DMs) excel at generating realistic and diverse synthetic data, their success heavily relies on class-balanced training sets. In the real world, data is almost always long-tailed—a few "head" classes have thousands of examples, while many "tail" classes have only a handful.

When trained on long-tailed data, standard diffusion models fail to generate faithful or diverse samples for rare classes. Instead, they suffer from feature borrowing, where generated images from a rare class (like a specific flower) mistakenly display attributes or backgrounds belonging to a dominant class (like grass from an animal category).

The authors look under the hood of the standard denoising U-Net architecture to find out why. They discover representation entanglement: in long-tailed settings, the latent representations at the bottleneck layer for tail classes completely overlap with and get absorbed by head classes.

Figure 1: t-SNE visualizations of U-Net bottleneck features. The dataset visualized is CIFAR10-LT where the tail-to-head ratio is 0.01, i.e., the head class (airplane) is 100 times more represented than the tail class (truck), with an exponential decay in-between. Real CIFAR10-LT samples are passed through models trained under different settings. Shown are (left) DDPM [18] trained on the original balanced CIFAR-10 dataset, (middle) DDPM trained on CIFAR10-LT with an imbalance ratio of 0.01, and (right) CORAL trained under the same imbalanced setting. In the balanced case, class representations are moderately separated, though some overlap remains. Under imbalance, DDPM exhibits substantial overlap between head and tail classes, an effect we refer to as representation entanglement, which degrades generation quality for tail classes. CORAL mitigates this effect by promoting class-wise separation in the latent space.

Methods

To resolve this entanglement, the authors propose CORAL (COntrastive Regularization for Aligning Latents). Rather than modifying the final image space or introducing complex post-hoc guidance, CORAL regularizes the internal feature space of the diffusion model itself during training.

The framework introduces three key components:

  1. Architectural Modification: A lightweight projection head (a single fully-connected layer followed by $\ell_2$ normalization) is attached to the bottleneck output of the U-Net encoder.
  2. Supervised Contrastive Loss (SupCon): During training, the projected embeddings within a mini-batch are optimized using a supervised contrastive loss. This explicitly forces the network to pull representations of the same class closer together while pushing different classes apart.
  3. Time-Dependent Weighting: Because diffusion models deal with varying levels of noise across timesteps ($t$), uniform regularization doesn't work. CORAL uses a dynamic weighting function, $\lambda(t)$, that heavily prioritizes contrastive alignment during early denoising steps ($t \approx 0$) where semantic structure is clean and recoverable, and decays as noise dominates ($t \approx T$).

Crucially, once training is complete, the projection head is discarded. The U-Net bottleneck retains its newly structured, well-separated latent space, allowing standard sampling procedures (like Classifier-Free Guidance) to run with zero added computational overhead.

Figure 2: CORAL architecture and workflow on CelebA-5. (a) The five-class CelebA-5 training data is input to the U-Net architecture. (b) Denoising U-Net. The white inset shows an actual t-SNE visualization of the U-Net latent representations due to CORAL. (c) CORAL’s addition to the standard DDPM architecture: a projection head MLP consisting of a single dense layer followed by normalization. (d) The output from the U-Net and the projection head are used to compute the corresponding diffusion and contrastive losses. (e) The contrastive loss is scaled by a time-dependent weighting function, λ(t), and added to the standard diffusion loss to obtain the CORAL loss. (f) Samples are obtained from a trained CORAL model.

Datasets

The authors evaluated CORAL across several challenging long-tailed image benchmarks:

  • CIFAR10-LT & CIFAR100-LT: Artificially imbalanced variants where class frequencies decay exponentially based on imbalance factors ($\rho = 0.01$ and $0.001$). At $\rho = 0.001$, the rarest class has 1,000$\times$ fewer samples than the head class.
  • CelebA-5: A naturally imbalanced 5-class subset of the CelebA dataset based on hair color, where dominant classes significantly outnumber rare ones (e.g., gray hair or baldness).
  • ImageNet-LT: A large-scale long-tailed benchmark sampled via a Pareto distribution, containing 1,000 classes with sample sizes ranging from a maximum of 1,280 images down to just 5 images per class.

Key Insights and Ideas

  • Imbalance vs. Scarcity: The paper reveals that tail-class generation failure isn't just a consequence of having few samples. When the authors trained models on small but balanced datasets, the latents simply scattered. In imbalanced datasets, however, the dominant head classes hijack the gradient updates, actively forcing the tail latents to collapse into head-class clusters.
  • Latent Space is the Right Place to Intervene: Previous state-of-the-art methods like CBDM and T2H operate primarily in the ambient image space or use complex score-shifting mechanisms. CORAL proves that structuring the internal bottleneck layer scales much better, especially when moving to complex, many-class datasets like ImageNet-LT.
  • Timing Matters: Regularizing the latent space when the image is mostly pure noise ($t \approx T$) degrades performance. The "aha moment" here is that contrastive alignment is most effective when the model is resolving fine semantic details near the end of the denoising process ($t \approx 0$).

Key Results

Quantitatively, CORAL consistently outperformed standard DDPM and specialized long-tailed baselines (CBDM, T2H) across all metrics, including Fréchet Inception Distance (FID), Inception Score (IS), and Recall.

  • CIFAR10-LT ($\rho = 0.01$): CORAL achieved a top FID of 5.32, outperforming CBDM (5.62) and T2H (7.01).
  • ImageNet-LT: On this massive 1,000-class benchmark, CORAL demonstrated its scalability, hitting an FID of 16.11 and an IS of 24.17, vastly superior to CBDM which degraded to an FID of 22.66 and IS of 17.13.
  • Qualitative Improvements: Visually, CORAL successfully eliminated mode collapse and feature borrowing. For instance, when generating rare flower classes in CIFAR100-LT, CORAL produced distinct, high-fidelity flowers with appropriate scales, whereas competing models filled the backgrounds with grass textures borrowed from dominant animal classes.

Limitations and Future Work

The primary limitation acknowledged by the authors is additional computational complexity during training, caused by the forward pass through the projection head and the batch-wide contrastive loss calculation. However, they note that this can be mitigated by fine-tuning an existing pretrained model with the CORAL loss rather than training from scratch.

For future work, the authors suggest extending this bottleneck contrastive regularization to large-scale text-to-image (T2I) models like Stable Diffusion. Applying CORAL via parameter-efficient fine-tuning methods (like LoRA) could prevent rare concepts from becoming entangled with common ones during domain-specific adaptation (e.g., adapting a model for rare medical imaging anomalies).

Summary updated

Abstract

Diffusion models have achieved impressive performance in generating high-quality and diverse synthetic data. However, their success typically assumes a class-balanced training distribution. In real-world settings, multi-class data often follow a long-tailed distribution, where standard diffusion models struggle -- producing low-diversity and lower-quality samples for tail classes. While this degradation is well-documented, its underlying cause remains poorly understood. In this work, we investigate the behavior of diffusion models trained on long-tailed datasets and identify a key issue: the latent representations (from the bottleneck layer of the U-Net) for tail class subspaces exhibit significant overlap with those of head classes, leading to feature borrowing and poor generation quality. Importantly, we show that this is not merely due to limited data per class, but that the relative class imbalance significantly contributes to this phenomenon. To address this, we propose COntrastive Regularization for Aligning Latents (CORAL), a contrastive latent alignment framework that leverages supervised contrastive losses to encourage well-separated latent class representations. Experiments demonstrate that CORAL significantly improves both the diversity and visual quality of samples generated for tail classes relative to state-of-the-art methods.
BibTeX
@inproceedings{rodriguez2025coral,
  author = {Esther Rodriguez and Monica Welfert and Samuel McDowell and Nathan Stromberg and Julian Antolin Camarena and Lalitha Sankar},
  title = {{CORAL: Disentangling Latent Representations in Long-Tailed Diffusion}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=VIf1Ygh1Pv},
}
Figure