Introduction
Large-scale text-to-image diffusion models, such as Stable Diffusion, have demonstrated remarkable generative capabilities. However, these models often inadvertently memorize and reproduce harmful, copyrighted, or sensitive concepts present in their massive, unregulated training datasets. The process of removing these specific concepts—known as concept erasure—is critical for the safe and ethical deployment of AI. Current methods often struggle with a "whack-a-mole" dynamic, where erasing one concept leads to quality degradation or remains vulnerable to adversarial bypasses.
In this work, we present EraseFlow, a framework introduced at NeurIPS 2025 (Spotlight), which treats concept erasure as a path-finding problem. By utilizing Generative Flow Networks (GFlowNets), EraseFlow optimizes entire denoising trajectories, offering a more robust and efficient solution for steering models away from unwanted content.
The Challenges of Concept Erasure
Existing concept erasure techniques typically suffer from three primary limitations:
- Quality Collapse: Modifications intended to erase a concept often inadvertently degrade the model's general ability to generate high-quality images across unrelated domains.
- Brittleness: Models remain susceptible to "adversarial reintroduction." For instance, while a model might refuse the prompt "nude woman," it may still generate NSFW content when prompted with descriptive euphemisms like "woman with shiny skin."
- Computational Inefficiency: Achieving robustness through adversarial training is often prohibitively expensive, sometimes requiring hours of GPU time to erase a single concept.
These failures stem from a "myopic" optimization strategy. Traditional methods focus on individual denoising steps or the final output in isolation. However, the denoising process is dynamic: early stages involve high uncertainty and structural formation, while later stages focus on deterministic refinement.
Methodology: GFlowNet-Driven Alignment
EraseFlow addresses these challenges by casting unlearning as a GFlowNet-driven alignment task. Instead of optimizing single states, the framework optimizes the entire trajectory of the generation process.
Trajectory Balance (TB)
The core of EraseFlow is the use of GFlowNets equipped with a Trajectory Balance (TB) objective. This allows the model to learn a stochastic policy that samples denoising paths leading away from "unsafe" regions of the latent space. By considering the full path, the model accounts for how conditional distributions evolve, making the erasure significantly harder to circumvent via prompt engineering.
Reward-Free Alignment via Safe Anchors
A significant hurdle in alignment is the reliance on external reward models (e.g., nudity classifiers), which are themselves prone to being "hacked." EraseFlow sidesteps this by introducing Safe Anchors. To erase a concept like "nudity," the model is trained to align the denoising trajectory of an unsafe prompt with the trajectory of a pre-defined safe anchor prompt (e.g., "fully dressed person").
The authors provide theoretical proof that assigning a constant reward to these safe anchor trajectories is sufficient to guarantee exact distributional alignment. This eliminates the need for complex, vulnerable reward models and ensures the "probability mass" of the target concept is redirected toward safe alternatives.
Experimental Evaluation
The researchers evaluated EraseFlow across several demanding tasks:
- NSFW Removal: Tested using the I2P, Ring-a-Bell, and MMA-Diffusion datasets, focusing on both explicit and adversarial "red-teaming" prompts.
- Artistic Style Erasure: Removing the distinct styles of artists like Van Gogh and Caravaggio.
- Fine-Grained Erasure: Targeted removal of specific elements, such as the Nike "swoosh" logo or wings from a Pegasus, without altering the underlying object.
- Quality Benchmarking: Performance was measured using Fréchet Inception Distance (FID) and CLIP scores on the MSCOCO dataset to ensure general generative fidelity remained intact.
Key Findings
EraseFlow demonstrates several advantages over state-of-the-art baselines:
- Efficiency: EraseFlow achieves superior results in approximately 3 minutes of training on a single A100 GPU. This is a massive improvement over adversarial methods that can take upwards of 3 hours.
- Robustness: On the UDAtk benchmark for adversarial prompts, EraseFlow reduced the Attack Success Rate (ASR) to 33.89%, significantly outperforming DUO (64.40%) and ESD (78.81%).
- Fidelity: The model achieved the lowest FID scores among non-adversarial methods, indicating that it preserves original image quality better than competing erasure techniques.
- Synergy: EraseFlow is "plug-and-play" and can be combined with other methods like SAFREE. When integrated, the failure rate on NSFW content dropped to just 1%.
Limitations and Future Directions
Despite its success, EraseFlow faces challenges in multiconcept scaling. When attempting to erase a large number of concepts simultaneously (e.g., 100 different celebrities), "interference" can occur. Visually similar concepts—such as human facial features—may begin to bleed into one another, potentially reducing the quality of non-targeted content. Additionally, the performance gains are slightly less pronounced on newer "flow-matching" architectures compared to traditional diffusion models.
Future research will likely focus on adaptive strategies to disentangle overlapping concepts, ensuring that safety measures can scale to thousands of concepts without compromising the model's creative utility.
Conclusion
EraseFlow represents a paradigm shift in concept erasure by moving from step-wise updates to trajectory-based alignment. By leveraging the mathematical strengths of GFlowNets and the simplicity of Safe Anchors, it provides a fast, robust, and high-fidelity solution for making large-scale generative models safer for public use.
Summary updated