Year: 2020

Abstract:
Recent works have applied Bayesian Neural Network (BNN) to adversarial training, and shown the improvement of adversarial robustness via the BNN’s strength of stochastic gradient defense. However, we have found that in general, the BNN loses its stochasticity after its training with the BNN’s posterior. As a result, the lack of the stochasticity leads to weak regularization effect to the BNN, which increases KL divergence in ELBO from variational inference. In this paper, we propose an enhanced Bayesian regularizer through hierarchical variational inference in order to boost adversarial robustness against gradient-based attack. Furthermore, we also prove that the proposed method allows the BNN’s stochasticity to be elevated with the reduced KL divergence. Exhaustive experiment results demonstrate the effectiveness of the proposed method by showing the improvement of adversarial robustness, compared with adversarial training (Madry et al., 2018) and adversarial-BNN (Liu et al., 2019) under PGD attack and EOT-PGD attack to the L∞ perturbation on CIFAR-10/100, STL-10, and Tiny-ImageNet.

text: Recent works have applied Bayesian Neural Network (BNN) to adversarial training, and shown the improvement of adversarial robustness via the BNN’s strength of stochastic gradient defense. However, we have found that in general, the BNN loses its stochasticity after its training with the BNN’s posterior. As a result, the lack of the stochasticity leads to weak regularization effect to the BNN, which increases KL divergence in ELBO from variational inference. In this paper, we propose an enhanced Bayesian regularizer through hierarchical variational inference in order to boost adversarial robustness against gradient-based attack. Furthermore, we also prove that the proposed method allows the BNN’s stochasticity to be elevated with the reduced KL divergence. Exhaustive experiment results demonstrate the effectiveness of the proposed method by showing the improvement of adversarial robustness, compared with adversarial training (Madry et al., 2018) and adversarial-BNN (Liu et al., 2019) under PGD attack and EOT-PGD attack to the L∞ perturbation on CIFAR-10/100, STL-10, and Tiny-ImageNet.

heading: 1 INTRODUCTION
text: Deep neural networks have achieved impressive performance in a wide variety of machine learning tasks. Despite the breakthrough outcomes, deep neural networks are easily deceived from adversarial attack with the carefully crafted perturbations (Szegedy et al., 2014; Goodfellow et al., 2015; Chen et al., 2017; Carlini & Wagner, 2017; Papernot et al., 2017; Eykholt et al., 2018; Madry et al., 2018). Injecting these perturbations into clean inputs (i.e., adversarial examples), which are imperceptible to the human eyes, fools the estimators in the deep neural networks. Weak reliability due to the invisible perturbations has affected security problems in deep learning applications (Apruzzese et al., 2019; Wang et al., 2019b; Sagduyu et al., 2019; Rosenberg et al., 2020).
To defend such adversarial examples, many algorithms have been studied to improve adversarial robustness so far. Adversarial training, where deep neural networks are trained on adversarial examples, is one of the few defense strategies against strong adversarial attacks (Huang et al., 2015; Zantedeschi et al., 2017; Kurakin et al., 2017; Madry et al., 2018; Athalye et al., 2018a; Liu et al., 2018). Among them, Madry et al. (2018) has shown that adversarially trained networks can be robust to white-box attacks with the knowledge of the network parameters. Besides, most of the above studies have agreed with that adversarial training shows an effective adversarial robustness against several white-box attacks.
Meanwhile, adversarial training and BNN have been combined to improve adversarial robustness with stochastic approach through variational inference. In fact, the variational inference maximizes Evidence Lower Bound (ELBO) to find an approximate posterior closely following the true posterior for the machine learning tasks (Graves, 2011; Kingma & Welling, 2014; Blundell et al., 2015; Hernández-Lobato & Adams, 2015). Based on the variational inference, adversarial training with BNN has accomplished the achievement of adversarial robustness by implicitly using the approximate posterior against the adversarial perturbations (Mescheder et al., 2017; Ye & Zhu, 2018). They have focused on training the network parameters or spaces itself on the maximum ELBO without obtaining the approximate posterior directly.
Contrary to the above studies, Liu et al. (2019) presents an adversarial training with BNN, called “adversarial-BNN” to deal with the approximate posterior explicitly. They straightforwardly learn Gaussian parameters (e.g., mean and variance) of the approximate posterior as follows: w ∼ N (µ, σ2), instead of the weight parameters. Alternatively, the weight parameters are sampled by the approximate posterior, such that w = µ + σ , where the stochastic sampler is gererated from ∼ N (0, 1). The stochastic sampler provides the change of the weight parameters with the learned Gaussian parameters. The variation of them creates stochastic gradient, helping the improvement of adversarial robustness (Carbone et al., 2020).
However, we find that in general, the approximate posterior’s variance converges to zero-like small value as follows: w ∼ N (µ, σ2 ≈ 0) after training the BNN with its posterior. Although the stochastic sampler helps the weight parameters to change, they become fixed-like parameters, such that w = µ+σ(≈ 0) . The lack of their stochasticity causes the BNN’s stochasticity to be vanished so that the BNN cannot easily respond to slightly different inputs within the same class. In other words, the vanished stochasticity breaks the regularization effect in the BNN, which increases KL divergence in the ELBO. The broken BNN regularizer produces an ill-posed posterior, thus resulting in weak adversarial robustness. This is because the broken regularizer hinders the maximum ELBO from approximating the true posterior against the adversarial perturbations. Therefore, an enhanced BNN regularizer is required to better approximate the true posterior for adversarial robustness.
In this paper, we present the enhanced Bayesian regularizer through hierarchical variational inference in order to boost adversarial robustness compared to the BNN regularizer from variational inference. Furthermore, we also prove that the proposed method significantly intensifies the BNN’s stochasticity by introducing a closed form approximation of conjugate prior for the true posterior. In the end, we validate the effectiveness of the proposed method by showing the improvement of adversarial robustness, compared with adversarial training (Madry et al., 2018) and adversarial-BNN (Liu et al., 2019) under PGD attack as well as EOT-PGD attack to theL∞ perturbation on CIFAR-10/100, STL-10, and Tiny-ImageNet.
Our contributions of this paper can be summarized into two-fold as follows.
• We newly design an enhanced Bayesian regularizer through hierarchical variational inference built with a concept of the conjugate prior, and verify that the proposed method further strengthens the BNN’s stochasticity, compared to the BNN regularizer based on variational inference. • We conduct exhaustive experiments to validate the effectiveness of the proposed method
by adversarial robustness, and exhibit the outstanding performance compared with adversarial training and adversarial-BNN under both PGD attack and EOT-PGD attack on four benchmark datasets: CIFAR-10/100, STL-10, and Tiny-ImageNet.

