MeanSparse: Post-Training Robustness Enhancement Through Mean-Centered Feature Sparsification

## Abstract

Abstract We present a simple yet effective method to improve the robustness of both Convolutional and attention-based Neural Networks against adversarial examples by post-processing an adversarially trained model.
Our technique, MeanSparse , cascades the activation functions of a trained model with novel operators that sparsify mean-centered feature vectors.
This is equivalent to reducing feature variations around the mean, and we show that such reduced variations merely affect the model’s utility, yet they strongly attenuate the adversarial perturbations and decrease the attacker’s success rate.
Our experiments show that, when applied to the top models in the RobustBench leaderboard, MeanSparse achieves a new robustness record of 75.28 % percent 75.28 75.28\% 75.28 % (from 73.71 % percent 73.71 73.71\% 73.71 % ), 44.78 % percent 44.78 44.78\% 44.78 % (from 42.67 % percent 42.67 42.67\% 42.67 % ) and 62.12 % percent 62.12 62.12\% 62.12 % (from 59.56 % percent 59.56 59.56\% 59.56 % ) on CIFAR-10, CIFAR-100 and ImageNet, respectively, in terms of AutoAttack accuracy.
Code: https://github.com/SPIN-UMass/MeanSparse

## 1 Introduction

*Adversarial Training* (AT) [] has become a popular method to defend deep neural networks (DNNs) against adversarial examples [, ]. The core idea involves generating adversarial examples during the training phase and incorporating them into the training dataset. The mere existence of such adversarial examples are due to features that are non-robust to imperceptible changes [].
AT attenuates the significance of these non-robust features on model’s output, therefore improving robustness.

While AT has demonstrated effectiveness in enhancing model robustness, it faces limitations in generalizability across various methods for generating adversarial examples and suffers from low training efficiency. Various directions have been taken [, , ] to overcome these challenges in order to enhance the robustness provided by AT. In this work, we explore a complementary direction towards improving AT’s robustness: The design of activation functions presents a promising, yet underexplored, avenue for improving AT. Smooth Adversarial Training (SAT) has shown that replacing ReLU with a smooth approximation can enhance robustness [], and activation functions with learnable parameters have also demonstrated improved robustness in adversarially trained models [, ]. This paper aims to further investigate the potential of activation functions in enhancing AT, providing new insights and approaches to bolster model robustness.

In this work, we explore the impact of sparsifying features to enhance robustness against adversarial examples. We introduce the MeanSparse technique, which integrates sparsity into models trained using AT. Our findings indicate that non-robust features persist in the model, albeit with reduced values, even after applying AT. This insight inspired our approach to partially block these remaining non-robust features. To achieve this, we propose imposing sparsity over mean-centered features, denoted by *Mean-based Sparsification*, inspired by sparsity-promoting regularizers commonly used for feature denoising [, ] and feature selection [, ].

Figure 1 illustrates the mean-based sparsification operator, a crucial component of the MeanSparse technique. In the first column, the histogram for a randomly selected channel in the first layer of the RaWideResNet trained on the CIFAR-10 dataset [] is displayed, showing the mean and standard deviation calculated over the CIFAR-10 training set (top figure). The mean-based sparsification operator (bottom figure), parameterized by $\alpha$ blocks variations around the mean. In the second column, the top figure shows the features of a hypothetical channel for a CIFAR-10 test image. The sparsification operator blocks variations between the blue and green dashed lines, producing the output shown in the bottom figure. The third column provides a similar visualization for the input and output histograms of the sparsification operator. Blocking high-probability (low information) variations prevents deterioration of model performance while limiting the attacker’s ability to exploit that region.

MeanSparse establishes a new state-of-the-art (SOTA) in robustness. When applied to the leading robust models, it improves $\ell_{\infty}$ AutoAttack accuracy from $73.71\%$ to $75.28\%$ on CIFAR-10, from $42.67\%$ to $44.78\%$ on CIFAR-100, and from $59.56\%$ to $62.12\%$ on ImageNet, while maintaining nearly unchanged clean accuracy. Additionally, when applied to the top model for $\ell_{2}$ AutoAttack accuracy on CIFAR-10, MeanSparse boosts robust accuracy from $84.97\%$ to $87.28\%$. In all four cases, MeanSparse achieves the highest ranking according to RobustBench specifications [].

Figure: Figure 1: Mean-based sparsification operator used in the MeanSparse technique for hypothetical channel *ch*. The first column represents the design procedure. First, the mean ($\mu_{\mathrm{ch}}$) and standard deviation ($\sigma_{\mathrm{ch}}$) are calculated over the training set (top figure). The mean-based sparsification operator is designed with hyper-parameter $\alpha$ which blocks the variations in the $\alpha\sigma_{\mathrm{ch}}$ vicinity of $\mu_{\mathrm{ch}}$ (bottom figure). The second column represents how mean-based sparsification affects the input features for one test sample (top figure) and generates output features (bottom figure). The effect of mean-based sparsification over the feature histogram is also demonstrated in the third column.
Refer to caption: x1.png

In summary, we make the following contributions:

- •
Integrating MeanSparse into the top robust models from the RobustBench benchmark [] improved robustness, establishing new records for $\ell_{\infty}$ AutoAttack accuracy: on CIFAR-10 (from $73.71\%$ to $75.28\%$), CIFAR-100 (from $42.67\%$ to $44.78\%$), and ImageNet (from $59.56\%$ to $62.12\%$). Additionally, new $\ell_{2}$ AutoAttack accuracy record was set on CIFAR-10 (from $84.97\%$ to $87.28\%$).
- •
The developed MeanSparse technique can be easily integrated into trained models, enhancing their robustness at almost no additional cost.
- •
We identified critical limitations of current activation functions and developed MeanSparse to mitigate these limitations. Our simulations show that regardless of the activation function, MeanSparse improves robustness upon integration.
- •
Through various experiments, we demonstrated that the improved robustness resulting from MeanSparse can be generalized across different model sizes and architecture types.

## 2 Preliminaries

### 2.1 Notations

We use bold lowercase letters to show vectors while the $i$-th element of vector $\bm{x}$ is represented by $x_{i}$. Two vector norm metrics are used throughout the paper, including $\ell_{0}=\|\cdot\|_{0}$ (number of non-zero elements) and $\ell_{2}=\|\cdot\|_{2}$ (Euclidean norm). The $\ell_{0}$ norm can also effectively penalize the variables with small values but its nonsmoothness limits its application. The proximal operator finds the minimizer of function $f$ in the vicinity of input vector $\bm{v}$ and plays an essential role in our intuition to design the mean-based sparsification operator.

###### Definition 2.1 (Proximal operator [ 33 ] ) .

Let $f:\mathbb{R}^{n}\rightarrow\mathbb{R}\cup\{+\infty\}$ be a proper and lower semi-continuous function. The proximal operator (mapping) $\mathop{\mathrm{prox}}_{f}:\mathbb{R}^{n}\rightarrow\mathbb{R}^{n}$ of $f$ at $\bm{v}$ is defined as:

$$ $\displaystyle\mathop{\mathrm{prox}}_{f}(\bm{v})=\operatorname*{arg\,min}_{\bm{ x}}~{}f(\bm{x})+\frac{1}{2}\|\bm{x}-\bm{v}\|_{2}^{2}$ (1) $$

The definition of proximal operator can be extended to nonsmooth functions such as $\ell_{0}$ norm. Assume $f(\bm{a})\triangleq\lambda\|\bm{a}\|_{0}$. Then the proximal operator can be calculated as []:

$$ $\displaystyle\mathop{\mathrm{prox}}_{f}(\bm{v})=\mathcal{H}_{2\lambda}(\bm{v}) ,~{}\mathcal{H}_{\alpha}(v)=\begin{cases}v&|v|>\sqrt{\alpha}\\ 0&|v|\leq\sqrt{\alpha}\end{cases}$ (2) $$

where $\mathcal{H}_{\alpha}(\cdot)$ is the element-wise hard-thresholding operator.

###### Definition 2.1 (Proximal operator [ 33 ] ) .

### 2.2 Related Work

Adversarial training, a method to enhance model robustness, encounters high complexity because of the adversarial attack design incorporated during training. The concept of using adversarial samples during training was first introduced in [] and then AT was introduced in []. *Fast Gradient Sign Method* (FGSM) is a low-complexity attack design used for AT [, , , ]. This approach while reducing the complexity of AT, cannot generalize to more complex adversarial attacks. On the other hand using *Projected Gradient Descent* with AT, although increasing the attack design complexity due to its iterative nature, can better generalize to other adversarial attacks [, , , ]. *Curriculum Adversarial Training* gradually increases the complexity of adversarial samples during AT []. Other types of adversarial attacks also have been proposed to be used for AT including *Jacobian-based Saliency Map Attack* [], Carlini and Wagner attack [, ] and attacking Ensemble of methods during AT [], among others.

Different activation functions have been proposed that generally target to improve the generalizability of DNNs [, , , , , , , ]. Bounded ReLU (BReLU) where the output of ReLU is clipped to avoid adversarial perturbation propagation has shown robustness improvements in standard training scenarios []. The effect of symmetric activation functions [], data-dependent activation functions [], learnable activation functions [] and activation function quantization [] over the robustness of the model in standard training scenario have also been explored.

The performance of different non-parametric activation functions in the AT scenario is explored in [] and smooth activation functions demonstrated better robustness. This result is on par with SAT where the authors argued that the ReLU activation function limits the robustness performance of AT due to its non-smooth nature. In other words, the non-smooth nature of ReLU makes the adversarial sample generation harder during training. Thus they proposed the SAT which replaces ReLU with its smooth approximation and trained using Adversarial training. The results show improved robustness while preserving the accuracy []. The effect of non-parametric activation function curvature has also been studied which shows that lower curvature improves the robustness [].

Parametric activation functions increase the flexibility of activation functions while the parameters can be learned during the training phase. This flexibility, if designed intelligently, is also shown to be effective in improving robustness with AT. An example of Parametric activation functions is parametric shifted SiLU (PSSILU) [].

