Contrastive Conditional-Unconditional Alignment for Long-tailed Diffusion Model
Fang Chen, Alex Villa, Gongbo Liang, Xiaoyi Lu, Meng Tang
TL;DR
This work tackles long-tailed data in class-conditional diffusion models by introducing Contrastive Conditional-Unconditional Alignment (CCUA), which pairs an Unsupervised Contrastive Loss (UCL) encouraging diversity with a Conditional-Unconditional Alignment Loss (AL) promoting knowledge sharing between head and tail classes. The method is applicable to both UNet-based diffusion and Diffusion Transformer backbones, and the overall objective combines $\mathcal{L}_{ccua} = \alpha \mathcal{L}_{ucl} + \gamma \mathcal{L}_{al}$ with the standard denoising diffusion loss. Empirical results across ImageNet-LT and other long-tailed datasets show consistent improvements in tail-class fidelity and diversity (e.g., FID_tail and Recall) without sacrificing head-class quality, outperforming vanilla DDPM, score-based diffusion, CBDM, OCLT, and Dispersive Loss baselines. The approach is practical to implement (batch resampling as optional) and demonstrates strong gains for both UNet and Diffusion Transformer architectures, suggesting broad applicability to long-tailed diffusion-based generation.
Abstract
Training data for class-conditional image synthesis often exhibit a long-tailed distribution with limited images for tail classes. Such an imbalance causes mode collapse and reduces the diversity of synthesized images for tail classes. For class-conditional diffusion models trained on imbalanced data, we aim to improve the diversity and fidelity of tail class images without compromising the quality of head class images. We achieve this by introducing two simple but highly effective loss functions. Firstly, we employ an Unsupervised Contrastive Loss (UCL) utilizing negative samples to increase the distance/dissimilarity among synthetic images. Such regularization is coupled with a standard trick of batch resampling to further diversify tail-class images. Our second loss is an Alignment Loss (AL) that aligns class-conditional generation with unconditional generation at large timesteps. This second loss makes the denoising process insensitive to class conditions for the initial steps, which enriches tail classes through knowledge sharing from head classes. We successfully leverage contrastive learning and conditional-unconditional alignment for class-imbalanced diffusion models. Our framework is easy to implement as demonstrated on both U-Net based architecture and Diffusion Transformer. Our method outperforms vanilla denoising diffusion probabilistic models, score-based diffusion model, and alternative methods for class-imbalanced image generation across various datasets, in particular ImageNet-LT with 256x256 resolution.
