EraseAnything: Enabling Concept Erasure in Rectified Flow Transformers
Daiheng Gao, Shilin Lu, Shaw Walters, Wenbo Zhou, Jiaming Chu, Jie Zhang, Bang Zhang, Mengxi Jia, Jian Zhao, Zhaoxin Fan, Weiming Zhang
TL;DR
EraseAnything addresses the challenge of concept erasure in flow-based text-to-image diffusion models (Flux) by formulating a bi-level optimization that jointly erases unwanted concepts and preserves unrelated ones. It combines LoRA-based fine-tuning on the unlearned dataset $D_{un}$ with an attention-map regularizer and a reverse self-contrastive loss to mitigate concept residue and maintain generation quality for $D_{ir}$. The method dynamically samples unrelated concepts via LLMs (GPT-4o) and uses a contrastive objective to steer attention away from erased concepts, yielding robust performance against prompt obfuscation. Empirically, EraseAnything achieves state-of-the-art erasure across diverse tasks on Flux, demonstrates strong preservation of unrelated concepts, and showcases practical viability for safe and controllable T2I generation in modern flow-based architectures, while noting challenges in scaling to many simultaneous concepts and the need for fine-grained control.
Abstract
Removing unwanted concepts from large-scale text-to-image (T2I) diffusion models while maintaining their overall generative quality remains an open challenge. This difficulty is especially pronounced in emerging paradigms, such as Stable Diffusion (SD) v3 and Flux, which incorporate flow matching and transformer-based architectures. These advancements limit the transferability of existing concept-erasure techniques that were originally designed for the previous T2I paradigm (e.g., SD v1.4). In this work, we introduce EraseAnything, the first method specifically developed to address concept erasure within the latest flow-based T2I framework. We formulate concept erasure as a bi-level optimization problem, employing LoRA-based parameter tuning and an attention map regularizer to selectively suppress undesirable activations. Furthermore, we propose a self-contrastive learning strategy to ensure that removing unwanted concepts does not inadvertently harm performance on unrelated ones. Experimental results demonstrate that EraseAnything successfully fills the research gap left by earlier methods in this new T2I paradigm, achieving state-of-the-art performance across a wide range of concept erasure tasks.
