Asynchronous Parallel Stochastic Gradient for Nonconvex Optimization

Xiangru Lian, Yijun Huang, Yuncheng Li, Ji Liu

Introduction

The asynchronous parallel optimization recently received many successes and broad attention in machine learning and optimization (Niu et al., 2011; Li et al., 2013, 2014b; Yun et al., 2013; Fercoq and Richtárik, 2013; Zhang and Kwok, 2014; Marecek et al., 2014; Tappenden et al., 2015; Hong, 2014). It is mainly due to that the asynchronous parallelism largely reduces the system overhead comparing to the synchronous parallelism. The key idea of the asynchronous parallelism is to allow all workers work independently and have no need of synchronization or coordination. The asynchronous parallelism has been successfully applied to speedup many state-of-the-art optimization algorithms including stochastic gradient (Niu et al., 2011; Agarwal and Duchi, 2011; Zhang et al., 2014; Feyzmahdavian et al., 2015; Paine et al., 2013; Mania et al., 2015), stochastic coordinate descent (Avron et al., 2014; Liu et al., 2014a; Sridhar et al., 2013), dual stochastic coordinate ascent (Tran et al., 2015), and randomized Kaczmarz algorithm (Liu et al., 2014b).

In this paper, we are particularly interested in the asynchronous parallel stochastic gradient algorithm (AsySG) for nonconvex optimization mainly due to its recent successes and popularity in deep neural network (Bengio et al., 2003; Dean et al., 2012; Paine et al., 2013; Zhang et al., 2014; Li et al., 2014a) and matrix completion (Niu et al., 2011; Petroni and Querzoni, 2014; Yun et al., 2013). While some research efforts have been made to study the convergence and speedup properties of AsySG for convex optimization, people still know very little about its properties in nonconvex optimization. Existing theories cannot explain its convergence and excellent speedup property in practice, mainly due to the nonconvexity of most deep learning formulations and the asynchronous parallel mechanism. People even have no idea if its convergence is certified for nonconvex optimization, although it has been used widely in solving deep neural network and implemented on different platforms such as computer network and shared memory (for example, multicore and multiGPU) system.

To fill these gaps in theory, this paper tries to make the first attempt to study AsySG for the following nonconvex optimization problem

where ξ∈Ξ\xi\in\Xi is a random variable and f(x)f(x) is a smooth (but not necessarily convex) function. The most common specification is that Ξ\Xi is an index set of all training samples Ξ={1,2,⋯ ,N}\Xi=\{1,2,\cdots,N\} and F(x;ξ)F(x;\xi) is the loss function with respect to the training sample indexed by ξ\xi.

We consider two popular asynchronous parallel implementations of SG: one is for the computer network originally proposed in (Agarwal and Duchi, 2011) and the other one is for the shared memory (including multicore/multiGPU) system originally proposed in (Niu et al., 2011). Note that due to the architecture diversity, it leads to two different algorithms. The key difference lies on that the computer network can naturally (also efficiently) ensure the atomicity of reading and writing the whole vector of xx, while the shared memory system is unable to do that efficiently and usually only ensures efficiency for atomic reading and writing on a single coordinate of parameter xx. The implementation on computer cluster is described by the “consistent asynchronous parallel SG” algorithm (AsySG-con), because the value of parameter xx used for stochastic gradient evaluation is consistent – an existing value of parameter xx at some time point. Contrarily, we use the “inconsistent asynchronous parallel SG” algorithm (AsySG-incon) to describe the implementation on the shared memory platform, because the value of parameter xx used is inconconsistent, that is, it might not be the real state of xx at any time point.

This paper studies the theoretical convergence and speedup properties for both algorithms. We establish an asymptotic convergence rate of O(1/KM)O(1/\sqrt{KM}) for AsySG-con where KK is the total iteration number and MM is the size of minibatch. The linear speedupThe speedup for TT workers is defined as the ratio between the total work load using one worker and the average work load using TT workers to obtain a solution at the same precision. “The linear speedup is achieved” means that the speedup with TT workers greater than cTcT for any values of TT (c∈(0,1]c\in(0,1] is a constant independent to TT). is proved to be achievable while the number of workers is bounded by O(K)O(\sqrt{K}). For AsySG-incon, we establish an asymptotic convergence and speedup properties similar to AsySG-con. The intuition of the linear speedup of asynchronous parallelism for SG can be explained in the following: Recall that the serial SG essentially uses the “stochastic” gradient to surrogate the accurate gradient. AsySG brings additional deviation from the accurate gradient due to using “stale” (or delayed) information. If the additional deviation is relatively minor to the deviation caused by the “stochastic” in SG, the total iteration complexity (or convergence rate) of AsySG would be comparable to the serial SG, which implies a nearly linear speedup. This is the key reason why AsySG works.

