Manuscript Offprint

arXiv:2611.09327

Robust Deep Prototype Classifiers via Lipschitz Training

Adia Khalid Khan, Lukas Gehring, Benjamin Paaßen

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

Abstract

Robustness and interpretability are interrelated and desirable properties of machine learning models. A model that changes its prediction under imperceptible perturbations behaves inconsistently with human-recognizable features and, hence, is not interpretable. Prototype-based classifiers such as Generalized Learning Vector Quantization (GLVQ) address both at once. They are interpretable by construction because they make the decision by comparing the input to the prototypical example; and their hypothesis margin yields a closed form robustness certificate. However, on high-dimensional data, such as images, these shallow models need deep embedding networks to achieve high accuracy, and this voids the robustness certificate. The margin is a statement about distances in the embedding space, and an unconstrained network can map an arbitrarily small input perturbation to arbitrarily large attacks in the embedding space. We close this gap with a composition theorem: if the embedding network is locally LL-Lipschitz around a point, and the classifier is ϵ\epsilon-robust around its embedding, then the full model is ϵ/L\epsilon/L-robust in the input space. Based on this theorem, we propose a novel Lipschitz training scheme to achieve LL-Lipschitz properties for embedding networks. In experiments, we evaluate three classification heads (linear, linear Support Vector Machine (SVM), and GLVQ) crossed with two embedding networks (standard and Lipschitz-constrained) on MNIST, CIFAR-10, and Imagenette-160, under Fast Gradient Sign (FGSM), Projected Gradient Descent (PGD), and Carlini-Wagner (C&W) attacks. The empirical evaluation shows that combining a prototype-based head with a Lipschitz-constrained embedding provides the strongest robustness. For example, on MNIST, the combined model retains roughly 52.9% accuracy under PGD at ϵ=0.20\epsilon = 0.20, while all unconstrained models essentially collapse. This suggests that the Lipschitz constraint provides an additional robustness benefit in addition to the advantage provided by the prototype-based head. However, since the Lipschitz constraint is enforced by sampling rather than by construction, the reported robustness is empirical rather than certified.

1 Introduction

Machine learning systems have achieved remarkable breakthroughs in recent years, enabling applications across a wide range of domains, including medical imaging, computer vision, autonomous driving, and security monitoring. In these safety-critical applications, erroneous predictions or decisions can have potentially catastrophic consequences [Zhou et al. (2022) Zhou, Liu, Ye, Zhu, Zhou, and Yu]. Therefore, such applications demand not only accurate predictions but robustness and interpretability [Carlini et al. (2019) Carlini, Athalye, Papernot, Brendel, Rauber, Tsipras, Goodfellow, Madry, and Kurakin, Göpfert et al. (2020b) Göpfert, Artelt, Wersing, and Hammer]; robust in the sense that decisions should remain stable under small changes in the input that a human would consider insignificant [Szegedy et al.(2013)Szegedy, Zaremba, Sutskever, Bruna, Erhan, Goodfellow, and Fergus, Goodfellow et al.(2014)Goodfellow, Shlens, and Szegedy, Xu et al.(2020)Xu, Ma, Liu, Deb, Liu, Tang, and Jain]; and interpretable in the sense that users should be able to understand why a particular decision was made [Gunning et al.(2019)Gunning, Stefik, Choi, Miller, Stumpf, and Yang, Xu et al.(2019)Xu, Uszkoreit, Du, Fan, Zhao, and Zhu, Biehl et al.(2016)Biehl, Hammer, and Villmann], to assess the system before deployment and to diagnose potential failures afterwards. High accuracy on a test set alone does not guarantee either of these properties.

Szegedy et al. [Szegedy et al.(2013)Szegedy, Zaremba, Sutskever, Bruna, Erhan, Goodfellow, and Fergus] were among the first to demonstrate this gap. They showed that small, often imperceptible changes to the input can completely change a network's prediction, and that such changes often transfer between independently trained models. Over the past decade, researchers have confirmed that even models with excellent accuracy on clean data can be reduced to near-zero accuracy under white-box attacks [Goodfellow et al.(2014)Goodfellow, Shlens, and Szegedy, Madry et al.(2017)Madry, Makelov, Schmidt, Tsipras, and Vladu, Carlini and Wagner(2017)]. Vulnerability to adversarial attacks can also indicate a lack of interpretability, as the model may rely on features that are not meaningful or recognizable to humans. Therefore, robustness and interpretability are closely connected rather than being distinct goals. Both assess whether the model makes decisions based on features that humans can understand and recognize. This connection is the main focus of this paper.

