Title: LARGE BATCH OPTIMIZATION FOR DEEP LEARNING: TRAINING BERT IN 76 MINUTES

Abstract: Training large deep neural networks on massive datasets is computationally very challenging. There has been recent surge in interest in using large batch stochastic optimization methods to tackle this issue. The most prominent algorithm in this line of research is LARS, which by employing layerwise adaptive learning rates trains RESNET on ImageNet in a few minutes. However, LARS performs poorly for attention models like BERT, indicating that its performance gains are not consistent across tasks. In this paper, we first study a principled layerwise adaptation strategy to accelerate training of deep neural networks using large mini-batches. Using this strategy, we develop a new layerwise adaptive large batch optimization technique called LAMB; we then provide convergence analysis of LAMB as well as LARS, showing convergence to a stationary point in general nonconvex settings. Our empirical results demonstrate the superior performance of LAMB across various tasks such as BERT and RESNET-50 training with very little hyperparameter tuning. In particular, for BERT training, our optimizer enables use of very large batch sizes of 32868 without any degradation of performance. By increasing the batch size to the memory limit of a TPUv3 Pod, BERT training time can be reduced from 3 days to just 76 minutes (Table 1 ). The LAMB implementation is available online 1 .

1. INTRODUCTION:

With the advent of large scale datasets, training large deep neural networks, even using computationally efficient optimization methods like Stochastic gradient descent (SGD), has become particularly challenging. For instance, training state-of-the-art deep learning models like BERT and ResNet-50 takes 3 days on 16 TPUv3 chips and 29 hours on 8 Tesla P100 gpus respectively (Devlin et al., 2018; He et al., 2016) . Thus, there is a growing interest to develop optimization solutions to tackle this critical issue. The goal of this paper is to investigate and develop optimization techniques to accelerate training large deep neural networks, mostly focusing on approaches based on variants of SGD.

Methods based on SGD iteratively update the parameters of the model by moving them in a scaled (negative) direction of the gradient calculated on a minibatch. However, SGD's scalability is limited by its inherent sequential nature. Owing to this limitation, traditional approaches to improve SGD training time in the context of deep learning largely resort to distributed asynchronous setup (Dean et al., 2012; Recht et al., 2011) . However, the implicit staleness introduced due to the asynchrony limits the parallelization of the approach, often leading to degraded performance. The feasibility of computing gradient on large minibatches in parallel due to recent hardware advances has seen the resurgence of simply using synchronous SGD with large minibatches as an alternative to asynchronous SGD. However, naïvely increasing the batch size typically results in degradation of generalization performance and reduces computational benefits (Goyal et al., 2017) .

Synchronous SGD on large minibatches benefits from reduced variance of the stochastic gradients used in SGD. This allows one to use much larger learning rates in SGD, typically of the order square root of the minibatch size. Surprisingly, recent works have demonstrated that up to certain minibatch sizes, linear scaling of the learning rate with minibatch size can be used to further speed up the 2018; Smith et al., 2017; Martens & Grosse, 2015; Devarakonda et al., 2017; Mikami et al., 2018; Osawa et al., 2018; You et al., 2019; Yamazaki et al., 2019) . To the best of our knowledge, the fastest training result for RESNET-50 on ImageNet is due to Ying et al. (2018) , who achieve 76+% top-1 accuracy. By using the LARS optimizer and scaling the batch size to 32K on a TPUv3 Pod, Ying et al. (2018) was able to train RESNET-50 on ImageNet in 2.2 minutes. However, it was empirically observed that none of these performance gains hold in other tasks such as BERT training (see Section 4).

2. PRELIMINARIES:

Notation. For any vector x t ∈ R d , either x t,j or [x t ] j are used to denote its j th coordinate where j ∈ [d] . Let I be the d × d identity matrix, and let I = [I 1 , I 2 , ..., I h ] be its decomposition into column submatrices I i = d × d h . For x ∈ R d , let x (i) be the block of variables corresponding to the columns of I i i.e., x (i) = I i x ∈ R di for i = {1, 2, • • • , h}. For any function f : R d → R, we use ∇ i f (x) to denote the gradient with respect to x (i) . For any vectors u, v ∈ R d , we use u 2 and u/v to denote elementwise square and division operators respectively. We use . and . 1 to denote l 2 -norm and l 1 -norm of a vector respectively. We start our discussion by formally stating the problem setup. In this paper, we study nonconvex stochastic optimization problems of the form

EQUATION

where is a smooth (possibly nonconvex) function and P is a probability distribution on the domain S ⊂ R k . Here, x corresponds to model parameters, is the loss function and P is an unknown data distribution.

We assume function (x) is L i -smooth with respect to i th block, i.e., there exists a constant L i such that ∇ i (x, s) -∇ i (x + I i δ, s)

EQUATION

for all i ∈ [h]. We use L = (L 1 , • • • , L h ) to denote the h-dimensional vector of Lipschitz constants. We use L ∞ and L avg to denote max i L i and i Li h respectively. We assume the following bound on the variance in stochastic gradients: E ∇ i (x, s) -∇ i f (x) 2 ≤ σ 2 i for all x ∈ R d and i ∈ [h]. Furthermore, we also assume E [∇ (x, s)] i -[∇f (x)] i 2 ≤ σ2 i for all x ∈ R d and i ∈ [d] . We use σ = (σ 1 , • • • , σ h ) and σ = (σ 1 , • • • , σd ) to denote the vectors of standard deviations of stochastic gradient per layer and per dimension respectively. Finally, we assume that the gradients are bounded i.e., |[∇l(x, s)] j | ≤ G for all j ∈ [d], x ∈ R d and s ∈ S. Note that such assumptions are typical in the analysis of stochastic first-order methods (cf. (Ghadimi & Lan, 2013a; Ghadimi et al., 2014; Reddi et al., 2016; 2018) ).

Stochastic gradient descent (SGD) is one of the simplest first-order algorithms for solving problem in Equation 1. The update at the t th iteration of SGD is of the following form:

x t+1 = x t -η t 1 |S t | st∈St ∇ (x t , s t ) + λx t , (SGD)

where S t is set of b random samples drawn from the distribution P. For very large batch settings, the following is a well-known result for SGD.

Theorem 1 ( (Ghadimi & Lan, 2013b) ). With large batch b = T and using appropriate learning rate, we have the following for the iterates of SGD:

E ∇f (x a ) 2 ≤ O (f (x 1 ) -f (x * ))L ∞ T + σ 2 T .

where x * is an optimal solution to the problem in equation 1 and x a is an iterate uniformly randomly chosen from {x 1 , • • • , x T }.

However, tuning the learning rate η t in SGD, especially in large batch settings, is difficult in practice. Furthermore, the dependence on L ∞ (the maximum of smoothness across dimension) can lead to significantly slow convergence. In the next section, we discuss algorithms to circumvent this issue.

3. ALGORITHMS:

In this section, we first discuss a general strategy to adapt the learning rate in large batch settings.

Using this strategy, we discuss two specific algorithms in the later part of the section. Since our primary focus is on deep learning, our discussion is centered around training a h-layer neural network.

General Strategy. Suppose we use an iterative base algorithm A (e.g. SGD or ADAM) in the small batch setting with the following layerwise update rule:

x t+1 = x t + η t u t , where u t is the update made by A at time step t. We propose the following two changes to the update for large batch settings:

1. The update is normalized to unit l 2 -norm. This is ensured by modifying the update to the form u t / u t . Throughout this paper, such a normalization is done layerwise i.e., the update for each layer is ensured to be unit l 2 -norm. 2. The learning rate is scaled by φ( x t ) for some function φ : R + → R + . Similar to the normalization, such a scaling is done layerwise.

Suppose the base algorithm A is SGD, then the modification results in the following update rule:

EQUATION

for all layers i ∈ [h] and where x (i) t and g

(i)

t are the parameters and the gradients of the i th layer at time step t. The normalization modification is similar to one typically used in normalized gradient descent except that it is done layerwise. Note that the modification leads to a biased gradient update; however, in large-batch settings, it can be shown that this bias is small. It is intuitive that such a normalization provides robustness to exploding gradients (where the gradient can be arbitrarily large) and plateaus (where the gradient can be arbitrarily small). Normalization of this form essentially ignores the size of the gradient and is particularly useful in large batch settings where the direction of the gradient is largely preserved.

The scaling term involving φ ensures that the norm of the update is of the same order as that of the parameter. We found that this typically ensures faster convergence in deep neural networks. In practice, we observed that a simple function of φ(z) = min{max{z, γ l }, γ u } works well. It is instructive to consider the case where φ(z) = z. In this scenario, the overall change in the learning rate is

x (i) t g (i) t

, which can also be interpreted as an estimate on the inverse of Lipschitz constant of the gradient (see equation 2). We now discuss different instantiations of the strategy discussed above. In particular, we focus on two algorithms: LARS (3.1) and the proposed method, LAMB (3.2).