The main contributions of this paper are highlighted as follows:

Our result for AsySG-con generalizes and improves earlier analysis of AsySG-con for convex optimization in (Agarwal and Duchi, 2011). Particularly, we improve the upper bound of the maximal number of workers to ensure the linear speedup from O(K1/4M−3/4)O(K^{1/4}M^{-3/4}) to O(K1/2M−1/2)O(K^{1/2}M^{-1/2}) by a factor K1/4M1/4K^{1/4}M^{1/4};

The proposed AsySG-incon algorithm provides a more accurate description than Hogwild! (Niu et al., 2011) for the lock-free implementation of AsySG on the shared memory system. Although our result does not strictly dominate the result for Hogwild! due to different problem settings, our result can be applied to more scenarios (e.g., nonconvex optimization);

Our analysis provides theoretical (convergence and speedup) guarantees for many recent successes of AsySG in deep learning. To the best of our knowledge, this is the first work that offers such theoretical support.

x∗x^{*} denotes the global optimal solution to (1).

G(x;ξ)G(x;\xi) is used to denote ∇F(x;ξ)\nabla F(x;\xi) for short;

We use ∇if(x)\nabla_{i}f(x) and (G(x;ξ))i(G(x;\xi))_{i} to denote the iith element of ∇f(x)\nabla f(x) and G(x;ξ)G(x;\xi) respectively.

Assumption Throughout this paper, we make the following assumption for the objective function. All of them are quite common in the analysis of stochastic gradient algorithms.

(Unbiased Gradient): The stochastic gradient G(x;ξ)G(x;\xi) is unbiased, that is to say,

(Bounded Variance): The variance of stochastic gradient is bounded:

(Lipschitzian Gradient): The gradient function ∇f(⋅)\nabla f(\cdot) is Lipschitzian, that is to say,

Under the Lipschitzian gradient assumption, we can define two more constants LsL_{s} and L\mboxmaxL_{\mbox{\rm\scriptsize max}}. Let ss be any positive integer. Define LsL_{s} to be the minimal constant satisfying the following inequality:

Define L\mboxmaxL_{\mbox{\rm\scriptsize max}} as the minimum constant that satisfies:

It can be seen that L\mboxmax≤Ls≤LL_{\mbox{\rm\scriptsize max}}\leq L_{s}\leq L.

Related Work

This section reviews stochastic gradient algorithms, synchronous parallel stochastic gradient algorithms, asynchronous parallel gradient algorithms, and asynchronous parallel stochastic gradient algorithms.

Stochastic gradient is a very powerful approach for large scale optimization. The well known convergence rate of stochastic gradient is O(1/K)O(1/\sqrt{K}) for convex problems and O(1/K)O(1/{K}) for strongly convex problems, for example, see (Nemirovski et al., 2009; Moulines and Bach, 2011). A parallel algorithm of stochastic gradient is the dual averaging approach, which achieves the same convergence rate (Xiao, 2009). The stochastic gradient is also closely related to online learning algorithms. Please refer to the online learning literature, for example, (Crammer et al., 2006; Shalev-Shwartz, 2011; Yang et al., 2014). Most studies for stochastic gradient focus on convex optimization. For nonconvex optimization using SG, Ghadimi and Lan (2013) proved an ergodic convergence rate of O(1/K)O({1/\sqrt{K}}) for stochastic gradient under nonconvex optimization, which is consistent with the rate of stochastic gradient for convex problems.

As for synchronous parallel stochastic gradient methods, Dekel et al. (2012) proposed a mini-batch stochastic gradient algorithm – multiple workers compute the stochastic gradient on MM data in parallel and need a synchronization step before modifying parameter xx in every iteration. The convergence rate is proven to be O(1/KM)O(1/\sqrt{KM}) for convex optimization. In their follow up work (Dekel et al., 2010), they showed that a variant of their approach is asymptotically robust to asynchrony, as long as most processors remain synchronized for most of time. (Precisely, this variant can be considered as a partially asynchronous parallel stochastic gradient algorithm.) (Zinkevich et al., 2010) studied a method where each node in the network runs the vanilla stochastic gradient method, using random subsets of the overall data set, and their solutions are only averaged in the final step.