heading: 2 PRELIMINARY
text: In this section, we specify the notations used in our paper at first and summarize the related works on adversarial attack/defense, and adversarial training with BNN.
Notations. Let x denote the clean image from a given dataset, and y denote the class label corresponding to the clean image. Let D and Dadv indicate each clean dataset and adversarial dataset, such that (x, y) ∼ D and (xadv, y) ∼ Dadv . A deep neural network f parameterized by weight parameters w is denoted by fw(x). Adversarial examples are represented by xadv = x + δ, where δ denotes the adversarial perturbations. In order to align the experiments in the previous works, we use the cross-entropy loss J (fw(x), y) for image classification. Moreover, we regard δ as the L∞ perturbation within γ-ball, such that ‖δ‖∞ ≤ γ. Here, ‖·‖∞ describes the L∞.

heading: 2.1 ADVERSARIAL ATTACK/DEFENSE
text: Adversarial Attacks. The goal of adversarial attacks is generating the adversarial examples to deceive the prediction of the deep neural networks. Most of them produce the adversarial examples by the gradient of the loss function over the input. Goodfellow et al. (2015) introduces a single-step attack called Fast Gradient Sign Method (FGSM). Kurakin et al. (2017) proposes iterative-FGSM with multiple-step attack. Further, Carlini & Wagner (2017) presents C&W attack to overcome
defensive distillation (Papernot et al., 2016), encompassing a range of attacks cast from the same optimization framework. On the other hand, Athalye et al. (2018a) analyzes the effectiveness of Projected Gradient Descent (PGD) method (Madry et al., 2018) to perform adversarial attack to the L∞ perturbation. PGD attack is an iterative algorithm by computing the gradient of the loss in the direction of the highest loss and projecting it back to the L∞ perturbation around the clean image. We use the PGD attack for the experiments of adversarial robustness, which can be written as:
xadvt+1 = ∏ x,γ [ xadvt + η · sign ( ∇xJ (fw(x), y) ∣∣ x=xadvt )] , (1)
where ∏ x,γ is the function to project its argument to the surface of x’s γ-neighbor ball{
x ∣∣ ∥∥xadv − x∥∥∞ ≤ γ}, and η denotes step size. For the adversarial defense utilizing randomized classifiers, an adaptive attack such as Expectation over Transformation (EOT) is known to be effective because it allows an attacker to compute the actual gradient over the expected transformation to the stochastic classifiers (Athalye et al., 2018a;b). Inspired from the EOT attack, we can modify Eq. (1) and adjust more efficient PGD attack (Zimmermann, 2019).
xadvt+1 = ∏ x,γ [ xadvt + η · sign ( E w [ ∇xJ (fw(x), y) ∣∣ x=xadvt ])] , (2)
Zimmermann (2019) applies the averaged-gradient over the multiple weight parameters to generate the adversarial examples, and shows that this efficient PGD attack degrades the BNN’s adversarial robustness. This is because the averaged-gradient can attack all of the possibly sampled weight parameters in the BNN. In other words, the averaged-gradient attack weakens the BNN’s advantage of stochastic gradient defense. In this paper, we call the efficient PGD attack, namely EOT-PGD attack, and take it to validate the effectiveness of the proposed method.
Adversarial Defense. The aim of adversarial defense is to secure deep learning networks against adversarial attacks. There are generally three main categories of defense strategies (Silva & Najafirad, 2020; Hao-Chen et al., 2020). (1) Gradient masking/obfuscation: a defender intentionally hides the gradient information of deep neural networks in order to confuse adversaries, because most attack algorithms are based on the classifier’s gradient information (Papernot et al., 2016; Buckman et al., 2018; Guo et al., 2018; Dhillon et al., 2018). (2) Adversarial detections: they focus on distinguishing whether the input is benign or adversarial (Metzen et al., 2017; Grosse et al., 2017; Xu et al., 2017). When they succeed to detect the adversarial attack in the input, the classifiers stop making a decision. (3) Robust optimization: it is a well-known paradigm that aims to obtain solutions under bounded feasible regions. Especially, its main interest from an adversarial perspective, is improving the classifier’s robustness by changing the learning scheme of deep neural networks (Cisse et al., 2017; Hein & Andriushchenko, 2017; Raghunathan et al., 2018; Wong & Kolter, 2018).
Adversarial training (Goodfellow et al., 2015; Kurakin et al., 2017; Madry et al., 2018) is one of the famous robust optimization methods in deep learning fields, which allows the deep neural network to learn robust parameters against the adversarial examples. Madry et al.(2018) tries to find the optimal weight parameters against adversarial dataset Dadv to improve adversarial robustness under PGD attack to the L∞ perturbation, by minimizing the pre-defined loss L for the machine learning tasks. The formulation can be written as:
w∗ = arg min w E (xadv,y)∼Dadv
[ L ( fw(x adv), y )] , (3)
where xadv is generated from the PGD attack as described in Eq. (1). The optimal weight parameters w∗ get the capacity of adversarial defense to confront the adversarial perturbations.