Similar to Neural Architecture Search (NAS), *Searching for Adversarial Robust Activation Functions* (SARAF) is designed to search over candidate activation functions to maximize the model robustness. Using a meta-heuristic search method, SARAF can handle the intractable complexity of the original search problem [, ].

## 3 Methodology

From the concept of non-robust features, it is understood that through adversarial training, these features become less informative about the output label []. From an information-theoretic point-of-view, we also recognize that as the occurrence probability of a random vector increases, its informational value decreases []. Consequently, to identify the less informative features, it is useful to examine the regions of high probability within the feature space. One easily accessible high-probability point is the feature mean. Following this reasoning, we can block minor variations around the mean to eliminate the less informative or equivalently, the non-robust features. We begin this section by designing a regularized optimization objective to block non-robust features. Although this optimization problem is not used in the final MeanSparse technique, its parameter update rule provides valuable insight into the design of the sparsification operator introduced later. Finally, we demonstrate the complete MeanSparse technique.

### 3.1 Intuition from Regularized Optimization Objective

Figure: Figure 2: Mean-centered feature used in regularized optimization problem equation 3
Refer to caption: x2.png

The small changes around the feature mean value at the output of different layers are potentially non-robust features. Thus we start by penalizing those changes using $\ell_{0}$ norm in an arbitrary layer $l$ for a training sample $\bm{x}$ (extension to the whole dataset and all layers is straightforward). The original training objective can be formulated as:

$$ $\displaystyle\mathcal{P}_{0}:~{}\bm{\theta}_{0}^{\star}=$ $\displaystyle\operatorname*{arg\,min}_{\bm{\theta}}~{}L(\bm{\theta})+\gamma\| \overline{\bm{a}}(\bm{x};\bm{\theta})\|_{0},~{}~{}L(\bm{\theta})\triangleq \mathcal{L}(\bm{y}(\bm{x}),\bm{y}^{\star};\bm{\theta})$ (3) $$

where $\bm{\theta}$ is the vector containing model parameters, $\gamma$ is a hyper-parameter, $\overline{\bm{a}}(\bm{x};\bm{\theta})$ is the centralized feature vector before the activation function in the regularized layer, $\bm{y}(\cdot)$ is the model output and $\bm{y}^{\star}$ is the target label corresponding to $\bm{x}$. Throughout the paper, we assume $\mu_{a}$ to be a fixed vector that is updated using an exponential filter during training, similar to the mean and variance vectors calculated in a batch normalization layer. Figure 2 represents the way mean-centered features for regularization are generated. One option to solve the optimization problem in equation 3 is via the penalty method.

To solve problem equation 3, we introduce an approximate version of this problem based on the penalty method (for simplicity we use $\overline{\bm{a}}$ instead of $\overline{\bm{a}}(\bm{x};\bm{\theta})$):

$$ $\displaystyle\mathcal{P}_{\lambda}:~{}\bm{\theta}^{\star}_{0,\lambda},\bm{w}^{ \star}=$ $\displaystyle\operatorname*{arg\,min}_{\bm{\theta},\bm{w}}~{}L(\bm{\theta})+ \gamma\|\bm{w}\|_{0}+\frac{1}{2\lambda}\|\bm{w}-\overline{\bm{a}}\|_{2}^{2}$ (4) $$

where $\lambda$ is the penalty parameter, $\bm{w}$ is the penalty variable, and the optimization is with respect to both variables $\bm{\theta}$ and $\bm{w}$. Based on the penalty method (PM), we can conclude:

$$ $\displaystyle\lim_{\lambda\rightarrow 0}\bm{\theta}_{0,\lambda}^{\star}=\bm{ \theta}^{\star}_{0}$ (5) $$

So to approximate $\bm{\theta}_{0}^{\star}$, one can solve problem $\mathcal{P}_{\lambda}$ and decrease $\lambda$ during the training. One approach to solve problem $\mathcal{P}_{\lambda}$ is to use block coordinate descent where the $\bm{\theta}$ and $\bm{w}$ are updated sequentially []. So we have two steps in each training iteration $k$.

Step1$\rightarrow$ Calculatign $\bm{w}_{k}$:
To calculate $\bm{w}_{k}$, we should solve:

$$ $\displaystyle\bm{w}_{k}$ $\displaystyle=\operatorname*{arg\,min}_{\bm{w}}~{}\gamma\lambda\|\bm{w}\|_{0}+ \frac{1}{2}\|\bm{w}-\overline{\bm{a}}_{k-1}\|_{2}^{2}$ (6) $$

The problem in equation 6 matches the definition of the proximal operator in equation 1 and can be solved exactly by the proximal operator for the function $f(\bm{w})=\gamma\lambda\|\bm{w}\|_{0}$. Thus we have:

$$ $\displaystyle\bm{w}_{k}=\mathop{\mathrm{prox}}_{f}(\bm{z}_{k-1})=\mathcal{H}_{ 2\lambda\gamma}(\overline{\bm{a}}_{k-1})$ (7) $$

Step 2 $\rightarrow$ Calculating $\bm{\theta}_{k}$:
To calculate $\bm{\theta}_{k}$, we have to solve the following problem:

$$ $\displaystyle\bm{\theta}_{k}=\operatorname*{arg\,min}_{\bm{\theta}}~{}L(\bm{ \theta})+\frac{1}{2\lambda}\|\bm{w}_{k}-\overline{\bm{a}}\|_{2}^{2}$ (8) $$

while $\bm{w}_{k}$ is calculated using hard-thresholding operator as in equation 7. One step of (stochastic) gradient descent can be used to update $\bm{\theta}$ based on equation 8.

### 3.2 Mean-centered Feature Sparsification

Update rule equation 8 shows $\overline{\bm{a}}$ approaches $\mathcal{H}_{2\lambda\gamma}(\overline{\bm{a}}_{k-1})$ by the second term while the weight for this term is increasing (equivalently $\lambda$ is decreasing) during the training. Based on this intuition, we propose to use the $\mathcal{H}_{2\lambda\gamma}(\overline{\bm{a}}_{k-1})$ in the forward propagation of the model. If we add the element-wise mean subtraction and addition in 2 into the hard-thresholding operator, we achieve the curve in the bottom of the first column in 1 assuming $\alpha\sigma_{\mathrm{ch}}=(2\lambda\gamma)^{2}$ (for simplicity of notation, we use $Th$ instead). This curve represents a sparsification around the feature mean value $\mu_{a}$. In other words, we have the following element-wise operation over the input $\bm{a}^{(\text{in})}$:

$$ $\displaystyle a^{(\text{out})}=\begin{cases}\mu_{a}&if~{}|a^{(\text{out})}-\mu _{a}|\leq~{}Th\\ a^{(\text{in})}&if~{}|a^{(\text{out})}-\mu_{a}|>~{}Th\\ \end{cases}$ $$

So, features within the $Th$-vicinity of the feature mean are blocked and the mean value is output, while larger values pass through the Sparsification operator unchanged.

### 3.3 MeanSparse Technique

Now we have a mean-centered sparsification operator that can be integrated into the model to block non-robust variations around the mean value. However, there are several challenges and improvements to address, which will be discussed in this section. By applying these enhancements, the final technique is formed.

### Sparsification in Post-processing

As a general input-output mapping relation, mean-centered feature sparsification can be added to any part of deep learning architecture without changing the dimension. The back-propagation of training signals through this sparsification operator will be zero for inputs in the $Th$-vicinity of the feature mean, which avoids model training since the mean is the place where the highest rate of features lies. Two options can be applied to solve this problem.

The first approach is to gradually increase the $Th$ value through iterations. At the start of training, $Th$ is set to zero. Thus, sparsification reduces to an identity transformation, which solves the problem of backpropagation. Then, throughout the iterations, $Th$ is increased until it reaches a predefined maximum value. The most challenging problem in this scenario is the selection of a $Th$ scheduler as the model output is not differentiable with respect to $Th$ and $Th$ cannot be updated using gradient. In this scenario, we need to calculate the mean vector for the input feature representation inside the sparsification operator in a similar way to batch normalization layers.

The second solution is to apply sparsification as a post-training step to an adversarially trained model. In this scenario, first, we freeze the model weights and add the mean-centered feature sparsification operator to the model in the predefined positions. Then we need to pass through the complete training set once to calculate the feature mean value. Next, we decide on the value of $Th$. Similar to the previous scenario, this step cannot be done using gradient-based methods as the operator is not differentiable with respect to $Th$. Thus, we can search over a range of $Th$ values and find the best one that results in the highest robustness while maintaining the model’s clean accuracy.

In this paper, we use the second method. Thus, we freeze the model and apply sparsification over mean-centered features before the activation functions in the trained model. Then calculate the mean value over the training set and finally find the value of $Th$ that results in the best robustness performance while maintaining the model’s clean accuracy.

### Adaptive Sparsification Using Feature Standard Deviation

As we need to apply sparsification before all activations in the model, searching over a simple space and finding a suitable set of $Th$ for different activation functions becomes intractable, even in small models. Thus, we design to select the threshold as $Th=\alpha\times\sigma_{\mathrm{a}}$. While we pass through the training set to find the mean value $\mu_{\mathrm{a}}$, we can also determine the variance value $\sigma_{a}^{2}$ in parallel and use $Th=\alpha\times\sigma_{\mathrm{a}}$ as the threshold. As a result, for a fixed value of $\alpha$, the blocking vicinity around the mean increases as the variance of the feature increases.

### Per-channel Sparsification

Throughout the neural network, the input to the activation functions can be considered as 4-dimensional, represented as $N\times C\times H\times W$ ($N$, $C$, $H$ and $W$ represents the batch size, channels, height and width, respectively). To better capture the statistics in the representation, we use per-channel mean $\mu_{\mathrm{ch}}$ and variance $\sigma_{\mathrm{ch}}$ in sparsification operator. As a result, the mean and variance vectors are $C$-dimensional vectors. The sparsification operates on each feature channel separately, using the mean and variance of the corresponding channel.

### Complete Pipeline

