1. Introduction
With the fast development of machine learning and artificial intelligence, adversarial learning is receiving growing attention. The first striking demonstration came from Szegedy et al. [
1], who showed that imperceptible perturbations can reliably force modern neural networks to misclassify inputs, thereby exposing a fundamental vulnerability of high-capacity models. Goodfellow et al. [
2] provided a concise explanation and practical attack algorithm so-called the Fast Gradient Sign Method (FGSM) for fast, effective adversarial example synthesis, and thus enabled a set of adversarial-training defenses. Kurakin et al. [
3] showed that adversarial training can be implemented on larger-scale datasets such as ImageNet, and further revealed that this approach leads to a significant improvement in the robustness of one-step methods. Roberts and Smyth [
4] analyzed stochastic gradient descent under Byzantine adversaries, highlighting robustness issues that also arise in distributed or large-scale settings. Chhabra et al. [
5] presented a black-box adversarial attack algorithm for clustering models with linearly separable clusters. Later, Chhabra et al. [
6] proposed a black-box adversarial attack against deep clustering models. We refer to [
7,
8,
9] for the review and monographs of adversarial learning.
Following widely adopted taxonomies, adversarial attacks can be divided into three types based on attacker’s knowledge: white-box (full access to parameters/gradients), black-box (only queries or input–output pairs), and gray-box in between. Due to different goals of attacks, it can also be classified as confidence reduction, untargeted misclassification, and targeted misclassification. A large body of work has been devoted to designing powerful white-box attacks such as FGSM [
2] and its iterative variants and decision-boundary-based attacks like DeepFool [
10]. Feinman et al. [
11] proposed detecting adversarial samples using kernel density estimates in the feature space of the last hidden layer together with Bayesian uncertainty estimates. Ahmed et al. [
12] systematically evaluate four representative deep learning attacks against intrusion-detection models on cybersecurity datasets and compare several defense strategies, highlighting how different combinations of attacks and defenses affect the robustness and accuracy of such systems. Madry et al. [
13] cast adversarial training as min–max robust optimization and used multi-step PGD as a strong white-box baseline for
-bounded threats. Dong et al. [
14] added momentum to iterative gradients to improve black-box transferability over standard iterative attacks. Brendel et al. [
15] proposed boundary attack that needs only top 1 decisions, walking along the boundary while shrinking perturbations. Papernot et al. [
16] targeted a specific label by perturbing a small, saliency chosen set of pixels (sparse
-style attack). Eykholt et al. [
17] showed sticker-based perturbations that reliably fool traffic-sign recognition in the real world.
While most exciting literature focuses on developing efficient algorithms to solve adversarial learning model, understanding the mechanism is also extremely crucial in order to improve the robustness of learning models. Below, we briefly review some related literature that motivates our work in this paper. Moosavi-Dezfooli et al. [
10] introduced the DeepFool attack, viewing adversarial perturbations as minimal crossings of local decision boundaries. By iteratively linearizing the classifier, it linked perturbations to decision region geometry and provided a principled way to approximate the smallest such perturbations. Carlini and Wagner [
18] formalized perturbation attacks as optimization problems with tailored loss functions, showing attack strength depends critically on objective function and constraint choices. Ilyas et al. [
19] offered a feature-based view, arguing that adversarial perturbations exploit non-robust features: predictive yet human-imperceptible statistical patterns. This shifted the focus from geometry to data representation. Su, Li, and Cui [
20] systematically studied three types of adversarial perturbations, deriving the explicit solutions for sample-adversarial perturbations (sAP), class-universal adversarial perturbations (cuAP), and universal adversarial perturbations (uAP) for binary classification, and approximated the solution for uAP multi-classification case. Later, Su and Li [
21] addressed the difficulty of generating sAP for nonlinear SVMs via implicit mapping by transforming the perturbation optimization into a solvable nonlinear KKT system.
On the other hand, clustering is a popular yet basic model in machine learning. The study of clustering technology dates back at least to the pioneering work of Driver and Kroeber [
22], who quantified cultural relationships by similarity analysis in anthropology, as well as Tryon’s monograph on cluster analysis in psychology [
23]. Since then, many clustering algorithms have been developed, including early agglomerative hierarchical methods based on nearest-neighbour graphs and minimum-variance criteria [
24,
25], the K-means algorithm and its modern variants [
26,
27], density-based methods such as DBSCAN [
28] and OPTICS [
29], and the more recent density peaks clustering algorithm (DPC) [
30,
31]. We refer the reader to the surveys and monographs [
32,
33] for the vast literature on clustering methods and their applications. Below we mainly focus on convex clustering, which is most related to our paper.
Convex clustering model was initially proposed by Pelckmans et al. [
34], and was studied in [
35,
36]. The idea of convex clustering model is as follows. If two observations belong to the same cluster, then their corresponding centroids should be the same. Convex clustering model [
35,
36,
37,
38,
39,
40] has several advantages, such as the uniqueness of solution and theoretical guarantee of cluster recovery. To deal with high dimensional data clustering, Yuan et al. [
41] proposed a dimension reduction technique for structured sparse optimization problems. Ma et al. [
42] proposed an improved robust sparse convex clustering (RSCC) model, which incorporates a novel norm-based feature normalization technique to effectively identify and eliminate outlier features. Angelidakis et al. [
43] developed improved algorithms for stable instances of clustering problems with center-based objectives, including K-means, K-median and K-center. However, the adversarial attack case for clustering remains untouched.
To summarize, due to the complicated structure of different learning models, most adversarial attacks are difficult to interpret. Therefore, a natural question is whether we can understand the attack for a simple learning model. This motivates our work. In this paper, we study the mechanism of adversarial attack on clustering models. The contribution of the paper can be summarized as follows. (i) Firstly, we start with the perturbation of learning models, and we qualify the robustness of the solution set of learning models under perturbation by calmness. By doing so, the robustness of learning models can be clearly analyzed by the calmness property of the solution mapping. (ii) As a case study, we identify the conditions for the robustness of convex clustering model. That is, under those conditions, the convex clustering model provides unchanged clustering results under perturbation. (iii) We introduce two bilevel optimization models for adversarial learning. In particular, we formulate two bilevel adversarial learning models based on the convex clustering model. (iv) We propose and analyze deviation measures that quantify the impact of adversarial perturbations. In particular, we study the so-called -measure and examine its behaviour in a series of 2-way and 3-way clustering examples. We also generalize it to arbitrary K-way clustering. (v) Finally, we verify the above theoretical results and the efficiency of two proposed models by numerical results on the state-of-the-art datasets. The experiments show that convex clustering is robust to moderate perturbations, while larger perturbations produce a clear staircase behaviour of deviation and . We also compare the direct method and fmincon on the different UCI datasets and find that RI-based function can be used as a reasonable deviation function, whereas NMI can’t.
The organization of the paper is as follows. In
Section 2, we investigate the perturbation of learning models and relate the sensitivity of solution mapping to the so-called calmness property in the context of perturbation analysis. In
Section 3, we study the effect of perturbation on the convex clustering model and provide some examples. In
Section 4, we propose the bilevel optimization models for adversarial learning. In
Section 5, we study the so-called
-measure function to show the well-definedness as the measure of adversarial attack. In
Section 6, we conduct numerical experiments to verify the theoretical results and the efficiency of bilevel models. Final conclusions are given in
Section 7.
Notations. We use as norm for vectors and Frobenius norm for matrices. We use to denote the number of elements in a set V.
3. Perturbation Analysis for Convex Clustering
In this section, we take clustering as an example to study the effect of perturbation. We choose the convex clustering model due to the following reasons. Firstly, the strong convexity of
guarantees the unique solution of (
3), that is,
is a singleton for each
. Secondly, there are exact recovery theoretical results under proper assumptions, which states that under some conditions, the solution of (
3) perfectly recovers the ground truth clustering. Finally, Ssnal [
40] was proposed to solve (
3) which is proved to be highly efficient. We will use it to solve (
3) in our numerical experiments. We start with the case where the small perturbation will not change the clustering result.
Let
be the data and
be a partitioning of
X and
K is the number of clusters. The index sets are defined by
The following result shows the exact recovery result of the learning model (
3).
Theorem 1 ([
40], Theorem 5)
. Consider the input data and its partitioning . Assume that all centroids are distinct. Let be the conjugate index of p such that . is the unique solution of (3) and define the map for . LetAssume thatLetIfand γ is chosen such that , then the map f perfectly recovers . Theorem 1 shows that if conditions (
6) and (
7) hold, then the clustering result
coincides with the ground truth partition of
X. That is,
. One can see that the exact recovery is based on conditions (
6) and (
7). Moreover, (
6) and (
7) are calculated based on the ground truth partition
as well as the data
X. Given the perturbed data
, one can make use of Theorem 1 and provide a sufficient condition under which the clustering result is unchanged under perturbation
. To that end, let
be the perturbation of
with
. Under the partition of
, we define the following notations
Here we use
and
to mean that those coefficients may be related to the perturbation
.
Theorem 2. Consider the perturbed data and the partitioning . Let , and be defined as in (8). Assume that all centroids are distinct. Let be the conjugate index of p such that . Let be learned via (3) in Example 2 and is given by . Let . Assume thatLetIfand γ is chosen such that , then , i.e., the clustering result is unchanged. Proof. By applying ([
40], Theorem 5) with the ground truth partitioning
, and
X replaced by
, we get that the mapping
recovers the partitioning
. That is,
is the same as
. The proof is finished. □
We demonstrate this by the following one-dimension example with two clusters, that is,
and
. We use the weighted matrix
(
denotes the matrix of size
whose elements are all ones) and
. We only consider adding perturbation to a specific data. The solution of (
3) is obtained by running the algorithm semismooth Newton-CG augmented Lagrangian method (Ssnal) (
https://www.polyu.edu.hk/ama/profile/dfsun//Codes/Statistical-Optimization/ (accessed on 18 November 2025)) in [
40].
Example 3. Let , as shown in Figure 1. The solution of convex clustering model in (3) is , with decision function We perturb only on . Let , that is, . We can easily see that . Moreover, , and . Therefore, conditions (9) and (10) hold and . In fact, the solution of (3) gives . Following Example 3, we can similarly calculate that for any
, that is,
, conditions (
9) and (
10) both hold, implying that the clustering results will not be changed. This is indeed the truth since one can verify it by eyesight (See
Figure 2).
In fact, if
does not satisfy (
9) or (
10), it is very likely that the clustering result will change compared with the unperturbed clustering result. Below we give another example to show this phenomenon.
Example 4. Let . Let with . One can see that , implying that . However, . That is, condition (10) fails. In fact, , which gives . Indeed, it can be noticed from Figure 3 that . The above example gives rise to another interesting question: how to choose in order to make the clustering result change? In fact, we have the following necessary condition for changing the clustering results.
Corollary 1. If , then either (9) or (10) fails for perturbed data under partition . Proof. Assume for contradiction that
satisfies both (
9) and (
10) with perturbed data
under partition
. By Theorem 2, it holds that
, implying that the clustering results for
will remain the same as
X, which is a contradiction. Therefore, the proof is finished. □
Here we would like to highlight the following two important issues.
- (i)
The assumptions of distinct centroids and strictly positive weights, which appear in Theorem 2, are inherited from the recovery result of convex clustering ([
40], Theorem 5) and are standard in that context. These conditions ensure that the convex clustering model admits a unique, well-separated partition and allow us to derive clean sufficient conditions under which this partition is preserved under perturbations. For practical clustering problems, these assumptions may fail, putting the exact recovery in question. Therefore, it would be interesting to further study the exact recovery result when the above assumptions fail. We leave this interesting question as our future research topic to study.
- (ii)
As mentioned in
Section 2.2, the perturbation of
can be in various forms. The results in Theorem 2 and Corollary 1 hold not only for the additive point-wise noise, but also hold for other noise situations, such as multiplicative noise, feature-level noise.
To conclude this section, we give a short summary. We discussed the role of in the perturbation of convex clustering. In Theorem 2, we identified conditions on under which the clustering result remains the same. We also provided a necessary condition on in order that the clustering result can be changed.
4. Bilevel Model for Adversarial Learning
In this part, we will reformulate adversarial learning by bilevel optimization models. For general modeling and algorithmic background on bilevel optimization, see [
51,
52].
As we mentioned in
Section 3, the perturbation
on
X may lead to the changed decision function, which means that the learning model is robust. On the other hand, the perturbation
on
X may lead to the change in decision result
. It has two implications. Firstly, it means that such kind of noise is not neglectable. One needs to either do the denoising process to get rid of such noise or to improve the training process to make the learning model more robust. Secondly, from data attacking point of view, attack happens in such situation. In this case, a question arises: how could we choose the perturbation
such that some attacking criteria is maximized or minimized? This leads to the following two models for adversarial learning. The first model is to make the output of the perturbed learning model have as huge of a difference as possible compared to the original learning model, which is described as (
is given)
where
is defined to be the deviation function which measures the effect of attack, that is, the changes in decision
compared with the decision
. To make
well representing the effect of attack,
must have the following properties:
- (i)
should be a nondecreasing function with respect to .
- (ii)
for any , in particular, if .
- (iii)
. That is, if there is no perturbation (), the deviation should be zero.
In (
11), the constraint
controls the magnitude of
, so that the perturbation is not too large. Otherwise, it would be easily detected and the attack would fail. In practice, the threshold
a can be calibrated using prior knowledge on admissible noise levels in a given application. For example, many clustering robustness studies explicitly test algorithms under injected noise ratios around
to
, such as adding
uniform or Gaussian noise to the data [
53,
54], and one may choose
a in accordance with such empirical noise levels. One can see that (
11) is a bilevel optimization problem where
describes the lower level problem, saying that
must be the solution of (
5).
The second model is to minimize the scale of perturbation
, such that the attacking effect reaches the prescribed effect level
. That is,
Remark 2. is usually difficult to design due to different learning models. As far as we know, there is little work focusing on developing efficient deviation function, which is in fact important to the two adversarial learning models. We will address this question in the scenario of clustering, which can be found in Section 5. Bilevel models (
11) and (
12) are flexible to accommodate many concrete learning tasks. At the lower level, one may take
-regularized least squares, logistic regression, Support Vector Machines, or deep neural networks [
55,
56]. The deviation function
may take prediction loss on a validation set or robust loss in adversarial training [
13,
57]. Moreover,
may also represent robustness-oriented criteria inspired by risk-driven anti-clustering, such as the risk-weighted diversity objective used to partition training data in [
58]. Exploring these deviation choices within our bilevel models thus offers several promising directions for future research.
Various approaches can be explored to solve the adversarial model (
11). For the white-box setting, where the lower-level model is fully accessible, many approaches can be employed, such as the KKT-based approaches [
59,
60], value-function-based approaches [
61,
62], the duality-based approaches [
63,
64] and the hypergradients-based approaches [
65,
66,
67]. On the other hand, the bilevel model also applies to black-box attacks. In such cases, the lower-level model does not admit explicit mathematical formula, one may use evolutionary strategies [
68,
69] or derivative-free methods [
70,
71] to solve (
11).
Comparing (
12) with (
11), (
12) is usually more challenging to solve. The reason is that the feasible region of
is difficult to explicitly represent due to the implicit form of
. Therefore, how to design efficient algorithms to solve (
12) is an interesting topic which is worth further investigation.
For convex clustering problem, bilevel models (
11) and (
12) reduce to the following form
We will discuss how to choose
for clustering in the following section.
5. A Case Study on Deviation Functions
In this part, we will study the -measure function in adversarial learning for clustering problems, to verify whether it is a deviation function.
As we mentioned above, due to the different structures of learning models as well as the variants of decision functions, the deviation function on the decision function can be in many different forms. Taking the binary classification as an example, the deviation function can be chosen as the norm of difference in the classification results, i.e.,
where
is
norm (
) or
, which counts the nonzero elements of a vector.
For clustering problems, recall the aim of clustering is to partition the data points into different groups, i.e.,
is a partition of points in
, there are many different ways of measuring the clustering results. See [
72,
73] for some of the clustering functions. One natural way is to use a matrix to represent the partition of points. Take
as an example. A 0-1 matrix
is defined as follows:
Then the matrix
actually shows whether data points are grouped together, where
The following function is proposed by Biggio et al. [
74]:
Chhabra et al. [
5] believed that
increases with the number of points that spill over from partition
to
for
. However, it is still not quite clear about whether this function can fully represent the deviation of
over the original
. Therefore, below we conduct a systematic analysis on the property of
defined in (
15). We consider the following two scenarios.
5.1. Analysis on 2-Way Clustering
, with clustered into and with . Let . Assume that under perturbation , the clustering of is changed to , , where , . We have the following result.
Theorem 3. For 2-way clustering, let be defined by (15). - (i)
.
- (ii)
If (Here denotes the smallest integer that is greater than or equal to a.), is a deviation function.
Proof. For simplicity, we use
and
to represent
and
. For (i), without loss of generality, let
. Then it holds that
where
is the column vector of length
whose elements are all ones and
denotes the matrix of size
whose elements are all ones. Here ‘0’ denotes the zero vector or matrix of proper sizes. By changing the last
s data points in
to
, we have
leading to the following (
denotes the matrix of
i by
j with all elements one)
and
This gives (i).
To show (ii), obviously, and for any . Moreover, note that , therefore, as s increases for , is a nondecreasing function with respect to s. In other words, only when , is a deviation function with respect to s. □
We give some examples as follows.
Example 5. Let with partition and , which means and . It holds thatChanging from to , we get and , leading to the followingTherefore, Example 6. Let X and be the same as in Example 5. Changing from to , to get and , we getwhich gives . Example 7. Let X and be the same as in Example 5. Changing from to to get and , we getwhich also leads to . Comparing Example 6 and Example 7, the number of changed data is increasing. However, the deviation function is the same. In this case, in Example 7, implying that can not fully represent the deviation of the perturbed clustering results over the original clustering results.
In summary, Theorem 3 as well as the above examples show that choosing a proper deviation function U is very important. However, sometimes it is difficult and even tricky to choose a good function which satisfy deviation properties (i)–(iii). Also, when dealing with adversarial learning models, we have to be very careful in order to choose a good deviation function since the chosen function may not fully reflect the changes in perturbation decision function after perturbation.
5.2. Analysis on 3-Way Clustering
, with clustered into with , and . After perturbation, the cluster changes to , , , where , .
Theorem 4. For 3-way clustering, it holds thatIn particular, - (i)
If , . Then is a deviation function.
- (ii)
If and , . Then is a deviation function.
- (iii)
If , . For , is a deviation function.
Proof. Without loss of generality, assume that
,
,
. It holds that
Now a subset of data points
changes their cluster membership from
to
and a subset of data points
changes their cluster membership from
to
. It holds that
leading to the following
After calculation, we get
This gives the first part of the results.
For (i), . In this case, the third cluster does not play any role. Then reduces to , which coincides with the results in Theorem 3.
For (ii), if
,
,
takes the following form (note that
)
Note that for
is nondecreasing. Also note that
, therefore, for any
in that case,
, which means that
is always nondecreasing. That is, for any
,
is always a deviation function.
For (iii), if
, then
So for
is nondecreasing. Therefore, it is a deviation function. The proof is finished. □
Below we show some examples (Examples 8 and 9) for case (ii) and case (iii) (Examples 10–12).
Example 8. Let with partition , and , that is, . It holds thatChanging from to and from to , which means , we getIt holds thatand Example 9. Let X and be the same as in Example 8. is the same as in Example 8. Changing from to and from to , which means , we getIt holds thatand For Examples 8 and 9, it can be noticed that for case (ii), if increases, then increases, which fully reflect the changes of in -measure function.
Example 10. Let with partition , and , i.e., , and . It holds thatChanging from to and from to , which means , we getIt holds thatand Example 11. Let X and be the same as in Example 10. is the same as in Example 10. Changing from to and from to , which means , we getIt holds thatand Example 12. Let X and be the same as in Example 10. is the same as in Example 10. Changing from to and from to , which means , we getIt holds thatand Comparing Example 10 and Example 11, , so it increases as the number of changed data points grows. However, when comparing Example 11 and Example 12, the deviation function decreases. In this case, in Example 12, implying that cannot fully represent the deviation of the perturbed clustering results from the original clustering results.
However, if are not the same or , the situation is more complicated to analyze. Some small examples are given below, as shown in Examples 13–15.
Example 13. Let X and be the same as in Example 10. is the same as in Example 10. Changing from to and from to , which means , we getIt holds thatand Example 14. Let X and be the same as in Example 10. is the same as in Example 10. Changing from to and from to , which means , we getIt holds thatand Example 15. Let X and be the same as in Example 10. is the same as in Example 10. Changing from to and from to , which means , we getIt holds thatand Comparing Example 13 with Example 14, we see that although more points are changed, decreases. It indicates that in this situation, -measure function are not fully reflect the changes in partitioning. Moreover, comparing Example 14 with Example 15 shows that even with the same number of changed points (), can differ because the points are reassigned to different clusters. This highlights that is influenced not only by how many points are perturbed, but also by how those perturbations are distributed across clusters.
Theorem 4 shows that the under 3-way depends on two factors: how many points leave in total and how unevenly they split between and . In the balanced, symmetric case (Examples 8 and 9), is a deviation function. When cluster sizes or perturbed sizes are unbalanced, the effect is more complicated. In summary, is affected by both the number of perturbed points and the asymmetry of the reassignment, and it is predictable under balanced, symmetric case.
5.3. Analysis on K-Way Clustering
In this subsection, we extend the formula of
to the general K-way clustering. The setting of K-way clustering is as follows. Let the original K-way clustering be
with
. We consider the following setting. After perturbation, we still have
K clusters, but only the first cluster
spills out to other clusters:
where
In a word, we move in total
S points out of
, with
points moved to
, …, and
points moved to
.
Theorem 5. For K-way clustering, it holds that Proof. Without loss of generality, assume that the data points are ordered so that
Recall that
is the cluster-indicator matrix before perturbation. Hence the matrix
has entries
Similarly, let
so that
if and only if
and
are in the same cluster after perturbation, and
otherwise.
By definition, Since , each term if and only if , and otherwise. Therefore, counts the number of ordered pairs for which the relation of changes after perturbation. That is, It thus suffices to count, under the given perturbation pattern, how many unordered pairs change their relation. There are two cases.
Case 1. Consider the points in
. After perturbation, the set
is split into
with
and
. We count the pairs that were in the same original cluster
but end up in different clusters.
- (i)
For pairs consisting of one point in and one point in , there are such unordered pairs.
- (ii)
For pairs consisting of one point in and one point in with , there are such unordered pairs.
All these pairs were in the same cluster (cluster 1) originally, but are in different clusters after perturbation, so their cluster relation changes.
Case 2. For each , points in move from to . Before perturbation, any pair consisting of one point in and one point in belonged to different clusters (cluster 1 and cluster ℓ), whereas after perturbation they both belong to and thus become in the same cluster. There are such unordered pairs for each ℓ, and in total unordered pairs whose relation changes in this way.
Overall, the total number of unordered pairs whose relation changes is
Hence
Note that
which implies
Therefore,
which is exactly the claimed formula. This completes the proof. □
6. Numerical Results
In this part, we conduct numerical experiments to verify the theoretical results obtained in
Section 2,
Section 3,
Section 4 and
Section 5. The numerical tests are conducted in
Matlab R2023a on a MacBook Air (13-inch, M3, 2024) running macOS Sonoma 14.6 with an Apple M3 chip and 16 GB of memory. The datasets used in our experiments are from the UCI Machine Learning Repository, which can be downloaded from
https://archive.ics.uci.edu/datasets (accessed on 18 November 2025).
We consider the adversarial learning of convex clustering model (
3) with
. Given data matrix
, we solve (
3) by Ssnal [
40] with default settings and obtain a baseline solution
and cluster labels
For perturbed data
, Ssnal is also applied to obtain
and perturbed labels
. The number of changed labels compared to
is denoted by
, that is,
From ([
40], Theorems 12, Theorems 13), we know that every sequence generated by Ssnal converges to the unique optimal solution of the convex clustering problem. In addition, the semismooth Newton iterations enjoy local superlinear (and often quadratic) convergence under mild regularity conditions. These results ensure that, in our bilevel formulation, each lower-level convex clustering problem can be solved efficiently and we can obtain the unique globally optimal solution of (
5) for each
.
6.1. Robustness Verification of the Convex Clustering Model
In this part, we conduct numerical tests to verify the robustness of the convex clustering model. That is, when the perturbation is relatively small, the clustering result returned by the convex clustering model remains the same.
To better understand the role of perturbation, we select the Fisher Iris dataset with one feature (Feature 4). That is,
. We choose additive noise as
for
and
otherwise, where
. Other parameters are chosen as
,
. In this test, we increase the perturbation
gradually and report
and
in
Figure 4.
In
Figure 4, it can be observed that when
, the number of changed labels is always 0, meaning that for
, the clustering results remains the same as the unperturbed result, which verify the robustness of the convex clustering model. If
, then
changes from 0 to 6, implying that there are six data whose label is changed, leading to the deviation function
jump to 1128. In other words, if
, attack happens. Similar situation also happens when
.
6.2. Numerical Results on Deviation Functions
In this part, we consider adversarial learning by adding larger noise to the dataset. We will check by numerical results to see whether the is a reasonable deviation function.
The dataset and related parameters are the same as
Section 6.1. The results are demonstrated in
Figure 5. It can be noticed that as
increases, there are some points of
where
jumps to another value. More interestingly, when
decreases from
to
, the number of changed labels reaches its maximum value, and then drops to 40. Correspondingly, the
exhibits a very similar staircase structure, where jumps in
coincide with jumps in
, which verifies that the
-measure is a nondecreasing function with respect to
.
6.3. Verification of Bilevel Models
To analyze the bilevel models (
13) and (
14), we fix a perturbation budget
and a target deviation level
in (
13) and (
14), respectively. The results are demonstrated in
Figure 6. On the left, the star indicates at
,
attains its maximum value of (
13), which is 4974. To solve (
14), we fix a threshold
. The star highlights the optimal value of (
14) is
. In other words, the smallest perturbation to achieve the prescribed effect level (1200) is
.
Next, we will check the efficiency of the proposed bilevel models. We focus on solving (
13). We apply
fmincon in MATLAB R2023a to solve (
13) on the different UCI datasets (Fisher Iris, Seeds (We select Feature 1, that is,
and set
.) and Wine (We select Feature 13, that is,
and set
.)). In our implementation, we use the MATLAB command
fmincon to solve (
13), where the interior-point algorithm is used in
fmincon and the gradient is approximated by forward finite differences. We also reported the optimal solution obtained by direct method, i.e., evaluate
at
and return the maximum value. For the Fisher Iris dataset, the related parameters are the same as in
Section 6.2. For the Seeds dataset, we set
,
, and for the Wine dataset, we set
,
. In all cases, the resulting additive perturbations are chosen so that they do not exceed roughly
of the corresponding feature range.
The results are summarized in
Table 1.
Table 1 compares the direct method and
fmincon on the different UCI datasets. For all datasets, the direct method consistently finds perturbations with larger deviation values
, but at the price of higher CPU time. In comparison, the perturbation
returned by
fmincon is different from that by the direct method. The reason is that
fmincon returns a stationary point of the constrained optimization problem (
13).
Below we analyze the computational complexity of the algorithm. In our bilevel model (
13), the main computational cost comes from the lower-level convex clustering problems solved by Ssnal, while the evaluation of the deviation functions
only requires simple counting and basic calculation and is therefore negligible.
6.4. Other Measurements for Deviation Functions
Notice that in clustering methods, there are many measurements that can be used to evaluate the clustering results, such as Rand index (RI) and Normalized Mutual Information (NMI). In this part, we analyse the behaviour of RI and NMI under perturbations.
RI and NMI are computed in the following way [
75]. Let
denote the cluster labels of point
i in the baseline and perturbed clusterings, respectively. We consider all pairs
with
and count
,
. Here
and
are the numbers of pairs on which the two clusterings both in the same cluster or both in different clusters. The RI at
is defined as
Thus
if and only if
for all
i, i.e., the two clusterings coincide, and the index decreases towards 0 as more pairs of points are assigned differently.
To define NMI, recall
in (
4) and let
as two partitions of the
n points. NMI is calculated by
if and only if
and
induce exactly the same partition, while smaller values indicate that the two clusterings share less information.
In our test, the dataset and related parameters are the same as
Section 6.1. The results are demonstrated in
Figure 7.
As we can see, as
increases, RI decreases, meaning that the clustering result becomes worse as the scale of noise grows. Therefore, based on our deviation function, one can choose the deviation function as
which then satisfies the properties of a deviation function.
However, for NMI, it first decreases as increases, but when exceeds a certain threshold it drops to 0 and then jumps to a larger value. Due to this jump, NMI does not preserve monotonicity in . Therefore, defining a reasonable deviation function based on NMI is not trivial.
Figure 8 overlays
, RI and NMI on the same plot. This combined visualization clearly shows that intervals with RI and NMI equal to 1 correspond to
, while large values of
are accompanied by significantly reduced RI and NMI. The three curves together therefore provide a consistent picture of clustering stability: the convex clustering model is robust with respect to moderate perturbations, but beyond certain thresholds the induced partition changes abruptly and the similarity indices drop accordingly.
6.5. Discussion and Limitations
The above experiments verify that the proposed bilevel models are numerically meaningful. Here we would like to highlight the following two important issues.
- (i)
The numerical experiments in
Section 6 are carried out under an additive perturbation. Nevertheless, one can also consider other types of perturbation (noises), including multiplicative perturbations, feature-level perturbations, and graph-structured perturbations.
- (ii)
The adversarial loss functions are very common used in bilevel optimization. However, due to the limitation of space, we are not able to conduct detailed study on the property of adversarial loss functions. We will study and compare it with -measure in our future research work.
7. Conclusions
In this paper, we proposed bilevel models for adversarial learning and instantiated it with the convex clustering model. Viewing attacks as data perturbations, we derived calmness-type results that connect the robustness of the learning model to properties of the solution mapping. In particular, we identify the conditions for the robustness of convex clustering model. We formulated two complementary bilevel models: model (
11), which searches for worst-case perturbations under a norm budget, and model (
12), which computes the smallest perturbation achieving a prescribed effect level.
As a concrete deviation measure, we analyzed the
-measure, obtained explicit formulas for 2-way, 3-way, and general
K-way clustering, and identified cases in which
behaves as a deviation function. The numerical results confirm that the proposed bilevel models are computationally viable and that the deviation measures, in particular, the
-measure and the RI-based function as defined in (
16), provide a meaningful way to capture and quantify adversarial effects in convex clustering.
However, several important questions remain open and deserve further investigation. On the one hand, it is still unclear how to design efficient algorithms for solving the two bilevel models for adversarial learning in more general settings. On the other hand, all our experiments are conducted in a white-box setting. In practice, the black-box clustering attacks are more prevalent. Therefore, how to design specified and efficient algorithms to solve the bilevel model is an interesting topic, which is worth further investigation.