heading: 2.2 ADVERSARIAL TRAINING WITH BNN
text: Many studies have mingled with adversarial training and BNN through variational inference. Here, variational inference imposes the probabilistic approach on the network parameters or spaces to obtain a closed form approximation of the true posterior based on the maximum ELBO, thus leading to well-posed inference (Welling & Teh, 2011; Paisley et al., 2012; Hoffman et al., 2013; Salimans & Knowles, 2013; Kingma & Welling, 2014; Rezende et al., 2014). Likewise, finding the closed form from an adversarial perspective can lead to well-posed inference for adversarial robustness. Thus,
adversarial training with BNN tries to approximate a true posterior against adversarial perturbations: p(w | Dadv) to indirectly utilize it to conduct the well-posed inference for adversarial robustness. Fundamentally, the reason we should approximate the true posterior is attributed by its intractability because of a high dimensional dependency of adversarial dataset p(Dadv). Thus, variational inference for adversarial robustness introduces an approximate posterior in the closed form of q(w) as a practical estimator to approximate the true posterior, where the formulation can be written as:
log p(y | xadv) = DKL(q(w) || p(w | Dadv)) + E w∼q(w) [ log p(y | xadv, w) ] −DKL(q(w) || p(w))︸ ︷︷ ︸
ELBO
. (4)
We should minimize KL divergence DKL ( q(w) || p(w | Dadv) ) above to make the probabilitydistance close between the two probability distributions. But, this KL divergence is still intractable measurement, and we can alternatively maximize the ELBO in Eq. (4), which has the same effect to minimize this KL divergence. This is because the log-probability log p(y | xadv) in Eq. (4) is consistent with the change of the weight parameters w. The formulation of variational inference also can be represented to lower bound as: log p(y | xadv) ≥ ELBO. Some of the studies (Mescheder et al., 2017; Ye & Zhu, 2018; Wang et al., 2019a; Carbone et al., 2020) are to improve adversarial robustness by maximizing the ELBO. Others (Feinman et al., 2017; Smith & Gal, 2018; Wang et al., 2018) are to detect the adversarial examples by predicting Bayesian uncertainty (Gal & Ghahramani, 2016; Kendall & Gal, 2017; Pearce et al., 2020), which are also based on the maximum ELBO. These previous studies have implicitly examined the approximate posterior to better learn the network parameters or spaces, instead of directly shaping the approximate posterior.
Unlike the previous studies, Liu et al. (2019) proposes “adversarial-BNN” which combines adversarial training and the BNN to improve adversarial robustness by shaping the approximate posterior explicitly. Liu et al. designs its posterior q(w) = N (µ, σ2) and considers Gaussian parameters (e.g., mean, variance) of it as learning parameters. In this work, the first term in the ELBO represents the expected log-likelihood calculated from the cross-entropy as follows: 1N ∑N i=1 J ( fw(i)(x adv), y ) by Monte-Carlo sampling, where N denotes the sampling number. As shown in Fig. 1(a), the weight parameter w(i) is sampled by the approximate posterior’s mean and variance µ, σ2, such that w(i) = µ+ σ (i). Here, (i) is the stochastic sampler, such that (i) ∼ N (0, 1). The second term in the ELBO normally represents a regularization term for an approximate posterior as the BNN’s posterior. This term can be computed from the KL divergence between the approximate posterior q(w) and a prior p(w) which is usually set to N (0, 1) for variational inference. In other words, this KL divergence has a role of a BNN regularizer in ELBO, and this regularizer is an
important factor for adversarial robustness. This is because once the BNN regularizer is increased unexpectedly, the minimum ELBO produces an ill-posed posterior, creating weak adversarial robustness. In contrast, as the BNN regularizer is reduced, the maximum ELBO allows for the well-posed inference due to strong regularization effect bringing in better approximating the true posterior. In addition to the aspect of the ELBO, there are many studies showing that high regularization performance improves adversarial robustness (Saito et al., 2018; Yu et al., 2019; Zhang & Liang, 2019; Sun et al., 2019; Terjék, 2020; Zhang et al., 2020).

