Skip to content
AI.info

Research

UnHype: CLIP-Guided Hypernetworks for Dynamic LoRA Unlearning

Overview Research area: Computer vision, generative AI safety, machine unlearning in text-to-image diffusion models. Technical level: Intermediate. Readers should be familiar with diffusion models, Lo

arXiv
2602.03410
Published
2026-02-03
Authors
Piotr Wójcik, Maksym Petrenko, Wojciech Gromski, Przemysław Spurek, Maciej Zieba

AI summary

Overview

Research area: Computer vision, generative AI safety, machine unlearning in text-to-image diffusion models.

Technical level: Intermediate. Readers should be familiar with diffusion models, Low-Rank Adaptation (LoRA), and CLIP embeddings to fully appreciate the method, though the core idea is accessible.

Scope: The paper presents UnHype, a framework that replaces static per-concept LoRA unlearning with a CLIP-conditioned hypernetwork that generates LoRA weights dynamically at inference time, evaluated across object, celebrity, and explicit-content erasure benchmarks on Stable Diffusion and Flux.

What This Paper Is About

Text-to-image diffusion models can generate harmful content such as non-consensual nudity or recognizable likenesses of people who wish to be excluded. Existing "unlearning" methods, especially LoRA-based ones, suppress such content by fine-tuning a small set of weights, but the resulting adapter is static: the same modification applies to every prompt, which can degrade unrelated concepts, struggle with synonyms, and become impractical when many concepts must be erased. UnHype replaces this static adapter with a hypernetwork that reads the CLIP embedding of the input prompt and generates a concept-specific LoRA on the fly.

Key Contributions

  1. Hypernetwork-driven LoRA unlearning: A context-aware framework that plugs into both Stable Diffusion (latent diffusion with CFG) and Flux (flow-matching), where a single hypernetwork generates adaptive LoRA weights conditioned on CLIP text embeddings.

  2. Amortized multi-concept erasure: A single training run can erase many concepts simultaneously (e.g., 100 celebrities), eliminating the per-concept fine-tuning, checkpoint storage, and hyperparameter tuning that bottleneck prior LoRA methods.

  3. Gradient-matching training without target LoRAs: The method adopts the Hypernet Fields principle—supervising the hypernetwork's local gradient with the task-loss gradient—so no paired (concept, target-LoRA) dataset is required.

  4. Empirical state-of-the-art across three erasure tasks: Object erasure, celebrity erasure, and explicit content removal, plus adversarial robustness evaluation against UnlearnDiffAtk and Ring-A-Bell attacks.

Main Findings

  • Object erasure: On CIFAR-10 classes (airplane, ship, bird), UnHype achieves the best composite score H_o across all three, with efficacy Acc_e as low as 5.30–8.46 percent, while baselines like FMN and AC retain much higher target accuracy.

  • Synonym generalization: Because the hypernetwork conditions on continuous CLIP embeddings rather than discrete tokens, it suppresses unseen synonyms of the erased concept, something baselines like ESD and MACE fail to do (Figure 4).

  • Nudity erasure on Stable Diffusion: UnHype reduces NudeNet detections from 743 (baseline SD v1.4) to 8, a 98.9 percent reduction, with better FID (13.45 vs 14.10) and CLIP (31.43 vs 31.34), beating SAeUron while using roughly 3 hours of training instead of 24+ hours.

  • Nudity erasure on Flux: 32 detections compared to EraseAnything's 199 and the Flux.1 baseline's 605, with the highest CLIP score (31.23) among compared methods.

  • 100-celebrity removal: GCD detection rate of 0.46 percent versus 3.52 percent for MACE, with the best harmonic trade-off H_o (92.48) and specificty Acc_s of 86.35 percent, while keeping FID competitive at 12.81.

  • Adversarial robustness: Attack Success Rate of 0.00 percent under UnlearnDiffAtk and 1.05 percent under Ring-A-Bell, the strongest across all compared baselines, including STEREO and AdvUnlearn. The authors attribute this to conditioning on the pooled CLIP embedding, which is less sensitive to token-level perturbation.

  • Semantic switch behavior: At inference, the hypernetwork outputs near-zero LoRA weights for safe concepts, so the base model behaves as if untouched, and non-zero weights for forbidden concepts, which redirect generation (e.g., "a photo of a cat" yields a forest).

Methodology in Plain English