3.1. LARS ALGORITHM:

The first instantiation of the general strategy is LARS algorithm (You et al., 2017) , which is obtained by using momentum optimizer as the base algorithm A in the framework. LARS was earlier proposed for large batch learning for RESNET on ImageNet. In general, it is observed that the using (heavy-ball) momentum, one can reduce the variance in the stochastic gradients at the cost of little bias. The pseudocode for LARS is provide in Algorithm 1.

We now provide convergence analysis for LARS in general nonconvex setting stated in this paper. For the sake of simplicity, we analyze the case where β 1 = 0 and λ = 0 in Algorithm 1. However, our analysis should extend to the general case as well. We will defer all discussions about the convergence rate to the end of the section.

Theorem 2. Let η t = η = 2(f (x1)-f (x * )) α 2 u L 1T for all t ∈ [T ], b = T , α l ≤ φ(v)

≤ α u for all v > 0 where α l , α u > 0. Then for x t generated using LARS (Algorithm 1), we have the following bound

E 1 √ h h i=1 ∇ i f (x a ) 2 ≤ O (f (x 1 ) -f (x * ))L avg T + σ 2 1 T h ,

where x * is an optimal solution to the problem in equation 1 and x a is an iterate uniformly randomly chosen from

{x 1 , • • • , x T }. Algorithm 1 LARS Input: x1 ∈ R d , learning rate {ηt} T t=1 , parameter 0 < β1 < 1, scaling function φ, > 0 Set m0 = 0 for t = 1 to T do Draw b samples St from P Compute gt = 1 |S t | s t ∈S t ∇ (xt, st) mt = β1mt-1 + (1 -β1)(gt + λxt) x (i) t+1 = x (i) t -ηt φ( x (i) t ) m (i) t m (i) t for all i ∈ [h] end for Algorithm 2 LAMB Input: x1 ∈ R d , learning rate {ηt} T t=1 , parameters 0 < β1, β2 < 1, scaling function φ, > 0 Set m0 = 0, v0 = 0 for t = 1 to T do Draw b samples St from P. Compute gt = 1 |S t | s t ∈S t ∇ (xt, st). mt = β1mt-1 + (1 -β1)gt vt = β2vt-1 + (1 -β2)g 2 t mt = mt/(1 -β t 1 ) vt = vt/(1 -β t 2 ) Compute ratio rt = m t √ v t + x (i) t+1 = x (i) t -ηt φ( x (i) t ) r (i) t +λx (i) t (r (i) t + λx (i) t ) end for

3.2. LAMB ALGORITHM:

The second instantiation of the general strategy is obtained by using ADAM as the base algorithm A. ADAM optimizer is popular in deep learning community and has shown to have good performance for training state-of-the-art language models like BERT. Unlike LARS, the adaptivity of LAMB is two-fold: (i) per dimension normalization with respect to the square root of the second moment used in ADAM and (ii) layerwise normalization obtained due to layerwise adaptivity. The pseudocode for LAMB is provided in Algorithm 2. When β 1 = 0 and β 2 = 0, the algorithm reduces to be Sign SGD where the learning rate is scaled by square root of the layer dimension (Bernstein et al., 2018) .

The following result provides convergence rate for LAMB in general nonconvex settings. Similar to the previous case, we focus on the setting where β 1 = 0 and λ = 0. As before, our analysis extends to the general case; however, the calculations become messy.

Theorem 3. Let η t = η = 2(f (x1)-f (x * )) α 2 u L 1T for all t ∈ [T ], b = T , d i = d/h for all i ∈ [h]

, and α l ≤ φ(v) ≤ α u for all v > 0 where α l , α u > 0. Then for x t generated using LAMB (Algorithm 2), we have the following bounds:

1. When β 2 = 0, we have

E 1 √ d ∇f (x a ) 1 2 ≤ O (f (x 1 ) -f (x * ))L avg T + σ 2 1 T h , 2. When β 2 > 0, we have E[ ∇f (x a ) 2 ] ≤ O G 2 d h(1 -β 2 ) × 2(f (x 1 ) -f (x * )) L 1 T + σ 1 √ T ,

where x * is an optimal solution to the problem in equation 1 and x a is an iterate uniformly randomly chosen from {x 1 , • • • , x T }.

Discussion on convergence rates. We first start our discussion with the comparison of convergence rate of LARS with that of SGD (Theorem 1). The convergence rates of LARS and SGD differ in two ways: (1) the convergence criterion is (E[

h i=1 ∇ i f ]) 2 as opposed to E[ ∇f 2

] in SGD and (2) the dependence on L and σ in the convergence rate. Briefly, the convergence rate of LARS is better than SGD when the gradient is denser than curvature and stochasticity. This convergence rate comparison is similar in spirit to the one obtained in (Bernstein et al., 2018) . Assuming that the convergence criterion in Theorem 1 and Theorem 2 is of similar order (which happens when gradients are fairly dense), convergence rate of LARS and LAMB depend on L avg instead of L ∞ and are thus, significantly better than that of SGD. A more quantitative comparison is provided in Section C of the Appendix. The comparison of LAMB (with β 2 = 0) with SGD is along similar lines. We obtain slightly worse rates for the case where β 2 > 0; although, we believe that its behavior should be better than the case β 2 = 0. We leave this investigation to future work.

4. EXPERIMENTS:

We now present empirical results comparing LAMB with existing optimizers on two important large batch training tasks: BERT and RESNET-50 training. We also compare LAMB with existing optimizers for small batch size (< 1K) and small dataset (e.g. CIFAR, MNIST) (see Appendix).

Experimental Setup. To demonstrate its robustness, we use very minimal hyperparameter tuning for the LAMB optimizer. Thus, it is possible to achieve better results by further tuning the hyperparameters. The parameters β 1 and β 2 in Algorithm 2 are set to 0.9 and 0.999 respectively in all our experiments; we only tune the learning rate. We use a polynomially decaying learning rate of η t = η 0 ×(1-t/T ) in Algorithm 2), which is the same as in BERT baseline. This setting also works for all other applications in this paper. Furthermore, for BERT and RESNET-50 training, we did not tune the hyperparameters of LAMB while increasing the batch size. We use the square root of LR scaling rule to automatically adjust learning rate and linear-epoch warmup scheduling. We use TPUv3 in all the experiments. A TPUv3 Pod has 1024 chips and can provide more than 100 petaflops performance for mixed precision computing. To make sure we are comparing with solid baselines, we use grid search to tune the hyper-parameters for ADAM, ADAGRAD, ADAMW (ADAM with weight decay), and LARS. We also tune weight decay for ADAMW. All the hyperparameter tuning settings are reported in the Appendix. Due to space constraints, several experimental details are relegated to the Appendix.

4.1. BERT TRAINING:

We first discuss empirical results for speeding up BERT training. For this experiment, we use the same dataset as Devlin et al. (2018) , which is a concatenation of Wikipedia and BooksCorpus with 2.5B and 800M words respectively. We specifically focus on the SQuAD task2 in this paper. The F1 score on SQuAD-v1 is used as the accuracy metric in our experiments. All our comparisons are with respect to the baseline BERT model by Devlin et al. (2018) . To train BERT, Devlin et al. (2018) first train the model for 900k iterations using a sequence length of 128 and then switch to a sequence length of 512 for the last 100k iterations. This results in a training time of around 3 days on 16 TPUv3 chips. The baseline BERT model3 achieves a F1 score of 90.395. To ensure a fair comparison, we follow the same SQuAD fine-tune procedure of Devlin et al. (2018) without modifying any configuration (including number of epochs and hyperparameters). As noted earlier, we could get even better results by changing the fine-tune configuration. For instance, by just slightly changing the learning rate in the fine-tune stage, we can obtain a higher F1 score of 91.688 for the batch size of 16K using LAMB. We report a F1 score of 91.345 in Table 1 , which is the score obtained for the untuned version. Below we describe two different training choices for training BERT and discuss the corresponding speedups.