heading: 3 PROPOSED METHOD
text: Adversarial training with BNN has expanded generic probability to adversarial probability, and has shown the improvement of adversarial robustness. However, as mentioned in the Section 1, the vanished stochasticity declines adversarial defense functionality of the BNN. To investigate the BNN’s stochasticity, we introduce a concept of the conjugate prior, and develop a new ELBO motivated by the conjugate prior. The conjugate prior can provide a key to how the Gaussian parameters of the approximate posterior q(w) are trained during adversarial training. Based on our findings in the conjugate view, we will design an enhanced Bayesian regularizer that solves the stochasticity problem causing weak adversarial robustness. Before we explain the proposed method, we firstly introduce two parts: (1) the conjugate prior of the Gaussian posterior, (2) hierarchical variational inference for building a new ELBO with this concept of conjugate prior.
Gaussian Conjugate Prior. The conjugate prior of the Gaussian posterior is called the Gaussian conjugate prior. In the conjugate view, the true posterior p(w | D) is no longer posterior, but is the likelihood p(w | D, µ, σ2) given the Gaussian parameters µ, σ2 when assuming the true posterior is Gaussian. Here, Gaussian conjugate prior is the probability distribution p(µ, σ2 | D) for the Gaussian parameters of the true posterior. The conjugate prior takes an benefit to approximate the true posterior by modeling such Gaussian parameters, thus guiding well-posed posterior. But, the conjugate prior is also intractable to deal with, similar to the true posterior because they are same distribution family. Therefore, we introduce an approximate conjugate prior q(µ, σ2), in the shape of Normal-Inverse Gamma distribution, to approximate the conjugate prior of the true posterior. The formulation of the approximate conjugate prior can be written as follows:
q(µ, σ2) = N ( µ | µ0, σ20 ) IG ( σ2 | ν, ψ ) . (5)
It can be factorized into the Normal distribution q(µ) = N ( µ | µ0, σ20 ) and the Inverse Gamma dis-
tribution q(σ2) = IG ( σ2 | ν, ψ ) independently by mean-field approximation (Kingma & Welling, 2014). In the Normal distribution, µ0 denotes the mean prior knowledge of the approximate posterior q(w), and σ20 denotes the variance of the approximate posterior’s mean. In addition, ν, in the Inverse Gamma distribution, denotes the degree of freedom on positive real set which determines the shape of this distribution, and ψ denotes the variance prior knowledge of the approximate posterior.
Here, the approximate conjugate prior can sample each of the Gaussian parameters independently. The Normal distribution samples the approximate posterior’s mean, and the Inverse Gamma distribution samples its variance. As illustrated in Fig. 1(b), tractable parameters µ0, σ20 , ψ, and ν in q(µ, σ
2) can generate the mean µ and the variance σ2 of the approximate posterior, where µ = µ0 + σ0 µ, and σ2 = ψ σ2 , such that µ ∼ N (0, 1), σ2 ∼ IG(ν, 1). In addition, the generated mean and the variance are both used to sample the weight parameters: w = µ0 + σ0 µ + (ψ σ2)1/2 . We call it Normal-Inverse Gamma sampling. More importantly, the approximate conjugate prior has more number of the tractable parameters than the approximate posterior q(w), which significantly help sampling the weight parameters for complex representation.
Hierarchical Variational Inference. Next, we tackle the way the approximate conjugate prior makes a closed form approximation of the conjugate prior as a same family of true posterior. We modify the ELBO in Eq. (4) to build up a new ELBO with the approximate conjugate prior, namely hierarchical-ELBO, which can be written as:
E (µ,σ2)∼q(µ,σ2)
[ log p(y | xadv, µ+ σ ) ] −DKL(q(µ, σ2) || p(µ, σ2)). (6)
The first term stands for the classification performance taken from the cross-entropy. The second term represents the BNN regularizer in hierarchical-ELBO equivalent to that in the ELBO as
depicted in Eq. (4). The second term can be computed by the KL divergence between the approximate conjugate prior q(µ, σ2) and a hierarchical prior p(µ, σ2). Note that the hierarchical prior is factorized into the mean prior p(µ | σ2) and the variance prior p(σ2). Then, the above KL divergence can be decomposed into two equations: (1) Eσ2∼q(σ2) [ DKL(q(µ) || p(µ | σ2)) ] and (2) DKL(q(σ2) || p(σ2)) (see Appendix A). In order to make two equations tractable, both the mean prior and the variance prior should be set, similar to the setting of the prior p(w) = N (0, 1) in the ELBO from variational inference. Since the prior is Gaussian, the hierarchical prior can be formed to Gaussian conjugate prior, Normal-Inverse Gamma, where we keep the prior knowledge of the mean and the variance with zero and one, respectively. We set the mean prior to N ( 0, λ−1σ2
) for (1), where λ denotes inverse scale factor to the variance σ2. In addition, the variance prior is set to IG(ν, 1) for (2). Here, ν is set to the same parameters both in q(σ2) and p(σ2) to reduce computational complexity in calculating (2).
On the above settings for the hierarchical prior p(µ, σ2), the second term can be tractably expanded with the summation of the two equations (see Appendix B), which can be written as:
DKL(q(µ, σ2) || p(µ, σ2)) = 1M ∑M j=1[νj λj(σ 2 0,j+µ 2 0,j)+2 2ψj + log ψ 2νj+1 2 j
(λiσ20,j) 1 2 − 2νj+12 − 1 2G(νj)], (7)
where M denotes the number of weight parameters in the deep neural networks, and j represents the jth parameters for the jth approximate conjugate prior. The function G has the formulation of Digamma function, such that G(νj) = Γ′ (νj)/Γ(νj).
ELBO vs Hierarchical-ELBO. Until we control the parameters λ, ν of the hierarchical prior p(µ, σ2), the ELBO is essentially same to the hierarchical-ELBO. Also, the BNN regularizer in the ELBO is identical to that in the hierarchical-ELBO. This is because it is nothing but we just have replaced the weight parameters in the ELBO with the Gaussian parameters for the extension, as described in Eq. (6). Different from the fixed prior p(w) = N (0, 1) in the ELBO, controllable parameters λ, ν of the hierarchical prior p(µ, σ2) can allow the BNN regularizer in the hierarchicalELBO to change adaptively. As a consequence, properly chosen parameters λ and ν can reduce the KL divergence, helping to well-posed posterior with the maximum hierarchical-ELBO. The formulation of the hierarchical-ELBO can be also represented to lower bound with the ELBO as follows: log p(y | xadv) ≥ hierarchical-ELBO ≥ ELBO, where the hierarchical-ELBO better approximates the true posterior than the ELBO.
Enhanced Bayesian Regularizer. Now, we focus on the optimization of the BNN regularizer in the hierarchical-ELBO to reduce the KL divergence. By gradient results over the controllable parameters: ∂∂λjDKL = 0 and ∂ ∂νj DKL = 0, we can easily obtain the optimal value λ∗ = ψν(σ20+µ20) , but the optimal value ν∗ is intractable to acquire, since the gradient result is intractable as follows: 1 2 d dνG(ν) − 1 2ν = 1 ψ + logψ − 1. We should indirectly find the optimal value ν
∗ by applying the above gradient results to the KL divergence, which can be written as:
DKL(q(µ, σ2) || p(µ, σ2)) = 1M ∑M j=1[ 1 2 log ( 1 + µ20,j σ20,j ) + νj 2 d dνj G(νj)− 1 2 G(νj) + 1 2 log νj − 1
2︸ ︷︷ ︸ H(νj)
], (8)
where the functionH(νj) is decreasing and convergent function (see Appendix C). We examine this function is converged to zero, as νj gets large enough. With the optimal value ν∗ infinite, the KL divergence in the hierarchical-ELBO can be definitely reduced.
Finally, we propose the enhanced Bayesian regularizer as follows: 1M ∑M j=1[ 1 2 log ( 1 + µ20,j σ20,j ) ]. The proposed method provides more tight lower bound than the ELBO, such that the formulation can be described as follows: log p(y | xadv) ≥ hierarchical-ELBO ELBO. Based on the tight lower bound, the enhanced Bayesian regularizer aids to the acquisition of the well-posed posterior to boost adversarial robustness. Consequently, we have verified that the proposed method considerably intensifies the BNN regularizer by designing the hierarchical-ELBO in the conjugate view. In practical, we can compute the proposed method for each training iteration, such as Expectation-Maximization (EM) step. We describe the algorithm for the proposed method below.
Algorithm 1 Code for adversarial training in the BNN with the enhanced Bayesian regularizer 1: Require: α (learning rate), µ0 and σ0 (learning parameters) 2: for (x, y) in D do . Training procedure per epoch 3: w ← µ0 + σ0 , ∼ N (0, 1) . Sample the weight parameters 4: xadv ← attack(x, y, w) . PGD attack to generate adversarial examples 5: ŷ ← fw(xadv) . Predict the outputs given the adversarial examples 6: L1 ← J(ŷ, y) . Calculate the cross-entropy loss 7: L2 ← ∑M j=1 1 2 log(1 + µ20,j σ20,j
) . Calculate the proposed method 8: L ← L1 + L2 . Calculate the hierarchical-ELBO in Eq. (6) 9: (µ0, σ0)← (µ0 − α ∂L∂µ0 , σ0 − α ∂L ∂σ0
) . Update the learning parameters 10: end for
Theoretical Analysis. On the above optimization with infinite ν∗, the Inverse Gamma distributions are converged to delta probability distribution, such that limν∗→∞ q(σ2) = δ(σ2), limν∗→∞ p(σ
2) = δ(σ2). Hence, we can discover that the BNN from the ELBO generally loses its stochasticity after its training with the approximate posterior q(w) via the zero convergence variance. For the hierarchical-ELBO, the tractable parameter ψ is not required anymore during sampling the weight parameters in Fig. 1(b). This is because σ2 is sampled to zero from delta distribution such that σ2 ∼ δ( σ2) = limν∗→∞ IG(ν, 1). Thus, only the Normal distribution q(µ) = N (µ0, σ20) is involved in sampling the weight parameters as follows: w = µ0 + σ0 . Here, according to the decomposition of the second term in Eq. (6), q(µ) is learned to follow the mean prior p(µ | σ2) with the optimal parameter λ∗, such that limλ→λ∗ p(µ | σ2) = N (0, k(µ20 + σ20)), where k is statistically proven to be above one (see Appendix D). Then, the variance σ20 of q(µ) follows the variance k(µ20 + σ 2 0) of the mean prior, which is definitely larger than the variance σ 2 0 . In short, training the BNN with the approximate conjugate prior leads to increase the change in the weight parameters, such that w = µ0 + σ0(↑) . Therefore, we verify that the proposed method allows for the enhancement of the BNN’s stochasticity through hierarchical-ELBO.

