An h-space Based Adversarial Attack for Protection Against Few-shot Personalization

Xide Xu, Sandesh Kamath, Muhammad Atif Butt, Bogdan Raducanu

Abstract

The rapid advancement of few-shot personalization techniques, such as DreamBooth and LoRA, has introduced significant privacy risks, allowing for the creation of high-fidelity deepfakes or unauthorized artistic style mimicry from just a few images. This paper presents HAAD (h-space based Adversarial Attack for Diffusion models), a novel defense mechanism that protects personal images by injecting imperceptible adversarial noise into the h-space—the deep semantic feature maps of a diffusion model's U-Net. By "poisoning" the fine-tuning process, HAAD ensures that any attempt to create a digital clone results in distorted, incoherent outputs. Our results demonstrate that HAAD, particularly its targeted HAAD-KV variant, provides superior robustness and imperceptibility compared to existing pixel-level protection methods.

Introduction

Few-shot personalization allows users to "teach" a text-to-image (T2I) diffusion model new concepts using only 3–5 images. While this facilitates creative expression, it also enables unauthorized identity cloning. Existing defenses often rely on pixel-level perturbations that are easily bypassed by image preprocessing (purification) or fail to disrupt the high-level semantic learning that occurs during fine-tuning.

The three-stage pipeline of HAAD: (a) Image Protection via adversarial noise, (b) Fine-tuning on protected images, and (c) Inference resulting in noisy, failed generations.

As shown in the figure above, the goal is to ensure that while the protected images look normal to humans, they contain hidden signals that fundamentally break the model's ability to associate a specific identity with a text prompt during the personalization phase.

Methodology: Attacking the h-space

The core innovation of HAAD is its focus on the h-space, the feature map produced by the middle block of the U-Net denoiser. Unlike raw pixels, the h-space is known to encode high-level semantic concepts, making it a more robust target for adversarial defense.

The HAAD architecture targeting the h-space (MidBlock) and its internal cross-attention mechanisms (Q, K, V).

HAAD and HAAD-KV

The authors propose two primary variants of the attack:

  1. HAAD: Utilizes Projected Gradient Descent (PGD) to find a perturbation $\delta$ that maximizes reconstruction loss specifically within the h-space feature maps.
  2. HAAD-KV: A more efficient and "surgical" variant. Instead of perturbing the entire h-space, it focuses solely on the Key (K) and Value (V) parameters of the cross-attention layers. Since cross-attention is the bridge where the model learns to associate text tokens (like "sks person") with visual features, disrupting this specific pathway prevents the model from "anchoring" the identity to the prompt.

Experimental Evaluation

The study evaluates HAAD on two distinct domains: CelebA-HQ (200 high-resolution face images) for identity protection and WikiArt (200 paintings) for artistic style protection. The methods were tested for transferability across different versions of Stable Diffusion (v1.4, v1.5, v2.1) and preliminary tests were conducted on the newer Stable Diffusion 3 (SD3).

Key Results

  • Superior Protection: HAAD-KV outperformed state-of-the-art methods like AdvDM and CAAT across metrics such as Identity Score Matching (ISM) and Face Detection Failure Rate (FDFR).
  • Robustness to Purification: Unlike pixel-level attacks, HAAD-KV remained effective even after images were subjected to Gaussian blurring, JPEG compression, and resizing.
  • Efficiency: HAAD-KV is remarkably efficient, updating only ~5.24 million parameters compared to the 97 million in full HAAD, yet it provides stronger protection by targeting the "Achilles' heel" of personalization: cross-attention.
  • Imperceptibility: User studies confirmed that at a noise budget of 4/255, humans could not distinguish between clean and protected images, ensuring the defense does not degrade the user experience.

Discussion and Conclusion

By shifting the adversarial attack from the shallow pixel level to the semantic h-space, HAAD provides a more fundamental and robust defense against unauthorized AI personalization. While the adversarial landscape remains a "cat-and-mouse" game, targeting the internal mechanisms of how models learn concepts offers a promising path forward for digital privacy. Future work will further explore how these h-space attacks translate to non-U-Net architectures like the Transformer-based DiT used in Stable Diffusion 3.

Summary updated

BibTeX
@inproceedings{xu2025h,
  author = {Xide Xu and Sandesh Kamath and Muhammad Atif Butt and Bogdan Raducanu},
  title = {{An h-space Based Adversarial Attack for Protection Against Few-shot Personalization}},
  booktitle = {ACM Multimedia},
  year = {2025},
  url = {https://openreview.net/forum?id=kBWoh04PYH},
}
Figure