版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、Leader Stochastic Gradient Descent for Distributed Training of Deep Learning Models Yunfei Teng,1 Wenbo Gao,2 Francois Chalus chalusf3 Anna Choromanska Donald Goldfarb Adrian Weller aw665cam.ac.uk Abstract We consider distributed op
2、timization under communication constraints for training deep learning models. We propose a new algorithm, whose parameter updates rely on two forces: a regular gradient step, and a corrective direction dictated by the currently best-performing worker (leader). Our method differs from the parameter-a
3、veraging scheme EASGD 1 in a number of ways: (i) our objective formulation does not change the location of stationary points compared to the original optimization problem; (ii) we avoid convergence decelerations caused by pulling local workers descending to different local minima to each other (i.e.
4、 to the averageoftheirparameters); (iii)ourupdatebydesignbreaksthecurseofsymmetry (the phenomenon of being trapped in poorly generalizing sub-optimal solutions in symmetric non-convex landscapes); and (iv) our approach is more communication effi cient since it broadcasts only parameters of the leade
5、r rather than all workers. We provide theoretical analysis of the batch version of the proposed algorithm, which we call Leader Gradient Descent (LGD), and its stochastic variant (LSGD). Finally, we implement an asynchronous version of our algorithm and extend it to the multi-leader setting, where w
6、e form groups of workers, each represented by its own local leader (the best performer in a group), and update each worker with a corrective direction comprised of two attractive forces: one to the local, and one to the global leader (the best performer among all workers). The multi-leader setting i
7、s well-aligned with current hardware architecture, where local workers forming a group lie within a single computational node and different groups correspond to different nodes. For training convolutional neural networks, we empirically demonstrate that our approach compares favorably to state-of-th
8、e-art baselines. 1Introduction As deep learning models and data sets grow in size, it becomes increasingly helpful to parallelize their training over a distributed computational environment. These models lie at the core of many modern machine-learning-based systems for image recognition 2, speech re
9、cognition 3, natural language processing 4, and more. This paper focuses on the parallelization of the data, not the model, and considers collective communication scheme 5 that is most commonly used nowadays. A typical approach to data parallelization in deep learning 6,7 uses multiple workers that
10、run variants of SGD 8 on different data batches. Therefore, the effective batch size is increased by the number of workers. Communication ensures that all models are synchronized and critically relies on a scheme where each worker broadcasts its parameter gradients to all the remaining workers. *,1:
11、 Equal contribution. Algorithm development and implementation on deep models. *,2: Equal contribution. Theoretical analysis and implementation on matrix completion. 33rd Conference on Neural Information Processing Systems (NeurIPS 2019), Vancouver, Canada. This is the case for DOWNPOUR 9 (its decent
12、ralized extension, with no central parameter server, based on the ring topology can be found in 10) or Horovod 11 methods. These techniques require frequent communication (after processing each batch) to avoid instability/divergence, and hence are communication expensive. Moreover, training with a l
13、arge batch size usually hurts generalization 12, 13, 14 and convergence speed 15, 16. Another approach, called Elastic Averaging (Stochastic) Gradient Decent, EA(S)GD 1, introduces elastic forces linking the parameters of the local workers with central parameters computed as a moving average over ti
14、me and space (i.e. over the parameters computed by local workers). This method allows less frequent communication as workers by design do not need to have the same parameters but are instead periodically pulled towards each other. The objective function of EASGD, however, has stationary points which
15、 are not stationary points of the underlying objective function (see Proposition 8 in the Supplement), thus optimizing it may lead to sub-optimal solutions for the original problem. Further, EASGD can be viewed as a parallel extension of the averaging SGD scheme 17 and as such it inherits the downsi
16、des of the averaging policy. On non-convex problems, when the iterates are converging to different local minima (that may potentially be globally optimal), the averaging term can drag the iterates in the wrong directions and signifi cantly hurt the convergence speed of both local workers and the mas
17、ter. In symmetric regions of the optimization landscape, the elastic forces related with different workers may cancel each other out causing the master to be permanently stuck in between or at the maximum between different minima, and local workers to be stuck at the local minima or on the slopes ab
18、ove them. This can result in arbitrarily bad generalization error. We refer to this phenomenon as the “curse of symmetry”. Landscape symmetries are common in a plethora of non-convex problems 18, 19, 20, 21, 22, including deep learning 23, 24, 25, 26. Figure 1: Low-rank matrix completion problems so
19、lved with EAGD and LGD. The dimensiond = 1000and four ranksr 1,10,50,100are used. The reported value for each algorithm is the value of the best worker (8 workers are used in total) at each step. This paper revisits the EASGD update and modifi es it in a simple, yet powerful way which overcomes the
20、above mentioned shortcomings of the original technique. We propose to replace the elastic force rely- ing on the average of the parameters of local workers by an attractive force link- ing the local workers and the current best performer among them (leader). Our ap- proach reduces the communication
21、over- head related with broadcasting parameters of all workers to each other, and instead re- quires broadcasting only the leader param- eters. The proposed approach easily adapts to a typical hardware architecture compris- ing of multiple compute nodes where each node contains a group of workers an
22、d local communication, within a node, is signifi - cantly faster than communication between the nodes. We propose a multi-leader extension of our approach that adapts well to this hardware architecture and relies on forming groups of workers (one per compute node) which are attracted both to their l
23、ocal and global leader. To reduce the communication overhead, the correction force related with the global leader is applied less frequently than the one related with the local leader. Finally, ourL(S)GDapproach, similarlytoEA(S)GD,tendstoexplorewidevalleysintheoptimization landscape when the pullin
24、g force between workers and leaders is set to be small. This property often leads to improved generalization performance of the optimizer 27, 28. The paper is organized as follows: Section 2 introduces the L(S)GD approach, Section 3 provides theoretical analysis, Section 4 contains empirical evaluat
25、ion, and fi nally Section 5 concludes the paper. Theoretical proofs and additional theoretical and empirical results are contained in the Supplement. 2 2Leader (Stochastic) Gradient Descent “L(S)GD” Algorithm 2.1Motivating example Figure 1 illustrates how elastic averaging can impair convergence. To
26、 obtain the fi gure we applied EAGD (Elastic Averaging Gradient Decent) and LGD to the matrix completion problem of the form:minX ?1 4kM XX Tk2 F : X Rdr?. This problem is non-convex but is known to have the property that all local minimizers are global minimizers 18. For four choices of the rankr,
27、we generated10random instances of the matrix completion problem, and solved each with EAGD and LGD, initialized from the same starting points (we use8workers). For each algorithm, we report the progress of the best objective value at each iteration, over all workers. Figure 1 shows the results acros
28、s 10 random experiments for each rank. It is clear that EAGD slows down signifi cantly as it approaches a minimizer. Typically, the center e X of EAGD is close to the average of the workers, which is a poor solution for the matrix completion problem when the workers are approaching different local m
29、inimizers, even though all local minimiz- ers are globally optimal. This induces a pull on each node away from the minimizers, which makes it extremely diffi cult for EAGD to attain a solution of high accuracy. In comparison, LGD does not have this issue. Further details of this experiment, and othe
30、r illustrative examples of the difference between EAGD and LGD, can be found in the Supplement. 2.2Symmetry-breaking updates Next we explain the basic update of the L(S)GD algorithm. Consider fi rst the single-leader setting and the problem of minimizing loss functionLin a parallel computing environ
31、ment. The optimization problem is given as min x1,x2,.,xl L(x1,x2,.,xl) :=min x1,x2,.,xl l X i=1 Ef(xi;i) + 2 |xi x|2,(1) wherelis the number of workers,x1,x2,.,xlare the parameters of the workers and xare the parameters of the leader. The best performing worker, i.e. x = argmin x1,x2,.,xl Ef(xi;i),
32、 andis are data samples drawn from some probability distributionP.is the hyperparameter that denotes the strength of the force pulling the workers to the leader. In the theoretical section we will refer to Ef(xi;i)as simplyf(xi). This formulation can be further extended to the multi-leader setting.
33、The optimization problem is modifi ed to the following form min x1,1,x1,2,.,xn,l L(x1,1,x1,2,.,xn,l) := min x1,1,x1,2,.,xn,l n X j=1 l X i=1 Ef(xj,i;j,i) + 2 |xj,i xj|2+ G 2 |xj,i x|2,(2) wherenis the number of groups,lis the number of workers in each group, xjis the local leader of thejthgroup (i.e
34、. xj= argminxj,1,xj,2,.,xj,lEf(xj,i;j,i), xis the global leader (the best worker among local leaders, i.e. x =argmin x1,1,x1,2,.,xn,l Ef(xj,i;j,i),xj,1,xj,2,.,xj,lare the parameters of the workers in thejthgroup, andj,is are the data samples drawn fromP.andGare the hyperparameters that denote the st
35、rength of the forces pulling the workers to their local and global leader respectively. The updates of the LSGD algorithm are captured below, wheret denotes iteration. The fi rst update shown in Equation 3 is obtained by taking the gradient descent step on the objective in Equation 2 with respect to
36、 variablesxj,i. The stochastic gradient ofEf(xi;i)with respect toxj,iis denoted asgj,i t (in case of LGD the gradient is computed over all training examples) andis the learning rate. xj,i t+1= x j,i t gj,i t (xj,i t ) (xj,i t xj t) G(x j,i t xt)(3) where xj t+1and xt+1 are the local and global leade
37、rs defi ned above. Equation 3 describes the update of any given worker and is comprised of the regular gradient step and two corrective forces (in single-leader setting the third term disappears asG= 0then). These 3 Algorithm 1 LSGD Algorithm (Asynchronous) Input: pulling coeffi cients ,G, learning
38、rate , local/global communication periods ,G Initialize: Randomly initialize x1,1,x1,2,.,xn,l Set iteration counters tj,i= 0 Set xj 0= argmin xj,1,.,xj,l Ef(xj,i;j,i 0 ), x0= argmin x1,1,.,xn,l Ef(xj,i;j,i 0 ); repeat for all j = 1,2,.,n, i = 1,2,.,l do. Do in parallel for each worker Draw random sa
39、mple j,i tj,i xj,i xj,i gj,i t (xj,i) tj,i= tj,i+ 1; if nl divides ( n P j=1 l P i=1 tj,i) then xj= argminxj,1,.,xj,lEf(xj,i;j,i tj,i). . Determine the local best workers xj,i xj,i (xj,i xj). Pull to the local best workers end if if nlGdivides ( n P j=1 l P i=1 tj,i) then x = argminx1,1,.,xn,lEf(xj,
40、i;j,i tj,i). . Determine the global best worker xj,i xj,i G(xj,i x). Pull to the global best worker end if end for until termination forces constitute the communication mechanism among the workers and pull all the workers towards the currently best local and global solution to ensure fast convergenc
41、e. As opposed to EASGD, the updates performed by workers in LSGD break the curse of symmetry and avoid convergence decelerations that result from workers being pulled towards the average which is inherently infl uenced by poorly performing workers. In this paper, instead of pulling workers to their
42、averaged parameters, we propose the mechanism of pulling the workers towards the leaders. The fl avor of the update resembles a particle swarm optimization approach 29, which is not typically used in the context of stochastic gradient optimization for deep learning. Our method may therefore be viewe
43、d as a dedicated particle swarm optimization approach for training deep learning models in the stochastic setting and parallel computing environment. Next we describe the LSGD algorithm in more detail. We rely on the collective communication scheme. In order to reduce the amount of communication bet
44、ween the workers, it is desired to pull them towards the leaders less often than every iteration. Also, in practice each worker can have a different speed. To prevent waiting for the slower workers and achieve communication effi ciency, we implement the algorithm in the asynchronous operation mode.
45、In this case, the communication period is determined based on the total number of iterations computed across all workers and the communication is performed everynlornlGiterations, whereandGdenote local and global communication periods, respectively. In practice, we useG since communication between w
46、orkers lying in different groups is more expensive than between workers within one group, as explained above. When communication occurs, all workers are updated at the same time (i.e. pulled towards the leaders) in order to take advantage of the collective communication scheme. Between communication
47、s, workers run their own local SGD optimizers. The resulting LSGD method is very simple, and is depicted in Algorithm 1. The next section provides a theoretical description of the single-leader batch (LGD) and stochastic (LSGD) variants of our approach. 4 3Theoretical Analysis We assume without loss
48、 of generality that there is a single leader. The objective function with multiple leaders is given byf(x)+ 1 2 kxz1k2+.+ c 2 kxzck2, which is equivalent tof(x)+ 2kxe zk 2 for = Pc i=1iand e z = 1 Pc i=1izi. Proofs for this section are deferred to the Supplement. 3.1Convergence Rates for Stochastic
49、Strongly Convex Optimization We fi rst show that LSGD obtains the same convergence rate as SGD for stochastic strongly convex problems 30. In Section 3.3 we discuss how and when LGD can obtain better search directions than gradient descent. We discuss non-convex optimization in Section 3.2. Througho
50、ut Section 3.1, f will typically satisfy: Assumption 1 fisM-Lipschitz-differentiable andm-strongly convex, which is to say, the gradient f satisfi eskf(x) f(y)k Mkx yk, andf satisfi esf(y) f(x) + f(x)T(y x) + m 2 ky xk2. We writexfor the unique minimizer off, and := M m for the condition number off.
51、 3.1.1Convergence Rates The key technical result is that LSGD satisfi es a similar one-step descent in expectation as SGD, with an additional term corresponding to the pull of the leader. To provide a unifi ed analysis of pure LSGD as well as more practical variants where the leader is updated infre
52、quently or with errors, we consider a general iterationx+= x(e g(x)+(xz), wherezis an arbitrary guiding point; that is,zmay not be the minimizer ofx1,.,xp, nor even satisfyf(z) f(xi). Since the nodes operate independently except when updatingz, we may analyze LSGD steps for each node individually, a
53、nd we write x = xifor brevity. Theorem 1.Letfsatisfy Assumption 1. Lete g(x)be an unbiased estimator forf(x)with Var(e g(x) 2+kf(x)k2, and letzbe any point. Suppose that,satisfy (2M( +1)1 and (2)1, (2m)1 . Then the LSGD step satisfi es Ef(x+) f(x) (1 m)(f(x) f(x) (f(x) f(z) + 2M 2 2.(4) Notetheprese
54、nceofthenewterm(f(x)f(z)whichspeedsupconvergencewhenf(z) f(x), i.e the leader is better thanx. If the leaderzkis always chosen so thatf(zk) f(xk)at every stepk, thenlimsupkEf(xk) f(x) 1 2 2. If decreases at the ratek= (1 k), then Ef(xk) f(x) O(1 k). TheO(1 k)rate of LSGD matches that of comparable d
55、istributed methods. Both Hogwild 31 and EASGD achieve a rate ofO(1 k) on strongly convex objective functions. We note that published convergence rates are not available for many distributed algorithms (including DOWNPOUR 9). 3.1.2Communication Periods In practice, communication between distributed m
56、achines is costly. The LSGD algorithm has a communication periodfor which the leader is only updated everyiterations, so each node can run independently during that period. Thisis allowed to differ between nodes, and over time, which captures the asynchronous and multi-leader variants of LSGD. We wr
57、itexk,jfor thej-th step during thek-th period. It may occur thatf(z) f(xk,j)for somek,j, that is, the current solutionxk,j is now better than the last selected leader. In this case, the leader term(x z)may no longer be benefi cial, and instead simply pullsxtowardz. There is no general way to determi
58、ne how many steps are taken before this event. However, we can show that if f(z) f(x), then Ef(x+) f(z) + 1 2 2M2, (5) so the solution will not become worse than a stale leader (up to gradient noise). As goes to infi nity, LSGD converges to the minimizer of(x) = f(x)+ 2kxzk 2 , which is quantifi ably better thanzas captured in Theorem 2. Together, these facts show that LSGD is safe to use with long communication periods as long as the original leader is good. 5 Theorem 2.Letfbem-strongly convex, and let
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 某汽车厂员工激励准则
- 4.3一分类和多分类支持向量机
- 某造纸厂资源利用率提升办法
- 水泥厂人员培训细则
- 网站制作服务协议模板官方搭建合同二篇
- 2026年半导体行业人才竞业限制合同三篇
- 四川省广元市剑阁县2024-2025学年九年级上学期语文期中试卷(含答案)
- 2026年全民国家安全教育日知识测试竞赛题及答案
- 招聘工业会计试题及答案
- 大炮物理题目及答案
- 浙江省省级机关基层遴选公务员笔试真题2025年附答案
- 母线-电气试验(调试)作业指导书模板
- 2025江苏无锡市江阴市江南水务股份有限公司招聘8人笔试题库历年考点版附带答案详解
- 施工现场环境保护与扬尘治理措施
- 水库大坝安全培训课件
- GJB2460A-2020军用夹布橡胶软管规范
- 石料板材销售方案(3篇)
- 德阳犬只管理办法
- 新高一暑假班物理讲义+习题册-学生版
- 医疗影像委托协议书
- 2024年广东省普通高中学业水平考试化学试卷(修改+答案)版
评论
0/150
提交评论