heading: 4 EXPERIMENTS
text: In this section, we validate adversarial robustness of the proposed method compared to strong baselines in various datasets. Since our method is inspired by adversarial training (Madry et al., 2018), BNN (Blundell et al., 2015), and adversarial-BNN (Liu et al., 2019), these three comparison methods are natural baseline methods.
Implementation Details. We conduct exhaustive experiments on not only a standard low dimensional dataset (CIFAR-10), but also more challenging datasets such as CIFAR-100, STL-10 (Coates et al., 2011), and Tiny-ImageNet (Le & Yang, 2015). STL-10 has 5,000 training images and 8,000 testing images with a size of 96×96 pixels. Tiny-ImageNet is a small subset of ImageNet dataset, containing 100,000 training images, 10,000 validation images, and 10,000 testing images separated in 200 different classes, whose dimensions are 64×64 pixels. Two vanilla networks, VGG and Model A1, are adopted as our baseline networks. Model A is trained for STL-10 while the others are trained via VGG. Each baseline network is trained with L∞ 0.03 perturbation magnitude during adversarial training stage for comparing baseline methods and Ours. For validation, we apply the PGD attack and EOT-PGD attack to the test set, and adjust L∞ perturbation magnitude of the adversarial perturbation δ from 0 to 0.03 within the perturbation magnitude used in adversarial training.
Computational complexity. According to Theoretical Analysis above, the number of learning parameters in the proposed method is same number of those in the adversarial-BNN. Thus, there is no excessive computational complexity to implement the proposed method.
Hyper-parameter. To fairly validate adversarial robustness, we equally set hyper-parameter settings that learning rate equals to 0.01 with Adam (Kingma & Ba, 2015), and the learning parameters (mean and variance) are initialized to each U(−1/ √ c, 1/ √ c) (c : channel number) and 0.1 (what
1Publicly available at https://github.com/aaron-xichen/pytorch-playground/tree/ master/stl10
we are interested in after training). For PGD attack, we set the number of steps T to 10 in adversarial training stage and 30 in test stage, and set the step size η to 2.3T δ. For EOT-PGD attack, we equally use the hyper-parameters of PGD attack and set the number of samples to 10.
Stochasticity and Regularization. Tab. 1 shows comparison of statistical summaries for the weight parameters such as mean, variance and KL divergence in adversarial training with BNN and Ours. The summaries shows that naively putting BNN to adversarial training reduces the variance, and even fails to maintain the initial variance 0.1. In addition, the decreased variance causes higher KL divergence. This phenomenon shows an empirical evidence on the recall of the vanished stochasticity from adversarial training with BNN, where the broken BNN regularizer increases the KL divergence. Conversely, the proposed method shows comparatively higher variance (more increased variance than the initial variance) and lower KL divergence (6.7 times lower on average across all datasets). Therefore, we expect the proposed method to have a strong regularization effect so that the robustness discrepancy between adversarial-BNN and Ours becomes greater in large datasets with more classes such as CIFAR-100 and Tiny-ImageNet.
Robustness under white-box PGD and EOT-PGD attack. First, we compare adversarially trained baseline networks with baseline methods and Ours by adversarial robustness under the white-box PGD attack (first row in the Fig. 2) and EOT-PGD (second row in the Fig. 2) to the L∞ perturbation. As illustrated in this figure, adversarial-BNN has greater performance on STL-10 than naive adversarial training, but it has lower performances on the other datasets. While, the proposed method outperforms baseline methods to all datasets.
Ablation studies. We conduct three ablation studies: (1) attacking with higher perturbation magnitude (δ > 0.03) than the perturbation magnitude of adversarial training, (2) adversarial training with large perturbation magnitude (δ = 0.06) on WideResNet (Zagoruyko & Komodakis, 2016), and (3) comparison of clean training and adversarial training with BNN and Ours. The two ablation studies (1) and (2) are represented in Fig. 2 where the proposed method generally surpasses baseline methods, although it converges to the performances of baseline methods in much higher perturbation magnitude. For the ablation study (3), the statistical summaries of clean training on
baseline networks (VGG, Model A) are illustrated in Appendix E. Further, Tab. 2 compares those of clean training and adversarial training with BNN and Ours on WideResNet. They show that both variances of BNN are lower than those of Ours. That is, this vanished stochasticity also happens in normal BNN when clean training. Here, we can analyze that the superior robustness of Ours does not come from the improvement of classification accuracy by itself.
Discussion. We tackle why the proposed method is effective to EOT-like attack. In general, a randomized network provides a stochastic tolerance obfuscating the gradient-based attack, which uses a single sample of the randomness. Especially, the BNN’s stochasticity makes an attacker confused to incorrectly estimate the true gradient. But, EOT-like attack easily bypasses this stochasticity by taking the expectation over multiple weight parameters. However, our re-birth of BNN’s stochasticity against EOT-like attack can be mathematically represented by Taylor series (see Appendix G). Now that it is possible to demonstrate the effectiveness of the proposed method against EOT-like attack, we can insist that the proposed method is not just obfuscating the gradient, but helping the deep neural networks to have strong adversarial robustness.