The asynchronous parallel algorithms received broad attention in optimization recently, although pioneer studies started from 1980s (Bertsekas and Tsitsiklis, 1989). Due to the rapid development of hardware resources, the asynchronous parallelism recently received many successes when applied to parallel stochastic gradient (Niu et al., 2011; Agarwal and Duchi, 2011; Zhang et al., 2014; Feyzmahdavian et al., 2015; Paine et al., 2013), stochastic coordinate descent (Avron et al., 2014; Liu et al., 2014a), dual stochastic coordinate ascent (Tran et al., 2015), randomized Kaczmarz algorithm (Liu et al., 2014b), and ADMM (Zhang and Kwok, 2014). Liu et al. (2014a) and Liu and Wright (2014) studied the asynchronous parallel stochastic coordinate descent algorithm with consistent read and inconsistent read respectively and prove the linear speedup is achievable if T≤O(n1/2)T\leq O(n^{1/2}) for smooth convex functions and T≤O(n1/4)T\leq O(n^{1/4}) for functions with “smooth convex loss + nonsmooth convex separable regularization”. Avron et al. (2014) studied this asynchronous parallel stochastic coordinate descent algorithm in solving Ax=bAx=b where AA is a symmetric positive definite matrix, and showed that the linear speedup is achievable if T≤O(n)T\leq O(n) for consistent read and T≤O(n1/2)T\leq O(n^{1/2}) for inconsistent read. Tran et al. (2015) studied a semi-asynchronous parallel version of Stochastic Dual Coordinate Ascent algorithm which periodically enforces primal-dual synchronization in a separate thread.

We review the asynchronous parallel stochastic gradient algorithms in the last. Agarwal and Duchi (2011) analyzed the AsySG-con algorithm (on computer cluster) for convex smooth optimization and proved a convergence rate of O(1MK+MT2K)O\left({1\over\sqrt{MK}}+{MT^{2}\over K}\right) which implies that linear speedup is achieved when TT is bounded by O(K1/4/M3/4)O(K^{1/4}/M^{3/4}). In comparison, our analysis for the more general nonconvex smooth optimization improves the upper bound by a factor K1/4M1/4K^{1/4}M^{1/4}. A very recent work (Feyzmahdavian et al., 2015) extended the analysis in Agarwal and Duchi (2011) to minimize functions in the form “smooth convex loss + nonsmooth convex regularization” and obtained similar results. Niu et al. (2011) proposed a lock free asynchronous parallel implementation of SG on the shared memory system and described this implementation as Hogwild! algorithm. They proved a sublinear convergence rate O(1/K)O(1/K) for strongly convex smooth objectives. Another recent work Mania et al. (2015) analyzed asynchronous stochastic optimization algorithms for convex functions by viewing it as a serial algorithm with the input perturbed by bounded noise and proved the convergences rates no worse than using traditional point of view for several algorithms.

Asynchronous parallel stochastic gradient for computer network

This section considers the asynchronous parallel implementation of SG on computer network proposed by Agarwal and Duchi (2011). It has been successfully applied to the distributed neural network (Dean et al., 2012) and the parameter server (Li et al., 2014a) to solve deep neural network.

The “star” in the star-shaped network is a master machineThere could be more than one machines in some networks, but all of them serves the same purpose and can be treated as a single machine. which maintains the parameter xx. Other machines in the computer network serve as workers which only communicate with the master. All workers exchange information with the master independently and simultaneously, basically repeating the following steps:

(Select): randomly select a subset of training samples S∈ΞS\in\Xi;

(Pull): pull parameter xx from the master;

(Compute): compute the stochastic gradient g←∑ξ∈SG(x;ξ)g\leftarrow\sum_{\xi\in S}G(x;\xi);

The master basically repeats the following steps:

(Aggregate): aggregate a certain amount of stochastic gradients “gg” from workers;

(Sum): summarize all “gg”s into a vector Δ\Delta;

(Update): update parameter xx by x←x−γΔx\leftarrow x-\gamma\Delta.

