Manuscript Offprint

arXiv:2610.26102

Provable Adversarial Detection: Prime Quantization meets Gromov--Wasserstein

Manohar Kaul, Sadbhavana Babar, Aditya Ramesh, Aditya Saibewar, Fumiyoshi Kasahara, Maki Inui, Hiroaki Kurihara

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Adversarial vulnerability persists across modern vision architectures from CNNs to vision language models (VLMs), yet existing detection methods rely on heuristics without theoretical guarantees. We address the fundamental question of when adversarial perturbations can be provably detected from a geometric perspective. Our key insight is that adversarial perturbations cannot simultaneously preserve geometric structure across spaces with fundamentally different properties. Accordingly, we construct two such complementary metric spaces. First, we use a standard CNN embedding space Z, where adversarial samples exhibit significant displacement patterns. Second, we build a novel prime-quantized space P, that absorbs small perturbations through number-theoretic discretization, resulting in minimal displacement, while preserving discriminability. We then leverage the geometric discrepancies across spaces Z and P to detect adversarial samples. To the best of our knowledge, we establish the first rigorous separation theory for adversarial detection, proving that adversarial samples create unavoidable geometric inconsistencies across both spaces. Our framework provides theoretical guarantees including pixel-level absorption bounds, neighborhood diameter concentration, Gromov-Wasserstein (GW) separation theorems, and practical risk control. Extensive experiments validate our theoretical predictions and achieve consistently strong detection performance across a wide range of attack types and model families.

1 Introduction

Vision systems have rapidly progressed from CNNs He et al. (2016) to Vision–Language Models (VLMs) Radford et al. (2021) and multimodal architectures Hurst et al. (2024), yet adversarial vulnerability persists across all these paradigms. As these increasingly capable models are deployed at scale, the consequences of undetected adversarial attacks also scale, making detection a core safety requirement.

Defenses fall into three main families. Adversarial training (Madry et al., 2018; Zhang et al., 2019; Gowal et al., 2021) augments models with adversarial examples. While effective in restricted scenarios, it requires expensive retraining and often fails to generalize across diverse attacks, including gradient-based (Goodfellow et al., 2014; Madry et al., 2018; Carlini & Wagner, 2017), physical (Brown et al., 2017), and natural corruptions (Hendrycks & Dietterich, 2019b; Engstrom et al., 2019). Detection methods (Metzen et al., 2017; Feinman et al., 2017; Ma et al., 2018; Lee et al., 2018; Ma et al., 2019; Meng & Chen, 2017; Lee et al., 2024) rely on auxiliary classifiers or statistical tests, but remain heuristic and easily broken by adaptive adversaries (Athalye et al., 2018). Certifiable robustness (Raghunathan et al., 2018; Cohen et al., 2019; Salman et al., 2019) provides provable invariance regions, but targets robust classification rather than detection, and is computationally intensive. Trade-off frameworks such as TRADES (Zhang et al., 2019) deepened our theoretical understanding, but left unanswered the key question: “Can detection itself be endowed with guarantees, and what properties make adversarial examples inherently detectable?”

Our insight. Clean and adversarial samples leave distinct geometric traces across two complementary spaces, namely, the CNN embedding space Z and a prime-quantized space P. In Z, clean samples form tight neighborhoods, while adversarial ones exhibit characteristic displacements that disrupt local structure. In P, each pixel is discretized by rounding to nearby primes under a secret bit mask, so small perturbations are either absorbed within prime gaps or forced into discrete jumps. This mechanism preserves overall discriminability yet creates systematic cross-space inconsistencies, making adversarial inputs detectable through geometric analysis.

To the best of our knowledge, we establish the first rigorous geometric separation theory for adversarial detection, spanning four levels of guarantees: (i) pixel-level absorption bounds proving when perturbations vanish in P or cross prime-gap boundaries, (ii) K-NN diameter envelopes showing clean and adversarial neighborhoods diverge differently in Z and P, (iii) cross-space separation theorems based on Gromov–Wasserstein (GW) distances that yield a non-vanishing gap scaling with dimension and perturbation strength, and (iv) risk control guarantees establishing that simple thresholding achieves bounded misclassification rates. Together, these results provide a principled foundation for adversarial detection, addressing the open question of when and why detection must succeed.