The complete pipeline to apply MeanSparse technique is formed by equipping the mean-centered sparsification operator with the three aforementioned modifications and adding it before all activation functions in the model with a shared $\alpha$ parameter. Figure 1 illustrates an example of integrating the MeanSparse technique into an adversarially trained model. In the first column, the upper figure represents the histogram of one channel features in the first layer of RaWideResNet trained adversarially over the CIFAR-10 dataset [] along with the mean $\mu_{\mathrm{ch}}$ and standard deviation $\sigma_{\mathrm{ch}}$ over the complete training set. Based on this histogram, we design the bottom sparsification operator where the variations in $\alpha\sigma_{\mathrm{ch}}$-vicinity of the mean are blocked. The second and third column represents the input and output of the sparsification operator for one test image of the CIFAR-10 dataset $\bm{x}_{t}$ in sample space and histogram, respectively. The top figures are input and the bottom ones are output. The feature histogram for $\bm{x}_{t}$ is bimodal. One of the modes matched the $\mu_{\mathrm{ch}}$ which is the feature’s peak over the training set. Based on our intuition, the variations in this region are uninformative and can be blocked as we see in the bottom figures of the second and third columns.

By using the MeanSparse presented in this paper, one can enhance the SOTA robust accuracy over CIFAR-10, CIFAR-100 [] and ImageNet [] datasets, as evidenced by the RobustBench [] rankings. Through various ablation studies, we also demonstrate the effectiveness of the proposed pipeline in multiple scenarios. This pipeline sheds light on a new approach to improve robustness without compromising clean accuracy.

## 4 Experiments

The proposed pipeline in Figure 1 represents the way one can integrate MeanSparse into different trained models. In this section, we present several experiments to demonstrate the effectiveness of the MeanSparse across different architectures and datasets and in improving the SOTA robustness. The experiments were conducted using an NVIDIA A100 GPU.

### 4.1 Evaluation Metrics

Throughout the experiments, we use *Clean* to represent the model accuracy for clean data. *$\text{A-PGD}_{\text{ce}}$* is used as a robustness measure and represents accuracy after applying Auto PGD with Cross-Entropy (CE) loss. *A-PGD* is used as another robustness measure and represents accuracy after applying Auto-PGD with both CE and Difference of Logits Ratio (DLR) loss metrics. Finally, we use *AA* to represent AutoAttack accuracy. All the robustness metrics can be found in []. In our experiments, MeanSparse is applied post-training, eliminating the randomness typically introduced during training. Moreover, results from RobustBench for *$\text{A-PGD}_{\text{ce}}$*, *A-PGD*, and *AA* accuracies are highly consistent, showing negligible variability. Consequently, statistical significance tests are almost zero for all the results reported in this section.

### 4.2 Integration to State-of-the-Art Models

With the introduction of adversarial examples for deep learning models, their reliability was severely questioned []. However, several models have now been developed that present a high level of accuracy while also maintaining acceptable robustness against attacks imperceptible to humans []. In this part, we focus on the trained models with leading performance over CIFAR-10, CIFAR-100 [] and ImageNet [] datasets. We use the trained models and the proposed pipeline to integrate MeanSparse before all the activation functions. Then we evaluate the performance of the resulting models.

Figure LABEL:fig:spaf shows that integrating MeanSparse into the SOTA robust model in the RobustBench ranking [] across various benchmark datasets achieves a new SOTA in robustness. Figure LABEL:fig:bench:sub1 depicts the results for the Clean and AA metrics of the standard and MeanSparse-integrated versions of the WideResNet-94-16 [], RaWideResNet-70-16 [] and WideResNet-70-16 [] over CIFAR-10 dataset. The original WideResNet-94-16 [] currently holds the SOTA performance in the RobustBench ranking [] for $\ell_{\infty}$ untargeted attack. After post-processing with the proposed pipeline, the Clean accuracy drops slightly (from $93.68\%$ to $93.63\%$), while the AA significantly increases (from $73.71\%$ to $75.28\%$), setting a new record for robustness in terms of AA on the CIFAR-10 dataset. Similar results can be obtained for RaWideResNet-70-16 [] and WideResNet-70-16 []. Also, as a result of post-processing the robust model based on the WideResNet-70-16 architecture, the resulting AA accuracy ($71.41\%$) exceeds this value for the robust model based on the RaWideResNet architecture ($71.07\%$), even though WideResNet has a less complex architecture compared to RaWideResNet, which is equipped with the Squeeze-and-Excitation module.

Figure LABEL:fig:bench:sub2 represents the result of integrating MeanSparse into the current SOTA robust model (WideResNet-70-16 []) in terms of AA accuracy with $\ell_{2}$ distance metric. Similarly, while the clean accuracy is almost unchanged (from $95.54\%$ to $95.49\%$), the AA accuracy is improved (from $84.97\%$ to $87.28\%$).

Figure LABEL:fig:bench:sub3 illustrates the clean and AA accuracy for three different models adversarially trained on the ImageNet dataset (Swin-L [], ConvNeXt-L [] and RaWideResNet []). By carefully selecting the $\alpha$ value, while the Clean accuracy remains unchanged, the AA accuracy improves significantly. The Swin-L model [] is currently the SOTA robust model over the ImageNet dataset. When integrating this model with MeanSparse, while clean accuracy drops slightly (from $78.92\%$ to $78.86\%$), the AA accuracy is increased (from $59.56\%$ to $62.12\%$) setting a new SOTA.

Figure LABEL:fig:bench:sub4 shows the results of integrating MeanSparse with the current state-of-the-art (SOTA) robust model on the CIFAR-100 dataset (WideResNet-70-16 []). For this model, the clean and AutoAttack (AA) accuracies are $75.22\%$ and $42.67\%$, respectively. After integrating MeanSparse, these accuracies change to $75.17\%$ and $44.78\%$, establishing a new SOTA robust model with nearly identical clean accuracy.

Table 1 presents the results of integrating MeanSparse into RaWideResNet [] and WideResNet [] architectures trained on the CIFAR-10 dataset and ConvNeXt-L [] and RaWideResNet [] on the ImageNet dataset using adversarial training. The results are provided for different values of $\alpha$ (note that the threshold equals $\alpha\times\sigma_{\mathrm{ch}}$). The experiment results over the CIFAR-10 test set depict that for a range of $\alpha$ below $0.25$, the clean accuracy has decreased negligibly or almost unchanged while $\text{APGD}_{\text{ce}}$is increasing. Although these results may be attributed to overfitting, the result over the CIFAR-10 training set also represents a similar trend. So an important takeaway from CIFAR-10 results in Table 1 is that the variations around the mean value of representation can be considered as a capacity provided by the model for the attackers while its utilization is limited. MeanSparse requires one pass over CIFAR-10 training set to calculate the statistics. The time for this pass is 102 seconds and 95 seconds for the RaWideResNet and WideResNet architectures, respectively. The increase in $\text{APGD}_{\text{ce}}$evaluation time after MeanSparse integration is negligible, with only a $2\%$ increase in time.

If this capacity is controlled suitably, then the robustness of the model will be increased (model capacity for attacker will be decreased) while model utilization will be unchanged. So by increasing $\alpha$ from zero, we decrease the attacker capacity while user utilization is unchanged. By increasing $\alpha$ to larger values, we start to decrease user utilization, too. Although there is no rigid margin between these two cases, one can find suitable $\alpha$ values that limit the attacker side while user utilization is unchanged.

Results over ImageNet presented in Table 1 show that similar outcomes are achieved when MeanSparse is integrated into models based on the ConvNeXt-L [] and RaWideResNet [] architectures adversarially trained. Note that throughout our experiment over the RaWideResNet [] architecture for both CIFAR-10 and ImageNet-1k datasets, we do not apply the sparsification operator inside the Squeeze-and-Excitation module. The time for the MeanSparse pass over the ImageNet-1K training set is 89 minutes for the ConvNeXt-L architecture and 101 minutes for the RaWideResNet architecture. The increase in $\text{APGD}_{\text{ce}}$evaluation time after MeanSparse integration is also negligible, with only a $3\%$ increase in time.

**Table 1: Clean accuracy and accuracy under A-PGD-CE attack [] (represented by $\text{APGD}_{\text{ce}}$) for leading robust models on the CIFAR-10 and ImageNet-1k datasets (*Base* row) and after their integration with the MeanSparse technique (RaWideResNet [] and WideResNet [] are leading models in Robustbench ranking for CIFAR-10 dataset and ConvNeXt-L [] and RaWideResNet [] are highly ranked models for ImageNet dataset in Robustbench []). The best result in each column is in bold and the threshold selected through the proposed pipeline is in blue.**
|  | CIFAR-10 |  | ImageNet-1k |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
|  | RaWideResNet |  | WideResNet |  | ConvNeXt-L |  | RaWideResNet |  |  |  |  |  |  |  |  |  |  |
|  | Train |  | Test |  | Train |  | Test |  | Test |  | Test |  |  |  |  |  |  |
| $\alpha$ | Clean | $\text{APGD}_{\text{ce}}$ |  | Clean | $\text{APGD}_{\text{ce}}$ |  | Clean | $\text{APGD}_{\text{ce}}$ |  | Clean | $\text{APGD}_{\text{ce}}$ |  | Clean | $\text{APGD}_{\text{ce}}$ |  | Clean | $\text{APGD}_{\text{ce}}$ |
| Base | $\mathbf{99.15}$ | $93.44$ |  | $\mathbf{93.27}$ | $73.87$ |  | $\mathbf{99.37}$ | $94.69$ |  | $\mathbf{93.26}$ | $73.45$ |  | $78.02$ | $60.28$ |  | $\mathbf{73.58}$ | $52.24$ |
| $0.15$ | $\mathbf{99.15}$ | $93.69$ |  | $\mathbf{93.27}$ | $74.40$ |  | $99.36$ | $\mathbf{94.94}$ |  | $93.15$ | $73.92$ |  | $78.00$ | $60.62$ |  | $73.24$ | $53.38$ |
| $0.20$ | $99.13$ | $\mathbf{93.75}$ |  | $93.26$ | $74.52$ |  | $99.33$ | $94.93$ |  | $93.18$ | $74.11$ |  | $\mathbf{78.04}$ | $60.88$ |  | $73.28$ | $53.78$ |
| $0.25$ | $99.10$ | $93.71$ |  | $93.24$ | $\mathbf{74.74}$ |  | $99.32$ | $94.85$ |  | $93.03$ | $\mathbf{74.12}$ |  | $77.94$ | $61.12$ |  | $72.82$ | $\mathbf{53.92}$ |
| $0.30$ | $99.07$ | $93.49$ |  | $93.17$ | $74.63$ |  | $99.29$ | $94.58$ |  | $92.90$ | $74.04$ |  | $77.96$ | $61.48$ |  | $72.36$ | $53.86$ |
| $0.35$ | $98.98$ | $93.12$ |  | $93.04$ | $74.55$ |  | $99.23$ | $94.07$ |  | $92.75$ | $73.72$ |  | $77.74$ | $61.54$ |  | $71.74$ | $52.92$ |
| $0.40$ | $98.87$ | $92.48$ |  | $92.88$ | $73.90$ |  | $99.11$ | $93.27$ |  | $92.38$ | $73.32$ |  | $77.56$ | $61.84$ |  | $69.90$ | $51.68$ |
| $0.45$ | $98.70$ | $91.37$ |  | $92.60$ | $73.36$ |  | $98.92$ | $91.93$ |  | $92.08$ | $72.27$ |  | $77.12$ | $62.18$ |  | $67.16$ | $48.74$ |
| $0.50$ | $98.42$ | $89.76$ |  | $92.37$ | $72.37$ |  | $98.66$ | $90.17$ |  | $91.55$ | $71.10$ |  | $76.90$ | $\mathbf{62.32}$ |  | $61.78$ | $43.06$ |

