ATFS Open-Source Framework Blocks AI Image Edits Across GANs and Diffusion Models
A new framework called ATFS defends images against multiple generative model families at once by shifting the attack from pixel space to shared feature space.
ProTakeaways
- ATFS defends images against diffusion, GAN, and VQ-VAE generators with a single perturbation. Paper
- Pixel-space gradients from heterogeneous generators are statistically orthogonal, so naive joint attacks cancel out.
- Solution: align each model's encoder features toward a shared target guidance image instead of fighting in pixel space.
- Beats MIST and Anti-Forgery on their own architectures, hitting 0.5122 MS-SSIM on SDEdit and 0.5228 on StarGAN.
- Reaches 90% of final performance in about 40 iterations (~5 seconds), no PCGrad-style gradient surgery required.
- Robust to JPEG compression and scaling; extends to new architectures by plugging in another encoder.
Protecting a photo from being manipulated by generative AI is usually a game of pick-your-poison. Defenses built for diffusion models tend to collapse the moment someone runs the image through a GAN, and vice versa. A new paper from researchers at the University of Shanghai for Science and Technology, Singapore Management University, and Shanghai Jiao Tong University proposes a fix that finally treats the two families as one problem, and they've open-sourced the code and models.
The framework, called Architecture-Agnostic Targeted Feature Synergy (ATFS), generates a single imperceptible perturbation that simultaneously breaks diffusion editors like SDEdit, GAN editors like StarGAN, and even VQ-VAE reconstructions. It does this without expensive gradient surgery, and it converges in about 40 iterations.
Why naive ensembles quietly fail
Proactive defenses work by embedding tiny perturbations in an image so that any downstream generator produces garbage when it tries to edit or forge that image. The catch: prevailing defense mechanisms are tailored to specific model architectures, resulting in fragile defense silos that generalize poorly against heterogeneous threats. A perturbation crafted for Stable Diffusion typically does nothing to StarGAN.

The obvious workaround is to sum up the losses from several models and optimize jointly. The paper shows why this doesn't work. Because heterogeneous generators have inherently divergent objective functions, their pixel-level gradients become statistically orthogonal, causing destructive interference during joint optimization. Diffusion models learn a score field via density estimation; GANs chase a minimax discriminator boundary. In high dimensions the two gradient vectors sit at roughly 90 degrees, so adding them cancels out rather than compounds.
Gradient-surgery methods like PCGrad can partially patch this, but they add projection cost per step and don't fix the underlying geometric mismatch.
The feature-space workaround
The key observation is that despite disparate pixel-space optimization landscapes, the high-level feature representations of generated content exhibit alignment across different architectures. Every generative model, whatever its objective, has to build some internal understanding of the input before it can produce plausible output. Those internal representations, it turns out, tend to agree on what the image is about.
ATFS exploits this with a simple trick: pick a random target guidance image, precompute its feature vector in each model's encoder, and then optimize the perturbation to push the protected image's features toward those targets in every model at once. The objective becomes a sum of squared distances in feature space:
for k in models:
t_k = phi_k(x_target) # precomputed once
for step in range(T):
g_syn = 0
for k in models:
f_k = phi_k(x + delta)
loss = ||f_k - t_k||^2
g = grad(loss, delta)
g_syn += g / (||g|| + eps) # L2-normalize per model
delta = clip(delta - alpha * sign(g_syn), -eps, eps)
The feature extractors are the natural encoder layers of each model: the VAE encoder for Stable Diffusion, the generator's encoder for StarGAN, and the encoder output for VQ-VAE. Because every model is now being pulled toward a shared feature-level target, the gradients projected back to pixel space end up directionally aligned rather than orthogonal.

What the numbers look like
The authors evaluated on VGG-Face2 in two heterogeneous scenarios: Stable Diffusion 1.5 plus StarGAN v2, and Stable Diffusion plus VQ-VAE. Lower MS-SSIM and PSNR mean the edit was more successfully disrupted.
- MIST (diffusion-specific) hits 0.6387 MS-SSIM on SDEdit but jumps to 0.8011 on StarGAN, meaning the GAN edit largely succeeds.
- Anti-Forgery (GAN-specific) does the opposite: 0.5464 on StarGAN, but 0.7534 on SDEdit.
- Naive joint and PCGrad land in the middle on both, without excelling.
- ATFS reaches 0.5122 on SDEdit and 0.5228 on StarGAN, beating both specialists on their home turf.
A few other results stand out. ATFS extends to VQ-VAE simply by swapping in that model's encoder, with no algorithmic change. Under a tight perturbation budget of just 2/255, it still cuts SDEdit MS-SSIM to 0.646. It reaches over 90% of its final performance in roughly 40 iterations (about 5 seconds), compared with more than 15 seconds for PCGrad-style baselines. And perturbations survive JPEG compression better than pixel-level attacks, because feature representations inherently smooth over high-frequency noise that JPEG's DCT would strip out.

Where it fits, and where it doesn't
The obvious use case is protecting portraits before they're posted publicly, so downstream editing or DreamBooth-style fine-tuning produces mangled outputs instead of a convincing forgery. Adversarial examples trained for the DM+GAN scenario transferred to DreamBooth without retraining, which is a decent proxy for real-world unknown-attacker conditions.
A few caveats worth noting. ATFS still assumes white-box access to each model's encoder to build the feature extractor set; truly unknown architectures require adding a new phi_k. The evaluation is limited to facial images from VGG-Face2, so behavior on complex scenes, artistic styles, or video is unknown, though the authors flag 3D and temporal extensions as future work. And like all proactive perturbations, it protects the image at upload time, not retroactively.
The deeper contribution isn't the specific loss function. It's the empirical claim that generative encoders, no matter how differently they're trained, converge on similar high-level representations, and that this alignment is enough to turn a multi-objective adversarial attack into a single-objective one. If that observation holds up as more architectures are tested, the pattern of building a separate defense for each new generator starts to look like a dead end.