Two main defense approaches (adversarial training and Lipschitz-based methods) have been proposed in the literature, each with its own strengths and drawbacks. Adversarial training adds adversarial examples into the training data and remains the most effective empirical defense [Madry et al.(2017)Madry, Makelov, Schmidt, Tsipras, and Vladu, Zhang et al.(2019)Zhang, Yu, Jiao, Xing, El Ghaoui, and Jordan]. However, this approach requires an inner optimization at every training step, trades clean accuracy for robustness [Tsipras et al.(2018)Tsipras, Santurkar, Engstrom, Turner, and Madry, Zhang et al.(2019)Zhang, Yu, Jiao, Xing, El Ghaoui, and Jordan], and provides no formal guarantees: robustness is only certified against the attacks that were actually tested. Lipschitz-based methods, on the other hand, bound how much the model can amplify input differences, providing an attack-independent guarantee [Fazlyab et al.(2019)Fazlyab, Robey, Hassani, Morari, and Pappas, Virmaux and Scaman(2018), Hoffman et al.(2019)Hoffman, Roberts, and Yaida]. Yet a Lipschitz bound alone is not a defense. In fact, the most Lipschitz-stable model is the constant function, which is useless for prediction [Zühlke and Kudenko(2025)]. Therefore, we propose to combine a Lipschitz constraint for a deep embedding network with the robustness guarantees of shallow classification models.

Prototype-based classifiers are such intrinsically robust classification models—and they additionally offer interpretability as a bonus. A nearest prototype classifier assigns an input to the class of its closest prototype. Thus, its decisions are interpretable as long as the prototypes themselves are interpretable [Biehl et al.(2016)Biehl, Hammer, and Villmann, Davoodi et al.(2023)Davoodi, Mohammadizadehsamakosh, and Komeili]. Since the decision depends solely on distances to a fixed set of prototypes, the distance to the decision boundary can be calculated in closed form. This distance, known as the hypothesis margin [Crammer et al.(2002)Crammer, Gilad-bachrach, Navot, and Tishby], was originally introduced to derive generalization bounds for Learning Vector Quantization (LVQ)—a specific family of prototype-based classifiers [Crammer et al.(2002)Crammer, Gilad-bachrach, Navot, and Tishby, Hammer et al.(2005)Hammer, Strickert, and Villmann]. Saralajew et al. [Saralajew et al.(2020b)Saralajew, Holdijk, and Villmann] later showed that it also yields an adversarial robustness guarantee. Subsequent work has tightened these bounds further and has shown that prototype classifiers can be competitive with certified neural networks [Voráček and Hein(2022)], while empirical studies report that GLVQ models are robust even before any explicit certification [Saralajew et al.(2020a)Saralajew, Holdijk, Rees, and Villmann].

The challenge, however, is that LVQ operates on distances in the input space, where the Euclidean distance is not meaningful for image data [Khalid and Paassen()]. The common solution is a hybrid approach: train a deep network ϕ\phi that embeds inputs nonlinearly, and then use prototype-based decisions in this embedding space [Chen et al.(2019)Chen, Li, Tao, Barnett, Rudin, and Su, Li et al.(2018)Li, Liu, Chen, and Rudin, Snell et al.(2017)Snell, Swersky, and Zemel]. While this approach improves accuracy, it implicitly compromises the formal robustness guarantee. The certificate of a nearest prototype classifier is only valid in the space where the prototypes live. However, an unconstrained embedding network can map an arbitrarily small input change to an arbitrarily large change in the embedding space [Khalid and Paaßen(2026)]. Therefore, a certified radius in the embedding space does not provide information regarding robustness in the original input space—unless we have a guarantee that distances in the embedding space are bounded by distances in the input space, which is precisely what a Lipschitz constraint does. As illustrated in Figure 1 (compare the top-left and top-right panels), without a Lipschitz constraint, small changes in the input space can result in large changes in the embedding space, invalidating the robustness guarantee.

Our approach is a combination of prototype-based classification and Lipschitz bounds to achieve better adversarial robustness for deep prototype classifiers. In more detail, our main contributions are:

  • A composition theorem (Theorem 1) that transfers local ϵ\epsilon-robustness guarantees in the embedding space to the input space using LL-Lipschitz continuity of the deep embedding network, yielding a radius of ϵ/L\epsilon/L around each correctly classified point.

  • A Lipschitz loss and corresponding training scheme which enhances the Lipschitz continuity of deep embedding networks by sampling Gaussian noise around the training data during training and punishes violations of the desired Lipschitz constant LL. Because sampling Gaussian noise is cheap, this is substantially cheaper than adversarial training [Madry et al.(2017)Madry, Makelov, Schmidt, Tsipras, and Vladu] and less restrictive than a global Lipschitz bound.

  • An evaluation on three data sets (MNIST, CIFAR-10, and Imagenette-160) using three classifiers (linear, linear SVM, and GLVQ) and two embedding networks (standard and Lipschitz-constrained) under three adversarial attacks (FGSM, PGD, and C&W),

This paper is an extension of the conference contribution ESANN [Khalid and Paaßen(2026)]. The present paper extends it in four ways: evaluation on three benchmarks instead of one, a sensitivity analysis over the Lipschitz training hyperparameters, the addition of the Carlini–Wagner (C&W) attacks and Projected Gradient Descent (PGD) attacks, and a measurement of residual constraint-violation rates that qualifies the transferred radius as empirical.

References (57)