### 4.3 Insights from Ablation Study

We conducted several experiments to explore different aspects of MeanSparse integration into trained models. These experiments examine the effects of activation functions A.1, the type of adversarial attack (either $\ell_{\infty}$ or $\ell_{2}$) A.2, the robustness of MeanSparse integrated models against black-box attacks A.3, the effect of adaptive attack with full access to MeanSparse modules location and specifications (mean and variance vectors) A.4, the types of adversarial examples used during training with AT A.5, the effect of integrating a standard trained model with MeanSparse A.6, the impact of centering MeanSparse around the mean value A.7, the influence of attack power on MeanSparse integration performance A.8, the effects of integrating MeanSparse with different patterns, such as isolated integration with a single activation A.9, and the robustness improvement resulting from MeanSparse integration in terms of PGD-50 attack A.10. The main takeaways from our ablation study can be summarized as:

- •
MeanSparse effectively enhances robustness across various activation functions. In other words, the activation function alone does not effectively eliminate non-robust features, which are previously reduced during training.
- •
By calculating the sparsity using other well-known adversarial attacks such as PGD-50 [], we observe a similar improvement in robustness, consistent with the AA and APGD accuracy values.
- •
Although MeanSparse masks the gradient, which can explain the robustness improvement against white-box attacks, it also demonstrates enhanced robustness when evaluated using black-box attacks.
- •
Designing adaptive adversarial attacks for models integrated with MeanSparse can slightly reduce the robust accuracy. However, due to the significant improvement from MeanSparse integration, the adaptively attacked models still exhibit substantially higher robustness compared to the original base model (see Section A.4 for a detailed description of the adaptive attack).
- •
MeanSparse is effective against both $\ell_{\infty}$ and $\ell_{2}$ attacks. Specifically, if a model is fortified against $\ell_{\infty}$ attacks using AT, adding MeanSparse enhances robustness against both $\ell_{\infty}$ and $\ell_{2}$ attacks. Also, MeanSparse is not sensitive to the method used to generate adversarial samples during AT.
- •
Using dedicated mean and variance for each channel in the MeanSparse technique is critical to its performance. Otherwise, we cannot expect the observed improvement in robustness.
- •
Integrating MeanSparse in isolated activation functions remains effective for robustification, although the improvement is limited.

### 4.4 Limitations

The MeanSparse technique proposed in this paper is a post-training method that is useful on top of adversarially trained models. Using MeanSparse for models trained in a standard way does not lead to robustness improvement as we expect based on our intuition introduced in this paper.

## 5 Conclusions

Adversarial training, a widely accepted defense against evasion attacks, attenuates non-robust feature extractors in a model. Although adversarial training (AT) is effective, this paper demonstrates that there is still an easily accessible capacity for attackers to exploit. We introduce the MeanSparse technique, which partially blocks this capacity in the model available to attackers and enhances adversarial robustness. This technique, easily integrable after training, improves robustness without compromising clean accuracy. By integrating this technique into trained models, we achieve a new record in adversarial robustness on CIFAR-10 for both $\ell_{\infty}$ and $\ell_{2}$ untargeted attacks, as well as on CIFAR-100 and ImageNet for $\ell_{\infty}$ untargeted attacks.

## Ethical Considerations

This research is conducted with adherence to the highest ethical standards, ensuring compliance with all relevant institutional and international guidelines to the best of the authors’ knowledge. We critically assessed the societal impacts of our work, aiming to mitigate any negative consequences while promoting beneficial applications. Positive impacts include improved model robustness and increased trust in AI systems. Negative impacts involve potential misuse for malicious applications and reinforcing existing biases. To address these, we suggest mitigation strategies such as implementing gated releases, conducting fairness audits, and promoting transparency through public availability of code and data. Transparency and accountability were prioritized throughout the research process, and there were no conflicts of interest influencing the outcomes of this study.

## Appendix A Ablation Experiment

We conducted several experiments to evaluate the effectiveness of MeanSparse in various scenarios. In the majority of experiments, we use APGD accuracy (accuracy after attacking the model with Auto-PGD using both Cross-entropy and Difference of Logits Ratio loss metrics) as the robustness metric []. During our simulations, we found APGD accuracy to be almost equal to AA accuracy, with the advantage that APGD can be measured faster.

### A.1 Activation Function

MeanSparse is generally appended before the activations function. This questions the effectiveness of MeanSparse for different activation functions. In this experiment, we check the performance of MeanSparse when integrating the models with different activation functions. The specifications of this experiment are:

- •
Dataset: CIFAR-10 []
- •
Architecture: ResNet-18 []
- •
Optimizer: SGD (initial learning rate: 0.1, weight decay: 0.0005, momentum: 0.9)
- •
Number of Epochs: 200
- •
Batch Size: 256
- •
Learning rate scheduler: The initial learning rate of 0.1 is reduced by a factor of 10 at epoch 100 and 150.
- •
Best model selection: We evaluate the model at each epoch of training and select the one with the highest PGD adversarial accuracy on the test set.
- •
Adversarial training properties: 10 step PGD adversarial training [] with respect to $\ell_{\infty}$ attacks with radius $8/255$ and step size of 0.0078.

The experiments were conducted using an NVIDIA A100 GPU. Training each ResNet-18 model required approximately 6 hours of computational time on a single A100 GPU. In addition, the evaluation of each trained model took around 20 minutes on the same GPU.

Table 2 demonstrates the Clean and APGD accuracy metrics for a base ResNet-18 model, denoted by *Base*, with different activation functions and the same model post-processed by the proposed pipeline to integrate MeanSaprse. We use both non-parametric and parametric activation functions, such as PSSiLU []. In our experiment, the GELU activation function, proposed in [] and generally used in attention-based architectures, results in the best APGD accuracy. When this model is integrated with MeanSparse, we observe a significant improvement in APGD accuracy ($49.12\%\rightarrow 50.37\%$) while the clean accuracy slightly decreases ($84.59\%\rightarrow 84.32\%$) for $\alpha=0.2$. Additionally, if we can tolerate $\sim 1\%$ reduction in clean accuracy, we can increase APGD accuracy by more than $2\%$. The first important takeaway is the effectiveness of MeanSparse integration with different activations and the inability of the activation function to replicate the role of the MeanSparse technique. The second is that $\alpha=0.2$ consistently leads to large improvements in APDG accuracy with a negligible reduction in clean accuracy for all activation functions. Even for the ReLU activation function, $\alpha=0.2$ increases both Clean and APGD accuracies simultaneously.
We will use the ResNet-18 model trained adversarially with GELU activation over the CIFAR-10 dataset for our future experiments.

**Table 2: Clean and APGD accuracy of ResNet-18 model with different activation functions over CIFAR-10 test set before (Base) and after integration with MeanSparse technique for different value of $\alpha$**
|  | Activation |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
|  | ReLU |  | ELU |  | GELU |  | SiLU |  | PSiLU |  | PSSiLU |  |  |  |  |  |  |
| $\alpha$ | Clean | APGD |  | Clean | APGD |  | Clean | APGD |  | Clean | APGD |  | Clean | APGD |  | Clean | APGD |
| Base | $83.59$ | $47.77$ |  | $\mathbf{81.65}$ | $46.65$ |  | $84.59$ | $49.12$ |  | $83.05$ | $48.54$ |  | $\mathbf{84.80}$ | $48.02$ |  | $83.95$ | $48.03$ |
| 0.05 | $83.58$ | $47.89$ |  | $81.64$ | $47.47$ |  | $\mathbf{84.63}$ | $49.25$ |  | $83.10$ | $48.70$ |  | $\mathbf{84.80}$ | $48.11$ |  | $\mathbf{83.97}$ | $48.22$ |
| 0.1 | $83.59$ | $48.25$ |  | $81.58$ | $48.69$ |  | $84.58$ | $49.57$ |  | $83.09$ | $49.05$ |  | $84.72$ | $48.58$ |  | $83.95$ | $48.61$ |
| 0.15 | $83.57$ | $48.60$ |  | $81.53$ | $49.22$ |  | $84.42$ | $50.00$ |  | $\mathbf{83.11}$ | $49.73$ |  | $84.66$ | $48.88$ |  | $83.93$ | $49.05$ |
| 0.2 | $\mathbf{83.71}$ | $48.88$ |  | $81.53$ | $\mathbf{49.49}$ |  | $84.32$ | $50.37$ |  | $83.01$ | $50.01$ |  | $84.69$ | $49.07$ |  | $83.79$ | $49.29$ |
| 0.25 | $83.46$ | $\mathbf{49.30}$ |  | $81.56$ | $49.14$ |  | $84.18$ | $50.80$ |  | $83.00$ | $50.59$ |  | $84.61$ | $\mathbf{49.36}$ |  | $83.75$ | $\mathbf{49.32}$ |
| 0.3 | $83.48$ | $49.24$ |  | $81.20$ | $48.66$ |  | $83.95$ | $51.13$ |  | $82.78$ | $\mathbf{50.81}$ |  | $84.27$ | $49.35$ |  | $83.81$ | $49.19$ |
| 0.35 | $83.13$ | $49.27$ |  | $80.34$ | $47.60$ |  | $83.51$ | $\mathbf{51.36}$ |  | $82.49$ | $50.79$ |  | $83.76$ | $49.25$ |  | $83.55$ | $49.11$ |
| 0.4 | $82.49$ | $48.87$ |  | $78.77$ | $46.10$ |  | $82.85$ | $51.25$ |  | $81.34$ | $49.97$ |  | $83.20$ | $48.76$ |  | $82.69$ | $48.63$ |

