Contrastive CFG: Improving CFG in Diffusion Models by Contrasting Positive and Negative Concepts

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Chang, Jinho, Chung, Hyungjin, Ye, Jong Chul
Format: Preprint
Published: 2024
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866910716189999104
author Chang, Jinho
Chung, Hyungjin
Ye, Jong Chul
author_facet Chang, Jinho
Chung, Hyungjin
Ye, Jong Chul
contents As Classifier-Free Guidance (CFG) has proven effective in conditional diffusion model sampling for improved condition alignment, many applications use a negated CFG term to filter out unwanted features from samples. However, simply negating CFG guidance creates an inverted probability distribution, often distorting samples away from the marginal distribution. Inspired by recent advances in conditional diffusion models for inverse problems, here we present a novel method to enhance negative CFG guidance using contrastive loss. Specifically, our guidance term aligns or repels the denoising direction based on the given condition through contrastive loss, achieving a nearly identical guiding direction to traditional CFG for positive guidance while overcoming the limitations of existing negative guidance methods. Experimental results demonstrate that our approach effectively removes undesirable concepts while maintaining sample quality across diverse scenarios, from simple class conditions to complex and overlapping text prompts.
format Preprint
id arxiv_https___arxiv_org_abs_2411_17077
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Contrastive CFG: Improving CFG in Diffusion Models by Contrasting Positive and Negative Concepts
Chang, Jinho
Chung, Hyungjin
Ye, Jong Chul
Machine Learning
Artificial Intelligence
Computer Vision and Pattern Recognition
As Classifier-Free Guidance (CFG) has proven effective in conditional diffusion model sampling for improved condition alignment, many applications use a negated CFG term to filter out unwanted features from samples. However, simply negating CFG guidance creates an inverted probability distribution, often distorting samples away from the marginal distribution. Inspired by recent advances in conditional diffusion models for inverse problems, here we present a novel method to enhance negative CFG guidance using contrastive loss. Specifically, our guidance term aligns or repels the denoising direction based on the given condition through contrastive loss, achieving a nearly identical guiding direction to traditional CFG for positive guidance while overcoming the limitations of existing negative guidance methods. Experimental results demonstrate that our approach effectively removes undesirable concepts while maintaining sample quality across diverse scenarios, from simple class conditions to complex and overlapping text prompts.
title Contrastive CFG: Improving CFG in Diffusion Models by Contrasting Positive and Negative Concepts
topic Machine Learning
Artificial Intelligence
Computer Vision and Pattern Recognition
url https://arxiv.org/abs/2411.17077