Asymptotically Exact Negative Guidance of Diffusion Models via Positive-Unlabeled Learning

Hirohane Takagi, Masashi SugiyamaNeurIPS 2026

TL;DR

When telling a diffusion model what not to generate—like copyrighted art or harmful content—current methods simply push individual samples away from the forbidden concept, often warping the overall output distribution or collapsing diversity. This paper introduces PU Steering, a method that frames "negative guidance" as sampling from an explicit, mathematically exact target distribution. By pairing lightweight online machine learning with particle filtering, it steers generation away from unwanted traits while keeping the rest of the creative landscape intact.

What Problem Does This Paper Address?

Diffusion models are great at taking a positive prompt ("a starry night") and amplifying it. Negative guidance does the opposite: it steers generation away from an undesired condition $c$ (say, "in the style of Van Gogh" or a specific set of copyrighted images).

Existing negative guidance techniques—like sign-flipped Classifier-Free Guidance (NegCFG) or Safe Denoiser—work locally. As each individual image denoises, the algorithm injects a repulsive force pushing it away from $c$. This creates two structural headaches:

  1. No explicit target: Because the repulsion is just a local heuristic, the sampler isn't actually aiming for a well-defined probability distribution.
  2. Irreducible bias: Throwing more compute at these methods doesn't fix the distortion; cranking up the repulsion strength often causes the model to lose diversity, generate artifacts, or collapse onto just a few modes.

Methods

Instead of inventing a new repulsive force, the authors define an explicit target density: $p_{\text{target}}(x) \propto p(x)(1 - p(c \mid x))^\lambda$, where $\lambda$ smoothly dials up how strongly we suppress the unwanted condition $c$. To sample from this without knowing $p(c \mid x)$ upfront, PU Steering weaves together three components across a batch of $M$ interacting "particles" (generating samples in parallel):

  • Online Positive–Unlabeled (PU) Learning (Novel): At each denoising step, the algorithm trains a lightweight classifier on the fly to estimate $p(c \mid x)$. Why PU learning? Because we don't have clean "non-$c$" examples! We only have positive examples of what to avoid (either reference images or a conditional model) and unlabeled data from the unconditional diffusion model (which naturally contains a mix of $c$ and $\neg c$).
  • Sequential Monte Carlo / SMC (Standard backbone, novel integration): Rather than relying solely on local nudges, SMC maintains importance weights across the batch of particles and periodically resamples them—killing off particles drifting toward $c$ and duplicating good ones. Crucially, any existing negative-guidance method can be plugged in as the SMC proposal step.
  • Particle Density Correction (Novel): As SMC steers particles away from $c$, they no longer represent the raw unconditional model, which would bias the PU classifier. The authors track a secondary, zero-cost importance weight that mathematically reweights the guided particles back to the unconditional distribution just for the classifier's loss function.

Datasets

The authors evaluate PU Steering across three setups (no new benchmarks are introduced, though custom evaluation splits are constructed):

  • Synthetic 3D Gaussian Mixture Model (GMM): 12 randomly placed modes (3 to avoid, 9 to keep) for exact ground-truth density comparisons.
  • CIFAR-10: Unconditional image generation using a pretrained UNet, avoiding either a single class ("plane") or a four-class group ("vehicles"), specified via 200 reference training images per class.
  • Stable Diffusion v1.4: Text-to-image generation ("a painting of a cafe terrace at night under a starry sky"), suppressing "in the style of Van Gogh".

Key Insights and Ideas

  • Turn heuristics into exact samplers: Existing negative guidance methods aren't discarded—they become proposal kernels inside an SMC wrapper. SMC cleans up their distributional bias, making the sampler asymptotically exact as the number of particles grows.
  • Only the final step needs perfection: Because intermediate SMC weights form a telescoping product across diffusion timesteps, estimation errors in the classifier at noisy intermediate steps cancel out in the target marginal. Thus, the authors parameterize the classifier on clean denoised estimates ($\hat{x}_0$), making online training fast and easy.
  • Global beats local: By sharing information across a batch of particles via PU learning and resampling, the sampler avoids mode collapse instead of blindly shoving individual samples into weird corners of pixel space.