### A.2 Threat Model

In this experiment, we focused on the effectiveness of MeanSparse against two well-studied threat models, $\ell_{\infty}$ and $\ell_{2}$. Until now, our focus was on the $\ell_{\infty}$ threat model, which generally results in lower robust accuracy []. On the other hand, $\ell_{2}$ threat models can focus on a specific part of the image, and this localization of adversarial perturbation may challenge the effectiveness of the MeanSparse technique. In this experiment, we compare the robustness against both $\ell_{\infty}$ and $\ell_{2}$ threat models. The model is ResNet-18 with the GELU activation function as in our *Activation Function* experiment in 2. Table 3 illustrates the clean and APGD accuracy for $\ell_{\infty}$ and $\ell_{2}$ threats. As the accuracy for the $\ell_{\infty}$ threat model increases with increasing $\alpha$, the accuracy for $\ell_{2}$ also increases, which depicts the effectiveness and generalization of MeanSparse across well-studied threat models. Additionally, the improvement compared to the base model at $\alpha=0.2$ is larger for the $\ell_{2}$ threat than for the $\ell_{\infty}$ threat.

**Table 3: Clean and APGD accuracy of ResNet-18 model with GELU activation function over CIFAR-10 test set before (Base) and after integration with MeanSparse technique for different value of $\alpha$ and different threat models from RobustBesnch []**
|  |  | Threat Model |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- |
|  |  |  |  | $\ell_{\infty},\epsilon=\frac{8}{255}$ |  | $\ell_{2},\epsilon=\frac{128}{255}$ |
| $\alpha$ |  | Clean |  | APGD |  | APGD |
| Base |  | $84.59$ |  | $49.12$ |  | $59.98$ |
| $0.05$ |  | $\mathbf{84.63}$ |  | $49.25$ |  | $60.23$ |
| $0.10$ |  | $84.58$ |  | $49.57$ |  | $60.53$ |
| $0.15$ |  | $84.42$ |  | $50.00$ |  | $60.87$ |
| $0.20$ |  | $84.32$ |  | $50.37$ |  | $61.36$ |
| $0.25$ |  | $84.18$ |  | $50.80$ |  | $61.60$ |
| $0.30$ |  | $83.95$ |  | $51.13$ |  | $61.73$ |
| $0.35$ |  | $83.51$ |  | $\mathbf{51.36}$ |  | $\mathbf{61.74}$ |
| $0.40$ |  | $82.85$ |  | $51.25$ |  | $\mathbf{61.74}$ |

### A.3 Blackbox Attacks

The MeanSparse operation masks the gradient during backward propagation when the input $a^{\mathrm{in}}$ lies within $\alpha\sigma_{\mathrm{ch}}$ of the channel mean $\mu_{\mathrm{ch}}$ (see the bottom plot in the first column of Figure 1). An interesting direction to explore is the performance of black-box attacks that do not rely on gradients, both before and after integrating MeanSparse. For this experiment, we select the Square Attack []. Table 4 shows the clean and robust accuracy for a ResNet-18 model with GELU activation before (Base) and after integration with MeanSparse (robust accuracy is denoted by Square, representing the accuracy under Square Attack). The results indicate a similar improvement in robust accuracy on par with APGD, while clean accuracy remains largely unaffected across a wide range of $\alpha$ values, from $0.05$ to $0.2$.

**Table 4: Clean and Square accuracy (Square accuracy in the Square column represents the accuracy after applying square attack []) of ResNet-18 model with GELU activation function over CIFAR-10 test set before (Base) and after integration with MeanSparse technique for different value of $\alpha$**
| $\alpha$ |  | Clean | Square |
| --- | --- | --- | --- |
| Base |  | $84.59$ | $57.37$ |
| $0.05$ |  | $\mathbf{84.63}$ | $57.66$ |
| $0.10$ |  | $84.58$ | $58.19$ |
| $0.15$ |  | $84.42$ | $59.31$ |
| $0.20$ |  | $84.32$ | $60.30$ |
| $0.25$ |  | $84.18$ | $60.67$ |
| $0.30$ |  | $83.95$ | $61.32$ |
| $0.35$ |  | $83.51$ | $\mathbf{61.52}$ |
| $0.40$ |  | $82.85$ | $61.49$ |

### A.4 Adaptive Attack

In this experiment, we investigate the potential for the attacker to enhance the attack by utilizing the knowledge that MeanSparse is employed to robustify the model. We propose a formulation to adapt the original PGD attack, incorporating the integration of MeanSparse to create a more powerful attack. In this scenario, we assume the attacker has complete access to the locations, mean, and variance vectors of the integrated MeanSparse operator throughout the model. Let $\bm{x}$ represent the input image and $\{\bm{z}_{i}\}$ the corresponding representations at the input of the MeanSparse modules in the model. When a perturbation $\bm{\delta}$ is added to the input ($\bm{x}+\bm{\delta}$), it results in new representations $\{\bm{z}_{i}^{\delta}\}$. In the adaptive PGD attack, we solve the following optimization problem to determine the perturbation $\bm{\delta}$:

$$ $\displaystyle\operatorname*{arg\,max}_{\bm{\delta}}\quad\mathrm{CE}(f(\bm{x}+ \bm{\delta}),y)-\lambda\sum_{i}\|\bm{m}_{i}\odot(\bm{z}_{i}-\bm{z}_{i}^{\delta })\|_{p}^{q}$ $\displaystyle\text{subject to}\quad\|\bm{\delta}\|_{\infty}\leq\epsilon,\quad \bm{x}+\bm{\delta}\in[0,1]^{D}$ (9) $$

where $\mathrm{CE}(\cdot,\cdot)$ is the cross-entropy loss, $f$ is the model, $y$ is the true label, $\lambda$ is a hyper-parameter, $i$ indexes different MeanSparse modules in the model, $\odot$ is the element-wise multiplication operator, $\epsilon$ controls the perturbation imperceptibility via the $\ell_{\infty}$ norm, and $D$ is the dimension of the input image. $\bm{m}_{i}$ represents a mask with the same dimensions as $\bm{z}_{i}$, identifying the locations in $\bm{z}_{i}$ affected by the MeanSparse module. For a given $\bm{z}$, the corresponding $\bm{m}$ can be computed element-wise as:

$$ $\displaystyle m_{j}=\begin{cases}1&\text{if~{}~{}}\mu_{\mathrm{ch}}-\alpha \sigma_{\mathrm{ch}}\leq z_{j}\leq\mu_{\mathrm{ch}}+\alpha\sigma_{\mathrm{ch}} \\ 0&\text{Otherwise}\end{cases},j=1,2,\ldots,K$ $$

where $\mu_{\mathrm{ch}}$ and $\sigma_{\mathrm{ch}}$ are the statistics of the MeanSparse module, and $K$ represents the representation dimension. Thus, whenever a feature in the input of MeanSparse is affected by this module for the input image $\bm{x}$, the corresponding mask value becomes $1$; otherwise, it is 0 0. As a result, the second term in the objective function of the adaptive PGD attack equation 9 penalizes perturbations that lead to changes in the features affected by MeanSparse. In the ideal case, the perturbation is designed such that none of the MeanSparse modules can block its effect in their input (we know that the changes in the input of the $i$-th MeanSparse module are $\bm{z}_{i}-\bm{z}_{i}^{d}$). Thus, the attacker can bypass the MeanSparse, which we denote as the Adaptive-$(p,q)$ attack.

To test the adaptive attack, we solve the optimization problem equation 9 using gradient ascent with a step size of $\mu=\frac{1}{255}$, a number of iterations $N=50$, and $\epsilon=\frac{8}{255}$. When $\lambda=0$, problem equation 9 reduces to the well-known PGD-50 attack, while for larger values of $\lambda$, we obtain an adaptive attack. We conducted experiments using this adaptive attack on a ResNet-18 model with a GELU activation function, which was adversarially trained on the CIFAR-10 dataset. Table 5 compares the results of the PGD-50 attack with the Adaptive-$(1,1)$ and Adaptive-$(2,2)$ attacks before (Base) and after integration ($\alpha=0.20$ and $\alpha=0.35$) with MeanSparse. For the base model, all the attacks are equivalent, as $\bm{m}_{i}$ is a zero matrix for all MeanSparse modules. As $\alpha$ increases, the accuracy after applying our adaptive attack decreases compared to the PGD-50 attack, demonstrating the effectiveness of our adaptation. While the adapted attack is more powerful than the original PGD-50 attack, the improvement gap in robustness resulting from MeanSparse is still significant. For the base model, the robust accuracy is $51.56\%$, while the worst accuracies are $53.56\%$ and $55.26\%$ for $\alpha=0.20$ and $\alpha=0.35$, respectively, indicating a clear improvement in robustness, while the clean accuracy remains almost unchanged.

