A Unified Framework for Diffusion Model Unlearning with f-Divergence

Nicola Novello, Federico Fontana, Luigi Cinque, Deniz Gunduz, Andrea M Tonello

Introduction

Diffusion models (DMs) like Stable Diffusion and FLUX are trained on massive, uncurated datasets, inevitably memorizing copyrighted artistic styles, fictional characters, and Not-Safe-For-Work (NSFW) content. To remove these elements, practitioners use "machine unlearning," typically fine-tuning the model using a Mean Squared Error (MSE) loss to push a "target" concept toward a safe "anchor" concept.

However, using MSE is mathematically equivalent to minimizing the Kullback-Leibler (KL) divergence between two Gaussian distributions. This approach is often unstable, leading to catastrophic forgetting—where unrelated knowledge is lost—or the generation of degenerate images during the fine-tuning process. The challenge lies in finding a way to erase specific concepts without breaking the rest of the model's generative capabilities.

The $f$-DMU Framework

To address these flaws, researchers introduce $f$-DMU, a unified framework that generalizes diffusion model unlearning by replacing standard MSE with a broader family of $f$-divergences. This allows practitioners to select an optimal divergence based on their specific application goals. The framework offers two primary optimization paths:

  1. Closed-Form Losses: For a specific family known as $\alpha$-divergences, the authors derive exact mathematical formulas that serve as computationally cheap, "drop-in" replacements for MSE.
  2. Hellinger Distance: Features naturally bounded gradients, acting as a conservative updater that ignores outliers and maintains training stability.
  3. Pearson $\chi^2$: Features fast-growing gradients, making it a "heavy hitter" for aggressive concept erasure.
  4. Variational Formulation: For divergences lacking a simple closed-form formula (such as Jensen-Shannon), $f$-DMU employs a min-max optimization strategy. This involves training a lightweight discriminator alongside the diffusion model to estimate the divergence, akin to how Generative Adversarial Networks (GANs) are trained.

Theoretical analysis confirms that these new loss functions are mathematically stable and, in cases like the Hellinger distance, converge faster than the standard KL/MSE approach.

Key Insights and Performance

The framework was rigorously tested across various models (Stable Diffusion v1.4 through XL, SD3, and FLUX) to erase concepts like R2D2, specific artistic styles (Van Gogh, Picasso), and nudity. Evaluation relied on benchmarks like I2P, Ring-A-Bell, and MMA-Diffusion, utilizing metrics such as CLIP Score and Kernel Inception Distance (KID).

  • Stability and Preservation: A major insight is that MSE often causes a "sudden death" in image quality during early training before eventually recovering. The Hellinger distance (H-DMU) avoids this entirely, providing a smooth unlearning curve. In style ablation tests, H-DMU consistently achieved superior KID scores, meaning the model's general creative capacity remained intact while the target style was successfully scrubbed.
  • Aggressive Erasure vs. Realism: The study reveals a fundamental trade-off. Closed-form losses like Hellinger excel at "realistic concept replacement" (e.g., swapping Van Gogh for a generic painting style). Variational losses are better suited for aggressive removal where erasing the concept is paramount, even at the cost of some image coherence.
  • Adversarial Robustness: Hellinger-based unlearning proved significantly more robust against adversarial "jailbreak" attacks. On the I2P benchmark for inappropriate image generation, H-DMU reduced the nudity generation rate to an impressive 0.063, outperforming both the SD 1.5 baseline (0.669) and state-of-the-art methods like CAbl (0.120).
  • Architecture Agnostic: The framework successfully unlearned concepts in the latest Diffusion Transformer (DiT) architectures, proving its viability beyond traditional U-Net designs.

Limitations and Future Directions

Despite its flexibility and strong performance, $f$-DMU has a few limitations. The variational approach introduces computational overhead due to the required discriminator training, making it slower than closed-form alternatives. Additionally, while the loss function is vastly improved, the choice of the "anchor" concept still heavily dictates the final output quality, remaining somewhat of an empirical art. Finally, scaling the variational discriminator for extremely large models may require further optimization to keep training times practical for widespread deployment.

Summary updated

BibTeX
@inproceedings{novello2026unified,
  author = {Nicola Novello and Federico Fontana and Luigi Cinque and Deniz Gunduz and Andrea M Tonello},
  title = {{A Unified Framework for Diffusion Model Unlearning with f-Divergence}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=6kyKD3bVi6},
}
Figure