heading: 5 CONCLUSION
text: As mentioned in Theoretical Analysis at the Section 3, we have found that the BNN generally loses its stochasticity after its training with the BNN’s posterior via the zero convergence variance. To solve it, we newly design the enhanced Bayesian regularizer with improved stochasticity through the hierarchical-ELBO under a concept of the conjugate prior. In addition, we have analyzed the improved stochasticity is effective to EOT-like attack. We believe the hierarchical-ELBO better approximates the true posterior against adversarial perturbations by the tight lower bound more than the ELBO, thus boosting the adversarial robustness. Further progress can be made by investigating the hierarchical-ELBO to explore generative models, such as Variational Auto-Encoder (VAE) and Generative Adversarial Network (GAN) for scalable machine learning tasks.

heading: A DECOMPOSITION OF KL DIVERGENCE IN HIERARCHICAL-ELBO
text: The approximate conjugate prior q(µ, σ2) can be independently factorized into the Normal distribution q(µ) and the Inverse Gamma distribution q(σ2) by the mean-field approximation. The hierarchical prior p(µ, σ2) is factorized into the mean prior p(µ | σ2) and the variance prior p(σ2). The KL divergence in the hierarchical-ELBO can be decomposed as follows:
DKL(q(µ, σ2) || p(µ, σ2))
= ∫∫ q(µ, σ2) log q(µ, σ2)
p(µ, σ2) dµdσ2
= ∫∫ q(µ)q(σ2) log q(µ)q(σ2)
p(µ2 | σ2)p(σ2) dµdσ2
= ∫∫ q(µ)q(σ2) log q(µ)
p(µ | σ2) dµdσ2 +
∫∫ q(µ)q(σ2) log q(σ2)
p(σ2) dµdσ2
= ∫ q(σ2) [∫ q(µ) log q(µ)
p(µ | σ2) dµ
] dσ2 + ∫ q(σ2) log q(σ2)
p(σ2) dσ2
= Eσ2∼q(σ2) [ DKL(q(µ) || p(µ | σ2)) ] +DKL(q(σ2) || p(σ2)).
(9)