For the first choice, we maintain the same training procedure as the baseline except for changing the training optimizer to LAMB. We run with the same number of epochs as the baseline but with batch size scaled from 512 to 32K. The choice of 32K batch size (with sequence length 512) is mainly due to memory limits of TPU Pod. Our results are shown in Table 1 . By using the LAMB optimizer, we are able to achieve a F1 score of 91.460 in 15625 iterations for a batch size of 32768 (14063 iterations for sequence length 128 and 1562 iterations for sequence length 512). With 32K batch size, we reduce BERT training time from 3 days to around 100 minutes. We achieved 49.1 times speedup by 64 times computational resources (76.7% efficiency). We consider the speedup is great because we use the synchronous data-parallelism. There is a communication overhead coming from transferring of the gradients over the interconnect. For RESNET-50, researchers are able to achieve 90% scaling efficiency because RESNET-50 has much fewer parameters (# parameters is equal to #gradients) than BERT (25 million versus 300 million).

To obtain further improvements, we use the Mixed-Batch Training procedure with LAMB. Recall that BERT training involves two stages: the first 9/10 of the total epochs use a sequence length of 128, while the last 1/10 of the total epochs use a sequence length of 512. For the second stage training, which involves a longer sequence length, due to memory limits, a maximum batch size of only 32768 can be used on a TPUv3 Pod. However, we can potentially use a larger batch size for the first stage because of a shorter sequence length. In particular, the batch size can be increased to 131072 for the first stage. However, we did not observe any speedup by increasing the batch size from 65536 to 131072 for the first stage, thus, we restrict the batch size to 65536 for this stage. By using this strategy, we are able to make full utilization of the hardware resources throughout the training Table 1 : We use the F1 score on SQuAD-v1 as the accuracy metric. The baseline F1 score is the score obtained by the pre-trained model (BERT-Large) provided on BERT's public repository (as of February 1st, 2019). We use TPUv3s in our experiments. We use the same setting as the baseline: the first 9/10 of the total epochs used a sequence length of 128 and the last 1/10 of the total epochs used a sequence length of 512. All the experiments run the same number of epochs. Dev set means the test data. It is worth noting that we can achieve better results by manually tuning the hyperparameters. et al., 2017) , but decreasing the batch size brings chaos to the optimization process and can cause divergence. In our experiments, we found a technique that is useful to stabilize the second stage optimization. Because we switched to a different optimization problem, it is necessary to re-warm-up the optimization. Instead of decaying the learning rate at the second stage, we ramp up the learning rate from zero again in the second stage (re-warm-up). As with the first stage, we decay the learning rate after the re-warm-up phase. With this method, we only need 8599 iterations and finish BERT training in 76 minutes (100.2% efficiency).

Comparison with ADAMW and LARS. To ensure that our approach is compared to a solid baseline for the BERT training, we tried three different strategies for tuning ADAMW (Loshchilov & Hutter, 2017) : (1) ADAMW with default hyperparameters (Devlin et al., 2018) (2) ADAMW with the same hyperparameters as LAMB, and (3) ADAMW with tuned hyperparameters. ADAMW stops scaling at the batch size of 16K because it is not able to achieve the target F1 score (88.1 vs 90.4). The tuning information of ADAMW is shown in the Appendix. For 64K/32K mixed-batch training, even after extensive tuning of the hyperparameters, we fail to get any reasonable result with ADAMW optimizer. We conclude that ADAMW does not work well in large-batch BERT training or is at least hard to tune. We also observe that LAMB performs better than LARS for all batch sizes (Table 2 ). ImageNet training with ResNet-50 is an industry standard metric that is being used in MLPerf4 . The baseline can get 76.3% top-1 accuracy in 90 epochs (Goyal et al., 2017) . All the successful implementations are based on momentum SGD (He et al., 2016; Goyal et al., 2017) or LARS optimizer (Ying et al., 2018; Jia et al., 2018; Mikami et al., 2018; You et al., 2018; Yamazaki et al., 2019) . Before our study, we did not find any paper reporting a state-of-the-art accuracy achieved For BERT and ImageNet training, we did not tune the hyperparameters of LAMB optimizer when increasing the batch size. We use the square root LR scaling rule and linear-epoch warmup scheduling to automatically adjust learning rate. The details can be found in Tables 4 and 5 Table 

5 2 3.0 ×10 3 5 2 2.5 ×10 3 5 2 2.0 ×10 3 5 2 1.5 ×10 3 5 2 1.0 ×10 3 5 2 0.5 ×10 3 5 2 0.0 ×10 3

Warmup Ratio:

4 2 3.0 ×100 4 2 2.5 ×100 4 2 2.0 ×100 4 2 1.5 ×100 4 2 1.0 ×100 4 2 0.5 ×100 4 2 0.0 ×100

APPENDIX A PROOF OF THEOREM 2:

Proof. We analyze the convergence of LARS for general minibatch size here. Recall that the update of LARS is the following

x (i) t+1 = x (i) t -η t φ( x (i) t ) g (i) t g (i) t , for all i ∈ [h].

Since the function f is L-smooth, we have the following:

EQUATION

The first inequality follows from the lipschitz continuous nature of the gradient. Let ∆

(i) t = g (i)

t -∇ i f (x t ). Then the above inequality can be rewritten in the following manner:

f (x t+1 ) ≤ f (x t ) -η t h i=1 φ( x (i) t ) ∇ i f (x t ) -η t h i=1 di j=1 φ( x (i) t ) × [∇ i f (x t )] j × (∆ (i) t,j + [∇ i f (x t )] j ) ∆ (i) t + ∇ i f (x t ) - [∇ i f (x t )] j ∇ i f (x t ) + η 2 t α 2 u 2 L 1 = f (x t ) -η t h i=1 φ( x (i) t ) ∇ i f (x t ) -η t h i=1 φ( x (i) t ) × ∆ (i) t + ∇ i f (x t ), ∇ i f (x t ) ∆ (i) t + ∇ i f (x t ) -∇ i f (x t ) + η 2 t α 2 u 2 L 1 = f (x t ) -η t h i=1 φ( x (i) t ) ∇ i f (x t ) + η t h i=1 φ( x (i) t ) × ∇ i f (x t ) ∆ (i) t + ∇ i f (x t ) -∆ (i) t + ∇ i f (x t ), ∇ i f (x t ) ∆ (i) t + ∇ i f (x t ) + η 2 t α 2 u 2 L 1 = f (x t ) -η t h i=1 φ( x (i) t ) ∇ i f (x t ) + η 2 t α 2 u 2 L 1 + η t h i=1 φ( x (i) t ) × ∇ i f (x t ) ∆ (i) t + ∇ i f (x t ) -∆ (i) t + ∇ i f (x t ) 2 + ∆ (i) t , ∆ (i) t + ∇ i f (x t ) ∆ (i) t + ∇ i f (x t )

.

(5) Using Cauchy-Schwarz inequality in the above inequality, we have:

f (x t+1 ) ≤ f (x t ) -η t h i=1 φ( x (i) t ) ∇ i f (x t ) + η t h i=1 φ( x (i) t ) × ∇ i f (x t ) -∆ (i) t + ∇ i f (x t ) + ∆ (i) t + η 2 t α 2 u 2 L 1 ≤ f (x t ) -η t h i=1 φ( x (i) t ) ∇ i f (x t ) + 2η t h i=1 φ( x (i) t ) × ∆ (i) t + η 2 t α 2 u 2 L 1

Taking expectation, we obtain the following:

EQUATION

Summing the above inequality for t = 1 to T and using telescoping sum, we have the following inequality:

E[f (x T +1 )] ≤ f (x 1 ) -ηα l T t=1 h i=1 E[ ∇ i f (x t ) ] + 2ηT α u σ 1 √ b + η 2 α 2 u T 2 L 1 .

Rearranging the terms of the above inequality, and dividing by ηT α l , we have:

1 T T t=1 h i=1 E[ ∇ i f (x t ) ] ≤ f (x 1 ) -E[f (x T +1 )] T ηα l + 2α u σ 1 √ bα l + ηα 2 u 2α l L 1 ≤ f (x 1 ) -f (x * ) T ηα l + 2α u σ 1 α l √ b + ηα 2 u 2α l L 1 .

B PROOF OF THEOREM 3:

Proof. We analyze the convergence of LAMB for general minibatch size here. Recall that the update of LAMB is the following

x (i) t+1 = x (i) t -η t φ( x (i) t ) r (i) t r (i) t , for all i ∈ [h].

For simplicity of notation, we reason the Since the function f is L-smooth, we have the following:

EQUATION

The above inequality simply follows from the lipschitz continuous nature of the gradient. We bound term T 1 in the following manner:

EQUATION

This follows from the fact that r

(i) t ≤ di 1-β2 and √ v t ≤ G. If β 2 = 0, then T 1 can be bounded

as follows:

T 1 ≤ -η t h i=1 di j=1 1 d i φ( x (i) t ) × |[∇ i f (x t )] j | -η t h i=1 di j=1 φ( x (i) t ) × [∇ i f (x t )] j × r (i) t,j r (i) t 1(sign(∇ i f (x t )] j ) = sign(r (i) t,j

))

The rest of the proof for β 2 = 0 is similar to argument for the case β 2 > 0, which is shown below.

Taking expectation, we have the following:

E[T 1 ] ≤ -η t h i=1 di j=1 1 -β 2 G 2 d i E φ( x (i) t ) × [∇ i f (x t )] j × g (i) t,j -η t h i=1 di j=1 E φ( x (i) t ) × [∇ i f (x t )] j × r (i) t,j r (i) t 1(sign(∇ i f (x t )] j ) = sign(g (i) t,j )) ≤ -η t h i=1 di j=1 1 -β 2 G 2 d i E φ( x (i) t ) × [∇ i f (x t )] j × g (i) t,j + η t h i=1 di j=1 E α u |[∇ i f (x t )] j |1(sign(∇ i f (x t )] j ) = sign(g (i) t,j )) ≤ -η t h i=1 di j=1 1 -β 2 G 2 d i E φ( x (i) t ) × [∇ i f (x t )] j × g (i) t,j + η t h i=1 di j=1 α u |[∇ i f (x t )] j |P(sign(∇ i f (x t )] j ) = sign(g (i) t,j ))