**Table 5: Clean, PGD-50 and Adaptive Attack accuracy for a ResNet-18 model with GELU activation over CIFAR-10 dataset before (Base) and after integration with MeanSparse**
| $\alpha$ |  | Clean | PGD-50 | Adaptive-$(1,1)$ | Adaptive-$(2,2)$ |
| --- | --- | --- | --- | --- | --- |
| Base |  | $\mathbf{84.59}$ | $51.56$ | $51.56$ | $51.56$ |
| $0.20$ |  | $84.32$ | $53.89$ | $53.56$ | $53.58$ |
| $0.35$ |  | $83.51$ | $\mathbf{55.50}$ | $\mathbf{55.36}$ | $\mathbf{55.26}$ |

### A.5 Adversarial Training

MeanSparse is designed to integrate with models trained using adversarial training. In previous experiments, PGD [] was used for adversarial training. In this section, we compare the PGD results with those of TRADES [] for adversarial training. For TRADES adversarial training, we set $\beta=0.6$. For the other properties of adversarial training, we adopt the parameters specified in Section 2. Table 6 compares the results for base adversarially trained models and models integrated with MeanSparse. For TRADES, MeanSparse can still improve the APGD accuracy while maintaining clean accuracy. This table demonstrates overlapping information gathered around the mean feature values for both PGD and TRADES as adversarial training methods. In both methods, the information around the feature mean with a value of $\alpha\simeq 0.2$ is almost uninformative for clean data but can be utilized by attackers. Thus, the performance of MeanSparse represents generalizability across both PGD and TRADES adversarial training methods.

**Table 6: Clean and APGD accuracy of ResNet-18 model with GELU activation function over CIFAR-10 test set before (Base) and after integration with MeanSparse technique for different value of $\alpha$ and adversarial training based on PGD [] and TRADES []**
|  |  | Adversarial training |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- |
|  |  | PGD |  | TRADES |  |  |
| $\alpha$ |  | Clean | APGD |  | Clean | APGD |
| Base |  | $84.59$ | $49.12$ |  | $83.01$ | $47.03$ |
| $0.05$ |  | $\mathbf{84.63}$ | $49.25$ |  | $83.04$ | $47.16$ |
| $0.10$ |  | $84.58$ | $49.57$ |  | $83.09$ | $47.61$ |
| $0.15$ |  | $84.42$ | $50.00$ |  | $\mathbf{83.11}$ | $48.08$ |
| $0.20$ |  | $84.32$ | $50.37$ |  | $83.08$ | $48.64$ |
| $0.25$ |  | $84.18$ | $50.80$ |  | $83.02$ | $48.92$ |
| $0.30$ |  | $83.95$ | $51.13$ |  | $82.92$ | $\mathbf{49.34}$ |
| $0.35$ |  | $83.51$ | $\mathbf{51.36}$ |  | $82.62$ | $49.24$ |
| $0.40$ |  | $82.85$ | $51.25$ |  | $82.20$ | $48.76$ |

### A.6 Standard Training

In the previous experiments, we explore the effect of two different adversarial training methods on performance improvement by MeanSparse. In this experiment, we test MeanSparse integration over a standard trained model. Table 7 represents the APGD accuracy over a ResNet-18 model with standard training for $\epsilon$ values starting from $1/255$ to $8/255$. The first column ($\alpha=0$) is the base model performance while the next two columns ($\alpha=0.2$ and $\alpha=0.35$) represent the models integrated with MeanSparse. In all cases, the attacker can fool the model with imperceptible perturbation ($\epsilon\leq 4/255$) which necessitates the integration of MeanSparse with adversarially trained models.

**Table 7: APGD accuracy of standard trained ResNet-18 model with GELU activation function over CIFAR-10 test set before (Base denoted by $\alpha=0$ in the table) and after the integration of MeanSparse technique for different attack power $\epsilon$ and two different $\alpha$ values ($0.20$ and $0.35$). Clean accuracy is provided next to each $\alpha$ value.**
|  |  | $\alpha$ |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- |
|  |  | 0 ($94.36$) |  | 0.2 ($94.20$) |  | 0.35 ($93.61$) |
| $\epsilon$ |  | APGD |  | APGD |  | APGD |
| $1/255$ |  | $49.09$ |  | $52.06$ |  | $56.36$ |
| $2/255$ |  | $4.86$ |  | $7.69$ |  | $14.52$ |
| $3/255$ |  | $0.07$ |  | $0.24$ |  | $1.33$ |
| $4/255$ |  | $0.0$ |  | $0.01$ |  | $0.03$ |
| $5/255$ |  | $0.0$ |  | $0.0$ |  | $0.01$ |
| $6/255$ |  | $0.0$ |  | $0.0$ |  | $0.01$ |
| $7/255$ |  | $0.0$ |  | $0.0$ |  | $0.01$ |
| $8/255$ |  | $0.0$ |  | $0.0$ |  | $0.01$ |

### A.7 Feature Centerization Type

The MeanSparse technique applies sparsification over mean-centered features across each channel in the input tensor to the activation function. In this section, we inspect the importance of the reference for feature centralization before sparsification in our proposed technique. For this purpose, we compare three cases where the reference for centering features is the channel mean ($\bm{\mu}_{ch}$), zero, and the mean over all features in all channels ($\mu$). For a fair comparison across all cases, we select the sparsification threshold equal to $\alpha\times\sigma_{ch}$, where $\sigma_{ch}$ emphasizes the channel-wise calculation standard deviation. Table 8 represents the result for different options of reference. When using zero as the reference for feature centralization, the improvement in APGD is higher than using the mean as the reference, but on the other hand, the utilization of the model also decreases. One challenging problem is the high rate of clean accuracy reduction when using zero as the reference, which may cause a huge reduction if not selected properly. When using the mean of all channels as the reference, the results in terms of both clean and APGD accuracy metrics underperform compared to the case where the channel mean is used as the reference. The main takeaway from the table is the importance of using channel-wise statistics to maintain utility while improving robustness.

**Table 8: Clean and APGD accuracy of ResNet-18 model with GELU activation function over CIFAR-10 test set before (Base) and after the application of MeanSparse technique for different references for feature centralization**
|  |  | Reference for Centralization |  |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
|  |  | zero |  | $\mu$ |  | $\bm{\mu}_{ch}$ |  |  |  |
| $\alpha$ |  | Clean | APGD |  | Clean | APGD |  | Clean | APGD |
| $Base$ |  | $\mathbf{84.59}$ | $49.12$ |  | $\mathbf{84.59}$ | $49.12$ |  | $84.59$ | $49.12$ |
| $0.05$ |  | $84.58$ | $49.32$ |  | $84.58$ | $49.22$ |  | $\mathbf{84.63}$ | $49.25$ |
| $0.1$ |  | $84.50$ | $49.63$ |  | $84.52$ | $49.45$ |  | $84.58$ | $49.57$ |
| $0.15$ |  | $84.30$ | $50.26$ |  | $84.36$ | $49.79$ |  | $84.42$ | $50.00$ |
| $0.2$ |  | $84.06$ | $50.98$ |  | $84.13$ | $50.23$ |  | $84.32$ | $50.37$ |
| $0.25$ |  | $83.55$ | $51.58$ |  | $83.83$ | $50.73$ |  | $84.18$ | $50.80$ |
| $0.3$ |  | $82.81$ | $\mathbf{52.08}$ |  | $83.27$ | $\mathbf{50.87}$ |  | $83.95$ | $51.13$ |
| $0.35$ |  | $81.68$ | $51.95$ |  | $82.52$ | $50.61$ |  | $83.51$ | $\mathbf{51.36}$ |
| $0.4$ |  | $79.84$ | $51.72$ |  | $81.09$ | $49.93$ |  | $82.85$ | $51.25$ |

### A.8 Attack Power

In the previous experiments, the attack power was set to a fixed value of $8/255$ for $\ell_{\infty}$ attack threat which is generally the threshold of imperceptibility []. In this experiment, we explore the effectiveness of the MeanSparse technique for a wide range of attack powers. Table 9 represents the APGD accuracy for $\epsilon$ values starting from $1/255$ to $16/255$. For $\alpha=0.2$, the accuracy is smaller than the base model ($\alpha=0$) for $1/255$ and $2/255$ values of $\epsilon$, which is generally due to the reduction of clean accuracy after applying MeanSparse (clean accuracy reduces to $84.32$ from $84.59$). For $\epsilon$ values larger than $2/255$, applying the MeanSparse technique persistently improves the APGD accuracy. The same trend is also observed for $\alpha=0.35$ except for the fact that after $\epsilon=4/255$, we have persistent improvements over the base model.

**Table 9: APGD accuracy of ResNet-18 model with GELU activation function over CIFAR-10 test set before (Base denoted by $\alpha=0$ in the table) and after the application of MeanSparse technique for different attack power $\epsilon$ and two different $\alpha$ values ($0.20$ and $0.35$). Clean accuracy is provided next to each $\alpha$ value.**
|  |  | $\alpha$ |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- |
|  |  | 0 ($84.59$) |  | 0.2 ($84.32$) |  | 0.35 ($83.51$) |
| $\epsilon$ |  | APGD |  | APGD |  | APGD |
| $1/255$ |  | $81.10$ |  | $80.97$ |  | $79.60$ |
| $2/255$ |  | $77.72$ |  | $77.60$ |  | $76.47$ |
| $3/255$ |  | $73.37$ |  | $73.54$ |  | $72.64$ |
| $4/255$ |  | $68.88$ |  | $69.08$ |  | $68.80$ |
| $5/255$ |  | $64.31$ |  | $64.70$ |  | $64.48$ |
| $6/255$ |  | $58.95$ |  | $59.92$ |  | $60.15$ |
| $7/255$ |  | $54.11$ |  | $55.15$ |  | $55.71$ |
| $8/255$ |  | $49.12$ |  | $50.37$ |  | $51.36$ |
| $9/255$ |  | $42.77$ |  | $44.41$ |  | $45.72$ |
| $10/255$ |  | $37.48$ |  | $39.17$ |  | $40.77$ |
| $11/255$ |  | $32.62$ |  | $34.20$ |  | $36.04$ |
| $12/255$ |  | $28.12$ |  | $29.77$ |  | $31.50$ |
| $13/255$ |  | $23.77$ |  | $25.44$ |  | $27.18$ |
| $14/255$ |  | $19.42$ |  | $20.76$ |  | $22.77$ |
| $15/255$ |  | $15.51$ |  | $17.01$ |  | $19.09$ |
| $16/255$ |  | $11.97$ |  | $13.41$ |  | $15.44$ |