heading: B FULL EXPANSION OF KL DIVERGENCE IN HIERARCHICAL-ELBO
text: The first term in the KL divergence at the hierarchical-ELBO can be written as:
Eσ2∼q(σ2) [ DKL(q(µ) || p(µ | σ2)) ]
= M∑ j=1 Eσ2j∼q(σ2j ) [ DKL(q(µj) || p(µj | σ2j )) ] (by Lemma B.4)
= M∑ j=1 Eσ2j∼q(σ2j )
[ σ20,j + µ 2 0,j
2λ−1j σ 2 j
+ 1
2 log
λ−1j σ 2 j
σ20,j − 1 2
] (by Lemma B.1)
= M∑ j=1
[ νj σ20,j + µ 2 0,j
2λ−1j ψj +
1 2 log
λ−1j ψj
σ20,j − 1 2
Γ′ (νj)
Γ (νj) − 1 2
] , (by Lemma B.2)
(10)
where
q(µj) = N (µj | µ0,j , σ20,j), p(µj | σ2j ) = N (µj | 0, λ−1i σ 2 j ). (11)
The second term in the KL divergence at the hierarchical-ELBO can be written as:
DKL(q(σ2) || p(σ2))
= M∑ j=1 DKL(q(σ2j ) || p(σ2j )) (by Lemma B.4)
= M∑ j=1 [ νj logψj − νj ψj − 1 ψj ] (by Lemma B.3)
(12)
where
q(σ2j ) = IG(σ2j | νj , ψj), p(σ2j ) = IG(σ2j | νj , 1). (13)
Full expansion of the KL divergence can be computed by the summation of the above two terms Eq. (10) and Eq. (12). The formulation can be written as:
DKL(q(µ, σ2) || p(µ, σ2)) = 1
M M∑ j=1 [νj λj(σ 2 0,j + µ 2 0,j) + 2 2ψj +log ψ 2νj+1 2 j (λiσ20,j) 1 2 −2νj + 1 2 −1 2 Γ′ (νj) Γ (νj) ],
(14) Lemma B.1. KL divergence between two Gaussian distributions.
DKL(q(x)||p(x)) = σ2q + (µq − µp)2
2σ2p +
1 2 log σ2p σ2q − 1 2 ,
where q(x) = N (x | µq, σ2q ), p(x) = N (x | µp, σ2p).
Lemma B.2. The expected Inverse Gamma distribution
Ex∼q(x)
[ 1
x
] = ν
ψ , Ex∼q(x) [log x] = logψ −
Γ′ (ν) Γ (ν) ,
where q(x) = IG(x | ν, ψ) = ψ ν
Γ(ν) x−(ν+1) exp
( −ψx−1 )
Lemma B.3. KL divergence between two Inverse Gamma distributions
DKL(q(x)||p(x)) = ∫ q(x) log ψνq Γ(ν)x −(ν+1) exp ( −ψqx−1 ) ψνp
Γ(ν)x −(ν+1) exp (−ψpx−1)
dx
= ∫ q(x) log [ ψνq ψνp exp ( −(ψq − ψp)x−1 )] dx
= ∫ q(x) [ ν log
ψq ψp − (ψq − ψp)x−1
] dx
= ν log ψq ψp − (ψq − ψp)
∫ q(x)
x dx
= ν log ψq ψp − ν(ψq − ψp) ψq , (by Lemma B.2)
where q(x) = IG(x | ν, ψq), p(x) = IG(x | ν, ψp).
Lemma B.4. KL divergence with independent random variables
DKL(q(x)||p(x)) = ∫∫ · · · ∫ q(x) log q(x)
p(x) dx1dx2 · · · dxM
= ∫∫ · · · ∫ q(x) log  M∏ j=1 q(xj) p(xj)  dx1dx2 · · · dxM
= M∑ j=1 ∫∫ · · · ∫ q(x) log q(xj) p(xj) dx1dx2 · · · dxM
= M∑ j=1 ∫ q(xj) log q(xj) p(xj) dxj︸ ︷︷ ︸
DKL(q(xj)||p(xj))
× M∏ i=1 i 6=j ∫ q(xi)dxi
︸ ︷︷ ︸ 1
= M∑ j=1 DKL(q(xj)||p(xj)),
where
x = (x1, x2, · · · , xM ) , q(x) = M∏ j=1 q(xi), p(x) = M∏ j=1 p(xi).

heading: C FUNCTION ANALYSIS
text: where
H(νj) = νj 2 d dνj G(νj)− 1 2 G(νj) + 1 2 log νj − 1 2
= 1
2 ∞∑ k=0 νj (νj + k)2 − Γ ′ (νj) Γ(νj) + 1 2 log νj − 1 2 > 0
(15)
and
lim νj→∞
H(νj) = 0 +. (16)
where
H ′(νj) = νj 2
d2
dν2j G(νi) +
1
2νj
= − ∞∑ k=0 νj (νj + k)3 + 1 2νj < 0
(17)
and
lim νj→∞
H ′(νj) = 0 −. (18)
D PROOF OF k VALUE
The Normal distribution q(µ) = N (µ0, σ20) is learned to follow the mean prior p(µ | σ2) = N (0, (λ∗)−1σ2), with the optimal value λ∗ = ψ
ν(µ20+σ 2 0) . The mean prior’s variance equals to νσ2
ψ (µ 2 0 + σ 2 0). Here, σ2 =
σ2
ψ is sampled from IG(ν, 1), as depicted in the Fig. 1(b). Thus, the variance is written as: ν σ2(µ20 + σ 2 0). Now, we can statistically estimate ν σ2 by the expectation over σ2 ∼ IG(ν, 1). Then, it satisfies E σ2 [ν σ2 ] = ν ν−1 > 1. Hence, the mean prior p(µ | σ 2) can be designed to N (0, k(µ20 + σ20)), where k > 1.

heading: E CLEAN TRAINING WITHOUT ADVERSARIAL EXAMPLES

