Rethinking the Spatial Inconsistency in Classifier-Free Diffusion Guidance

Dazhong Shen, Guanglu Song, Zeyue Xue, Fu-Yun Wang, Yu Liu
2/9/2026

No official code found. Best implementation: SmilesDZgk/S-CFG (23 stars, last commit 2024-03-25).

Abstract

Classifier-Free Guidance (CFG) has been widely used in text-to-image diffusion models, where the CFG scale is introduced to control the strength of text guidance on the whole image space. However, we argue that a global CFG scale results in spatial inconsistency on varying semantic strengths and suboptimal image quality. To address this problem, we present a novel approach, Semantic-aware Classifier-Free Guidance (S-CFG), to customize the guidance degrees for different semantic units in text-to-image diffusion models. Specifically, we first design a training-free semantic segmentation method to partition the latent image into relatively independent semantic regions at each denoising step. In particular, the cross-attention map in the denoising U-net backbone is renormalized for assigning each patch to the corresponding token, while the self-attention map is used to complete the semantic regions. Then, to balance the amplification of diverse semantic units, we adaptively adjust the CFG scales across different semantic regions to rescale the text guidance degrees into a uniform level. Finally, extensive experiments demonstrate the superiority of S-CFG over the original CFG strategy on various text-to-image diffusion models, without requiring any extra training cost. our codes are available at https://github.com/SmilesDZgk/S-CFG.

View on arXivView PDF

Code Implementations(1)

SmilesDZgk/S-CFGCommunity100%
232PythonMar 25, 20242 years ago

Similar Papers

Cite this paper

@article{shen2026rethinking,
  title  = {Rethinking the Spatial Inconsistency in Classifier-Free Diffusion Guidance},
  author = {Dazhong Shen and Guanglu Song and Zeyue Xue and Fu-Yun Wang and Yu Liu},
  year   = {2026},
  eprint = {2404.05384},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/pdf/2404.05384},
  journal = {CVPR 2024 2024}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2404.05384.svg)](https://codeofpaper.com/paper/2404.05384)

Discussion