Figure 1: Generated samples on one trial. Each point is a sample in its first two coordinates, colored by the true posterior p(c | x) ∈[0, 1] (red: p(c | x)=1, blue: 0). Oracle and Ours avoid the condition c and cover all remaining modes. NegCFG suppresses leak by collapsing onto a few remaining modes, and DNG keeps coverage but retains residual samples on the avoided modes.

Key Results

  • 3D GMM: Over 50 trials, PU Steering matches the ground-truth Oracle in avoiding the forbidden modes ("posterior leak" of 0.012 vs. Oracle's 0.012) while keeping the 2-Wasserstein distance low (1.8 vs. Oracle's 1.5). Meanwhile, NegCFG suffers massive distributional distortion ($W_2 = 20.5$) to achieve a 0.018 leak.
  • CIFAR-10: Using Safe Denoiser as its proposal kernel, PU Steering's $\lambda$-sweep Pareto-dominates standalone Safe Denoiser across the board—achieving lower target-class leak alongside better image quality (FID) and class balance (KL divergence).
CIFAR-10 plane avoidance showing PU Steering (dashed lines) achieving lower FID at better avoidance rates than Safe Denoiser (solid blue).
  • Stable Diffusion: Avoiding Van Gogh's style with $M=128$ particles, PU Steering hits an avoided-style rate of 0.235 (matching the idealized "oracle floor" of 0.238) while achieving the best FID of 28.10, outperforming specialized baselines like SLD and DNG in both style suppression and visual quality. Increasing particles from 64 to 128 improved both avoidance (0.276 $\to$ 0.235) and FID (33.46 $\to$ 28.10).

Limitations and Future Work

  • Weight degeneracy: A classic Achilles' heel of SMC is that importance weights can develop high variance, causing a few ancestor particles to dominate after resampling. Designing variance-minimizing proposals when the target path itself shifts online is an open problem.
  • Small-batch PU stability: Online PU learning can be noisy when batch sizes or reference sets are small (on CIFAR-10 with $M=128$, the authors had to fall back to standard binary cross-entropy as a practical proxy). Incorporating modern variance-reduction techniques from streaming PU literature is a natural next step.
  • Application scope: Expanding beyond 2D image tasks to other safety-critical domains (like molecules, audio, or robotic control) remains future work.

Summary updated

Abstract

Negative guidance of diffusion models generates samples that avoid an undesired condition, specified either by reference samples or by a conditional score alongside an unconditional model. Existing methods inject repulsive terms derived from local information at each sample, so the resulting sampler does not target an explicit density, and its bias cannot be systematically reduced by increasing computation. We instead present a negative-guidance method that samples from an explicit target density, which uniformly handles both reference-sample and score-based specifications and suppresses probability mass near the undesired condition with an avoidance strength that parametrizes the target density itself. Realizing this target requires estimating, at each diffusion timestep, how likely each sample is to belong to the undesired condition. We cast this estimation as a Positive-Unlabeled learning problem that admits lightweight online training along the diffusion trajectory, using condition samples as positives and diffusion particles as unlabeled data. Because the guided particles drift from the unconditional marginal, we further correct the residual mismatch via Sequential Monte Carlo, yielding a sampler that is asymptotically exact in the particle limit and that turns any existing negative-guidance method into its proposal kernel. Empirically, our method approaches the ground-truth target on Gaussian mixtures and Pareto-dominates existing methods on trade-offs between avoidance and generation quality, distributional bias, and diversity, including in an image-generation setting with a pretrained score network.
BibTeX
@inproceedings{takagi2026asymptotically,
  author = {Hirohane Takagi and Masashi Sugiyama},
  title = {{Asymptotically Exact Negative Guidance of Diffusion Models via Positive-Unlabeled Learning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=xCdsktvB3f},
}
Figure