Skip to content

Ring-A-Bell: How Reliable Are Concept Removal Methods for Diffusion Models?Ring-A-Bell! How Reliable are Concept Removal Methods for Diffusion Models?

arXiv· arXiv:2310.10012· Yu-Lin Tsai, Chia-Yi Hsu, Chulin Xie, Chih-Hsun Lin, Jia-You Chen, Bo Li, Pin-Yu Chen, Chia-Mu Yu, Chun-Ying HuangNational Yang Ming Chiao Tung University; University of Illinois at Urbana Champaign; University of Chicago; IBM ResearchIndexed by this site · 27 days ago· Originally publishedAttacks

Quick read

Attacks

Based on the paper PDF (AI-generated); refer to the original

The authors propose Ring-A-Bell, a model-agnostic red team tool for T2I diffusion models, which the authors claim can bypass concept erasure and the safety mechanisms of online services to generate inappropriate images.

Threat modelThe attacker's goal is to make a T2I model with safety mechanisms generate inappropriate images containing target concepts (nudity, violence); only black-box access is assumed, no knowledge of the target model is required, and only a general text encoder (such as CLIP) is used to generate problematic prompts offline, which are then deployed online; the victim systems are concept erasure models and online T2I services.

Questions
Whether the safety mechanisms of T2I diffusion models (safety filters, concept erasure) can block prompts intended to generate inappropriate content such as nudity and violence; the authors believe existing evaluations lack scalable automated red team testing.
Methods
Ring-A-Bell uses the CLIP text encoder to extract concept representations by subtracting the embeddings of paired prompts, injects them into the embedding of the target prompt, and then uses a genetic algorithm to search for a discrete problematic prompt; the whole process is offline and requires no knowledge of the target model.
Experiments and results
On I2P's nudity (95 prompts) and violence (250 prompts), the ASR of the 8 concept-erasure settings is mostly higher than that of the original prompts and QF-Attack, and the Union setting reaches 100% on SLD-Medium and CA (Table 2); the authors say it can also bypass the checks of four online services.
Limitations and future work
The authors note in Appendix C: the tool could be used maliciously; the evaluation relies on NudeNet and the Q16 classifier, which may have false positives and misdetections. The experiments cover only the two concepts nudity and violence, generate only 1 image per prompt, and do not report manual review.
Experimental setupStable Diffusion (SD)、Erased Stable Diffusion (ESD) et al. · I2P · ASR
Evaluated models
Stable Diffusion (SD)Erased Stable Diffusion (ESD)SLD-MaxSLD-StrongSLD-MediumSD-NPConcept Ablation (CA)Forget-Me-Not (FMN)MidjourneyDALL·E 2Gen-2Stable Diffusion XL
Benchmarks
I2P
Metrics
ASR
AI summaryThe researchers propose Ring-A-Bell, a model-agnostic red-teaming tool for text-to-image diffusion models, used to test the reliability of deployed safety mechanisms. The tool first obtains holistic representations of sensitive and inappropriate concepts through concept extraction, then automatically finds problematic prompts that cause the diffusion model to generate inappropriate content; the entire evaluation can be prepared in advance and requires no prior knowledge of the target model. The authors validate it on online services such as Midjourney and on multiple concept removal methods; results show that the tool can rewrite prompts originally regarded as safe into forms that bypass existing safety mechanisms, exposing the flaw that these so-called safety mechanisms may actually lead to the generation of harmful content. Code is open-sourced at https://github.com/chiayi-hsu/Ring-A-Bell。