heading: F NON-ZERO MEAN AND HIGHER VARIANCE
text: Non-zero Mean. According to the experiment results in Tab. 1-3, the mean learned from adversarial training with BNN follows zero, while the mean from the proposed method follows non-zero. Analyzing KL divergences between ELBO and hierarchical-ELBO can provide a clue to this phenomenon. The relationship of their KL divergences can be written as follows:
DKL(q(µ, σ2) || p(µ, σ2))︸ ︷︷ ︸ for hierarchical-ELBO < DKL(q(w) || p(w))︸ ︷︷ ︸ for ELBO . (19)
The left KL divergence above represents the proposed method to better approximate the true posterior by the tight lower bound of hierarchical-ELBO, and the right one denotes the BNN regularizer in ELBO during adversarial training with BNN. Through the optimization described in the Section 3, the proposed method can be much smaller than the BNN regularizer. Based on this relationship of Eq. (19), it is not required that hierarchical-ELBO concentrates on learning its KL divergence due to already optimized strong regularization. In contrast, ELBO more tries to reduce its KL divergence to improve regularization effect through the zero mean, the purpose of which is addressing weak regularization effect attributed by the vanished stochasticity. At this time, the proposed method relatively more focuses to learn the expected log-likelihood in the hierarchical-ELBO, where the mean does not have to be zero. Instead, the mean is adaptively learned according to the characteristics of the datasets.
Higher Variance. As also shown in Tab. 1-3, the proposed method promotes higher variance compared to the initial variance 0.1. While, adversarial training with BNN has lower variance causing the lack of its stochasticity. We contemplate whether the stochasticity and higher variance purely affects the adversarial robustness of the deep neural networks. To examine this impact, we handle the magnitude of the derivative to the log-likelihood over the weight parameters, which can be written as follows:∥∥∥∥ ddw log p(y | xadv, w) ∥∥∥∥ = ∥∥∥∥ 1σ dd log p(y | xadv, µ+ σ ) ∥∥∥∥ (20)
where w = µ + σ , such that ∼ N (0, 1). Note that for mathematical convenience, the denoted µ and σ2 correspond to the mean and the variance respectively in both adversarial training with BNN and Ours.
Eq. (20) explicates the magnitude of the change in the cross-entropy as the weight parameters change from the variation of , which can be represented to: dw = σd . Once the variance gets much smaller due to the vanished stochasticity, the magnitude becomes larger. That is, prediction results of the deep neural networks differ significantly from the slight change of the weight parameters, such that w = µ + σ(≈ 0) . The large change in cross-entropy makes ELBO inconsistent, and it loses adversarial robustness. In contrast, once the variance from the proposed method gets much larger, the prediction results are robust to the large change of the weight parameters, where the magnitude becomes smaller. Accordingly, Eq. (20) guides the proposed method to keep the maximum hierarchical-ELBO consistent by the higher variance, thus better obtaining well-posed inference to boost adversarial robustness. Consequently, we verify that the higher variance has a positive impact on adversarial robustness by itself with large BNN’s stochasticity.

heading: G ROBUSTNESS OF PROPOSED METHOD AGAINST EOT-LIKE ATTACK
text: Let T (w) = ∇xJ (fw(x), y) where w denotes the weight parameters w = µ + σ , such that ∼ N (0, 1). Note that for mathematical convenience, the denoted µ and σ2 correspond to the mean and the variance respectively in both adversarial training with BNN and Ours.
Expectation over Transformation (EOT) attack is well-known adaptive attack targeting randomized neural networks. The EOT-like attack easily bypasses the stochasticity of randomized classifiers by taking the expectation over the multiple weight parameters to compute the actual gradient. The formulation of the expected T over the weight parameters can be written as follows:
Ew[T (w)] = E [T (µ+ σ )]. (21)
According to Taylor series, the above equation can be written as follows:
E [T (µ+ σ )] = E [T (µ) + σ T ′(µ) + (σ )2
2! T ′′(µ) + · · · ]
= E [T (µ)]︸ ︷︷ ︸ actual gradient +E [σ T ′(µ)] + E [ (σ )2 2! T ′′(µ)] + · · · .
(22)
For naive adversarial training (σ is not used), the expected T can be written as:
E [T (µ)] = T (µ). (23)
For adversarial training with BNN, the variance σ2 of the approximate posterior q(w) becomes to be reduced, so Taylor series ends up with first-order approximation. Eq. (22) can be written as:
E [T (µ+ σ )] = E [T (µ)] + E [σ T ′(µ)] = T (µ), (24)
which equals to the result of the expected T from naive adversarial training in Eq. (23). On the other hand, the proposed method can enhance the BNN’s stochasticity with the large enough variance σ2. Hence, the remaining higher order terms of Taylor series in Eq. (22) still survive at even degree, which can be written as:
E [T (µ+ σ )] = E [T (µ) + σ T ′(µ) + (σ )2
2! T ′′(µ) + · · · ]
= T (µ)︸ ︷︷ ︸ actual gradient + σ2 2 T ′′(µ) + · · ·︸ ︷︷ ︸
stochastic tolerant terms
.
(25)
The remaining terms of Taylor series make a difference from the actual gradient as opposed to adversarial training and adversarial-BNN. Here, these terms retain stochastic tolerance against EOTlike attack, thus bringing in the improvement of adversarial robustness as the effectiveness of the proposed method.

Review summaries:
In this paper the authors study the adversarial robustness of BNNs on large scale datasets. BNNs have been shown to be a more robust learning paradigm due to their uncertainty/stochasticity. Given the empirical observation that adversarially trained BNN posterior variances converge to zero (which the authors need to do much more to show as this is not a well-established phenomena), the authors propose a hierarchical prior where they put a prior over the parameters of the Gaussian prior normally used  in mean-field variational inference. The authors show that performing approximate inference with a hierarchical prior leads to an increased variational posterior variance, which the authors claim is correlated to the observation of increased adversarial robustness. 

This paper presents a new adversarial training for BNNs with variational inference (VI). Specifically, Adv-BNN training of Liu et al. 2019 uses a standard normal prior for VI of BNNs.  The paper observes that the above method may have vanished stochasticity that reduces the robustness and the proposed method extends it with a conjugate prior constructed by a normal distribution and an inverse gamma distribution. This extension results in a stronger regularisation of the weights of BNNs, which can enhance the robustness against adv attacks and leads to a hierarchical inference. The method is reported to have better performance than vanilla adv training and adv-BNN training on several benchmark datasets.

This paper studies the adversarial robustness of DNNs with Bayesian neural networks. Although BNN has been integrated with adversarial training for better robustness, this paper argues that the previous method lacks the stochasticity (i.e., the posterior tends to have zero variance), thus limiting the robustness performance. In this paper, a new hierarchical variational inference is proposed to enhance the robustness when integrating with adversarial training. The proposed method is presented well. The experiments show the effectiveness of the proposed method.