The researchers reformulate unlearning as a dynamic weight-generation problem instead of a static fine-tuning problem.

  1. Two inputs, one network. A small MLP hypernetwork takes two inputs: the 768-dimensional CLIP embedding of a text concept and a continuous "unlearning step" value s. It outputs the entire set of LoRA weights for the diffusion model's attention modules (cross-attention for Stable Diffusion, value and output projections for Flux).

  2. Training without target weights. Directly learning a mapping from concept to final LoRA would require pre-computing a LoRA for every concept, which defeats the purpose. Instead, the authors borrow the Hypernet Fields idea: rather than matching the final weights, they match the trajectory. At each training step, they compare the hypernetwork's own numerical gradient H(c, s+1) − H(c, s) against the analytical gradient of an unlearning task loss −η∇L_task. The MSE between these is the removal loss.

  3. Two losses, one goal. The removal loss teaches the network to follow the gradient field of the unlearning objective. A retention loss penalizes any deviation from zero weights when the input concept is safe, which is what produces the semantic-switch behavior. The final objective is a weighted sum of the two.

  4. Task loss inherited from UnGuide. The unlearning task itself is a guided regression problem: the model is pushed away from a forget prompt c and toward a mapping prompt c_m (e.g., cat to forest), with the target noise prediction being a linear combination of the base model's conditional predictions.

  5. Inference is a single forward pass. Given any text prompt, the hypernetwork produces LoRA weights θ_S = H(c, S). For Stable Diffusion, these are applied only to the conditional CFG branch (the unconditional branch stays frozen). For Flux, since it uses distilled guidance rather than iterative CFG, weights are applied directly throughout sampling.

Why This Matters

Impact on research: The paper moves machine unlearning from a per-concept fine-tuning problem to an amortized generation problem. It shows that a single hypernetwork can act as a "generative model for unlearning adapters," which is a meaningful conceptual shift for the safe-generation literature and connects diffusion unlearning to hypernetwork and implicit-field research traditions.

Real-world applications:

  • Content moderation platforms filtering explicit material from open-source image generators.
  • Privacy protection for public figures or private individuals who wish to be excluded from generative outputs.
  • Enterprise deployment of diffusion models with client-specific content restrictions, where erasing many concepts at once would otherwise be cost-prohibitive.
  • Regulatory compliance for data deletion requests, where specific concepts or identities must be removed without retraining the base model.

Industry relevance: The framework's amortization property is directly useful for commercial deployments where dozens or hundreds of concepts need to be blocked simultaneously. The 3-hour training regime, compatibility with both Stable Diffusion and Flux, and plug-in nature (no architectural change to the base model) make it practical for production pipelines. The strong adversarial robustness also matters for any deployment exposed to end users who may attempt to bypass filters.

Future Directions

  • Scaling beyond 100 concepts: The paper demonstrates joint erasure of 100 celebrities; it remains open whether thousands of concepts can be handled by one hypernetwork without capacity loss or concept interference.

  • Compositional and multi-concept prompts: The current semantic switch decides per prompt whether to apply or suppress; how the method handles prompts containing both a forbidden and a retained concept is not fully characterized.

  • Cross-architecture generalization: UnHype is applied to Stable Diffusion 1.4 and Flux.1 [dev]. Extending to newer architectures (video diffusion, autoregressive image models) and to non-CLIP text encoders is a natural next step.

  • Formal guarantees and adversarial arms race: Empirical robustness is strong, but a formal analysis of how CLIP-space conditioning resists optimization-based attacks, and how it holds against stronger future attacks, would strengthen the claims.

  • Interpretability of the hypernetwork field: Since the network models a continuous unlearning trajectory, analyzing the geometry of that field may yield insights into how concepts are entangled in the base model.

Target Audience

Researchers and engineers working on diffusion model safety, machine unlearning, and parameter-efficient fine-tuning. The paper is most valuable to those familiar with LoRA and Stable Diffusion who want a scalable alternative to per-concept erasure, and to practitioners building content-filtering pipelines for generative models. Readers primarily interested in the theory of unlearning or formal privacy guarantees will find less here, since the focus is empirical and architectural.

Authors’ abstract

Recent advances in large-scale diffusion models have intensified concerns about their potential misuse, particularly in generating realistic yet harmful or socially disruptive content. This challenge has spurred growing interest in effective machine unlearning, the process of selectively removing specific knowledge or concepts from a model without compromising its overall generative capabilities. Among various approaches, Low-Rank Adaptation (LoRA) has emerged as an effective and efficient method for fine-tuning models toward targeted unlearning. However, LoRA-based methods often exhibit limited adaptability to concept semantics and struggle to balance removing closely related concepts with maintaining generalization across broader meanings. Moreover, these methods face scalability challenges when multiple concepts must be erased simultaneously. To address these limitations, we introduce UnHype, a framework that incorporates hypernetworks into single- and multi-concept LoRA training. The proposed architecture can be directly plugged into Stable Diffusion as well as modern flow-based text-to-image models, where it demonstrates stable training behavior and effective concept control. During inference, the hypernetwork dynamically generates adaptive LoRA weights based on the CLIP embedding, enabling more context-aware, scalable unlearning. We evaluate UnHype across several challenging tasks, including object erasure, celebrity erasure, and explicit content removal, demonstrating its effectiveness and versatility. See the code on GitHub: https://github.com/gmum/UnHype.

Read the original paper