Contributions. (i) We introduce prime quantization, a cryptographically inspired discretization that generalizes across CNN, VLM, and multimodal architectures, and could extend to other one-way transforms. (ii) We present a unified theoretical framework proving that adversarial perturbations necessarily induce cross-space inconsistencies, with guarantees from pixel absorption up through GW-based separation. (iii) We empirically validate our method on a broad suite of attacks, VLM zero-shot settings, and adaptive adversaries, demonstrating consistent and strong performance compared to state-of-the-art defenses.

References (100)

  • Square attack: a query-efficient black-box adversarial attack via random search
  • Obfuscated gradients give a false sense of security: Circumventing defenses to adversarial examples
  • Robust Optimization
  • Food-101–mining discriminative components with random forests
  • Adversarial patch (opens arXiv in a new tab)
  • Towards evaluating the robustness of neural networks
  • Zoo: Zeroth order optimization based black-box attacks to deep neural networks without training substitute models
  • Deep learning for classical Japanese literature (opens arXiv in a new tab)
  • Certified adversarial robustness via randomized smoothing
  • Reliable evaluation of adversarial robustness with an ensemble of diverse parameter-free attacks
  • On the robustness of large multimodal models against image adversarial attacks
  • Order statistics
  • Imagenet: A large-scale hierarchical image database
  • An image is worth $16 \times 16$ words: Transformers for image recognition at scale
  • Pierre Dusart. Estimates of some functions over primes without rh. arXiv preprint arXiv:1002.0442, 2010. (opens arXiv in a new tab)
  • Exploring the landscape of spatial robustness
  • Learning generative visual models from few training examples: An incremental bayesian approach tested on 101 object categories
  • Detecting adversarial samples from artifacts (opens arXiv in a new tab)
  • Boosting adversarial transferability by achieving flat local maxima
  • Explaining and Harnessing Adversarial Examples
  • Improving robustness using generated data
  • Technical report, Technical Report 7694, California Institute of Technology Pasadena, 2007
  • An introduction to the theory of numbers
  • Deep residual learning for image recognition
  • Be your own neighborhood: Detecting adversarial examples by the neighborhood relations built on self-supervised learning
  • Benchmarking neural network robustness to common corruptions and perturbations (opens arXiv in a new tab)
  • Benchmarking neural network robustness to common corruptions and perturbations
  • Semantic adversarial examples
  • GPT-4o System Card
  • Batch normalization: Accelerating deep network training by reducing internal covariate shift
  • A simple weight decay can improve generalization
  • Datafreeshield: Defending adversarial attacks without training data
  • A simple unified framework for detecting out-of-distribution samples and adversarial attacks
  • Advad: Exploring non-parametric diffusion for imperceptible adversarial attacks
  • Visual instruction tuning
  • A survey for the quadratic assignment problem (opens the publisher in a new tab)
  • Metaadvdet: Towards robust detection of evolving adversarial attacks
  • Characterizing adversarial subspaces using local intrinsic dimensionality
  • Towards deep learning models resistant to adversarial attacks
  • Magnet: a two-pronged defense against adversarial examples
  • On detecting adversarial perturbations
  • Universal adversarial perturbations
  • Gromov-wasserstein averaging of kernel and distance matrices
  • Exponential expressivity in deep neural networks through transient chaos
  • Certified defenses against adversarial examples
  • Simulation and the Monte Carlo method
  • Provably robust deep learning via adversarially trained smoothed classifiers
  • How does batch normalization help optimization? Advances in neural information processing systems, 31, 2018
  • Deep information propagation
  • Pixeldefend: Leveraging generative models to understand and defend against adversarial examples
  • Dropout: A simple way to prevent neural networks from overfitting
  • One pixel attack for fooling deep neural networks
  • Dropout training as adaptive regularization
  • Boosting adversarial transferability by block shuffle and rotation
  • Patchcleanser: Certifiably robust defense against adversarial patches for any image classifier
  • Fashion-MNIST: a Novel Image Dataset for Benchmarking Machine Learning Algorithms
  • Feature squeezing: Detecting adversarial examples in deep neural networks
  • Qwen2 Technical Report
  • A fourier perspective on model robustness in computer vision
  • Theoretically principled trade-off between robustness and accuracy
  • Detecting adversarial data by probing multiple perturbations using expected perturbation score
  • Boosting cross-task adversarial attack with random blur
  • Unless otherwise noted, all notation is consistent across sections
  • Since $R_k^{(b_j)}$ rounds each integer to one of the two primes bracketing its interval, the images
  • By independence of $U_i$ and $U_i'$
  • Hence, $\Pr[T_k^{(b)}(x) = T_k^{(b)}(x')] \leq \left(\Lambda^2 \frac{G_k}{N}\right)^d$, yielding the stated bound
  • For $k = 3$ ( $N = 10^3$) with empirical maximum gap $G_k = 36$, the per-pixel factor is $36/1000 = 0.036$, so for CIFAR-10 ( $d = 3072$) the bound is at most $(0.036)^{3072} \approx 10^{-4.4 \times 10^3}$
  • We consider their product space $W = X \times Y$ endowed with a standard $\ell_p$ product metric
  • An identical argument applies to $d_Y(y_1, y_2)$
  • To see that $\ell_\infty$ is the tightest, observe that for any $p < \infty$, $(M_X^p + M_Y^p)^{1/p} \geq \max\{M_X, M_Y\}$
  • Projections are defined by $\Pi_X(x, y) = x$ and $\Pi_Y(x, y) = y$
  • These will serve as the foundation for the GW bounds in Section 5
  • For two clean images $x_i, x_j$, we denote their embeddings by $z_i, z_j$ and define the product space distance as $D_{ij} = d_{\mathcal{C}}(z_i, z_j)$
  • Accordingly, we summarize the resulting clean pairwise-distance behavior via the tail proxy
  • Let $\mathcal{N}_K^{\mathcal{C}}(z) = \{z_{(1)}, \ldots, z_{(K)}\}$ be the $K$ nearest neighbors of $z$ (ties broken arbitrarily), and write $D_{(K)} := d_{\mathcal{C}}(z, z_{(K)})$
  • Taking logarithms of the bound
  • Absorbing absolute constants (including $\log C$ and the $O(\log K)$ term) into $c$, it suffices to choose
  • An $\ell_\infty$ budget $\epsilon$ implies an $\ell_2$ budget $\epsilon_2 \leq \sqrt{d} \epsilon$, and conversely an $\ell_2$ budget $\epsilon_2$ implies $\ell_\infty$ budget $\geq \epsilon_2 / \sqrt{d}$
  • Thus, bounding the query’s displacement (via Assumption 2) allows us to extend the clean k-NN diameter bound to the adversarial case
  • For any dataset point u, the triangle inequality implies
  • Since $D_{(j)}(z) \geq D_{(K+1)}(z)$ for all $j \geq K+1$, the above inequality implies that no index $j \geq K+1$ can enter the K-NN set under the perturbation
  • Intersecting the clean diameter event and the displacement event and applying a union bound yields probability at least $1 - (\delta_{\text{clean}} + \delta_{\text{grad}})$
  • For simplicity of notation, let $Q_i^b := T_k^{(b)}(x_i) \in \mathbb{R}^d$
  • By McDiarmid's inequality
  • Define the product distance
  • Then equation 25 implies equation 26 with this $t$
  • For the adversarial displacement term, by the $\ell_\infty$ product metric
  • Intuitively, an mm-space encodes both the geometry (via $d_X$) and the distribution of mass (via $\mu$)
  • X \to Y$, i.e
  • However, it is highly combinatorial and not well-suited to data applications
  • Thus GW finds a soft correspondence $\pi$ between X and Y and penalizes discrepancies between their intra-space distances
  • Assume the clean radius envelopes $R_C \leq U_\star^\mathcal{C}$ and $R_K \leq U_\star^\mathcal{K}$ hold with probabilities at least $1 - \delta_C$ and $1 - \delta_K$, as established in Appendix D
  • Define the $K$-NN radii as $R_C := \max_{1 \leq i \leq K} d_C(x_i, q_C)$ and $R_K := \max_{1 \leq i \leq K} d_K(y_i, q_K)$
  • Finally, by the union bound, $\Pr(E) \geq 1 - (\delta_C + \delta_K)$, which concludes the proof
  • Let $x$ be a clean image and $\eta$ a perturbation
  • cluster split
  • However, whenever one index $i \in H$ and the other $j \in L$, we know $r_i^{\mathcal{C}} - r_j^{\mathcal{C}} \geq \gamma_{\mathcal{C}}$
  • Summing over all $(i,i') \in S$ gives
  • Hence the induced adversarial gap satisfies
  • Combining Theorem 2 with Remark 5, with probability at least $1 - (\delta_{\mathcal{K}}^{\mathrm{env}} + \delta_{\mathrm{grad}})$

Couldn't load all references. Reload the page to try again.