Using the bound on the probability that the signs differ, we get:

E[T 1 ] ≤ -η t α l h(1 -β 2 ) G 2 d ∇f (x t ) 2 + η t α u h i=1 di j=1 σ i,j √ b .

Substituting the above bound on T 1 in equation 7, we have the following bound:

E[f (x t+1 )] ≤ f (x t ) -η t α l h(1 -β 2 ) G 2 d ∇f (x t ) 2 + η t α u σ 1 √ b + η 2 t α 2 u L 1 2 (9)

Summing the above inequality for t = 1 to T and using telescoping sum, we have the following inequality:

E[f (x T +1 )] ≤ f (x 1 ) -η t α l h(1 -β 2 ) G 2 d T t=1 E[ ∇f (x t ) 2 ] + ηT α u σ 1 √ b + η 2 α 2 u T 2 L 1 . Algorithm 3 N-LAMB Input: x1 ∈ R d , learning rate {ηt} T t=1 , parame- ters 0 < β1, β2 < 1, scaling function φ, > 0, parameters 0 < {β t 1 } T t=1 < 1 Set m0 = 0, v0 = 0 for t = 1 to T do Draw b samples St from P. Compute gt = 1 |S t | s t ∈S t ∇ (xt, st). mt = β1mt-1 + (1 -β1)gt m = β t+1 1 m t 1-Π t+1 i=1 β i 1 + (1-β t 1 )g t 1-Π t i=1 β i 1 vt = β2vt-1 + (1 -β2)g 2 t v = β 2 v t 1-β t 2 Compute ratio rt = m √ v+ x (i) t+1 = x (i) t -ηt φ( x (i) t ) r (i) t +λx (i) t (r (i) t + λxt) end for Algorithm 4 NN-LAMB Input: x1 ∈ R d , learning rate {ηt} T t=1 , parameters 0 < β1, β2 < 1, scaling function φ, > 0, parame- ters 0 < {β t 1 } T t=1 < 1 Set m0 = 0, v0 = 0 for t = 1 to T do Draw b samples St from P. Compute gt = 1 |S t | s t ∈S t ∇ (xt, st). mt = β1mt-1 + (1 -β1)gt m = β t+1 1 m t 1-Π t+1 i=1 β i 1 + (1-β t 1 )g t 1-Π t i=1 β i 1 vt = β2vt-1 + (1 -β2)g 2 t v = β t+1 2 v t 1-Π t+1 i=1 β i 2 + (1-β t 2 )g 2 t 1-Π t i=1 β i 2 Compute ratio rt = m √ v+ x (i) t+1 = x (i) t -ηt φ( x (i) t ) r (i) t +λx (i) t (r (i) t + λxt) end for

Rearranging the terms of the above inequality, and dividing by ηT α l , we have:

h(1 -β 2 ) G 2 d 1 T T t=1 E[ ∇f (x t ) 2 ] ≤ f (x 1 ) -E[f (x T +1 )] T ηα l + α u σ 1 α l √ b + η 2 L 1 ≤ f (x 1 ) -f (x * ) T ηα l + α u σ 1 α l √ b + ηα 2 u 2α l L 1 .

C COMPARISON OF CONVERGENCE RATES OF LARS AND SGD:

Inspired by the comparison used by (Bernstein et al., 2018) for comparing SIGN SGD with SGD, we define the following quantities:

h i=1 ∇ i f (x t ) 2 = ψ(∇f (x t ))d ∇f (x t ) 2 h ≥ ψ g d ∇f (x t ) 2 h L 2 1 ≤ ψ L d 2 L 2 ∞ h 2 σ 2 1 = ψ σ d σ 2 h .

Then LARS convergence rate can be written in the following manner:

(E[ ∇f (x a ) ) 2 ≤ O (f (x 1 ) -f (x * ))L ∞ T ψ L ψ 2 g + σ 2 T ψ 2 σ ψ 2 g .

If ψ L ψ 2 g and ψ σ ψ 2 g then LARS (i.e., gradient is more denser than curvature or stochasticity), we gain over SGD. Otherwise, SGD's upper bound on convergence rate is better. D N-LAMB: NESTEROV MOMENTUM FOR LAMB Sutskever et al. (2013) report that Nesterov's accelerated gradient (NAG) proposed by Nesterov ( 1983) is conceptually and empirically better than the regular momentum method for convex, non-stochastic objectives. Dozat (2016) incorporated Nesterov's momentum into Adam optimizer and proposed the Nadam optimizer. Specifically, only the first moment of Adam was modified and the second moment of Adam was unchanged. The results on several applications (Word2Vec, Image Recognition, Figure 1 : This figure shows N-LAMB and NN-LAMB can achieve a comparable accuracy compared to LAMB optimizer. Their performances are much better than momentum solver. The result of momentum optimizer was reported by Goyal et al. (2017) . For Nadam, we use the learning rate recipe of (Goyal et al., 2017) : (1) 5-epoch warmup to stablize the initial stage; and (2) multiply the learning rate by 0.1 at 30th, 60th, and 80th epoch. The target accuracy is around 0.763 (Goyal et al., 2017) . We also tuned the learning rate of Nadam in {1e-4, 2e-4, ..., 9e-4, 1e-3, 2e-3, ..., 9e-3, 1e-2}. and LSTM Language Model) showed that Nadam optimizer improves the speed of convergence and the quality of the learned models. We also tried using Nesterov's momentum to replace the regular momentum of LAMB optimizer's first moment. In this way, we got a new algorithm named as N-LAMB (Nesterov LAMB). The complete algorithm is in Algorithm 3. We can also Nesterov's momentum to replace the regular momentum of LAMB optimizer's second moment. We refer to this algorithm as NN-LAMB (Nesterov's momentum for both the first moment and the second moment). The details of NN-LAMB were shown in Algorithm 4. Dozat (2016) suggested the best performance of Nadam was achieved by β 1 = 0.975, β 2 = 0.999, and = 1e-8. We used the same settings for N-LAMB and NN-LAMB. We scaled the batch size to 32K for ImageNet training with ResNet-50. Our experimental results show that N-LAMB and NN-LAMB can achieve a comparable accuracy compared to LAMB optimizer. Their performances are much better than momentum solver (Figure 1 ).

E LAMB WITH LEARNING RATE CORRECTION:

There are two operations at each iteration in original Adam optimizer (let us call it adam-correction):

m t = m t /(1 -β t 1 ) v t = v t /(1 -β t

2 ) It has an impact on the learning rate by η t := η t * (1 -β t

2 )/(1 -β t 1 ). According to our experimental results, adam-correction essentially has the same effect as learning rate warmup (see Figure 2 ). The warmup function often was implemented in the modern deep learning system. Thus, we can remove adam-correction from the LAMB optimizer. We did not observe any drop in the test or validation accuracy for BERT and ImageNet training.

F LAMB WITH DIFFERENT NORMS:

We need to compute the matrix/tensor norm for each layer when we do the parameter updating in the LAMB optimizer. We tried different norms in LAMB optimizer. However, we did not observe a significant difference in the validation accuracy of ImageNet training with ResNet-50. In our experiments, the difference in validation accuracy is less than 0.1 percent (Figure 3 ). We use L2 norm as the default. G REGULAR BATCH SIZES FOR SMALL DATASETS: MNIST AND CIFAR-10.

According to DAWNBench, DavidNet (a custom 9-layer Residual ConvNet) is the fastest model for CIFAR-10 dataset (as of April 1st, 2019)5 . The baseline uses the momentum SGD optimizer. Table 6 and Figure 4 show the test accuracy of CIFAR-10 training with DavidNet. The PyTorch implementation (momentum SGD optimizer) on GPUs was reported on Standford DAWNBench's website, which achieves 94.06% in 24 epochs. The Tensorflow implementation (momentum SGD optimizer) on TPU achieves a 93.72% accuracy in 24 epochs6 . We use the implementation of TensorFlow on TPUs. LAMB optimizer is able to achieve 94.08% test accuracy in 24 epochs, which is better than other adaptive optimizers and momentum SGD. Even on the smaller tasks like MNIST training with LeNet, LAMB is able to achieve a better accuracy than existing solvers (Table 7 ).

H IMPLEMENTATION DETAILS AND ADDITIONAL RESULTS:

There are several hyper-parameters in LAMB optimizer. Although users do not need to tune them, we explain them to help users to have a better understanding. β 1 is used for decaying the running average of the gradient. β 2 is used for decaying the running average of the square of gradient. The default setting for other parameters: weight decay rate λ=0.01, β 1 =0.9, β 2 =0.999, =1e-6. We did not tune β 1 and β 2 . However, our experiments show that tuning them may get a higher accuracy.