While the master is aggregating stochastic gradients from workers, it does not care about the sources of the collected stochastic gradients. As long as the total amount achieves the predefined quantity, the master will compute Δ\Delta and perform the update on xx. The “update” step is performed as an atomic operation – workers cannot read the value of xx during this step, which can be efficiently implemented in the network (especially in the parameter server (Li et al., 2014a)). The key difference between this asynchronous parallel implementation of SG and the serial (or synchronous parallel) SG algorithm lies on that in the “update” step, some stochastic gradients “gg” in “Δ\Delta” might be computed from some early value of xx instead of the current one, while in the serial SG, all gg’s are guaranteed to use the current value of xx.

The asynchronous parallel implementation substantially reduces the system overhead and overcomes the possible large network delay, but the cost is to use the old value of “xx” in the stochastic gradient evaluation. We will show in Section 3.2 that the negative affect of this cost will vanish asymptotically.

2 Analysis for AsySG-con

To analyze Algorithm 1, besides Assumption 1 we make the following additional assumptions.

(Independence): All random variables in {ξk,m}k=0,1,⋯ ,K;m=1,⋯ ,M\{\xi_{k,m}\}_{k=0,1,\cdots,K;m=1,\cdots,M} in Algorithm 1 are independent to each other;

(Bounded Age): All delay variables τk,m\tau_{k,m}’s are bounded: max⁡k,mτk,m≤T\max_{k,m}\tau_{k,m}\leq T.

The independence assumption strictly holds if all workers select samples with replacement. Although it might not be satisfied strictly in practice, it is a common assumption made for the analysis purpose. The bounded delay assumption is much more important. As pointed out before, the asynchronous implementation may use some old value of parameter xx to evaluate the stochastic gradient. Intuitively, the age (or “oldness”) should not be too large to ensure the convergence. Therefore, it is a natural and reasonable idea to assume an upper bound for ages. This assumption is commonly used in the analysis for asynchronous algorithms, for example, (Niu et al., 2011; Avron et al., 2014; Liu and Wright, 2014; Liu et al., 2014a; Feyzmahdavian et al., 2015; Liu et al., 2014b). It is worth noting that the upper bound TT is roughly proportional to the number of workers.

Under Assumptions 1 and 2, we have the following convergence rate for nonconvex optimization.

Assume that Assumptions 1 and 2 hold and the steplength sequence {γk}k=1,⋯ ,K\{\gamma_{k}\}_{k=1,\cdots,K} in Algorithm 1 satisfies

We have the following ergodic convergence rate for the iteration of Algorithm 1

Taking a close look at Theorem 1, we can properly choose the steplength γk\gamma_{k} as a constant value and obtain the following convergence rate:

Assume that Assumptions 1 and 2 hold. Set the steplength γk\gamma_{k} to be a constant γ\gamma

then the output of Algorithm 1 satisfies the following ergodic convergence rate

This corollary basically claims that when the total iteration number KK is greater than O(T2)O(T^{2}), the convergence rate achieves O(1/MK)O({1/\sqrt{MK}}). Since this rate does not depend on the delay parameter TT after sufficient number of iterations, the negative effect of using old values of xx for stochastic gradient evaluation vanishes asymptoticly. In other words, if the total number of workers is bounded by O(K/M)O(\sqrt{K/M}), the linear speedup is achieved.

Note that our convergence rate O(1/MK)O({1/\sqrt{MK}}) is consistent with the serial SG (with M=1M=1) for convex optimization (Nemirovski et al., 2009), the synchronous parallel (or mini-batch) SG for convex optimization (Dekel et al., 2012), and nonconvex smooth optimization (Ghadimi and Lan, 2013). Therefore, an important observation is that as long as the number of workers (which is proportional to TT) is bounded by O(K/M)O(\sqrt{K/M}), the iteration complexity to achieve the same accuracy level will be roughly the same. In other words, the average work load for each worker is reduced by the factor TT comparing to the serial SG. Therefore, the linear speedup is achievable if T≤O(K/M)T\leq O(\sqrt{K/M}). Since our convergence rate meets several special cases, it is tight.

Next we compare with the analysis of AsySG-con for convex smooth optimization in Agarwal and Duchi (2011, Corollary 2). They proved an asymptotic convergence rate O(1/MK)O(1/\sqrt{MK}), which is consistent with ours. But their results require T≤O(K1/4M−3/4)T\leq O(K^{1/4}M^{-3/4}) to guarantee linear speedup. Our result improves it by a factor O(K1/4M1/4)O(K^{1/4}M^{1/4}).

Asynchronous parallel stochastic gradient for shared memory architecture

