BASGD: B UFFERED A SYNCHRONOUS SGD FOR B YZANTINE L EARNING
Anonymous authors
Paper under double-blind review
A BSTRACT
Distributed learning has become a hot research topic due to its wide application in cluster-based large-scale learning, federated learning, edge computing and so on.
Most traditional distributed learning methods typically assume no failure or attack on workers.
However, many unexpected cases, such as communication failure and even malicious attack, may happen in real applications.
Hence, Byzantine learning (BL), which refers to distributed learning with failure or attack, has recently attracted much attention.
Most existing BL methods are synchronous, which are impractical in some applications due to heterogeneous or ofﬂine workers.
In these cases, asynchronous BL (ABL) is usually preferred.
In this paper, we propose a novel method, called buffered asynchronous stochastic gradient descent (BASGD), for ABL.
To the best of our knowledge, BASGD is the ﬁrst ABL method that can resist malicious attack without storing any instances on server.
Compared with those methods which need to store instances on server, BASGD takes less risk of privacy leakage.
BASGD is proved to be convergent, and be able to resist failure or attack.
Empirical results show that BASGD signiﬁcantly outperforms vanilla
ASGD and other ABL baselines when there exists failure or attack on workers.
I NTRODUCTION
Due to the wide application in cluster-based large-scale learning, federated learning (Kone v cn ` y et al., 2016; Kairouz et al., 2019), edge computing (Shi et al., 2016) and so on, distributed learning has recently become a hot research topic (Zinkevich et al., 2010; Yang, 2013;
Jaggi et al., 2014; Shamir et al., 2014; Zhang & Kwok, 2014; Ma et al., 2015; Lee et al., 2017; Lian et al., 2017; Zhao et al., 2017; Sun et al., 2018; Wangni et al., 2018;
Zhao et al., 2018;
Zhou et al., 2018; Yu et al., 2019a;b;
Haddadpour et al., 2019).
Most traditional distributed learning methods are based on stochastic gradient descent (SGD) and its variants (Bottou, 2010; Xiao, 2010; Duchi et al., 2011; Johnson &
Zhang, 2013; Shalev-Shwartz & Zhang, 2013; Zhang et al., 2013; Lin et al., 2014; Schmidt et al., 2017; Zheng et al., 2017; Zhao et al., 2018), and typically assume no failure or attack on workers.
However, in real distributed learning applications with multiple networked machines (nodes), different kinds of hardware or software failure may happen.
Representative failure include bit-ﬂipping in the communication media and the memory of some workers (Xie et al., 2019).
In this case, a small failure on some machines (workers) might cause a distributed learning method to fail.
In addition, malicious attack should not be neglected in an open network where the manager (or server) generally has not much control on the workers, such as the cases of edge computing and federated learning.
Some malicious workers may behave arbitrarily or even adversarially.
Hence, Byzantine learning (BL), which refers to distributed learning with failure or attack, has recently attracted much attention (Diakonikolas et al., 2017; Chen et al., 2017; Blanchard et al., 2017; Alistarh et al., 2018;
Damaskinos et al., 2018; Xie et al., 2019; Baruch et al., 2019; Diakonikolas & Kane, 2019).
Existing BL methods can be divided into two main categories: synchronous BL (SBL) methods and asynchronous BL (ABL) methods.
In SBL methods, the learning information, such as the gradient in
SGD, of all workers will be aggregated in a synchronous way.
On the contrary, in ABL methods the learning information of workers will be aggregated in an asynchronous way.
Existing SBL methods mainly take two different ways to achieve resilience against Byzantine workers which refer to those workers with failure or attack.
One way is to replace the simple averaging aggregation operation with some more robust aggregation operations, such as median and trimmed-mean (Yin et al., 2018).
Krum (Blanchard et al., 2017) and ByzantinePGD (Yin et al., 2019) take this way.
The other way is to ﬁlter the suspicious learning information (gradients) before averaging.
Representative examples include ByzantineSGD (Alistarh et al., 2018) and Zeno (Xie et al., 2019).
The advantage of SBL methods is that they are relatively simple and easy to be implemented.
But SBL methods will result in slow convergence when there exist heterogeneous workers.
Furthermore, in some applications like federated learning and edge computing, synchronization cannot even be performed most of the time due to the ofﬂine workers (clients or edge servers).
Hence, ABL is preferred in these cases.
To the best of our knowledge, there exist only two ABL methods: Kardam (Damaskinos et al., 2018) and Zeno++ (Xie et al., 2020).
Kardam introduces two ﬁlters to drop out suspicious learning information (gradients), which can still achieve good performance when the communication delay is heavy.
However, when in face of malicious attack, some work ﬁnds that Kardam also drops out most correct gradients in order to ﬁlter all faulty (failure) gradients.
Hence, Kardam cannot resist malicious attack (Xie et al., 2020).
Zeno++ scores each received gradient, and determines whether to accept it according to the score.
But Zeno++ needs to store some training instances on server for scoring.
In practical applications, storing data on server will increase the risk of privacy leakage or even face legal risk.
Therefore, under the general setting where server has no access to any training instances, there have not existed ABL methods to resist malicious attack.
In this paper, we propose a novel method, called buffered asynchronous stochastic gradient descent (BASGD), for ABL.
The main contributions of BASGD are listed as follows:
• To the best of our knowledge, BASGD is the ﬁrst ABL method that can resist malicious attack without storing any instances on server.
Compared with those methods which need to store instances on server, BASGD takes less risk of privacy leakage.
• BASGD is theoretically proved to be convergent, and be able to resist failure or attack.
• Empirical results show that BASGD signiﬁcantly outperforms vanilla ASGD and other ABL baselines when there exist failure or malicious attack on workers.
In particular, BASGD can still converge under malicious attack, when ASGD and other ABL methods fail.
P RELIMINARY
This section presents the preliminary of this paper, including the distributed learning framework used in this paper and the deﬁnition of Byzantine worker.
2. D ISTRIBUTED L EARNING F RAMEWORK
Many machine learning models, such as logistic regression and deep neural networks, can be formulated as the following ﬁnite sum optimization problem:
[Equation]
where w is the parameter to learn, d is the dimension of parameter, n is the number of training instances, f ( w ; z i ) is the empirical loss on the training instance z i .
The goal of distributed learning is to solve the problem in (1) by designing learning algorithms based on multiple networked machines.
Although there have appeared many distributed learning frameworks, in this paper we focus on the widely used Parameter Server (PS) framework (Li et al., 2014).
In a PS framework, there are several workers and one or more servers.
Each worker can only communicate with server(s).
There may exist more than one server in a PS framework, but for the problem of this paper servers can be logically conceived as a unity.
Without loss of generality, we will assume there is only one server in this paper.
Training instances are disjointedly distributed across m workers.
Let D k denote the index set of training instances on worker k , we have ∪ m k =1 D k = { 1 , 2 , . . . , n } and D k ∩ D k (cid:48)
= ∅ if k (cid:54)
=
k (cid:48) .
In this paper, we assume that server has no access to any training instances.
If two instances have the same value, they are still deemed as two distinct instances.
Namely, z i may equal z i (cid:48)
( i (cid:54) =
i (cid:48) ) .
One popular asynchronous method to solve the problem in (1) under the PS framework is ASGD (Dean et al., 2012)
(see Algorithm 1 in Appendix A).
In this paper, we assume each worker samples one instance for gradient computation each time, and do not separately discuss the mini-batch case.
In PS based ASGD, server is responsible for updating and maintaining the latest parameter.
The number of iterations that server has already executed is used as the global logical clock of server.
At the beginning, iteration number t = 0 .
Each time a SGD step is executed, t will increase byimmediately.
The parameter after t iterations is denoted as w t .
If server sends parameters to worker k at iteration t (cid:48) , some SGD steps may have been excuted before server receives gradient from worker k next time at iteration t .
Thus, we deﬁne the delay of worker k at iteration t as τ tk = t − t (cid:48) .
Worker k is heavily delayed at iteration t if τ tk > τ max , where τ max is a pre-deﬁned non-negative constant.
2. B YZANTINE W ORKER
For workers that have sent gradients (one or more) to server at iteration t , we call worker k loyal worker if it has ﬁnished all the tasks without any fault and each sent gradient is correctly received by the server.
Otherwise, worker k is called Byzantine worker .
If worker k is a Byzantine worker, it means the received gradient from worker k is not credible, which can be an arbitrary value.
Formally, we denote the gradient received from worker k t at iteration t as g tk t .
Then, we have:
[Equation]
if worker k t is loyal at iteration t
[Equation]
arbitrary value, if worker k t is Byzantine at iteration t, where 0 ≤ t (cid:48) ≤ t , and i is randomly sampled from D k .
Our deﬁnition of Byzantine worker is consistent with most previous works (Blanchard et al., 2017;
Xie et al., 2019; 2020).
Either accidental failure or malicious attack will result in Byzantine workers.
B UFFERED A SYNCHRONOUS SGD
In synchronous BL, gradients from all workers are received at each iteration.
During this process, we can compare the gradients with each other, and then ﬁlter suspicious ones, or use more robust aggregation rules such as median and trimmed-mean for updating.
However, in asynchronous BL, only one gradient is received by the server at a time.
Without any training instances stored on server, it is difﬁcult for server to identify whether a received gradient is credible or not.
In order to deal with this problem in asynchronous BL, we propose a novel method called buffered asynchronous SGD (BASGD).
BASGD introduces B buffers ( 0 < B ≤ m ) on server, and the gradient used for updating parameters will be aggregated from these buffers.
The detail of the learning procedure of BASGD is presented in Algorithm 2 in Appendix A.
In this section, we will introduce the details of the two key components of BASGD: buffer and aggregation function.
3. B UFFER
In BASGD, the workers do the same job as that in ASGD, while the updating rule on server is modiﬁed.
More speciﬁcally, there are B buffers ( 0 < B ≤ m ) on server.
When a gradient g from worker s is received, it will be temporarily stored in buffer b , where b = s mod B , as illustrated in Figure 1.
Only when each buffer has stored at least one gradient, a new SGD step will be executed.
Please note that no matter whether a SGD step is executed or not, server will immediately send the latest parameters back to the worker after server have received a gradient from that worker.
Hence, BASGD introduces no barrier, and is a fully asynchronous algorithm.
For each buffer b , more than one gradient may have been received at iteration t .
We will store the average of these gradients, denoted by h b , in buffer b .
Assume that there are already ( N − 1)
gradients g 1 , g 2 , . .
, g N − 1 which should be stored in buffer b , and h b ( old ) =
1 N − 1 (cid:80) N − 1 i
=1 g i .
When the N -th gradient g N is received, the new average value in buffer b should be:
[Equation]
This is the updating rule for each buffer b when a gradient is received.
We use N tb to denote the total number of gradients stored in buffer b at the t -th iteration.
After the parameter w is updated, all buffers will be zeroed out at once.
With the beneﬁt of buffers, server has access to B candidate gradients when updating parameter.
Thus, a more reliable (robust) gradient can be aggregated from the B gradients of buffers, if a proper aggregation function Aggr ( · ) is chosen.
3. A GGREGATION F UNCTION
When a SGD step is ready to be executed, there are B buffers providing candidate gradients.
An aggregation function is needed to get the ﬁnal gradient for updating.
A naive way is to take the mean of all candidate gradients.
However, mean value is sensitive to outliers which are common in BL.
For designing proper aggregation functions, we ﬁrst deﬁne the q -Byzantine Robust ( q -BR) condition to quantitatively describe the Byzantine resilience ability of an aggregation function.
Deﬁnition 1 ( q -Byzantine Robust) .
For an aggregation function Aggr ( · ) : Aggr ([ h 1 , . . .
, h B ])
=
G , where G =
[ G 1 , . . .
, G d ] T and h b =
[ h b 1 , . .
, h bd ] T , ∀ b ∈ [ B ] , we call Aggr ( · ) q -Byzantine
Robust ( q ∈ Z , 0 < q < B/ 2 ), if it satisﬁes the following two properties: (a). Aggr ([ h
[Equation]
h (cid:48) , . . .
, h
[Equation]
h
[Equation]
]) =
Aggr ([ h 1 , . .
, h B ])
[Equation]
[Equation]
h
[Equation]
[Equation]
. , h B
[Equation]
d ,
[Equation]
h (cid:48)
[Equation]
R
[Equation] ; (b). min s ∈S { h sj } ≤ G j ≤ max s ∈S { h sj } , ∀ j ∈ [ d ] , ∀S ⊂ [ B ] with |S| = B − q ,
Intuitively, property (a) in Deﬁnition 1 says that if all candidate gradients h i are added by a same vector h (cid:48) , the aggregated gradient will also be added by h (cid:48) .
Property (b) says that for each coordinate j , the aggregated value G j will be between the ( q + 1) -th
smallest value and the ( q + 1) -th
largest value among the j -th coordinates of all candidate gradients.
Thus, the gradient aggregated by a q -BR function is insensitive to at least q outliers.
We can ﬁnd that q -BR condition gets stronger when q increases.
In other words, if Aggr ( · ) is q -BR, then for any 0 < q (cid:48) < q , Aggr ( · ) is also q (cid:48) -BR.
Remark 1.
It is not hard to ﬁnd that when B > 1 , mean function is not q -Byzantine Robust for any q > 0 .
We illustrate this by a one-dimension example: h 1 , . . .
, h B − 1 ∈ [0 , 1] , and h B = 10 × B .
Then 1 B (cid:80)
Bb =1 h b ≥ h B B =
(cid:54)∈ [0 , 1] .
Namely, the mean is larger than any of the ﬁrst B − 1 values.
We ﬁnd that the following two aggregation functions satisfy Byzantine Robust condition.
Deﬁnition 2 (Coordinate-wise median (Yin et al., 2018)) .
For candidate gradients h 1 , h 2 , . . .
, h B ∈ R d , h b =
[ h b 1 , h b 2 , . .
, h bd ] T , ∀ b = 1 , 2 , . . .
, B .
Coordinate-wise median is deﬁned as:
[Equation]
where Med ( h · j ) is the scalar median of the j -th coordinates, ∀ j = 1 , 2 , . .
, d .
Deﬁnition 3 (Coordinate-wise q -trimmed-mean (Yin et al., 2018)) .
For any positive interger q <
B/ 2 and candidate gradients h 1 , h 2 , . .
, h B ∈ R d , h b =
[ h b 1 , h b 2 , . .
, h bd ] T , ∀ b = 1 , 2 , . . .
, B .
Coordinate-wise q -trimmed-mean is deﬁned as:
[Equation]
where Trm ( h · j ) is the scalar q -trimmed-mean: Trm ( h · j )
=
1 B − 2 q (cid:80) b ∈M j h bj .
M j is the subset of { h bj } Bb =1 obtained by removing the q largest elements and q smallest elements.
In the following content, coordinate-wise median and coordinate-wise q -trimmed-mean are also called median and trmean , respectively.
Proposition 1 shows the q -BR property of these two functions.
Proposition 1.
Coordinate-wise q -trmean is q -BR, and coordinate-wise median is (cid:98) B − 1 2 (cid:99) -BR.
Here, (cid:98) x (cid:99) is the maximum integer not larger than x .
According to Proposition 1, both median and trmean are proper choices for aggregation function in BASGD.
The proof can be found in Appendix B.
Now we deﬁne another class of aggregation functions, which is also important in analysis in Section 4.
Deﬁnition 4 (Stable aggregation function) .
Aggregation function Aggr ( · ) is said to be stable provided that ∀
h 1 , . . .
, h B , ˜ h 1 , . . . ,
˜ h B ∈ R d , letting δ =
( (cid:80) Bb =1 (cid:107) h b − ˜ h b (cid:107) 2 ) 12 , we have:
[Equation]
If Aggr ( · ) is a stable aggregation function, it means that when there is a disturbance with L 2 -norm δ on buffers, the disturbance of aggregated result will not be larger than δ .
Deﬁnition 5 (Effective aggregation function) .
A stable aggregation function Aggr ( · ) is called an ( A 1 , A 2 ) -effective aggregation function, provided that when there are at most r Byzantine workers and τ tk = 0 for each loyal worker k ( ∀ t = 0 , 1 , . .
, T − 1) , it satisﬁes the following two properties:
(i).
E [ ∇ F ( w t ) T G tsyn | w t ] ≥ (cid:107)∇ F ( w t ) (cid:107) 2 − A 1 , ∀ w t ∈ R d ; (ii).
E [ (cid:107) G tsyn (cid:107) 2 | w t ] ≤ ( A 2 ) 2 , ∀ w t ∈ R d ;
where A 1 , A 2 ∈ R + are two non-negative constants, G tsyn is the gradient aggregated by Aggr ( · ) at the t -th iteration in cases without delay ( τ max = 0 ).
For different aggregation functions, constants A 1 and A 2 may differ.
A 1 and A 2 are also related to loss function F ( · ) , distribution of instances, buffer number B , maximum Byzantine worker number r and so on.
Inequalities (i) and (ii) in Deﬁnition 5 are two important properties in convergence proof of synchronous Byzantine learning methods.
Many aggregation functions in existing works (Blanchard et al., 2017; Yin et al., 2018) are proved to have these two properties.
Please note that too large B will slow down the updating frequency and damage the performance, which is supported by both theoretical (in Appendix B) and empirical (in Section 5) results.
In practical application, we could estimate Byzantine worker number r in advance, and set B to make
Aggr ( · ) be r -BR.
Specially, B is suggested to be (2 r + 1) for median, since median is (cid:98) B − 1 2 (cid:99) -BR.
C ONVERGENCE
In this section, we theoretically prove the convergence and resilience of BASGD against failure or attack.
There are two main theorems.
The ﬁrst theorem presents a relatively loose but general bound for all q -BR aggregation functions.
The other one presents a relatively tight bound for each distinct
( A 1 , A 2 ) -effective aggregation function.
Since the deﬁnition of ( A 1 , A 2 ) -effective aggregation function is usually more difﬁcult to verify than q -BR property, the general bound is also useful.
Here we only present the results.
Proof details are in Appendix B.
We ﬁrst make the following assumptions, which also have been widely used in stochastic optimization.
Assumption 1.
Global loss function F ( w ) is bounded below: ∃ F ∗ ∈ R , F ( w ) ≥ F ∗ , ∀ w ∈ R d .
Assumption 2 (Bounded bias) .
For any loyal worker, it can use locally stored training instances to estimate global gradient with bounded bias κ : (cid:107) E [ ∇ f ( w ; z i )] − ∇ F ( w ) (cid:107) ≤ κ, ∀ w ∈ R d .
Assumption 3 (Bounded gradient) .
∇ F ( w ) is bounded: ∃ D ∈ R + , (cid:107)∇ F ( w ) (cid:107) ≤ D, ∀ w ∈ R d .
Assumption 4 (Bounded variance) .
E [ ||∇ f ( w ; z i ) − E [ ∇ f ( w ; z i ) | w ] || 2 | w ] ≤ σ 2 , ∀ w ∈ R d .
Assumption 5 ( L -smoothness) .
Global loss function F ( w ) is differentiable and L -smooth: ||∇ F
[Equation]
Remark 2.
Please note that we do not give any assumption about convexity.
The analysis in this section is suitable for both convex and non-convex models in machine learning, such as logistic regression and deep neural networks.
Also, we do not give any assumption about the behavior of
Byzantine workers, which may behave arbitrarily.
Let N ( t ) be the ( q + 1) -th smallest value in { N tb } b ∈ [ B ] , and constant Λ B,q,r =
[Equation]
Lemma 1.
If Aggr ( · ) is q -BR, and there are at most r Byzantine workers ( r ≤ q ) , we have:
[Equation]
Lemma 2.
If Aggr ( · ) is q -BR, and the total number of heavily delayed workers and Byzantine workers is not larger than r ( r ≤ q ) , we have:
[Equation]
Theorem 1.
Let ˜ D
= 1 T (cid:80) T − 1 t =
( D 2 + σ 2 /N ( t ) ) 12 .
If Aggr ( · ) is q -BR, and the total number of heavily delayed workers and Byzantine workers is not larger than r ( r ≤ q ) , set B
= O ( r ) and learning rate η = O ( 1 L √ T ) , we have:
[Equation]
Please note that the convergence rate of vanilla ASGD is O ( T − 12 ) .
Hence, Theorem 1 indicates that
BASGD has a theoretical convergence rate as fast as vanilla ASGD, with an extra constant variance.
The term O ( rDdσ ) is caused by the aggregation function, which can be deemed as a sacriﬁce for Byzantine resilience.
The term O ( rDdκ ) is caused by the differences of training instances among different workers.
In independent and identically distributed (i.i.d.) cases, κ = 0 and the term vanishes.
The term O ( r 32 LD ˜ Dd 32 τ max ) is caused by the delay, and related to parameter τ max .
The term is also related to the buffer size.
When N tb increases, N ( t ) may increase, and thus ˜ D will decrease.
Namely, larger buffer size will result in smaller ˜ D .
Although general, the bound presented in Theorem 1 is relatively loose in high-dimensional cases, since d appears in all the three extra terms.
To obtain a tighter bound, we introduce Theorem 2 for
BASGD with ( A 1 , A 2 ) -effective aggregation function (Deﬁnition 5).
Theorem 2.
If Aggr ( · ) is an ( A 1 , A 2 ) -effective aggregation function, and the total number of heavily delayed workers and Byzantine workers is not larger than r ( r ≤ q ) , setting learning rate
η = O ( 1 √ LT ) , then in general asynchronous cases, we have: [Equation] E [ [Equation]
w t
[Equation]
Theorem 2 indicates that if Aggr ( · ) makes a synchronous BL method converge (i.e., satisﬁes
Deﬁnition 5), BASGD converges when using Aggr ( · ) as aggregation function.
Hence, BASGD can also be seen as a technique of asynchronization.
That is to say, new asynchronous methods can be obtained from synchronous ones when using BASGD.
The extra constant term A[-
 and ( 12 α + α-] 1 is caused by gradient bias.
When there is no Byzantine workers ( r = 0 ), letting B =
and Aggr ( h 1 , . .
. , h B ) =
Aggr ( h 1 ) =
h 1 , BASGD degenerates to vanilla ASGD, and there is no gradient bias.
Under this circumstance, A 1 = 0 and the extra constant term vanishes.
E XPERIMENT
In this section, we empirically evaluate the performance of BASGD and baselines in both image classiﬁcation (IC) and natural language processing (NLP) applications.
Our experiments are conducted on a distributed platform with dockers.
Each docker is bound to an NVIDIA Tesla V100 (32G)
GPU (in IC) or an NVIDIA Tesla K80 GPU (in NLP).
Please note that different GPU cards do not affect the reported metrics in the experiment.
We choose 30 dockers as workers in IC, and 8 dockers in NLP.
An extra docker is chosen as server.
All algorithms are implemented with PyTorch 1.3.
5. E XPERIMENTAL S ETTING
We compare the performance of different methods under two types of attack: negative gradient attack (NG-attack) and random disturbance attack (RD-attack).
Byzantine workers with NG-attack send ˜ g NG = − k atk · g to server, where g is the true gradient and k atk ∈ R + is a parameter.
Byzantine workers with RD-attack send ˜ g RD =
g + g rnd to server, where g rnd is a random vector sampled from normal distribution N ( 0 , (cid:107) σ atk g (cid:107) 2 · I ) .
Here, σ atk is a parameter and I is an identity matrix.
NG-attack is a typical kind of malicious attack, while RD-attack can be seen as an accidental failure [Figure] [Table] [Table]
[Table] [Table] with expectation 0 . Besides, each worker is manually set to have a delay, which is k del times the computing time.
Training set is randomly and equally distributed to different workers.
We use the average top-1 test accuracy (in IC) or average perplexity (in NLP) on all workers w.r.t.
epochs as ﬁnal metrics.
For BASGD, we use median and trimmed-mean as aggregation function.
Because BASGD is an ABL method, SBL methods cannot be directly compared with BASGD.
The
ABL method Zeno++ either cannot be directly compared with BASGD, because Zeno++ needs to store some instances on server.
The number of instances stored on server will affect the performance of
Zeno++ (Xie et al., 2020).
Hence, we compare BASGD with ASGD and Kardam in our experiments.
We set dampening function Λ( τ ) =
11+ τ for Kardam as suggested in (Damaskinos et al., 2018).
5. I MAGE C LASSIFICATION E XPERIMENT
In IC experiment, algorithms are evaluated on CIFAR-10 (Krizhevsky et al., 2009) with deep learning model ResNet-20 (He et al., 2016).
Cross-entropy is used as the loss function.
We set k atk =
10 for
NG-attack, and σ atk = 0 .
2 for RD-attack.
k del is randomly sampled from truncated standard normal distribution within [0 , + ∞ ) .
As suggested in (He et al., 2016), learning rate η is set to 0 .
1 initially for each algorithm, and multiplied by 0.1 at the 80 -th epoch and the 120 -th epoch respectively.
The weight decay is set to 10 − 4 .
We run each algorithm for 160 epochs.
Batch size is set to 25 .
Firstly, we compare the performance of different methods when there are no Byzantine workers.
Experimental results with median and trmean aggregation functions are illustrated in Figure 2(a) and
Figure 2(d), respectively.
ASGD achieves the best performance.
BASGD ( B > 1 ) and Kardam have [Figure] similar convergence rate to ASGD, but both sacriﬁce a little accuracy.
Besides, the performance of
BASGD gets worse when the buffer number B increases, which is consistent with the theoretical results.
Please note that ASGD is a degenerated case of BASGD when B = 1 and Aggr ( h 1 )
=
h 1 .
Hence, BASGD can achieve the same performance as ASGD when there is no failure or attack.
Then, for each type of attack, we conduct two experiments in which there are 3 and 6 Byzantine workers, respectively.
We respectively set 10 and 15 buffers for BASGD in these two experiments.
For space saving, we only present average top- 1 test accuracy in Figure 2(b) and Figure 2(e) (
Byzantine workers), and Figure 2(c) and Figure 2(f) ( 6 Byzantine workers).
Results about training loss are in Appendix C. We can ﬁnd that BASGD signiﬁcantly outperforms ASGD and Kardam under both RD-attack (accidental failure) and NG-attack (malicious attack).
Under the less harmful
RD-attack, although ASGD and Kardam still converge, they both suffer a signiﬁcant loss on accuracy.
Under NG-attack, both ASGD and Kardam cannot converge, even if we have tried different values of assumed Byzantine worker number for Kardam, which is denoted by a hyper-parameter γ in this paper.
Hence, both ASGD and Kardam cannot resist malicious attack.
On the contrary, BASGD still has a relatively good performance under both types of attack.
Moreover, we count the ratio of ﬁltered gradients in Kardam, which is shown in Table 1.
We can ﬁnd that in order to ﬁlter Byzantine gradients, Kardam also ﬁlters approximately equal ratio of loyal gradients.
It explains why Kardam performs poorly under malicious attack.
5. N ATURAL L ANGUAGE P ROCESSING E XPERIMENT
In NLP experiment, the algorithms are evaluated on the WikiText-2 dataset with LSTM networks.
We only use the training set and test set, while the validation set is not used in our experiment.
For
LSTM, we adopt 2 layers with 100 units in each.
Word embedding size is set to 100 , and sequence length is set to 35 .
Gradient clipping size is set to 0 .
Cross-entropy is used as the loss function.
For each algorithm, we run each algorithm for 40 epochs.
Initial learning rate η is chosen from { 1 , 2 , 5 , 10 , 20 } , and is divided by 4 every 10 epochs.
The best test result is adopted as the ﬁnal one.
The performance of ASGD under no attack is used as gold standard.
We set k atk = 10 and σ atk = 0 . 1 .
One of the eight workers is Byzantine.
k del is randomly sampled from exponential distribution with parameter λ = 1 .
Each experiment is carried out for 3 times, and the average perplexity is reported in Figure 3.
We can ﬁnd that BASGD converges under each kind of attack, with only a little loss in perplexity compared to the gold standard (ASGD without attack).
On the other hand, ASGD and
Kardam both fail, even if we have set the largest γ ( γ = 3 ) for Kardam.
C ONCLUSION
In this paper, we propose a novel method called BASGD for asynchronous Byzantine learning.
To the best of our knowledge, BASGD is the ﬁrst ABL method that can resist malicious attack without storing any instances on server.
Compared with those methods which need to store instances on server, BASGD takes less risk of privacy leakage.
BASGD is proved to be convergent, and be able to resist failure or attack.
Empirical results show that BASGD signiﬁcantly outperforms vanilla ASGD and other ABL baselines, when there exists failure or attack on workers.
A A LGORITHM D ETAILS A. A SYNCHRONOUS SGD (ASGD)
One popular asynchronous method to solve the problem in (1) under the PS framework is ASGD (Dean et al., 2012), which is presented in Algorithm 1.
A. B UFFERED A SYNCHRONOUS SGD (BASGD)
The details of learning procedure in BASGD is presented in Algorithm 2.
B P ROOF D ETAILS B. P ROOF OF P ROPOSITION
Proof.
Firstly, we prove coordinate-wise q -trimmed-mean is q -BR.
It is not hard to check that trmean satisﬁes the property (a) in the deﬁnition of q -BR, then we prove that it also satisﬁes property (b).
Without loss of generality, we assume h 1 j , . .
, h
Bj are already in descending order.
By deﬁnition,
Trm ( h · j ) is the average value of M j , which is obtained by removing q largest values and q smallest values of { h ij } Bi =1 .
Therefore,
[Equation]
For any S ⊂ [ B ] with |S| = B − q , by Pigeonhole Principle, S includes at least one of h 1 j , . . .
, h ( q +1) j , and includes at least one of h ( n − q ) j , . . .
, h
Bj .
Therefore,
[Equation]
Combining these two inequalities, we have:
[Equation]
Thus, coordinate-wise q -trimmed-mean is q -BR.
By deﬁnition, coordinate-wise median can be seen as (cid:98) B − 1 2 (cid:99) -trimmed-mean, and thus is (cid:98) B − 1 2 (cid:99) -BR.
Input learning rate aggregation function
Aggr
Initialization rate
Send initial
Set t ← 0 ;
Set buffer: h b ←
N tb ← 0 ; repeat
Wait until receiving g from some worker s ;
Choose buffer: b ← s mod B ;
N tb ← N tb + 1 ; h b ← ( N tb − 1) h b + g N tb ; if N tb > 0 for each b ∈ [ B ] then
Aggregate: G t =
Aggr ([ h 1 , . .
, h B ]) ;
Execute SGD step: w t +1 ← w t − η · G t ; for b = 1 to B do
Zero out buffer: h b ← 0 , N tb ← 0 ; end for t ← t + 1 ; end if
Send back the latest parameters back to worker s , no matter whether a SGD step is executed or not.
until stop criterion is satisﬁed
Notify all workers to stop;
Worker k : ( k = 0 , 1 , ..., m − 1) repeat
Wait until receiving the latest parameter w from server;
Randomly sample an index i from D k ;
Compute ∇ f ( w ; z i ) ;
Send ∇ f ( w ; z i ) to server; until receive server’s notiﬁcation to stop
P ROOF OF L EMMA
To begin with, we will introduce a lemma to estimate the ordered statistics.
Lemma 3.
X 1 , . .
, X M are non-negative, independent and identically distributed (i.i.d.)
random variables sampled from distribution D , and have limited expectation E [ X ] .
Denote the K -th largest value in { X 1 , . . .
, X M } as X ( K ) , then E [ X ( K ) ] ≤ C M,K · E [ X ] , where
[Equation]
K
[Equation]
Proof.
Denote the Probability Density Function (PDF) and Cumulative Density Function (CDF) of
D as p ( x ) and P ( x ) , respectively.
Then the PDF of X ( K ) is:
[Equation]
Thus
[Equation] [Equation]
Inequality (a) is derived based on [1 − P ( x )]
K − 1 P ( x ) M − K ≤ ( K − 1) K − 1 ( M − K )
M − K ( M − 1) M −, which is obtained by the following process:
Let θ ( x ) =
(1 − x ) K − 1 x M − K , x ∈ [0 , 1] .
Then θ (cid:48)
( x ) = (1 − x ) K − 2 x M − K − 1 [( M − K )(1 − x ) − ( K − 1) x ] .
Let θ (cid:48)
( x ) = 0 .
Solving the equation, we obtain x =
M − K M − 1 , 0 or 1 .
Also, we have θ (0)
=
θ (1) = 0 , and θ ( M − K M − 1 ) =
( K − 1) K − 1 ( M − K )
M − K ( M − 1) M −.
Then we have max x ∈ [0 , 1] θ ( x )
= θ ( M − K M − 1 )
=
( K − 1) K − 1 ( M − K )
M − K ( M − 1) M −.
Thus, [1 − P ( x )] K − 1 P ( x ) M − K
=
θ
( P ( x )) ≤ ( K − 1) K − 1 ( M − K )
M − K ( M − 1) M −.
Proposition 2. ∀ B, q, r ∈ Z + , 0 ≤ r ≤ q < B 2 , C B − r,q − r +1 ≤ ( B − r ) √ B − r +(cid:112)
[Equation]
Proof.
By Stirling’s approximation, we have: √
[Equation]
Therefore,
[Equation]
By deﬁnition of C M,k ,
[Equation]
where the inequality uses Inequality (2)
[Equation]
Case (i).
When r < q ,
[Equation]
Case (ii).
When r = q , by deﬁnition of C M,K , we have:
[Equation]
In conclusion, when r ≤ q , we have:
[Equation]
+(cid:112) ( B − q − 1)( q − r + 1) .
When B and q are ﬁxed, the upper bound of C B − r,q − r
+1 will increase when r (number of Byzantine workers) increases.
Namely, the upper bound will be larger if there are more Byzantine workers.
When B and r are ﬁxed, q measures the Byzantine Robust degree of aggregation function Aggr ( · ) .
The factor [( B − q − 1)( q − r )] − 12 is monotonically decreasing with respect to q , when q < B − 1+ r.
Since r ≤ q < B 2 , the upper bound will decrease when q increases.
Also, B − q decreases when q increases.
Namely, the upper bound will be smaller if Aggr ( · ) has a stronger q -BR property.
In the worst case ( q = r ), the upper bound of C B − r,q − r +1 is linear to B .
Even in the best case ( r = 0 , q = (cid:98) B − 1 2 (cid:99) ), the denominator is about B 2 and the upper bound of C B − r,q − r
+1 is linear to √ B .
Thus, larger B might result in larger error.
Hence, buffer number is not supposed to be set too large.
Now we prove Lemma 1.
Proof. [Equation] where Aggr ([ h 1 , . . . , h B ]) j represents the j -th coordinate of the aggregated gradient.
We use H t to denote the credible buffer index set, which is composed by the index of buffers, where the stored gradients are all from loyal workers.
For each b ∈ H t , h b has stored N tb gradients at iteration t : g 1 , . .
. , g N tb , and we have:
[Equation]
Then,
E [ (cid:107)
[Equation]
Inequality (a) is derived based on Assumption 4 and the fact that g i is mutually uncorrelated.
Inequality (b) is derived by the following process:
[Equation]
[Equation]
Inequality (c) is derived based on Assumption 3.
Because there are no more than r Byzantine workers at iteration t , no more than r buffers contain
Byzantine gradient.
Thus, the credible buffer index set H t has at least ( B − r ) elements.
In case that H t has more than ( B − r ) elements, we take the indices of the smallest ( B − q ) elements in { h bj } b ∈H t to compose H tj , and we have |H tj | =
B − q .
Note that Aggr ( · ) is q -BR, and by deﬁnition we have:
[Equation]
Therefore, d (cid:88)
[Equation]
There are ( B − r ) credible buffers, and we choose the smallest ( B − q ) buffers to compose H tj .
Therefore, for all b ∈ H tj , h bj is not larger than the ( q − r + 1) -th
largest one in { h bj } b ∈H t .
Let N ( t ) be the ( q + 1) -th smallest value in { N tb } b ∈ [ B ] .
Using Lemma 3, we have:
[Equation]
Thus,
[Equation] By Proposition
[Equation]
we have:
[Equation]
B. P ROOF OF L EMMA
Proof.
[Equation]
where the second equation is derived based on the Property (b) in the deﬁnition of q -BR.
For each b ∈ H t [Equation] h b has stored N tb gradients at iteration t : g 1 , . .
. , g N tb , and we have:
[Equation]
where 0 ≤ t − t k ≤ τ max , ∀ k = 1 , 2 , . . .
, N tb .
Taking expectation on both sides [Equation] we have:
[Equation]
where (a) is derived based on Triangle Inequality.
The ﬁrst part:
[Equation]
where (b) is derived based on Assumption 5, (c) is derived based on Lemma 1 and (d) is derived based on t − t k ≤ τ max .
The second part:
[Equation]
where (e) is derived based on Assumption 4.
By Assumption 2, we have the following estimation for the third part:
[Equation]
Therefore,
[Equation]
Similar to the proof of Lemma
[Equation]
∀ j ∈ [ d ]
[Equation]
we have:
[Equation]
where H tj is composed by the indices of the smallest ( B − q ) elements in { h bj − ∇ F ( w t ) j } b ∈H t .
Therefore,
[Equation]
where (f) is derived based on deﬁnition of q -BR, (g) is derived based on Lemma 3, and (h) is derived based on Inequality (4)
[Equation]
Combining Equation (3) and Inequality (5) [Equation] we obtain: [Equation]
By Proposition (2)
[Equation]
we have:
[Equation]
B. P ROOF OF T HEOREM
Proof.
[Equation]
where (a) is derived based on Assumption
[Equation]
Using Lemma 1 and Lemma
[Equation]
we have:
[Equation]
Also, by Assumption 3, ||∇ F ( w t ) || ≤ D .
Taking total expectation and combining ||∇ F ( w t )
|| ≤ D , we have:
[Equation]
Let ˜ D
= 1 T (cid:80) T − 1 t =
(cid:112) D 2 + σ 2 /N ( t ) .
By telescoping, we have:
[Equation]
Note that E [ F ( w T )] ≥ F ∗ , and let η = O (cid:16) 1 L √ T (cid:17) :[-(cid:80) T − 1 t =
-]
[Equation] Specailly, when q = r and B = O ( r ) , we have C B − r,q − r +1 ≤ ( B − r ) √ B − r +1 √ ( B − q − 1)
( q − r +1)
= O ( r ) .
{+Thus, (cid:80) T − 1 t =
 E [ ||∇ F ( w t )+} || 2 ] T ≤ O (cid:18) L [ F ( w 0 )
[Equation]
F ∗ ]
T(cid:19)
+ O (cid:32) rd ˜ D
T(cid:33)
+ O ( rDdσ ) + O ( rDdκ ) + O (cid:16) r 32 LD
˜
Dd 32 τ max (cid:17) .
B. P ROOF OF T HEOREM
Proof.
Let h (cid:48)
b be the value of the b -th buffer, if all received loyal gradients were computed based on w t .
Note G t =
Aggr ( h 1 , . .
. , h B ) .
[Equation]
where (a) is derived based on Assumption (5).
Firstly, we estimate the value of E [ ∇ F ( w t ) T G t | w t ] .
Since there are at most r Byzantine workers, at most r buffers may contain Byzantine gradients.
Without loss of generality, suppose only the ﬁrst r buffers may contain Byzantine gradients.
Let G tsyn =
Aggr ( h 1 , . .
, h r , h (cid:48)
r +1 , . . .
, h (cid:48) B ) ,
where h 1 , . . . , h r may contain Byzantine gradients and be arbitrary value, and h (cid:48) r +1 , . .
, h (cid:48)
B each stores loyal gradients computed based on w t .
Thus,
[Equation]
Let α = 2 η 2 L 2 τ 2 max ( B − r ) < 1 .
We claim that
[Equation]
and
[Equation]
Now we prove it by induction on t .
Step 1.
When t = 0 , all gradients are computed according to w 0 , and we have G 0 =
G 0 syn .
Thus,
[Equation]
Step 2.
If
[Equation]
holds for all t (cid:48)
=
[Equation]
[Equation]
[Equation]
t − 1 (induction hypothesis)
[Equation]
then:
[Equation]
[Table]
[Equation]
where (b) is derived based on the deﬁnition of stable aggregation function, (c) is derived based on
Cauchy’s Inequality, (d) is derived based on Assumption 5, (e) is also derived based on Cauchy’s
Inequality, (f) is derived based on induction hypothesis, (g) is derived based on that t − t k ≤ τ max , and (h) is derived based on that α = 2 η 2 L 2 τ 2 max ( B − r ) .
Therefore,
[Equation]
where (i) is derived based on that (cid:107) x
+ y (cid:107) 2 ≤ 2 (cid:107) x (cid:107) 2 + 2 (cid:107) y
(cid:107) 2 , ∀ x ,
y ∈ R d , (j) is derived by the deﬁnition of ( A 1 , A 2 ) -effective aggregation function, and (k) is derived based on Inequality (9).
By Inequality (9) and (10), the claimed property also holds for t (cid:48)
=
t .
In conclusion, for all t = 0 , 1 , . . .
, T − 1 , we have:
[Equation]
and
E [ (cid:107)
[Equation]
Also, E [ (cid:107) G t (cid:107) | w t ] 2 + V ar [ (cid:107) G t (cid:107) | w t ] =
E [ (cid:107) G t (cid:107) 2 | w t ] .
Therefore,
[Equation]
We have:
[Equation]
where (l) is derived based on the deﬁnition of ( A 1 , A 2 ) -effective aggregation function, (m) is derived by Assumption [Equation] and (n) is derived based on Inequality (11) [Equation]
Combining Inequalities (6), (12), (14) and taking total expectation [Equation] we have:
[Equation]
By telescoping, we have:
[Equation]
Divide both sides of the equation by ηT [Equation] and let η = O ( 1 √ LT ) : [Equation]
T
[Equation]
[Equation]
[ (cid:107)∇
[Equation] Note that α = 2 η 2 L 2 τ 2 max ( B − r ) = O (cid:16) Lτ 2 max ( B − r ) T (cid:17) , ﬁnally we have:
[Equation]
Specailly, when B = O ( r ) , we have:
[Equation]
C M ORE E XPERIMENTAL R ESULTS
Figure 4, Figure 5 and Figure 6 illustrate the average training loss w.r.t.
epochs when there are no
Byzantine workers, 3 Byzantine workers and 6 Byzantine workers.
Please note that in Figure 5 and
Figure 6, some curves do not appear, because the value of loss function is extremely large or even exceeds the range of ﬂoating-point numbers, due to the Byzantine attack.
γ is the hyper-parameter about the assumed number of Byzantine workers in Kardam.
The experimental results about training loss give further support to the experimental summary in Section
[Figure]
[Figure] [Figure]