The researchers propose Ring-A-Bell, a model-agnostic red-teaming tool for text-to-image diffusion models, used to test the reliability of deployed safety mechanisms. The tool first obtains holistic representations of sensitive and inappropriate concepts through concept extraction, then automatically finds problematic prompts that cause the diffusion model to generate inappropriate content; the entire evaluation can be prepared in advance and requires no prior knowledge of the target model. The authors validate it on online services such as Midjourney and on multiple concept removal methods; results show that the tool can rewrite prompts originally regarded as safe into forms that bypass existing safety mechanisms, exposing the flaw that these so-called safety mechanisms may actually lead to the generation of harmful content. Code is open-sourced at https://github.com/chiayi-hsu/Ring-A-Bell。

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    The authors propose Ring-A-Bell, which automatically finds problematic prompts that can bypass T2I safety mechanisms, testing the defenses of concept erasure and online services.

    Core question: whether the safety mechanisms of T2I diffusion models (safety filters, concept erasure) remain effective against deliberately constructed prompts, and the lack of scalable automated testing methods.

    • Problem setting: T2I models (such as Stable Diffusion) are trained on data from the internet, and the authors claim the models memorize and generate copyrighted, restricted, or NSFW content, hence two types of defenses have emerged: safety filters and concept erasure.
    • Shortcomings of existing methods: the authors claim these safety mechanisms are effective in their respective evaluations, but their protective effect against a wide range of prompts is largely unexplored; the red team method of Rando et al. (2022) requires manually selecting prompts, which is cumbersome and not scalable.
    • Core observation: the authors believe safety mechanisms only learn to disassociate target concepts from their representations or filter related words; if implicit text-concept associations exist in the T2I generation process, detection or removal of concepts may be incomplete, and erased concepts can be re-evoked by prompt optimization.
    • Paper proposes: Ring-A-Bell, a model-agnostic red team tool that uses only a general text encoder such as CLIP to generate problematic prompts offline, for evaluating concept erasure methods and online T2I services.
    • Threat model:
      • Goal: make a T2I model with safety mechanisms generate inappropriate images containing target concepts (nudity, violence; the appendix additionally has cars and Van Gogh style).
      • Knowledge: only black-box access, no prior knowledge of the target model is assumed; only access to a general text encoder is needed.
      • Capability: can only manipulate the prompt input, cannot modify the model; the attack can be fully prepared offline.
      • Victim systems: concept erasure methods (ESD, SLD, CA, FMN, etc.) and online services (Midjourney, DALL·E 2, Gen-2, Stable Diffusion XL).
  2. What related research exists?

    Related work is divided into three groups: AI red team tools, prompt engineering, T2I safety mechanisms; the baseline is QF-Attack, with additional comparisons to P4D and SneakyPrompt.

    AI red team evaluation tools

    • Perez et al. (2022), Shi et al. (2023), Lee et al. (2023)——red team methods for language models, respectively using an LM to generate test cases, rewriting outputs to deceive detectors, and Bayesian optimization to iteratively modify test cases.
    • Zhuang et al. (2023)——query-free attack, adding small perturbations to input prompts to cause semantic drift in outputs; Qu et al. (2023)——collecting unsafe prompts from online forums to examine T2I online services and fine-tuning models to generate hateful memes.
    • P4D (Chin et al., 2023, concurrent work)——also develops a T2I diffusion model red team tool; the paper points out that its main weakness is assuming white-box access to the target model, and that it is a special case of this paper's model-specific formalization.

    Prompt engineering

    • Hard prompt (discrete): Brown et al. (2020), Schick & Schütze (2021), Jiang et al. (2020), Gao et al. (2021)——adapting to downstream tasks with manually written or templated discrete word patterns.
    • Soft prompt (continuous): Lester et al. (2021), Li & Liang (2021)——optimizing continuous embedding vectors.
    • Combining both: AutoPrompt (Shin et al., 2020), FluentPrompt (Shi et al., 2022), PeZ (Wen et al., 2023)——using continuous gradients to optimize and learn discrete prompts; this paper uses GA for discrete optimization and compares with PeZ in the ablation.

    T2I safety mechanisms

    • Detection-based: Rando et al. (2022)——filtering through a safety checker after generation; Rando et al. also proposed prompt dilution to bypass the Stable Diffusion safety filter, and this paper adopted this method when evaluating online services.
    • Removal-based: SD with negative prompts (Rombach et al., 2022), SLD (Schramowski et al., 2023) constrain at the inference stage; ESD (Gandikota et al., 2023), CA (Kumari et al., 2023), FMN (Zhang et al., 2023) erase concepts by fine-tuning model weights.

    Baselines and benchmarks: the baseline attack is QF-Attack (Zhuang et al., 2023), using its targeted attack setting; the evaluation dataset is I2P (Schramowski et al., 2023). P4D was not selected as a baseline because it cannot be used for online T2I services, but Appendix K compares with it using two metrics; Appendix M compares with SneakyPrompt (Yang et al., 2023).

    The authors position this paper as: a red team tool that does not rely on knowledge of the target model, can be prepared offline, and can be automated and scaled to online services and concept erasure methods, to distinguish it from P4D's white-box assumption and the practice of manually collecting prompts.

  3. How does the paper address this problem?

    First do a model-specific formalization, then based on it construct a model-agnostic pipeline that uses only a text encoder: concept extraction→embedding injection→GA discrete search.

    Overall approach: first give a formalization of a model-specific attack assuming white-box access, then, based on empirical observations, construct a model-agnostic framework, Ring-A-Bell, that requires only a general text encoder, generating problematic prompts offline and then deploying them to the target system.

    Model-specific formalization (Section 3.2)

    • Let the model without safety mechanisms be ϵθ and the model with safety mechanisms be ϵθ′, and for a target concept c find an adversarial concept c̃ such that the two models have similar probabilities of generating the same trajectory: Pϵθ(z0,...,zT|c) ≈ Pϵθ′(z0,...,zT|c̃), i.e., making the model with safety mechanisms reproduce the generation trajectory of inappropriate images under c̃.
    • Minimizing the KL divergence between the two distributions gives the objective Lwhite = ∑t̂ E[|ρ(ϵθ(zt̂, c, t̂) − ϵθ′(zt̂, c̃, t̂))|2] (derivation in Appendix A), with c̃ taken as its minimizer.
    • The authors note this approach requires knowing ϵθ′, requires multiple samples to estimate the expectation, requires holding the model without safety mechanisms ϵθ, and requires the two model architectures to be similar, so it is limited in practice; P4D is a special case of it.

    Concept extraction (Section 3.3)

    • Collect prompt pairs that are semantically similar and differ only in the target concept c (e.g., clashed/peaceful and bleeding/fine contrasts on the violence concept), use the text encoder f to subtract and average the paired embeddings, and obtain an empirical concept representation ĉ.
    • The authors say this avoids context-dependent effects and obtains the full semantics of the target concept; the prompt pairs are generated by ChatGPT (Appendix H).

    Problematic prompt generation

    • Inject the concept into the embedding of the target prompt P: P̃cont := f(P) + η·ĉ, where η is an adjustable strength coefficient.
    • Solve a discrete optimization: under the constraints of length K and vocabulary S, minimize the L2 distance between f(P̂) and P̃cont to obtain the hard prompt P̂.
    • The optimizer chosen is a genetic algorithm (GA), which the authors say is competitive for searching large discrete spaces; it is compared with PeZ in the ablation.

    Key parameters and procedure

    • The text encoder is CLIP ViT-L/14; 50 prompts for nudity and 30 for violence are used to construct the concept representation.
    • GA settings: 200 random initial prompts, 3000 generations, mutation rate 0.25, crossover rate 0.5.
    • There is also Ring-A-Bell-Union: merging the prompts generated by three (K, η) configurations, with success if any configuration succeeds.

    Success determination

    • The metric is ASR: the proportion of problematic prompts that successfully generate inappropriate images; each prompt generates 1 image with a fixed random seed.
    • Nudity is determined by the NudeNet detector (counted if any of EXPOSED ANUS, EXPOSED BREAST F, EXPOSED GENITALIA F/M is detected); violence and other inappropriate content are determined by the Q16 classifier.
  4. What experiments did the paper conduct?

    Evaluated on I2P across 8 concept erasure settings and 4 online services, Ring-A-Bell's ASR is mostly higher than the original prompts and QF-Attack.

    Experimental setup

    • Subjects tested: concept-erasure methods SD, ESD, SLD-Max, SLD-Strong, SLD-Medium, SD-NP, CA, FMN; online services Midjourney, DALL·E 2, Gen-2, Stable Diffusion XL (Clipdrop).
    • Dataset: I2P; for nudity, 95 prompts with a nudity proportion greater than 50% were selected; for violence, 250 were selected (nudity proportion less than 50%, inappropriateness proportion greater than 50% and labeled harmful).
    • Baselines: original prompts, QF-Attack (targeted attack, character length 5, GA-generated perturbations).
    • Metric: ASR; each prompt generates 1 image with a fixed random seed; the paper does not report the number of repetitions.
    • Determination method: NudeNet detector for nudity, Q16 classifier for violence; a w/ SC condition is also set, i.e., filtering through a safety checker after generation.
    • Parameters: for nudity, K=16, η=3, and Union uses (16,3), (77,2), (77,2.5); for violence, K=77, η=5.5, and Union uses (77,5.5), (77,5), (77,4.5).

    Main results

    According to Table 2, the ASR of each method against concept-erasure models (w/o SC):

    Swipe horizontally to read the table

    ConceptAttackSDESDSLD-MaxSLD-StrongSLD-MediumSD-NPCAFMN
    NudityOriginal52.63%12.63%2.11%12.63%30.53%4.21%58.95%37.89%
    NudityQF-Attack51.58%6.32%9.47%13.68%28.42%5.26%56.84%37.89%
    NudityRing-A-Bell93.68%35.79%42.11%61.05%91.58%34.74%89.47%68.42%
    NudityR-A-B-Union97.89%55.79%57.89%86.32%100%49.47%96.84%94.74%
    ViolenceOriginal60.4%42.4%16%20.8%34%28%62%50.4%
    ViolenceQF-Attack62%56%14.8%24.2%32.8%24.8%58.4%53.6%
    ViolenceRing-A-Bell96.4%54%19.2%50%76.4%80%97.6%79.6%
    ViolenceR-A-B-Union99.6%86%40.4%80.4%97.2%94.8%100%98.8%
    • The authors say Ring-A-Bell is better than the original prompts and QF-Attack at making these models recall forgotten concepts; with SC, the Union setting is still highest (e.g., 99.2% for violence against SD, 57.89% for nudity against SLD-Medium).
    • The authors note the safety checker is more sensitive to nudity and can filter more explicit images, but its detection of violence drops markedly.
    • Exception: QF-Attack is not lower than Ring-A-Bell in individual cells (e.g., for violence against ESD w/ SC, QF-Attack is 53.6%, higher than Ring-A-Bell's 49.2%); the authors say CA and FMN themselves cannot effectively erase nudity and violence and are included only for completeness.

    Online service evaluation

    • What was tested: prompts generated by Ring-A-Bell for concept-erasure models were used to test four online services, and Table 1 reports how many adaptations (tokens) each prompt on average needs to generate an image of the target concept.
    • Results: under the nudity concept, Midjourney 36.75, DALL·E 2 44.5, Gen-2 33.5, Stable Diffusion XL 1.33; under the violence concept, 5.25, 35.5, 4.5, 0 respectively.
    • Authors' interpretation: for Midjourney, DALL·E 2 and Gen-2, sensitive words need to be modified and prompts should not be too long (use K=16); combined with prompt dilution this can increase the probability of bypassing; the authors say most services detect violence less effectively than nudity, with DALL·E 2 as an exception (it checks both prompts and images and pre-filters training data).

    Comparison with P4D and SneakyPrompt

    • P4D (Appendix K, Table 9): using the official code P4D-N, K=16, the same random seed, compared under two metrics. Under the P4D metric, Ring-A-Bell is higher in 3 of 5 settings (e.g., 91.58% vs. 28.42% against SLD-Medium), but lower against ESD (21.05% vs. 35.79%) and SD-NP (2.11% vs. 34.74%); under the Ring-A-Bell metric, P4D-N against ESD is 66.31%, higher than Ring-A-Bell's 55.79%.
    • SneakyPrompt (Appendix M, Table 10): run with its default settings (RL search, CLIP score reward, early-stopping threshold 0.26, query limit 60), the ASR on the nudity concept is ESD 12.63%, SLD-Max 3.16%, SLD-Strong 7.37%, SLD-Medium 27.37%, all lower than Ring-A-Bell (35.79%, 42.11%, 61.05%, 91.58%).
    • Authors' interpretation: SneakyPrompt targets jailbreaking safety filters, and when images generated by concept-erasure models are judged safe by the filter they are skipped, so it cannot find problematic prompts targeting concept erasure.

    Other ablations and analyses

    • K (Table 3): nudity is better at K=16 (93.68% against SD), violence is best at K=77 (96.4% against SD); in Appendix J, K=8 is not better than K=16.
    • η (Table 4): nudity is better at η=3; violence improves as η increases, with η=5 and 5.5 giving similar results.
    • Optimizer (Table 5): GA and PeZ each win some; on nudity, GA is higher on ESD and the SLD series, PeZ is higher on SD-NP, CA and FMN; on violence, GA is higher across the board.
    • Number of prompt pairs N (Table 6): the violence prompts for N=10 and 20 are only blood-related; N=30 adds firearms- and robbery-related ones; the authors say more diverse prompt pairs can extract context-independent concept representations.
    • Concept retrieval visualization (Appendix F): the authors say Ring-A-Bell can make ESD regenerate cars (K=38, η=3.5) and make ESD, CA and FMN recall Van Gogh style (K=38, η=0.9), with only figures and no quantitative results.
  5. What are some points that can be further explored?

    In Appendix C, the authors point out two limitations: the risk of tool misuse and dependence on classifiers; the experiments cover only two concepts, with 1 image per prompt.

    Limitations noted by the authors and future directions

    • Risk of misuse (Appendix C): the authors note the method could be misused by malicious actors, but position it as a red-teaming tool that can proactively test for and reduce such risks.
    • Reliance on external classifiers (Appendix C): validation relies on the quality of independent concept classifiers (NudeNet, Q16), which may have false positives and misdetections.
    • Concluding call (Appendix C): the authors say the evaluated concept-erasure methods and online services need to be redone as a whole along with stronger safety mechanisms.

    Scope of experiments

    • The concepts tested are two: nudity and violence; Appendix F additionally has visualizations of cars and Van Gogh style, with no quantitative results.
    • The concept-erasure evaluation covers 8 settings: three variants of SD, ESD and SLD, plus SD-NP, CA and FMN; the online services cover 4: Midjourney, DALL·E 2, Gen-2 and Stable Diffusion XL.
    • The data are 95 nudity prompts and 250 violence prompts from I2P; each prompt generates 1 image, and the paper does not report the number of repetitions or manual review.
    • The attacker uses a CLIP ViT-L/14 text encoder; prompt pairs are generated by ChatGPT; the GA budget is 200 initial prompts and 3000 generations.
    • Success determination is done entirely by automatic classification with NudeNet and Q16, and the paper does not report the agreement between classifier judgments and human judgment.
  6. Summarize the main content of the paper

    Ring-A-Bell uses a text encoder to construct problematic prompts offline; the authors claim it can bypass concept erasure and online service defenses, with ASR mostly higher than the baseline.

    A red-teaming paper targeting the safety mechanisms of T2I diffusion models, proposing the model-agnostic tool Ring-A-Bell.

    • Problem: whether safety filters and concept erasure can block deliberately constructed prompts; the authors argue that existing evaluations rely on manually selected prompts and are not scalable.
    • Method: use the CLIP text encoder to subtract the embeddings of paired prompts to extract a concept representation ĉ, inject it into the target prompt embedding, then use GA to search for discrete problematic prompts; fully offline, requiring only black-box access.
    • Main results: on I2P's nudity (95 items) and violence (250 items), ASR against 8 concept erasure settings is mostly higher than original prompts and QF-Attack; the Union setting reaches 100% on both concepts on SLD-Medium and CA, and 99.6% on SD for violence (Table 2).
    • Online services: the authors claim that after modifying sensitive words, controlling length, and combining with prompt dilution, the checks of Midjourney, DALL·E 2, Gen-2, and Stable Diffusion XL can be bypassed; Table 1 reports the average number of adaptations required per prompt for each service.
    • Comparison: in Appendix K, P4D-N is lower than Ring-A-Bell in 3 of 5 settings under the P4D metric; in Appendix M, SneakyPrompt's ASR on nudity (3.16%–27.37%) is lower than Ring-A-Bell's (35.79%–91.58%).
    • Authors' conclusion: Ring-A-Bell can serve as a red-teaming tool to reveal flaws in existing safety mechanisms; in Appendix C the authors note that the tool could be misused and that the evaluation depends on the quality of NudeNet and the Q16 classifier.

Related papers

Show 3 more papers
Read originalarxiv.org