This section considers a widely used lock-free asynchronous implementation of SG on the shared memory system proposed in Niu et al. (2011). Its advantages have been witnessed in solving SVM, graph cuts (Niu et al., 2011), linear equations (Liu et al., 2014b), and matrix completion (Petroni and Querzoni, 2014). While the computer network always involves multiple machines, the shared memory platform usually only includes a single machine with multiple cores / GPUs sharing the same memory.

For the shared memory platform, one can exactly follow AsySG-con on the computer network using software locks, which is expensiveThe time consumed by locks is roughly equal to the time of 10410^{4} floating-point computation. The additional cost for using locks is the waiting time during which multiple worker access the same memory address.. Therefore, in practice the lock free asynchronous parallel implementation of SG is preferred. This section considers the same implementation as Niu et al. (2011), but provides a more precise algorithm description AsySG-incon than Hogwild! proposed in Niu et al. (2011).

In this lock free implementation, the shared memory stores the parameter “xx” and allows all workers reading and modifying parameter xx simultaneously without using locks. All workers repeat the following steps independently, concurrently, and simultaneously:

(Read): read the parameter from the shared memory to the local memory without software locks (we use x^\hat{x} to denote its value);

(Compute): sample a training data ξ\xi and use x^\hat{x} to compute the stochastic gradient G(x^;ξ)G(\hat{x};\xi) locally;

(Update): update parameter xx in the shared memory without software locks x←x−γG(x^;ξ)x\leftarrow x-\gamma G(\hat{x};\xi).

Since we do not use locks in both “read” and “update” steps, it means that multiple workers may manipulate the shared memory simultaneously. It causes the “inconsistent read” at the “read” step, that is, the value of x^\hat{x} read from the shared memory might not be any state of xx in the shared memory at any time point. For example, at time , the original value of xx in the shared memory is a two dimensional vector [a,b][a,b]; at time 11, worker WW is running the “read” step and first reads aa from the shared memory; at time 22, worker W′W^{\prime} updates the first component of xx in the shared memory from aa to a′a^{\prime}; at time 22, worker W′W^{\prime} updates the second component of xx in the shared memory from bb to b′b^{\prime}; at time 33, worker WW reads the value of the second component of xx in the shared memory as b′b^{\prime}. In this case, worker WW eventually obtains the value of x^\hat{x} as [a,b′][a,b^{\prime}], which is not a real state of xx in the shared memory at any time point. Recall that in AsySG-con the parameter value obtained by any worker is guaranteed to be some real value of parameter xx at some time point.

To precisely characterize this implementation and especially represent x^\hat{x}, we monitor the value of parameter xx in the shared memory. We define one iteration as a modification on any single component of xx in the shared memory since the update on a single component can be considered to be atomic on GPUs and DSPs (Niu et al., 2011). We use xkx_{k} to denote the value of parameter xx in the shared memory after kk iterations and x^k\hat{x}_{k} to denote the value read from the shared memory and used for computing stochastic gradient at the kkth iteration. x^k\hat{x}_{k} can be represented by xkx_{k} with a few earlier updates missing

where J(k)⊂{k−1,k,⋯ ,0}J(k)\subset\{k-1,k,\cdots,0\} is a subset of index numbers of previous iterations. This way is also used in analyzing asynchronous parallel coordinate descent algorithms in (Avron et al., 2014; Liu and Wright, 2014). The kkth update happened in the shared memory can be described as

where ξk\xi_{k} denotes the index of the selected data and iki_{k} denotes the index of the component being updated at kkth iteration. In the original analysis for the Hogwild! implementation (Niu et al., 2011), x^k\hat{x}_{k} is assumed to be some earlier state of xx in the shared memory (that is, the consistent read) for simpler analysis, although it is not true in practice.

One more complication is to apply the mini-batch strategy like before. Since the “update” step needs physical modification in the shared memory, it is usually much more time consuming than both “read” and “compute” steps are. If many workers run the “update” step simultaneously, the memory contention will seriously harm the performance. To reduce the risk of memory contention, a common trick is to ask each worker to gather multiple (say MM) stochastic gradients and write the shared memory only once. That is, in each cycle, run both “update” and “compute” steps for MM times before you run the “update” step. Thus, the mini-batch updates happen in the shared memory can be written as