Figure 4 : LAMB is better than the existing solvers (batch size = 512). We make sure all the solvers are carefully tuned. The learning rate tuning space of Adam, AdamW, Adagrad and LAMB is {0.0001, 0.0002, 0.0004, 0.0006, 0.0008, 0.001, 0.002, 0.004, 0.006, 0.008, 0.01, 0.02, 0.04, 0.06, 0.08, 0.1, 0.2, 0.4, 0.6, 0.8, 1, 2, 4, 6, 8, 10, 15, 20, 25, 30, 35, 40, 45, 50} . The momentum optimizer was tuned by the baseline implementer. The weight decay term of AdamW was tuned by {0.0001, 0.001, 0.01, 0.1, 1.0}.

Table 6 : CIFAR-10 training with DavidNet (batch size = 512). All of them run 24 epochs and finish the training under one minute on one cloud TPU. We make sure all the solvers are carefully tuned. The learning rate tuning space of Adam, AdamW, Adagrad and LAMB is {0.0001, 0.0002, 0.0004, 0.0006, 0.0008, 0.001, 0.002, 0.004, 0.006, 0.008, 0.01, 0.02, 0.04, 0.06, 0.08, 0.1, 0.2, 0.4, 0.6, 0.8, 1, 2, 4, 6, 8, 10, 15, 20, 25, 30, 35, 40, 45 Based on our experience, learning rate is the most important hyper-parameter that affects the learning efficiency and final accuracy. Bengio (2012) suggests that it is often the single most important hyper-parameter and that it always should be tuned. Thus, to make sure we have a solid baseline, we carefully tune the learning rate of ADAM, ADAMW, ADAGRAD, and momentum SGD

In our experiments, we found that the validation loss is not reliable for large-batch training. A lower validation loss does not necessarily lead to a higher validation accuracy (Figure 5 ). Thus, we use the test/val accuracy or F1 score on dev set to evaluate the optimizers.

H.0.1 BERT:

Table 8 shows some of the tuning information from BERT training with ADAMW optimizer. ADAMW stops scaling at the batch size of 16K. The target F1 score is 90.5. LAMB achieves a F1 score of 91.345. The table shows the tuning information of ADAMW. In Table 8 , we report the best F1 score we observed from our experiments.

The loss curves of BERT training by LAMB for different batch sizes are shown in Figure 6 . We observe that the loss curves are almost identical to each other, which means our optimizer scales well with the batch size.

The training loss curve of BERT mixed-batch pre-training with LAMB is shown in Figure 7 . This figure shows that LAMB can make the training converge smoothly at the batch size of 64K. From these figures we can see that these ratios are very different from each other for different layers.

LAMB uses the trust ratio to help the slow learners to train faster. (2) multiply the learning rate by 0.1 at 30th, 60th, and 80th epoch. The target accuracy is around 76.3% (Goyal et al., 2017) . There techniques help to improve the accuracy of Adam/AdamW/AdaGrad to around 73%. However, even with these techniques, Adam/AdamW/AdaGrad stil can not achieve the target validation accuracy.

To make sure our baseline is solid, we carefully tuned the hyper-parameters. Table 9 shows the tuning information of standard Adagrad. Table 10 shows the tuning information of adding the learning rate scheme of Goyal et al. (2017) to standard Adagrad. Table 11 shows the tuning information of standard Adam. Table shows the tuning information of adding the learning rate scheme of Goyal et al. (2017) to standard Adam. It is tricky to tune the AdamW optimizer since both the L2 regularization and weight decay have the effect on the performance. Thus we have four tuning sets.

The first tuning set is based on AdamW with default L2 regularization. We tune the learning rate and weight decay. The tuning information is in Figures 13, 14, 15, and 16.

The second tuning set is based on AdamW with disabled L2 regularization. We tune the learning rate and weight decay. The tuning information is in Figures 17, 18, 19, and 20 .

Then we add the learning rate scheme of Goyal et al. (2017) to AdamW and refer to it as AdamW+.

The third tuning set is based on AdamW+ with default L2 regularization. We tune the learning rate and weight decay. The tuning information is Figure 21 and 22.

The fourth tuning set is based on AdamW+ with disabled L2 regularization. We tune the learning rate and weight decay. The tuning information is in Figures 23, 24, 25. Figure 12: The LAMB trust ratio.

Figure 13 : The LAMB trust ratio. 

:

https://github.com/tensorflow/addons/blob/master/tensorflow_addons/ optimizers/lamb.py

https://rajpurkar.github.io/SQuAD-explorer/

Pre-trained BERT model can be downloaded from https://github.com/google-research/bert

https://mlperf.org/

https://dawn.cs.stanford.edu/benchmark/CIFAR10/train.html

https://github.com/fenwickslab/dl_tutorials/blob/master/tutorial3_cifar10_davidnet_fix.ipynb

Figures and Tables:

Figure 2: The figure shows that adam-correction has the same effect as learning rate warmup. We removed adam-correction from the LAMB optimizer. We did not observe any drop in the test or validation accuracy for BERT and ImageNet training.

Figure 3: We tried different norms in LAMB optimizer. However, we did not observe a significant difference in the validation accuracy of ImageNet training with ResNet-50. We use L2 norm as the default.

, 50}. The momentum optimizer was tuned by the baseline implementer. The weight decay term of AdamW was tuned by {0.0001, 0.001, 0.01, 0.1, 1

Figure8shows that we can achieve 76.8% scaling efficiency by scaling the batch size (49.1 times speedup by 64 times computational resources) and 101.8% scaling efficiency with mixed-batch (65.2 times speedup by 64 times computational resources)

Figure 5: Our experiments show that even the validation loss is not reliable in the large-scale training. A lower validation loss may lead to a worse accuracy. Thus, we use the test/val accuracy or F1 score on dev set to evaluate the optimizers.

Figure 6: This figure shows the training loss curve of LAMB optimizer. We just want to use this figure to show that LAMB can make the training converge smoothly. Even if we scale the batch size to the extremely large cases, the loss curves are almost identical to each other.Based on our comprehensive tuning results, we conclude the existing adaptive solvers do not perform well on ImageNet training or at least it is hard to tune them.

Figure 7: This figure shows the training loss curve of LAMB optimizer. This figure shows that LAMB can make the training converge smoothly at the extremely large batch size (e.g. 64K).

Figure 8: We achieve 76.8% scaling efficiency (49 times speedup by 64 times computational resources) and 101.8% scaling efficiency with a mixed, scaled batch size (65.2 times speedup by 64 times computational resources). 1024-mixed means the mixed-batch training on 1024 TPUs.

Figure 9: The LAMB trust ratio.

Figure 10: The LAMB trust ratio.

Figure 11: The LAMB trust ratio.

Figure 14: The LAMB trust ratio.

The data in this table is collected from the untuned version.

Table content: <table><tr><td>Solver</td><td colspan="4">batch size steps F1 score on dev set TPUs</td><td>Time</td></tr><tr><td>Baseline</td><td>512</td><td>1000k</td><td>90.395</td><td>16</td><td>81.4h</td></tr><tr><td>LAMB</td><td>512</td><td>1000k</td><td>91.752</td><td>16</td><td>82.8h</td></tr><tr><td>LAMB</td><td>1k</td><td>500k</td><td>91.761</td><td>32</td><td>43.2h</td></tr><tr><td>LAMB</td><td>2k</td><td>250k</td><td>91.946</td><td>64</td><td>21.4h</td></tr><tr><td>LAMB</td><td>4k</td><td>125k</td><td>91.137</td><td>128</td><td>693.6m</td></tr><tr><td>LAMB</td><td>8k</td><td>62500</td><td>91.263</td><td>256</td><td>390.5m</td></tr><tr><td>LAMB</td><td>16k</td><td>31250</td><td>91.345</td><td>512</td><td>200.0m</td></tr><tr><td>LAMB</td><td>32k</td><td>15625</td><td>91.475</td><td colspan="2">1024 101.2m</td></tr><tr><td>LAMB</td><td>64k/32k</td><td>8599</td><td>90.584</td><td colspan="2">1024 76.19m</td></tr></table>

LAMB achieves a higher performance (F1 score) than LARS for all the batch sizes. The baseline achieves a F1 score of 90.390. Thus, LARS stops scaling at the batch size of 16K.

Table content: <table><tr><td>Batch Size</td><td>512</td><td>1K</td><td>2K</td><td>4K</td><td>8K</td><td>16K</td><td>32K</td></tr><tr><td>LARS</td><td colspan="7">90.717 90.369 90.748 90.537 90.548 89.589 diverge</td></tr><tr><td>LAMB</td><td colspan="7">91.752 91.761 91.946 91.137 91.263 91.345 91.475</td></tr><tr><td colspan="4">4.2 IMAGENET TRAINING WITH RESNET-50.</td><td/><td/><td/><td/></tr></table>

by ADAM(Kingma & Ba, 2014), ADAGRAD, or ADAMW optimizer. In our experiments, even with comprehensive hyper-parameter tuning, ADAGRAD/ADAM/ADAMW (with batch size 16K) only achieves 55.38%/66.04%/67.27% top-1 accuracy. After adding learning rate scheme ofGoyal et al. (2017), the top-1 accuracy of ADAGRAD/ADAM/ADAMW was improved to 72.0%/73.48%/73.07%. However, they are still much lower than 76.3%. The details of the tuning information are in the Appendix. Table3shows that LAMB can achieve the target accuracy. Beyond a batch size of 8K, LAMB's accuracy is higher than the momentum. LAMB's accuracy is also slightly better than LARS. At a batch size of 32K, LAMB achieves 76.4% top-1 accuracy while LARS achieves 76.3%. At a batch size of 2K, LAMB is able to achieve 77.11% top-1 accuracy while LARS achieves 76.6%. Top-1 validation accuracy of ImageNet/RESNET-50 training at the batch size of 16K (90 epochs). The performance of momentum was reported by(Goyal et al., 2017). + means adding the learning rate scheme ofGoyal et al. (2017) to the optimizer: (1) 5-epoch warmup to stablize the initial stage; and (2) multiply the learning rate by 0.1 at 30th, 60th, and 80th epoch. The target accuracy is around 0.763(Goyal et al., 2017). All the adaptive solvers were comprehensively tuned.

Table content: <table><tr><td>The tuning</td></tr></table>

Untuned LAMB for ImageNet training with RESNET-50 for different batch sizes (90 epochs). We use square root LR scaling and linear-epoch warmup. The baseline Goyal et al. (2017) gets 76.3% top-1 accuracy in 90 epochs. Stanford DAWN Bench(Coleman et al., 2017) baseline achieves 93% top-5 accuracy. LAMB achieves both of them. LAMB can achieve an even higher accuracy if we manually tune the hyperparameters.

Table content: <table><tr><td/><td>1</td><td>1</td><td>1</td><td>1</td><td>1</td><td>1</td><td>1</td></tr><tr><td/><td>320</td><td>160</td><td>80</td><td>40</td><td>20</td><td>10</td><td>5</td></tr><tr><td>F1 score</td><td>91.752</td><td>91.761</td><td>91.946</td><td>91.137</td><td>91.263</td><td>91.345</td><td>91.475</td></tr><tr><td>Exact Match</td><td>85.090</td><td>85.260</td><td>85.355</td><td>84.172</td><td>84.901</td><td>84.816</td><td>84.939</td></tr><tr><td>Batch Size</td><td>512</td><td>1K</td><td>2K</td><td>4K</td><td>8K</td><td>16K</td><td>32K</td></tr><tr><td>Learning Rate</td><td/><td/><td/><td/><td/><td/><td/></tr></table>

Furthermore, LAMB is a general purpose optimizer that works for both small and large batches. We also provided theoretical analysis for the LAMB optimizer, highlighting the cases where it performs better than standard SGD. LAMB achieves a better performance than existing optimizers for a wide range of applications. By using LAMB, we are able to scale the batch size of BERT pre-training to 64K without losing accuracy, thereby, reducing the BERT training time from 3 days to around 76 minutes. LAMB is also the first large batch adaptive solver that can achieve state-of-the-art accuracy on ImageNet training with RESNET-50.

Table content: <table><tr><td>Warmup Epochs</td><td>0.3125</td><td>0.625</td><td>1.25</td><td>2.5</td><td>5</td><td>10</td><td>20</td></tr><tr><td>Top-5 Accuracy</td><td>0.9335</td><td>0.9349</td><td>0.9353</td><td>0.9332</td><td>0.9331</td><td>0.9322</td><td>0.9308</td></tr><tr><td>Top-1 Accuracy</td><td>0.7696</td><td>0.7706</td><td>0.7711</td><td>0.7692</td><td>0.7689</td><td>0.7666</td><td>0.7642</td></tr><tr><td colspan="2">5 CONCLUSION</td><td/><td/><td/><td/><td/><td/></tr></table>

Test Accuracy by MNIST training with LeNet (30 epochs for Batch Size = 1024). The tuning space of learning rate for all the optimizers is {0.0001, 0.001, 0.01, 0.1}. We use the same learning rate warmup and decay schedule for all of them.

Table content: <table><tr><td>Optimizer</td><td colspan="5">Momentum Addgrad ADAM ADAMW LAMB</td></tr><tr><td>Average accuracy over 5 runs</td><td>0.9933</td><td>0.9928</td><td>0.9936</td><td>0.9941</td><td>0.9945</td></tr></table>

ADAMW stops scaling at the batch size of 16K. The target F1 score is 90.5. LAMB achieves a F1 score of 91.345. The table shows the tuning information of ADAMW. In this table, we report the best F1 score we observed from our experiments.

Table content: <table><tr><td>Solver</td><td colspan="2">batch size warmup steps</td><td>LR</td><td>last step infomation</td><td>F1 score on dev set</td></tr><tr><td>ADAMW</td><td>16K</td><td colspan="3">0.05×31250 0.0001 loss=8.04471, step=28126</td><td>diverged</td></tr><tr><td>ADAMW</td><td>16K</td><td colspan="3">0.05×31250 0.0002 loss=7.89673, step=28126</td><td>diverged</td></tr><tr><td>ADAMW</td><td>16K</td><td colspan="3">0.05×31250 0.0003 loss=8.35102, step=28126</td><td>diverged</td></tr><tr><td>ADAMW</td><td>16K</td><td colspan="3">0.10×31250 0.0001 loss=2.01419, step=31250</td><td>86.034</td></tr><tr><td>ADAMW</td><td>16K</td><td colspan="3">0.10×31250 0.0002 loss=1.04689, step=31250</td><td>88.540</td></tr><tr><td>ADAMW</td><td>16K</td><td colspan="3">0.10×31250 0.0003 loss=8.05845, step=20000</td><td>diverged</td></tr><tr><td>ADAMW</td><td>16K</td><td colspan="3">0.20×31250 0.0001 loss=1.53706, step=31250</td><td>85.231</td></tr><tr><td>ADAMW</td><td>16K</td><td colspan="3">0.20×31250 0.0002 loss=1.15500, step=31250</td><td>88.110</td></tr><tr><td>ADAMW</td><td>16K</td><td colspan="3">0.20×31250 0.0003 loss=1.48798, step=31250</td><td>85.653</td></tr></table>

The accuracy information of tuning default AdaGrad optimizer for ImageNet training with ResNet-50 (batch size = 16384, 90 epochs, 7038 iterations).

Table content: <table><tr><td colspan="2">Learning Rate Top-1 Validation Accuracy</td></tr><tr><td>0.0001</td><td>0.0026855469</td></tr><tr><td>0.001</td><td>0.015563965</td></tr><tr><td>0.002</td><td>0.022684732</td></tr><tr><td>0.004</td><td>0.030924479</td></tr><tr><td>0.008</td><td>0.04486084</td></tr><tr><td>0.010</td><td>0.054158527</td></tr><tr><td>0.020</td><td>0.0758667</td></tr><tr><td>0.040</td><td>0.1262614</td></tr><tr><td>0.080</td><td>0.24037679</td></tr><tr><td>0.100</td><td>0.27357993</td></tr><tr><td>0.200</td><td>0.458313</td></tr><tr><td>0.400</td><td>0.553833</td></tr><tr><td>0.800</td><td>0.54103595</td></tr><tr><td>1.000</td><td>0.5489095</td></tr><tr><td>2.000</td><td>0.47680664</td></tr><tr><td>4.000</td><td>0.5295207</td></tr><tr><td>6.000</td><td>0.36950684</td></tr><tr><td>8.000</td><td>0.31081137</td></tr><tr><td>10.00</td><td>0.30670166</td></tr><tr><td>12.00</td><td>0.3091024</td></tr><tr><td>14.00</td><td>0.3227946</td></tr><tr><td>16.00</td><td>0.0063680015</td></tr><tr><td>18.00</td><td>0.11287435</td></tr><tr><td>20.00</td><td>0.21602376</td></tr><tr><td>30.00</td><td>0.08315023</td></tr><tr><td>40.00</td><td>0.0132039385</td></tr><tr><td>50.00</td><td>0.0009969076</td></tr></table>

The accuracy information of tuning AdaGrad optimizer for ImageNet training with ResNet-50 (batch size = 16384, 90 epochs, 7038 iterations). We use the learning rate recipe of(Goyal et al., 2017): (1) 5-epoch warmup to stablize the initial stage; and (2) multiply the learning rate by 0.1 at 30th, 60th, and 80th epoch. The target accuracy is around 0.763(Goyal et al., 2017).

Table content: <table><tr><td colspan="2">Learning Rate Top-1 Validation Accuracy</td></tr><tr><td>0.0001</td><td>0.0011189779</td></tr><tr><td>0.001</td><td>0.00793457</td></tr><tr><td>0.002</td><td>0.012573242</td></tr><tr><td>0.004</td><td>0.019022623</td></tr><tr><td>0.008</td><td>0.027079264</td></tr><tr><td>0.010</td><td>0.029012045</td></tr><tr><td>0.020</td><td>0.0421346</td></tr><tr><td>0.040</td><td>0.06618246</td></tr><tr><td>0.080</td><td>0.10970052</td></tr><tr><td>0.100</td><td>0.13429768</td></tr><tr><td>0.200</td><td>0.26550293</td></tr><tr><td>0.400</td><td>0.41918945</td></tr><tr><td>0.800</td><td>0.5519816</td></tr><tr><td>1.000</td><td>0.58614093</td></tr><tr><td>2.000</td><td>0.67252606</td></tr><tr><td>4.000</td><td>0.70306396</td></tr><tr><td>6.000</td><td>0.709493</td></tr><tr><td>8.000</td><td>0.7137858</td></tr><tr><td>10.00</td><td>0.71797687</td></tr><tr><td>12.00</td><td>0.7187703</td></tr><tr><td>14.00</td><td>0.72007245</td></tr><tr><td>16.00</td><td>0.7194214</td></tr><tr><td>18.00</td><td>0.7149251</td></tr><tr><td>20.00</td><td>0.71293133</td></tr><tr><td>30.00</td><td>0.70458984</td></tr><tr><td>40.00</td><td>0.69085693</td></tr><tr><td>50.00</td><td>0.67976886</td></tr></table>

The accuracy information of tuning default Adam optimizer for ImageNet training with ResNet-50 (batch size = 16384, 90 epochs, 7038 iterations). The target accuracy is around 0.763(Goyal et al., 2017).

Table content: <table><tr><td colspan="2">Learning Rate Top-1 Validation Accuracy</td></tr><tr><td>0.0001</td><td>0.5521</td></tr><tr><td>0.0002</td><td>0.6089</td></tr><tr><td>0.0004</td><td>0.6432</td></tr><tr><td>0.0006</td><td>0.6465</td></tr><tr><td>0.0008</td><td>0.6479</td></tr><tr><td>0.001</td><td>0.6604</td></tr><tr><td>0.002</td><td>0.6408</td></tr><tr><td>0.004</td><td>0.5687</td></tr><tr><td>0.006</td><td>0.5165</td></tr><tr><td>0.008</td><td>0.4812</td></tr><tr><td>0.010</td><td>0.3673</td></tr></table>

The accuracy information of tuning Adam optimizer for ImageNet training with ResNet-50 (batch size = 16384, 90 epochs, 7038 iterations). We use the learning rate recipe of(Goyal et al.,

Table content: <table><tr><td colspan="2">2017): (1) 5-epoch warmup to stablize the initial stage; and (2) multiply the learning rate by 0.1 at</td></tr><tr><td colspan="2">30th, 60th, and 80th epoch. The target accuracy is around 0.763 (Goyal et al., 2017).</td></tr><tr><td colspan="2">Learning Rate Top-1 Validation Accuracy</td></tr><tr><td>0.0001</td><td>0.410319</td></tr><tr><td>0.0002</td><td>0.55263263</td></tr><tr><td>0.0004</td><td>0.6455485</td></tr><tr><td>0.0006</td><td>0.6774495</td></tr><tr><td>0.0008</td><td>0.6996867</td></tr><tr><td>0.001</td><td>0.71010333</td></tr><tr><td>0.002</td><td>0.73476154</td></tr><tr><td>0.004</td><td>0.73286945</td></tr><tr><td>0.006</td><td>0.72648114</td></tr><tr><td>0.008</td><td>0.72214764</td></tr><tr><td>0.010</td><td>0.71466064</td></tr><tr><td>0.012</td><td>0.7081502</td></tr><tr><td>0.014</td><td>0.6993001</td></tr><tr><td>0.016</td><td>0.69108075</td></tr><tr><td>0.020</td><td>0.67997235</td></tr><tr><td>0.040</td><td>0.58658856</td></tr><tr><td>0.060</td><td>0.51090497</td></tr><tr><td>0.080</td><td>0.45174155</td></tr><tr><td>0.100</td><td>0.40297446</td></tr></table>

The accuracy information of tuning AdamW optimizer for ImageNet training with ResNet-50 (batch size = 16384, 90 epochs, 7038 iterations). We use the learning rate recipe of(Goyal et al., 2017): (1) 5-epoch warmup to stablize the initial stage; and (2) multiply the learning rate by 0.1 at 30th, 60th, and 80th epoch. The target accuracy is around 0.763(Goyal et al., 2017).

Table content: <table><tr><td colspan="4">learning rate weight decay L2 regularization Top-1 Validation Accuracy</td></tr><tr><td>0.0001</td><td>0.01</td><td>default (0.01)</td><td>0.0009969076</td></tr><tr><td>0.0002</td><td>0.01</td><td>default (0.01)</td><td>0.0009969076</td></tr><tr><td>0.0004</td><td>0.01</td><td>default (0.01)</td><td>0.0009969076</td></tr><tr><td>0.0006</td><td>0.01</td><td>default (0.01)</td><td>0.0009358724</td></tr><tr><td>0.0008</td><td>0.01</td><td>default (0.01)</td><td>0.0009969076</td></tr><tr><td>0.001</td><td>0.01</td><td>default (0.01)</td><td>0.0009765625</td></tr><tr><td>0.002</td><td>0.01</td><td>default (0.01)</td><td>0.0010172526</td></tr><tr><td>0.004</td><td>0.01</td><td>default (0.01)</td><td>0.0010172526</td></tr><tr><td>0.006</td><td>0.01</td><td>default (0.01)</td><td>0.0010172526</td></tr><tr><td>0.008</td><td>0.01</td><td>default (0.01)</td><td>0.0010172526</td></tr><tr><td>0.0001</td><td>0.001</td><td>default (0.01)</td><td>0.0010172526</td></tr><tr><td>0.0002</td><td>0.001</td><td>default (0.01)</td><td>0.0010172526</td></tr><tr><td>0.0004</td><td>0.001</td><td>default (0.01)</td><td>0.0010172526</td></tr><tr><td>0.0006</td><td>0.001</td><td>default (0.01)</td><td>0.0009969076</td></tr><tr><td>0.0008</td><td>0.001</td><td>default (0.01)</td><td>0.0010172526</td></tr><tr><td>0.001</td><td>0.001</td><td>default (0.01)</td><td>0.0010172526</td></tr><tr><td>0.002</td><td>0.001</td><td>default (0.01)</td><td>0.0010172526</td></tr><tr><td>0.004</td><td>0.001</td><td>default (0.01)</td><td>0.0038452148</td></tr><tr><td>0.006</td><td>0.001</td><td>default (0.01)</td><td>0.011881511</td></tr><tr><td>0.008</td><td>0.001</td><td>default (0.01)</td><td>0.0061442056</td></tr></table>

The accuracy information of tuning AdamW optimizer for ImageNet training with ResNet-50 (batch size = 16384, 90 epochs, 7038 iterations). We use the learning rate recipe of(Goyal et al., 2017): (1) 5-epoch warmup to stablize the initial stage; and (2) multiply the learning rate by 0.1 at 30th, 60th, and 80th epoch. The target accuracy is around 0.763(Goyal et al., 2017).learning rate weight decay L2 regularization Top-1 Validation Accuracy

Table content: <table><tr><td>0.0001</td><td>0.0001</td><td>default (0.01)</td><td>0.3665975</td></tr><tr><td>0.0002</td><td>0.0001</td><td>default (0.01)</td><td>0.5315755</td></tr><tr><td>0.0004</td><td>0.0001</td><td>default (0.01)</td><td>0.6369222</td></tr><tr><td>0.0006</td><td>0.0001</td><td>default (0.01)</td><td>0.6760457</td></tr><tr><td>0.0008</td><td>0.0001</td><td>default (0.01)</td><td>0.69557697</td></tr><tr><td>0.001</td><td>0.0001</td><td>default (0.01)</td><td>0.7076009</td></tr><tr><td>0.002</td><td>0.0001</td><td>default (0.01)</td><td>0.73065186</td></tr><tr><td>0.004</td><td>0.0001</td><td>default (0.01)</td><td>0.72806805</td></tr><tr><td>0.006</td><td>0.0001</td><td>default (0.01)</td><td>0.72161865</td></tr><tr><td>0.008</td><td>0.0001</td><td>default (0.01)</td><td>0.71816</td></tr><tr><td>0.0001</td><td>0.00001</td><td>default (0.01)</td><td>0.49804688</td></tr><tr><td>0.0002</td><td>0.00001</td><td>default (0.01)</td><td>0.6287028</td></tr><tr><td>0.0004</td><td>0.00001</td><td>default (0.01)</td><td>0.6773885</td></tr><tr><td>0.0006</td><td>0.00001</td><td>default (0.01)</td><td>0.67348224</td></tr><tr><td>0.0008</td><td>0.00001</td><td>default (0.01)</td><td>0.6622111</td></tr><tr><td>0.001</td><td>0.00001</td><td>default (0.01)</td><td>0.6468709</td></tr><tr><td>0.002</td><td>0.00001</td><td>default (0.01)</td><td>0.5846761</td></tr><tr><td>0.004</td><td>0.00001</td><td>default (0.01)</td><td>0.4868978</td></tr><tr><td>0.006</td><td>0.00001</td><td>default (0.01)</td><td>0.34969077</td></tr><tr><td>0.008</td><td>0.00001</td><td>default (0.01)</td><td>0.31193033</td></tr></table>

The accuracy information of tuning AdamW optimizer for ImageNet training with ResNet-50 (batch size = 16384, 90 epochs, 7038 iterations). We use the learning rate recipe of(Goyal et al., 2017): (1) 5-epoch warmup to stablize the initial stage; and (2) multiply the learning rate by 0.1 at 30th, 60th, and 80th epoch. The target accuracy is around 0.763(Goyal et al., 2017).learning rate weight decay L2 regularization Top-1 Validation Accuracy

Table content: <table><tr><td>0.0001</td><td>0.01</td><td>disable</td><td>0.0010172526</td></tr><tr><td>0.0002</td><td>0.01</td><td>disable</td><td>0.0009765625</td></tr><tr><td>0.0004</td><td>0.01</td><td>disable</td><td>0.0010172526</td></tr><tr><td>0.0006</td><td>0.01</td><td>disable</td><td>0.0009969076</td></tr><tr><td>0.0008</td><td>0.01</td><td>disable</td><td>0.0010172526</td></tr><tr><td>0.001</td><td>0.01</td><td>disable</td><td>0.0009765625</td></tr><tr><td>0.002</td><td>0.01</td><td>disable</td><td>0.0009969076</td></tr><tr><td>0.004</td><td>0.01</td><td>disable</td><td>0.0009969076</td></tr><tr><td>0.006</td><td>0.01</td><td>disable</td><td>0.0009765625</td></tr><tr><td>0.008</td><td>0.01</td><td>disable</td><td>0.0010172526</td></tr><tr><td>0.0001</td><td>0.001</td><td>disable</td><td>0.0009765625</td></tr><tr><td>0.0002</td><td>0.001</td><td>disable</td><td>0.0010172526</td></tr><tr><td>0.0004</td><td>0.001</td><td>disable</td><td>0.0010172526</td></tr><tr><td>0.0006</td><td>0.001</td><td>disable</td><td>0.0010172526</td></tr><tr><td>0.0008</td><td>0.001</td><td>disable</td><td>0.0010172526</td></tr><tr><td>0.001</td><td>0.001</td><td>disable</td><td>0.0009969076</td></tr><tr><td>0.002</td><td>0.001</td><td>disable</td><td>0.0010579427</td></tr><tr><td>0.004</td><td>0.001</td><td>disable</td><td>0.0016886393</td></tr><tr><td>0.006</td><td>0.001</td><td>disable</td><td>0.019714355</td></tr><tr><td>0.008</td><td>0.001</td><td>disable</td><td>0.1329956</td></tr></table>

The accuracy information of tuning AdamW optimizer for ImageNet training with ResNet-50 (batch size = 16384, 90 epochs, 7038 iterations). We use the learning rate recipe of(Goyal et al., 2017): (1) 5-epoch warmup to stablize the initial stage; and (2) multiply the learning rate by 0.1 at 30th, 60th, and 80th epoch. The target accuracy is around 0.763(Goyal et al., 2017).learning rate weight decay L2 regularization Top-1 Validation Accuracy

Table content: <table><tr><td>0.0001</td><td>0.0001</td><td>disable</td><td>0.28515625</td></tr><tr><td>0.0002</td><td>0.0001</td><td>disable</td><td>0.44055176</td></tr><tr><td>0.0004</td><td>0.0001</td><td>disable</td><td>0.56815594</td></tr><tr><td>0.0006</td><td>0.0001</td><td>disable</td><td>0.6234741</td></tr><tr><td>0.0008</td><td>0.0001</td><td>disable</td><td>0.6530762</td></tr><tr><td>0.001</td><td>0.0001</td><td>disable</td><td>0.6695964</td></tr><tr><td>0.002</td><td>0.0001</td><td>disable</td><td>0.70048016</td></tr><tr><td>0.004</td><td>0.0001</td><td>disable</td><td>0.71698</td></tr><tr><td>0.006</td><td>0.0001</td><td>disable</td><td>0.72021484</td></tr><tr><td>0.008</td><td>0.0001</td><td>disable</td><td>0.7223918</td></tr><tr><td>0.010</td><td>0.0001</td><td>disable</td><td>0.72017413</td></tr><tr><td>0.012</td><td>0.0001</td><td>disable</td><td>0.72058105</td></tr><tr><td>0.014</td><td>0.0001</td><td>disable</td><td>0.7188924</td></tr><tr><td>0.016</td><td>0.0001</td><td>disable</td><td>0.71695966</td></tr><tr><td>0.018</td><td>0.0001</td><td>disable</td><td>0.7154134</td></tr><tr><td>0.020</td><td>0.0001</td><td>disable</td><td>0.71358234</td></tr><tr><td>0.025</td><td>0.0001</td><td>disable</td><td>0.7145386</td></tr><tr><td>0.030</td><td>0.0001</td><td>disable</td><td>0.7114258</td></tr><tr><td>0.040</td><td>0.0001</td><td>disable</td><td>0.7066447</td></tr><tr><td>0.050</td><td>0.0001</td><td>disable</td><td>0.70284015</td></tr></table>

The accuracy information of tuning AdamW optimizer for ImageNet training with ResNet-50 (batch size = 16384, 90 epochs, 7038 iterations). We use the learning rate recipe of(Goyal et al., 2017): (1) 5-epoch warmup to stablize the initial stage; and (2) multiply the learning rate by 0.1 at 30th, 60th, and 80th epoch. The target accuracy is around 0.763(Goyal et al., 2017).learning rate weight decay L2 regularization Top-1 Validation Accuracy

Table content: <table><tr><td>0.0001</td><td>0.00001</td><td>disable</td><td>0.31247965</td></tr><tr><td>0.0002</td><td>0.00001</td><td>disable</td><td>0.4534912</td></tr><tr><td>0.0004</td><td>0.00001</td><td>disable</td><td>0.57765704</td></tr><tr><td>0.0006</td><td>0.00001</td><td>disable</td><td>0.6277669</td></tr><tr><td>0.0008</td><td>0.00001</td><td>disable</td><td>0.65321857</td></tr><tr><td>0.001</td><td>0.00001</td><td>disable</td><td>0.6682129</td></tr><tr><td>0.002</td><td>0.00001</td><td>disable</td><td>0.69938153</td></tr><tr><td>0.004</td><td>0.00001</td><td>disable</td><td>0.7095947</td></tr><tr><td>0.006</td><td>0.00001</td><td>disable</td><td>0.710612</td></tr><tr><td>0.008</td><td>0.00001</td><td>disable</td><td>0.70857745</td></tr><tr><td>0.010</td><td>0.00001</td><td>disable</td><td>0.7094116</td></tr><tr><td>0.012</td><td>0.00001</td><td>disable</td><td>0.70717365</td></tr><tr><td>0.014</td><td>0.00001</td><td>disable</td><td>0.7109375</td></tr><tr><td>0.016</td><td>0.00001</td><td>disable</td><td>0.7058309</td></tr><tr><td>0.018</td><td>0.00001</td><td>disable</td><td>0.7052409</td></tr><tr><td>0.020</td><td>0.00001</td><td>disable</td><td>0.7064412</td></tr><tr><td>0.025</td><td>0.00001</td><td>disable</td><td>0.7035319</td></tr><tr><td>0.030</td><td>0.00001</td><td>disable</td><td>0.6994629</td></tr><tr><td>0.040</td><td>0.00001</td><td>disable</td><td>0.6972656</td></tr><tr><td>0.050</td><td>0.00001</td><td>disable</td><td>0.6971232</td></tr></table>

Peer review (iclr2020):
This paper developed a novel layerwise adaptation strategy, LAMB, that allows training BERT model with large mini-batches (32k vs baseline 512). This significantly speeds up the status quo in training BERT model, and effectively reduces the training time from original 3 days to only 76 minutes. In addition to demonstrating superior results across various tasks in practice, the paper also provides theoretical convergence analysis on LAMB optimizer. Overall, this paper has made sound contributions that enables BERT-alike language to be trained with significant speedups, which is not otherwise achievable through LARS. The paper is well written and structured. I recommend acceptance.