Revealing Hidden Vulnerabilities in Autoencoders through Gradient Signal Restoration
Research Institute CODE, University of the Bundeswehr Munich
TL;DR: Autoencoders can look robust to adversarial attacks simply because the attacks fail to optimize, not because the models are truly robust. Near-zero singular values in ill-conditioned layers make the attack gradient vanish. We propose GRILL, which restores this gradient signal and reveals vulnerabilities that existing attacks miss, in autoencoders and in vision-language models such as Gemma 3 and Qwen 2.5.
Motivation: an illusion of robustness
Autoencoders (AEs) are used for image compression, denoising, anomaly detection and generative modelling, often in high-stakes settings. To know how much we can trust them, we test them with white-box adversarial attacks: we search for a tiny, norm-bounded perturbation of the input that damages the reconstruction as much as possible. If even a strong attack cannot cause much damage, we call the model robust.
But this conclusion is only as good as the attack. We found that standard attacks on AEs often stall early and converge to weak perturbations. The model then looks robust, while a better-optimized attack under the same budget can destroy its output.
Why attacks fail: vanishing gradients in ill-conditioned layers
Encoder–decoder models compress data into a smaller latent space, so they are ill-conditioned by design, and training often makes this worse: some singular values of the layer weights grow large while others shrink toward zero.
Most robustness work focuses on the large singular values, which amplify perturbations. We look at the other end. When an attack backpropagates its loss gradient through a layer whose smallest singular value \(\sigma_{\min} \to 0\), the gradient signal is squashed. By the time it reaches the input, it is close to zero, and gradient-based optimization has nothing to follow.


The main idea: GRILL
GRILL (Gradient Signal Restoration in Ill-Conditioned Layers) builds on a simple observation: even when the gradient from the output vanishes, layers before the ill-conditioned part still carry a useful gradient.
We first combine the latent distortion and the output distortion as a product instead of a sum. Through the product rule, the healthy latent gradient is scaled by the output distortion, so the attack still moves in a meaningful direction even when the output gradient has vanished. We call this Latent Gradient Restoration (LGR).
Ill-conditioning can occur anywhere in a network, not just in the decoder. So GRILL treats every layer as a possible split point between an “encoder” \(\phi_k\) and a “decoder” \(\psi_k\), and sums the distortion over all splits, scaled by the final output distortion \(\delta^{*}\):
\[x_a^{*} = \arg\max_{x_a \in B_c^p(x)} \; \delta^{*} \sum_{k=1}^{n-1} \delta_k , \qquad \delta_k = \Delta\big(\phi_k(x_a), \phi_k(x)\big)\]
The multiplicative coupling matters: if we drop \(\delta^{*}\) and simply add up the layer losses, the attack becomes clearly weaker. GRILL also reuses activations from the normal forward and backward pass, so it costs about the same number of FLOPs per step as a standard latent-space attack.
Results
We tested GRILL on five autoencoders (β-VAE, TC-VAE, NVAE, DiffAE and MAE), against universal and sample-specific attacks, with and without a state-of-the-art defense, and with three distance functions (L2, Wasserstein and cosine).
The worse the conditioning, the bigger the gain. On the severely ill-conditioned NVAE, GRILL increases output distortion by 38–57% over the strongest baseline. On DiffAE, whose ill-conditioning is concentrated in the last encoder layer, the gain is 14–16%. On the mildly ill-conditioned models, GRILL matches the best baselines, and on TC-VAE it still beats them by up to 12.7%.
GRILL stays strong against defenses. A Hamiltonian Monte Carlo defense refines latent codes at inference time and strongly suppresses baseline attacks. In the adaptive setting, where the attacker knows about the defense, GRILL is ahead on NVAE, DiffAE, TC-VAE and β-VAE. Only on MAE is there no gain, because the defense is less effective for its deterministic latent space.
Beyond autoencoders: vision-language models
Large vision-language models have a similar layered encoder–decoder structure, and Gemma 3 and Qwen 2.5 also show widespread near-zero singular values. Applying GRILL to their intermediate representations, with perturbation budgets too small to see, changes what the model says about an image. Existing attacks (BSA, DRA, FDA, SSPA and EGA) only paraphrase the original answer. On Gemma 3, GRILL also achieves lower BERTScore precision and recall than all of these baselines, meaning stronger semantic damage.
Takeaway
A model that withstands an attack is not necessarily robust: the attack may simply have lost its gradient. Robustness evaluation needs to be conditioning-aware. GRILL is a drop-in way to make white-box attacks on encoder–decoder models more reliable, so that we stop overestimating how safe these models are.
Citation
@article{ramanaik2025revealing,
title={Revealing Hidden Vulnerabilities in Autoencoders through Gradient Signal Restoration},
author={Ramanaik, Chethan Krishnamurthy and Roy, Arjun and Callies, Tobias and Ntoutsi, Eirini},
journal={arXiv preprint arXiv:2505.03646},
year={2025}
}