where iki_{k} denotes the coordinate index updated at the kkth iteration, and G(x^k,m;ξk,m)G(\hat{x}_{k,m};\xi_{k,m}) is the mmth stochastic gradient computed from the data sample indexed by ξk,m\xi_{k,m} and the parameter value denoted by x^k,m\hat{x}_{k,m} at the kkth iteration. x^k,m\hat{x}_{k,m} can be expressed by:

where J(k,m)⊂{k−1,k,⋯ ,0}J(k,m)\subset\{k-1,k,\cdots,0\} is a subset of index numbers of previous iterations. The algorithm is summarized in Algorithm 2 from the view of the shared memory.

2 Analysis for AsySG-incon

To analyze the AsySG-incon, we need to make a few assumptions similar to Niu et al. (2011); Liu et al. (2014b); Avron et al. (2014); Liu and Wright (2014).

We assume that the following holds for Algorithm 2:

(Independence): All groups of variables {ik,{ξk,m}m=1M}\{i_{k},\{\xi_{k,m}\}_{m=1}^{M}\} at different iterations from k=1k=1 to KK are independent to each other.

(Bounded Age): Let TT be the global bound for delay: J(k,m)⊂{k−1,...k−T},∀k,∀mJ(k,m)\subset\{k-1,...k-T\},\quad\forall k,\forall m, so ∣J(k,m)∣≤T|J(k,m)|\leq T.

The independence assumption might not be true in practice, but it is probably the best assumption one can make in order to analyze the asynchronous parallel SG algorithm. This assumption was also used in the analysis for Hogwild! (Niu et al., 2011) and asynchronous randomized Kaczmarz algorithm (Liu et al., 2014b). The bounded delay assumption basically restricts the age of all missing components in x^k,m\hat{x}_{k,m} (∀m, ∀k\forall m,~{}\forall k). The upper bound “TT” here serves a similar purpose as in Assumption 2. Thus we abuse this notation in this section. The value of TT is proportional to the number of workers and does not depend on the size of mini-batch MM. The bounded age assumption is used in the analysis for asynchronous stochastic coordinate descent with “inconsistent read” (Avron et al., 2014; Liu and Wright, 2014). Under Assumptions 1 and 3, we have the following results:

Assume that Assumptions 1 and 3 hold and the constant steplength γ\gamma satisfies

We have the following ergodic convergence rate for Algorithm 2

Taking a close look at Theorem 3, we can choose the steplength γ\gamma properly and obtain the following error bound:

Assume that Assumptions 1 and 3 hold. Set the steplength to be a constant γ\gamma

If the total iterations KK is greater than

then the output of Algorithm 2 satisfies the following ergodic convergence rate

This corollary indicates the asymptotic convergence rate achieves O(1/MK)O(1/\sqrt{MK}) when the total iteration number KK exceeds a threshold in the order of O(T2)O(T^{2}) (if nn is considered as a constant). We can see that this rate and the threshold are consistent with the result in Corollary 2 for AsySG-con. One may argue that why there is an additional factor n\sqrt{n} in the numerator of (19). That is due to the way we count iterations – one iteration is defined as updating a single component of xx. If we take into account this factor in the comparison to AsySG-con, the convergence rates for AsySG-con and AsySG-incon are essentially consistent. This comparison implies that the “inconsistent read” would not make a big difference from the “consistent read”.

Next we compare our result with the analysis of Hogwild! by (Niu et al., 2011). In principle, our analysis and their analysis consider the same implementation of asynchronous parallel SG, but differ in the following aspects: 1) our analysis considers the smooth nonconvex optimization which includes the smooth strongly convex optimization considered in their analysis; 2) our analysis considers the “inconsistent read” model which meets the practice while their analysis assumes the impractical “consistent read” model. Although the two results are not absolutely comparable, it is still interesting to see the difference. Niu et al. (2011) proved that the linear speedup is achievable if the maximal number of nonzeros in stochastic gradients is bounded by O(1)O(1) and the number of workers is bounded by O(n1/4)O(n^{1/4}). Our analysis does not need this prerequisite and guarantees the linear speedup as long as the number of workers is bounded by O(K)O(\sqrt{K}). Although it is hard to say that our result strictly dominates Hogwild! in Niu et al. (2011), our asymptotic result is eligible for more scenarios.

We consider an extension of AsySG-incon for sparse stochastic gradients. In this scenario, we slightly change Steps 3 and 4 in Algorithm 2:

3: Uniformly select iki_{k} from the support set of gk:=∑m=1MG(x^k,m;ξk,m)g_{k}:=\sum_{m=1}^{M}G(\hat{x}_{k,m};\xi_{k,m}); 4: (xk+1)ik=(xk)ik−γ∥gk∥0(gk)ik(x_{k+1})_{i_{k}}=(x_{k})_{i_{k}}-\gamma\|g_{k}\|_{0}(g_{k})_{i_{k}}.

The convergence rate in (19) can be slightly improved by taking the advantage of sparsity:

The proof can be simply get by extending the proof for (19).

Experiments

The successes of AsySG-con and AsySG-incon and their advantages over synchronous parallel algorithms have been widely witnessed in many applications such as deep neural network (Dean et al., 2012; Paine et al., 2013; Zhang et al., 2014; Li et al., 2014a), matrix completion (Niu et al., 2011; Petroni and Querzoni, 2014; Yun et al., 2013), SVM (Niu et al., 2011), and solving linear equations (Liu et al., 2014b). We refer readers to these literatures for more comphrehensive comparison and empirical studies. This section mainly provides the empirical study to validate the speedup properties for completeness.

We perform experiments for AsySG-con and AsySG-incon on computer cluster and multicore machine respectively. The main purpose of the following experiments is to validate the speedup property. We are particularly interested in two types of speedup: iteration speedup and running time speedup. The iteration speedup is exactly the speedup we discussed in the whole paper. Given TT workers, it is computed from the ratio

where #\# is the iteration count when the same level of precision achieved. This speedup is less affected by the hardware. The running time speedup is the actual speedup. It is defined with respect to the running time:

The running time speedup is seriously affected by the hardware. It is generally worse than the iteration speedup.

We implement AsySG-con for deep neural network based on the Caffe (Jia et al., 2014) package. Caffe is an open source code base of deep learning algorithms. We evaluate AsySG-con on two standard datasets provided in the Caffe package, LENET and CIFAR10-FULL.

The neural network consists of convolution layer, nonlinear layer, max pool layer and fully connected layer (Krizhevsky et al., 2012), and the detailed specification can be found on the Caffe websitehttps://github.com/BVLC/caffe. LENET is a digit classifier network, training on the MNIST datasethttp://yann.lecun.com/exdb/mnist/. CIFAR10-full has 10 classes of color images, training on the CIFAR10 dataset (Krizhevsky and Hinton, 2009). We first initialize a parameter server hosting the parameters, and then spawn up to 8 stochastic gradient workers. The point to point communication between the parameter server and gradient workers are handled by the MPICH libraryhttps://www.mpich.org/. The parameter server and stochastic gradient workers run on separate machines, and each process uses a single core of a Xeon(R) E5-2430 CPU. The steplength γ\gamma for LENET is chosen as the default value. It means that this steplength has been tuned to be the optimal for the serial SG algorithm on LENET. The steplength we used for CIFAR10-FULL is chosen as the default value as well.

We draw the curves of objective loss against iterations and running time in Figures 2 and 2 respectively, and report their speedups in Tables 2 and 2. (More details about datasets and the parameter setting in experiments can be found in Table 3.) We can observe that

The iteration speedup is always better than the running time speedup, which meets our common sense;

The speedups for both problems are comparable overall as shown in Tables 2 and 2. The time speedup for CIFAR10-FULL is slightly more stable, while we notice that the time speedup for LENET in Table 2 suddenly drops to “2.882.88” with mpi-8 from “5.29” with mpi-7. That is because it hits the ceiling of communication bandwidth. The number of parameters in LENET is more than CIFAR10-FULL, thus requiring more communication cost. When the number of machines achieves a certain threshold (in this case LENET, it is 88), the performance might become dramatically worse.

2 AsySG-incon

We conduct the empirical study for AsySG-incon on the machine (Intel Xeon architecture), which has 4 sockets and 10 cores for each socket. The synthetic data is generated from a full connected neural network with 5 layers (400×100×50×20×10400\times 100\times 50\times 20\times 10) and 4638046380 parameters totally. The total number of samples is 463800463800. The data size is about 1.51.5 GB. The input vector and all parameters are generated from i.i.d. Gaussian distribution. The output vector is constructed by applying the network parameter to the input vector plus some Gaussian random noise.

Conclusion