### A.9 Applying to Specific Activation Functions

The MeanSparse technique is designed to sparsify mean-centered inputs to all activation functions in a model. In this experiment, we will focus on applying sparsification over a selected subset of activation functions. For this purpose, we index the activation functions in the ResNet-18 model. This model has 8 residual blocks, each with 2 activation functions: one in the *Main Path* and one after the result of the main path is added to the residual connection, totaling 16 activation functions. Additionally, this architecture has one activation function before the residual block. So, in total, we have 17 indices. Index 0 is the initial activation function. The odd indices are related to the activation function in the main path, and the even indices correspond to activation functions after the addition of the residual connection to the main path output. We select two scenarios. In the first scenario, denoted by *Single Activation*, we present the results when MeanSparse is applied to only the corresponding row-indexed activation function, while *Cumulative* depicts the result when MeanSparse is applied to the activation functions with indices less than or equal to the index represented in each row.

Table 10 represents the results for both *Single Activation* and *Cumulative* scenarios. One shared remark is that the starting layers are more effective in improving robustness. We can attribute this to the abstraction level in different layers of the ResNet-18 model. In the case of Single Activation, when we apply the MeanSparse technique to larger indices, we observe that not only does the robust accuracy decrease, but the clean accuracy increases. This indicates that for even better performance, we can use different $\alpha$ values for activation functions based on their depth level. Note that for the current version of the MeanSparse technique, we use a shared $\alpha$ for all activation functions.

Another aspect worth inspecting in this experiment is how the application of the MeanSparse technique to activation functions in the main path and after the addition of residual data to the main path result affects robustness in terms of APGD accuracy. So we consider two cases in Table 11. In the first case, MeanSparse is applied to all the activation functions in the main path of the ResNet block, denoted by *Main Path*. In the second case, MeanSparse is applied to all the activation functions after the addition of residual data to the output of the main path, denoted by *After Addition*. This table reveals an important result. While the application of MeanSparse to both types of activation functions contributes to the robustness of the model, the application of MeanSparse to the main flow of the model (*After Addition*) is more responsible for the improvements in the ranges where clean accuracy is almost unchanged ($\alpha\simeq 0.2$).

**Table 10: Clean and APGD accuracy of ResNet-18 model with GELU activation function over CIFAR-10 test set after the application of MeanSparse technique for *Single Activation* and *Cumulative * cases. Single Activation represents the results when MeanSparse is applied to only the index activation function, and Cumulative Activation represents the results when MeanSparse is applied to the index activation function and all previous activation functions (for the based model the Clean and APGD accuracy are $84.59\%$ and $49.12\%$, respectively).**
|  | Single Activation |  | Cumulative |  |  |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
|  | Threshold |  | Threshold |  |  |  |  |  |  |  |  |
|  | 0.2 |  | 0.35 |  | 0.2 |  | 0.35 |  |  |  |  |
| Index | Clean | APGD |  | Clean | APGD |  | Clean | APGD |  | Clean | APGD |
| 0 0 | $84.52$ | $\mathbf{49.34}$ |  | $84.21$ | $49.19$ |  | $84.52$ | $49.37$ |  | $84.21$ | $49.19$ |
| $1$ | $84.56$ | $49.19$ |  | $84.44$ | $49.09$ |  | $\mathbf{84.53}$ | $49.38$ |  | $\mathbf{84.31}$ | $49.35$ |
| $2$ | $84.46$ | $49.21$ |  | $84.45$ | $49.20$ |  | $84.49$ | $49.37$ |  | $83.98$ | $49.29$ |
| $3$ | $84.50$ | $49.15$ |  | $84.33$ | $49.19$ |  | $84.45$ | $49.52$ |  | $83.72$ | $49.69$ |
| $4$ | $84.48$ | $49.21$ |  | $84.26$ | $\mathbf{49.26}$ |  | $84.41$ | $49.67$ |  | $83.47$ | $50.02$ |
| $5$ | $84.54$ | $49.24$ |  | $84.36$ | $49.25$ |  | $84.38$ | $49.86$ |  | $83.14$ | $50.29$ |
| $6$ | $84.60$ | $49.11$ |  | $84.58$ | $49.21$ |  | $84.34$ | $49.90$ |  | $83.21$ | $50.50$ |
| $7$ | $84.51$ | $49.13$ |  | $84.45$ | $49.16$ |  | $84.32$ | $49.99$ |  | $83.02$ | $50.65$ |
| $8$ | $84.58$ | $49.19$ |  | $84.59$ | $49.21$ |  | $84.34$ | $50.12$ |  | $83.05$ | $50.86$ |
| $9$ | $84.60$ | $49.12$ |  | $84.53$ | $49.02$ |  | $84.35$ | $50.32$ |  | $82.96$ | $51.09$ |
| $10$ | $84.59$ | $49.06$ |  | $84.59$ | $49.07$ |  | $84.34$ | $50.35$ |  | $83.12$ | $51.15$ |
| $11$ | $84.60$ | $49.06$ |  | $84.56$ | $49.05$ |  | $84.38$ | $50.33$ |  | $83.02$ | $51.23$ |
| $12$ | $84.62$ | $49.09$ |  | $84.72$ | $49.05$ |  | $84.37$ | $50.27$ |  | $83.09$ | $51.23$ |
| $13$ | $84.59$ | $49.13$ |  | $84.63$ | $49.09$ |  | $84.38$ | $50.37$ |  | $83.14$ | $51.20$ |
| $14$ | $84.60$ | $49.17$ |  | $84.63$ | $49.12$ |  | $84.40$ | $50.34$ |  | $83.26$ | $\mathbf{51.41}$ |
| $15$ | $84.57$ | $49.15$ |  | $84.69$ | $49.10$ |  | $84.36$ | $\mathbf{50.38}$ |  | $83.30$ | $51.37$ |
| $16$ | $\mathbf{84.63}$ | $49.09$ |  | $\mathbf{84.75}$ | $49.01$ |  | $84.32$ | $50.37$ |  | $83.51$ | $51.36$ |

**Table 11: Clean and APGD accuracy of ResNet-18 model with GELU activation function over CIFAR-10 test set before (Base denoted by $\alpha=0$ in the table) and after the application of MeanSparse technique for *Main Path* (application of MeanSparse to activation functions in the main path of residual block) and *After Addition* (application of MeanSparse to activation functions operating after addition of main path result and residual data) cases.**
|  |  | Layer type |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- |
|  |  | Main Path |  | After Addition |  |  |
| $\alpha$ |  | Clean | APGD |  | Clean | APGD |
| Base |  | $\mathbf{84.59}$ | $49.12$ |  | $84.59$ | $49.12$ |
| $0.05$ |  | $84.59$ | $49.20$ |  | $\mathbf{84.62}$ | $49.25$ |
| $0.10$ |  | $84.59$ | $49.31$ |  | $84.59$ | $49.43$ |
| $0.15$ |  | $84.50$ | $49.43$ |  | $84.49$ | $49.53$ |
| $0.20$ |  | $84.40$ | $49.63$ |  | $84.47$ | $49.66$ |
| $0.25$ |  | $84.26$ | $49.68$ |  | $84.46$ | $\mathbf{49.93}$ |
| $0.30$ |  | $83.94$ | $49.88$ |  | $84.27$ | $49.90$ |
| $0.35$ |  | $83.66$ | $\mathbf{49.94}$ |  | $84.15$ | $49.73$ |
| $0.40$ |  | $82.96$ | $49.91$ |  | $83.67$ | $49.24$ |

### A.10 Attack Type

Figure LABEL:fig:spaf demonstrates the improvement in robustness of leading models in RobustBench in terms of AutoAttack accuracy. In this experiment, we use PGD-50 [] for robustness measurement. Table 12 represents the Clean and PGD-50 accuracy values for different models before (denoted by Base) and after integration with MeanSparse (denoted by MeanSparse) over CIFAR-10, CIFAR-100 and ImageNet datasets. The results again confirm the improvements in Figure LABEL:fig:spaf as t integration with MeanSparse increases the PGD-50 accuracy in all models.