This paper studied two popular asynchronous parallel implementations for SGSG on computer cluster and shared memory system respectively. Two algorithms (AsySG-con and AsySG-incon) are used to describe two implementations. An asymptotic sublinear convergence rate is proven for both algorithms on nonconvex smooth optimization. This rate is consistent with the result of SGSG for convex optimization. The linear speedup is proven to achievable when the number of workers is bounded by K\sqrt{K}, which improves the earlier analysis of AsySG-con for convex optimization in (Agarwal and Duchi, 2011). The proposed AsySG-incon algorithm provides a more precise description for lock free implementation on shared memory system than Hogwild! (Niu et al., 2011). Our result for AsySG-incon can be applied to more scenarios.

Acknowledgements

This project is supported by the NSF grant CNS-1548078, the NEC fellowship, and the startup funding at University of Rochester. We thank Professor Daniel Gildea and Professor Sandhya Dwarkadas at University of Rochester, Professor Stephen J. Wright at University of Wisconsin-Madison, and anonymous (meta-)reviewers for their constructive comments and helpful advices.

References

Appendix: Proofs

From the Lipschitzisan gradient assumption (5), we have

Taking expectation respect to ξk,∗\xi_{k,*} on both sides of (21), we have

where we use the unbiased stochastic gradient assumption in (2). From the fact

Next we estimate the upper bound of T1T_{1} and T2T_{2}. For T2T_{2} we have

and the last inequality is due to the assumption (3) and

where the second inequality is from the Lipschitzian gradient assumption (5). It follows that

where the last inequality uses the fact that ∥a+b∥2≤2∥a∥2+2∥b∥2\|a+b\|^{2}\leq 2\|a\|^{2}+2\|b\|^{2} for any real vectors aa and bb. Taking the expectation in terms of {ξj,∗∣j∈{k−τk,μ,...,k−1}}\{\xi_{j,*}|j\in\{k-\tau_{k,\mu},...,k-1\}\} for T3T_{3}, we have

where the second last equality is due to (25) and the third equality is due to

Taking the expectation in terms of ξj,∗\xi_{j,*} for T4T_{4}, we have

where the last inequality uses the upper bound of the delay age: τk,μ≤T\tau_{k,\mu}\leq T.

Summarizing the inequality (30) from k=1k=1 to k=Kk=K, we have

where the last inequality is due to (7). Note that x∗x^{*} is the global optimization point. Thus we have

which implies that the condition (7) in Theorem 1 is satisfied globally. Then we can safely apply (8) in Theorem 1:

where the second last inequality is due to (31) and the last equality uses (9). It completes the proof. ∎

From the Lipschitzisan gradient assumption (5), we have

Taking the expectation of iki_{k} on both sides of (32), we have

Taking the expectation of ξk,∗\xi_{k,*} on both sides of (33), we obtain

where the last equation is deduced by the fact 2⟨a,b⟩=∥a∥2+∥b∥2−∥a−b∥22\langle a,b\rangle=\|a\|^{2}+\|b\|^{2}-\|a-b\|^{2}. We next consider T1T_{1} and T2T_{2} respectively.

and the last inequality is due to the assumption (3) and

where the last inequality uses the fact that ∥a+b∥2≤2∥a∥2+2∥b∥2\|a+b\|^{2}\leq 2\|a\|^{2}+2\|b\|^{2} for any real vector aa and bb. Taking the expectation in terms of iji_{j} and ξj,∗\xi_{j,*} with all jj’s in J(k,μ)J(k,\mu) for T3T_{3}, we have

where the second last equality is due to (36) and the third equality is due to

Taking the expectation in terms of iji_{j} with all jj’s in J(k,μ)J(k,\mu) for T4T_{4}, we have

where the second last inequality is due to that for any j′′>j′j^{\prime\prime}>j^{\prime}:

Summarizing (41) from k=1k=1 to KK, we have

From the definition of the steplength (17) and the lower bound of KK (18), we have

which gives an upper bound for γ\gamma. We can further relax this upper bound by

Next we will show that the steplength satisfies the condition in (15):

where the first inequality uses the fact L\mboxmax≤LTL_{\mbox{\rm\scriptsize max}}\leq L_{T} and the first inequality uses the upper bound of γ\gamma in (43). The third last inequality comes from nT≤2n+2T2\sqrt{n}T\leq 2n+2T^{2}. It means that the condition (15) in Theorem 3 is satisfied globally. Then we can safely apply (16) in Theorem 3:

where the second inequality is due to the upper bound of γ\gamma in (44) and the last equality is acquired by substituting γ\gamma by its definition in (17). It completes the proof. ∎