**Table 12: Clean and PGD-50 [] accuracy of various RobustBench-ranked models [], both before (Base) and after integration with the MeanSparse technique (models tested here includes WideResNet-94-16 [] and RaWideResNet-70-16 [] over CIFAR-10 dataset, WideResNet-70-16 [] over CIFAR-100 dataset and Swin-L [] and ConvNeXt-L [] over ImageNet dataset**
|  | CIFAR-10 |  | CIFAR-100 | ImageNet |  |  |  |  |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
|  | WideResNet-94-16 |  | RaWideResNet-70-16 |  | WideResNet-70-16 |  | Swin-L |  | ConvNeXt-L |  |  |  |  |  |
|  | Clean | PGD-50 |  | Clean | PGD-50 |  | Clean | PGD-50 |  | Clean | PGD-50 |  | Clean | PGD-50 |
| Base | $\mathbf{93.68}$ | $76.36$ |  | $\mathbf{93.27}$ | $74.01$ |  | $\mathbf{75.23}$ | $48.35$ |  | $\mathbf{78.92}$ | $61.42$ |  | $\mathbf{78.02}$ | $60.62$ |
| MeanSparse | $93.63$ | $\mathbf{78.21}$ |  | $93.24$ | $\mathbf{75.17}$ |  | $75.17$ | $\mathbf{50.64}$ |  | $78.88$ | $\mathbf{61.78}$ |  | $77.96$ | $\mathbf{61.78}$ |

## Peer Reviews

confidence: 3
contribution: 2
initial_rating: 5
presentation: 2
questions: 1. On page 6, in the first and second paragraphs, you mention two approaches and choose the second one. I am curious why you selected the second approach as your method. Is it superior? Can you provide evidence to support your choice and a brief comparison of the two approaches, highlighting the advantages and disadvantages of each?

2. In Section 4 on page 7, I did not find the experimental settings. You only mentioned that the experiments were conducted using an NVIDIA A100 GPU. For better reproducibility, it would be helpful to include detailed experimental settings. I suggest providing details such as the software versions used, hyperparameters, data preprocessing steps, and any other relevant configuration details that would allow others to replicate their experiments
soundness: 3
strengths: 1. The idea of manipulating activation functions to enhance adversarial robustness is quite interesting.
2. Extensive experiments have been conducted to support the proposed method.
3. The intuition behind the idea is provided, making it easier to follow.
4. The paper includes a discussion of its limitations.
summary: This paper introduces a method called MEANSPARSE, which enhances the adversarial robustness of trained neural networks in a post-processing manner without compromising clean accuracy. The idea behind this method is to attenuate the reliance on non-robust features by modifying activation functions. Their experiments demonstrate a significant increase in the adversarial robustness of neural networks.
weaknesses: 1. The explanation of the method in the Introduction is vague. On page 1, lines 37 and 44, you state: "In this work,..." twice, but the first sentence mentions "design of activation functions," while the second shifts to "sparsifying features to enhance robustness against adversarial attacks." These two sentences make it unclear what the key points of your work are and how investigating activation functions is related to sparsifying features. It would be better to provide a consistent expression for the main points and briefly describe the connection between them. I suggest a clear statement about your key contributions.

2. Lack of intuitive explanation of the proposed concept. On page 1, line 48, the proposed sparsity method "Mean-based Sparsification" is not well explained, and it’s followed only by a brief description of Figure 1. Without a clear explanation of the "sparsification operator", it is difficult to follow. I suggest adding a brief explanation of the "sparsification operation" you mentioned in line 90 and providing a concise mathematical definition or detailed description of how the sparsification operator works, perhaps with a simple example.

3. There are some writing errors in the paper. In Figure 2, "equation 3" appears at the end of the title, which is confusing. It would be better to remove it or rephrase the title.

---

confidence: 5
contribution: 2
initial_rating: 3
presentation: 3
questions: See above.
soundness: 2
strengths: - The proposed method is efficient, can be applied to any pre-trained model without additional training, and incurs in limited additional inference cost.

- The experiments include several architectures, datasets and threat models.
summary: The paper proposes a post-training method for enhancing the robustness of adversarially trained models. In particular, it inserts, at various layers, the MeanSparse modules which project the features (before activation) onto their mean computed over the training set if they are closer than a threshold to the mean itself. This has the goal of preventing an attacker from exploiting non-informative features to change the predicted class. In the experiments, several SOTA robust models are equipped with MeanSparse, which leaves clean performance unchanged while improving robustness.
weaknesses: - The main concern is about the possible presence of gradient masking [A]. In fact, as mentioned in the paper, the MeanSparse operator induces zero gradients for the features which are projected. Since these are supposed to be the most common ones, and MeanSparse is applied in multiple points in the network, one can expect that the computed gradient might contain limited information, and thus the gradient-based attacks not work properly. While the paper tests black-box attacks, in this case the base model is (highly) robust, and the improvements given by MeanSparse are in the order of 1-3%, which might be of the same order or even smaller than the gap between white- and black-box (with standard query budget) attacks for the base model: then it is not clear that in this case this is sufficient to exclude gradient masking. A simple adaptive attack would consist in removing the projection operation when computing the gradient in the attacks, which would modify the backward pass of the model while preserving its predictions (a similar approach to BPDA [A]).

- The discussion in Sec. 3.1 seems a bit disconnected from the final approach (also, $z_{k-1}$ in Eq. (7) is not defined).

[A] https://arxiv.org/abs/1802.00420

---

confidence: 3
contribution: 3
initial_rating: 6
presentation: 3
questions: - Is the feature mean always a high-probability point? I would imagine that in certain multimodal distributions the mean is actually unlikely to occur. Might this occur in practice?
- One component of MeanSparse involves calculating the mean and standard deviations of features. Can you provide more information regarding what data is used to calculate these values? Specifically, are these statistics computed on benign or adversarially perturbed data? 
- How sensitive is the feature mean to class imbalances in the training set? If classes aren't evenly balanced (assuming feature distributions are different for different classes), could that result in changes in feature means?
soundness: 3
strengths: - The results show meaningful improvement in the robustness of SOTA adversarially trained models. Since this method can be applied post-training, it has the potential to lead to a significant jump across the board in standards for robustness to adversarial examples.
- The experimental section appears well designed. Results are presented for CIFAR-10, CIFAR-100, and Imagenet, and a representative variety of model architectures and adversarial attacks are tested.
- The method is also shown to be robust against adaptive attacks, as shown in Appendix A.4.
- I quite like the visualizations provided in Figure 1, they simply and effectively convey how MeanSparse operates.
summary: This paper seeks to improve adversarial training by inducing sparsity in the features of an adversarially-trained model. To achieve this, MeanSparse blocks variations in features within a given distance of the mean, which is intended to lessen the importance of non-robust features during training. Before describing their sparsification method, the authors provide intuition as to how non-robust features can be removed during training through regularizad optimization. Here, a regularization term is included in the training objective which penalizes the $\ell_0$ norm of mean-centered learned features. In theory, this would remove small deviations from the mean which don't result in significant reductions in loss. Inspired by this intuition, the authors then propose a sparsification operator, which is applied during forward propagation and explicitly blocks variation within a given distance of the feature mean. Severel implementation challenges are then addressed. Experimental results show that integrating MeanSparse into state of the art image classifiers can significantly improve robustness with negligible impact on clean performance.
weaknesses: - The description of the MeanSparse technique is somewhat ambiguous to me. The term "feature" is often used, but never specifically defined. What features are being used here? Are you referring to input features? Activations of the final layer? Activations of some internal layer?
- I don't entirely agree with the provided intuition for blocking minor variations around the feature mean. Based off of the provided explanation, I would expect this approach to work when minor variations are blocked around high-probability feature values. However, it's not clear to me that the feature mean would always be a high-probability point.
- Appendix A.2 does provide results looking at $\ell_2$ bounded attacks, rather than $\ell_\infty$ bounded attacks. However, I think the topic of how MeanSparse performs against different threat models does warrant additional study. Threat models have been studied in which the adversary can introduce perturbations that are unbounded in $\ell_p$ space (i.e. [1]), and it is not obvious to me whether these types of attacks would have similar impacts on the distributions of features. If the claims made in this paper are limited to $\ell_p$ bounded attacks, I think that should be made explicit.

[1] Xiao, Chaowei, Jun-Yan Zhu, Bo Li, Warren He, Mingyan Liu, and Dawn Song. "Spatially transformed adversarial examples." arXiv preprint arXiv:1801.02612 (2018).

---

confidence: 5
contribution: 3
initial_rating: 3
presentation: 3
questions: 1. Could the method be used for adversarial training and accumulate the running mean and running var during training? Then during testing, fix the running mean and var.

2. Could you provide a detailed analysis of how MEANSPARSE's effectiveness changes as the attack strength increases, like 16/255?
soundness: 3
strengths: 1. The application of sparsification to mean-centered features is an innovative approach, as it targets non-robust features in a unique way.

2. Authors provide comprehensive results across multiple datasets and models

3. The paper is well-organized and clearly describes the underlying motivation, methodology, and results
summary: The paper introduces MeanSparse, a novel post-training method designed to enhance the robustness of convolutional and attention-based neural networks. MeanSparse works by sparsifying mean-centered feature vectors. This technique effectively decreases the success rate of adversarial attacks by minimizing the exploitable feature variations. The paper demonstrates that MEANSPARSE improves the robustness on datasets such as CIFAR-10, CIFAR-100, and ImageNet.
weaknesses: 1. whether its effectiveness generalizes across different types of attention-based models, such as ViT?

2. Could you provide provide an analysis of how MEANSPARSE's effectiveness scales with model size? Authors only apply their method on large networks, like wrs-70. How about the performance of the method on smaller network, like ResNet-18, Swin-Small?

3. After reading the codes provided, I found that the MeadSquare will calculate the mean and var of the input data to get running_mean and running_var. I do no think the model should change its any parameters according to the test data.

4. The number of baselines in this paper is too few. Authors do not compare their methods with other sparsity methods.

Meta-review: **Summary** This work explores sparsity for adversarial robustness by proposing and evaluating a particular sparsity transform on deep representations. The MeanSparse operation is similar to (soft-)thresholding, in reducing differences about the center to zero, but distinct in maintaining values away from zero. In this case the center is set to the feature mean and a threshold hyperparameter $\alpha$ is scaled by the feature variance. This sparsity transform is applied either during adversarial training or after training and only during inference. The after training/post-training variation is favored and is implemented by calculating feature statistics over the training data without adversarial attacks. Evaluation on the standard AutoAttack benchmark shows improvement.

**Strengths**: altering activation functions is general and of interest (ik2X, ry3U) and computationally efficient (8mZY), the experiments are extensive w.r.t. architectures/datasets/threat models (ik2X, 8mZY, ry3U, bqUf), limitations are identified (ik2X), and the work is clear with an intuitive visualization and explanation help to understand the proposed operation (ik2X, ry3U, bqUf).

**Weaknesses**: the apparent robustness of the proposed operation could be explained away by gradient masking (8mZY), the explanation of the operation is vague (ik2X, ry3U), and experimental settings are not detailed (ik2X). Note that the weaknesses raised by bqUf have been discounted, although they are worthwhile points, because they were satisfactorily discussed in the response.

**Decision**: four expert reviewers choose marginal acceptance (ry3U: 6), marginal rejection (ik2X: 5), and clear rejection (8mZY: 3, bqUf: 3). Weaknesses concerning clarity or further results were addressed, and the vote for rejection by bqUf has been qualified accordingly, but the essential weakness about gradient masking and adaptive attacks (8mZY) remains. The meta-reviewer agrees with the reply by 8mZY to the rebuttal that "discussing the potential limitations without a quantitative evaluation is in this case is not sufficient, given that there exist a large body of work on adaptive attacks". The meta-reviewer therefore sides with rejection, but encourages the authors to revise their work with further study and attacks and resubmit, so that the evaluation of the proposed defense is more convincing to experts on adversarial robustness.

Decision: Reject