Machine learning algorithms aim to find patterns from observations, which may include some noise, especially in robotics domain. To perform well even with such noise, we expect them to be able to detect outliers and discard them when needed. We therefore propose a new stochastic gradient optimization method, whose robustness is directly built in the algorithm, using the robust student-t distribution as its core idea. Adam, the popular optimization method, is modified with our method and the resultant optimizer, so-called TAdam, is shown to effectively outperform Adam in terms of robustness against noise on diverse task, ranging from regression and classification to reinforcement learning problems. The implementation of our algorithm can be found at https://github.com/Mahoumaru/TAdam.git

## Authors

• 3 publications
• 14 publications
• 2 publications

Stochastic gradient algorithms have been the main focus of large-scale l...
12/23/2014 ∙ by Caglar Gulcehre, et al. ∙ 0

• ### PAL: A fast DNN optimization method based on curvature information

We present a novel optimizer for deep neural networks that combines the ...
03/28/2019 ∙ by Maximus Mutschler, et al. ∙ 0

• ### Towards Deep Robot Learning with Optimizer applicable to Non-stationary Problems

This paper proposes a new optimizer for deep learning, named d-AmsGrad. ...
07/31/2020 ∙ by Taisuke Kobayashi, et al. ∙ 0

• ### On stochastic gradient Langevin dynamics with dependent data streams in the logconcave case

Stochastic Gradient Langevin Dynamics (SGLD) is a combination of a Robbi...
12/06/2018 ∙ by M. Barkhagen, et al. ∙ 0

• ### Learning to Learn from Mistakes: Robust Optimization for Adversarial Noise

Sensitivity to adversarial noise hinders deployment of machine learning ...
08/12/2020 ∙ by Alex Serban, et al. ∙ 33

• ### A Stochastic Trust Region Algorithm

An algorithm is proposed for solving stochastic and finite sum minimizat...
12/29/2017 ∙ by Frank E. Curtis, et al. ∙ 0

• ### ClipUp: A Simple and Powerful Optimizer for Distribution-based Policy Evolution

Distribution-based search algorithms are an effective approach for evolu...
08/05/2020 ∙ by Nihat Engin Toklu, et al. ∙ 0

## Code Repositories

##### This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

## I Introduction

The field of machine learning is undoubtedly dominated by first-order optimization methods based on the gradient descent algorithm and particularly [1]

, its stochastic variant, the stochastic gradient descent (SGD) method

[2]

. The popularity of the SGD algorithm comes from its simplicity, its computational efficiency with respect to second-order methods, its applicability to online training and its convergence rate that is independent of the training set. In addition, SGD has high affinity with deep learning

[3]

, where network parameters are updated by backpropagation of their gradients, and is intensively used to train large deep neural networks.

Despite such established popularity, a specific trait of SGD is the inherent noise, coming from sampling training points. Even though this stochasticity makes the algorithm more likely to find a global minimum, those fluctuations also slow down the learning process and furthermore, render the algorithm sensitive to outliers. Indeed, bad estimates of the gradients are likely to produce bad estimation of the minimum.

Many of the new optimizers proposed to improve the SGD algorithm and tackle complex training scenarios where gradient descent methods behave poorly also share the same weakness to aberrant value. Adam (Adaptive moment estimates)

[4], one of the most widely used and practical optimizers for training deep learning models, is no exception. This is mainly due to the insufficient number of samples implicitly involved in its first moment evaluation.

The weakness to noisy data is particularly important in robotics learning where incomplete, ambiguous and noisy sensor data are inevitable. Furthermore, in order to generate large scale robot datasets for scaling up robot learning, the ability to use automatically labeled data [5] is important. Robust learning methods are therefore needed to deal with the eventual noisy labels and can improve the performance of low-cost robots that suffers from inaccurate position control and calibration and noisy executions, without the need of a noise modeling network [6].

Hence, the aim of the present research is to propose a robust version of Adam through the use of robust estimates of the momentum, which is assumed to be the first-order probabilistic moment of the gradients. The key idea for such robust estimates is the use of the student-t distribution, which is a model suitable for the estimates from a few samples [7].

## Ii Background and previous works

### Ii-a Background

Let be a random sample from the data set at iteration , the objective function evaluated on data with the parameters , its gradient, and the learning rate. The SGD algorithm [2] updates to through the following update rule:

 θt=θt−1−αgt (1)

This algorithm yields at least local minima of w.r.t .

##### Improving SGD

Since its proposition, many ideas have been developed in order to improve the convergence property of the SGD algorithm. This feature heavily connects to the fluctuations of the gradients during learning. All the research that aim to accelerate the convergence rate have done so through several approaches. For instance, they improved i) the update method of the parameters [8, 9, 10, 11]; ii) the adjustment of the learning rate [12, 13, 14, 15]; and iii) the robustness to aberrant values from heavy-tailed data [16, 17, 18, 19]

. Those approaches have culminated to some pretty effective state-of-the-art first-order optimization methods, going from the momentum idea to the adaptive learning rate and variance reduction schemes. Below, we review some of the works related to the robustness.

### Ii-B Previous works

As stated before, SGD is inherently noisy and susceptible to produce bad minima estimates when facing aberrant gradient estimates. A lot of work have therefore been done to propose more robust methods for efficient machine learning under noise or data with heavy tails.

In this review, we ignore the general statistical methods for robust mean estimates [20] such as the median based estimations [21, 22, 23] due to their practical limitations. Three main approaches are distinguished: a) methods based on direct robust estimates of the loss (or risk) function [24]; b) methods based on robust estimates of the gradients [25, 19] among which falls our algorithm; and c) methods with small learning rates for wrong gradient estimates [18].

##### Robust risk estimation

Those methods usually require the use of all the available data in order to produce, for each parameter, a robust estimate of the loss function to be minimized. A specific inconvenient trait of this approach is the implicit definition of the robust estimate, which may introduce some computational roadblocks. As briefly explained by Holland et al.

[19], since the estimates do not need to be convex even in the case where the loss function is, the non-linear optimization can be both unstable and costly in high dimensions.

This approach usually rely on the replacement of the empirical mean (first moment) gradient estimate with a more robust alternative, and simply differs in the method used to achieve this objective. Chen et al. [25] proposed the use of the geometric median of the gradients mean to aggregate multiple candidates. Using the same strategy, Prasad et al. [26] proposed a class of gradient estimator based on the idea that the gradient of a population loss could be regarded as the mean of a multivariate distribution, reducing the problem of gradient estimation to a multivariate mean estimation problem. Very close to our approach, Holland et al. [19] proposed to carefully reduce the effect of aberrant values instead of discarding them, which can also result in unfortunate discards of valuable data.

This approach is to reduce the effect of wrong gradient estimates by reducing the learning rate. One such approach has been proposed by Haimin et al. [18] and shares the same objective as ours to produce a robust version of the Adam optimization algorithm. The method employed by Haimin et al. uses an exponential moving average (EMA) of the ratio between the current loss value and the past one to scale the learning rate. However, this strategy allows the outliers to modify the estimated gradient mean, and then uses the impact of the deviated mean on the loss function to reduce the effect on subsequent updates.

As one of the problems in the EMA scheme, the lack of robustness has been dealt with in [16] and [17]. In those methods, the exponential decay parameter of the EMA is increased whenever a value that falls beyond some boundary is encountered. The common drawback in this strategy is that all outlier gradients are treated equally and discretely without consideration of how far they are from the normal values, and the boundary over which a data is considered to be an outlier must be set manually before training.

##### Our contribution

To the best of our knowledge, our approach, named TAdam, is the first to employ estimates of the student-t distribution first moment to replace the estimates of the Gaussian first moment introduced by Adam, through the EMA scheme. The main advantage of this approach is that it relies on the natural robustness of the student-t distribution and its ability to deal with outliers, and can easily be reduced to Adam for non-heavy-tailed data. Also, even though, in this letter, we use our method to modify the popular optimizer Adam, we encourage the reader to keep in mind that it can be integrated to the other stochastic gradient descent methods that rely on EMAs like RMSProp

## Iii Proposal

Before describing our proposal, let us introduce Adam [4], the baseline of TAdam. Adam is a popular method that combines the advantages of SGD with momentum along with those of adaptive learning rate methods [14, 13]. Its update rule is implemented as follows:

 mt =β1mt−1+(1−β1)gt (2) vt =β2vt−1+(1−β2)gt2 (3) θt =θt−1−αmt(1−βt1)(√vt(1−βt2)−1+ϵ) (4)

where is the first-order moment (i.e., mean of gradients) and is the second-order moment utilized to adjust learning rates at time step . and are the exponential decay rates (by default and , respectively). is the global learning rate and is a small value added to avoid division by zero (typical value of ).

Although the use of EMAs in equations (2) and (3) makes the gradients smooth and reduces the fluctuations inherent to SGD, they are also sensitive to outliers. In particular, with a small value like (), the momentum is very likely to be pulled out by outliers and easily deviate from the true average. This fluctuation makes learning unstable (see Fig. 1), and therefore, more robust learning techniques are needed.

### Iii-B Overview

Our proposition relies on the fact that the EMA, like equations (2) and (3

), can be regarded as an incremental update law of the mean in the normal distribution with a fixed number of samples. The sensitivity of Adam to aberrant gradient values is therefore just a feature inherited from the normal distribution, which is itself also sensitive to outliers.

In order for Adam to be robust, the distribution of the gradients must be assumed to come from a robust probability distribution. We therefore propose to replace the normal distribution moment estimates by those from the student-t distribution, which is well-known to be a robust probability distribution

[7, 27, 28], as shown in Fig. 2, and a general form of the normal distribution. From the next section, we describe how the EMA is replaced using the student-t distribution, and the features of our implementation are analyzed later. A pseudo code of TAdam is summarized in Algorithm 1.

### Iii-C Formulation

To replace the EMA by the student-t distribution, a new hyperparameter, the degrees of freedom of the student-t distribution

, is introduced to control the robustness.

We can derive the incremental update law of the first moment for the student-t distribution using a maximum log-likelihood estimator. Given -dimensional i.i.d. random samples from multivariate student-t distribution with the parameters , and , its log-likelihood function is expressed as:

 (5)

where . Taking the gradient with respect to and setting it equal to gives us:

 ∂log(pt)∂μ =n∑i=1(ν+d)xi−μν+Di =n∑i=1xiν+dν+Di−μn∑i=1ν+dν+Di=0 (6)

If we solve this equation for , we get the expression of the first moment estimate given samples:

 ^μn =∑ni=1xiwiWn=∑n−1i=1xiwi+xnwnWn−1+wn =Wn−1Wn−1+wn^μn−1+wnWn−1+wnxn (7)

where and .

By assuming a diagonal distribution and fixing the number of samples (decaying ), we can derive the equation (8) used below in TAdam. Due to the high value of (i.e., about samples) w.r.t. (i.e., about samples), only the first-order moment in equation (2) is replaced by the following rule:

 mt=Wt−1Wt−1+wtmt−1+wtWt−1+wtgt (8)

where

 wt =ν+dν+∑dj(gjt−mjt−1)2vjt−1+ϵ (9) Wt =2β1−1β1Wt−1+wt (10)

is the unmodified Adam’s second moment estimate coming from equation (3), and is the dimension of the gradient (i.e., the number of parameters in subsets like layers of deep learning). Here, the summation in the denominator of is substituted from now on by since it corresponds to the Mahalanobis distance between the gradient of the parameter , , and the corresponding previous estimate of the mean, , w.r.t. the variance that is assumed to be the same as Adam’s second moment estimate, . Note that, ultimately, the gradients converge to zero, and therefore, the second moment would be consistent with the variance of the gradients.

The power of this update rule is two folds: the outliers detection and the robustness control. Their details are explained below.

### Iii-D The outliers detection

This is performed through which is an adaptive weight of the mean introduced in equation (8) with degrees of freedom . Again, we can notice that depends on the Mahalanobis distance . Hence, outlying gradient values are down-weighted since their Mahalanobis distances are larger than for normal values, and their contribution to the momentum update is therefore automatically dampened. On the contrary, the normal gradients are up-weighted ultimately by due to zero Mahalanobis distances, although is kept in that case since . In short, TAdam automatically and continuously reduces only the adverse effects of the outlier gradients.

### Iii-E The robustness control

The Student-t distribution has a controllable robustness and that nice property of being similar to the normal distribution when the degrees of freedom grows larger. The same feature is left in TAdam, as can be seen in equation (9). Namely, when , we have:

 limν→∞wt=∞+d∞+Dt=1 (11)

To make TAdam be an extended version of Adam, the decay rule in equation (10) is designed to fulfill some requirements. Specifically, if , the decay rate derived from and in equation (8) must be consistent with at any time.

 Wt=W0=β11−β1,∀t>0 (12)

To satisfy such a constant , the decay rate in equation (10) can be derived as follows if the decay rule is given as .

 γ=Wt−wtWt−1=2β1−1β1 (13)

By the above derivation, TAdam defined by equations (8)–(10) is proved to be the extended version of Adam defined by the equation (2) (and equations (3)–(4)).

### Iii-F The Regret Bound and TAdam’s Convergence

The convergence of the TAdam algorithm is assured by the two following theorems, whose proofs can be found in the appendix:

###### Theorem 1.

Given and , the sequences obtained from the TAdam algorithm, , , and . If has a bounded diameter , and if for all and . Then, for generated using TAdam (with the AMSGrad [29] scheme), we have the following upper bound on the regret:

 RT≤D2∞2αT(1−¯βw)d∑i=1^v1/2T,i+D2∞(1−¯βw)2T∑t=1d∑i=1β1t^v1/2t,iαt+α√1+logT(1−¯βw)2(1−γ)√(1−β2)d∑i=1∥g1:T,i∥2 (14)
###### Theorem 2.

, according to the central limit theorem; then the Mahalanobis distance appearing in TAdam follows a Chi-Squared distribution

, and the expected value of the adaptive decay parameter is constrained, for , by the following relation:

 E[βw] ≤β1 (15)

We can see that the difference between the upper bound of TAdam and Adam lies in the value of , which corresponds to the expected value of the adaptive exponential decay parameter . Theorem (2) tells us that, if the gradients are normally distributed, this value is bounded above by , so that we can recover the same upper bound for TAdam and Adam. However, if we know the exact value of the expected value, a more precise upper bound for the regret can be obtained.

## Iv Experiments

To assess the robustness of TAdam against noisy data, we conducted three types of experiments spanning the main machine learning frameworks, i.e. supervised learning (regression and classification) and reinforcement learning. We compare TAdam mainly with Adam, but also with another robust gradient descent algorithm, RoAdam

[18].

### Iv-a Robust Supervised Learning

It has been shown [30] that training standard supervised learning algorithms with noisy data resulted in bad performance and accuracy of the resulting models. In real robotic tasks, it is often unrealistic to assume that the true state is completely observable and noise-free, and perfect supervised signals are difficult to obtain. In the following experiments, TAdam reveals to be useful in increasing the accuracy of the models, even when facing noisy inputs.

#### Iv-A1 Robust Regression

##### Experimental settings

A ground truth function is defined as and we set a fully-connected neural network to approximate it from scattered observations , sampled from the true function with noise. The observations have a probability of being infected by some noise , so that:

 t =sin(2πx)+ζ (16) ζ ∼St(νζ,0,λζ)Bern(p100) (17) p ∈{0,10,20,30,40,50,60,70,80,90,100} (18)

where designates a student-t distribution with degrees of freedom , location, and scale , and

is a Bernoulli distribution with the probability

as its parameter.

The model, on the other hand, is a neural network with linear layers, each composed of neurons. The ReLU activation function [31] is used for all the hidden layers, while the loss function for the network is the Mean Squared Error (MSE).

##### Experimental results

The results of the loss functions against the noise probability on the regression task are depicted in Fig. 3 and Fig. 3. Note that 50 trials are conducted for each . As it can be seen, TAdam absolutely outperformed Adam in all the cases, and reveals to be more robust than RoAdam. In addition, as the noise probability in the observations increases, TAdam managed to resist to their effect.

To visualize the learning results, the predicted curves after learning are also illustrated in Fig. 3 and Fig. 3. The learning variances of Adam were obviously larger than those generated by TAdam, and TAdam relatively succeeded in following the ground truth function from the observations even with large noise.

#### Iv-A2 Robust Classification

##### Experimental settings

Here, we use the same experimental settings described in [15] and compare Adam, AMSGrad and their T versions along with RoAdam on an image classification task on the standard CIFAR-100 dataset.

The architecture of the convolutional network involved in the described experiments is the ResNet-34 [32]. A fixed budget of 200 epochs are used throughout the training, and the learning rates are reduced by 10 after 150 epochs.

The optimizers are launched with the following hyperparameter values: {learning rate: 0.001}, {betas: (0.99, 0.999)} and both T algorithms use the default degrees of freedom, i.e. {degrees of freedom = dimension of the gradients}. The third beta value of RoAdam is also set to {0.999}.

##### Experimental results

We first launched a simulation without noise, using directly the unmodified datasets. The results for that simulation are found in Fig. 4 and Fig. 4. We can see that TAdam and TAMSGrad are able to achieve faster convergence during the training phase compared to the standard versions, and also show higher level of generalization during the test phase. The corresponding loss curves, Fig. 4 and Fig. 4, show that TAMSGrad is able to reach a lowest point during the training phase, while also keeping a low loss value on the test data. This result points the fact that TAMSGrad builds on the combined improvement of the first moment (TAdam) and second moment (AMSGrad) in order to provide a more stable algorithm that can outperform the others.

Next, we applied, with a probability of 25%, a color jittering effect on the training dataset and replaced 20% of the original training data points by fake ones, in order to test the ability of the optimizers to extract the most useful informations from corrupted datasets. The results can be seen in Fig. 4 and Fig. 4 and it highlights the benefits of TAdam against Adam. Indeed, even thought the value of beta1 is larger (0.99 instead of default 0.9), Adam remains sensitive to outliers, while TAdam can ignore them.

### Iv-B Robust Reinforcement Learning

Whether it comes from sensors, or from bad estimates during learning, or from different feedbacks from different human instructors (e.g. non-technical users in real-world robotics situations), noisiness is inseparable from robotics reinforcement learning (RL). In order to test the robustness properties of TAdam in RL tasks, we conducted some simulations on six different Pybullet gym environments [33]. The results are summarized in Fig. 5.

##### Experimental settings

The Fig. 5 summarizes four trials with four different seeds on each environment. The algorithm employed is the proximal policy optimization (PPO) [34]

, from the Berkley artificial intelligence research implementation, rlpyt

[35], with the following setting:

No gradient norm clipping was used throughout the simulations, since the property at test is the robustness of the optimizers to aberrant gradient values and their ability to produce good policies. Gradient norm clipping introduces a manually defined heuristic threshold, which depends on the task and on various conditions, and moreover, is used for the norm of all gradients larger than its value. Such trick would therefore introduce some undesirable bias in the results.

The simulations involved two different learning rates: the widely used and fine tuned value for Adam, , and the defined default, yet larger value, .

##### Experimental results

Searching for the optimal learning rate is commonly known to be a tedious and serious problem in SGD based algorithms, and high learning rates (particularly the default Adam step value ) are usually not used in reinforcement learning due to the amount of noise coming from the early bootstrapping stage, but also to avoid the agent from reaching an early deterministic policy.

As displayed by the results in Fig. 5, a high learning rate causes Adam to suffer from both these problems and makes it unable to converge to a good policy. On the other hand, TAdam proves to be robust enough to sustain different learning rates, and learns the tasks with both given hyperparameter values. Thanks to its careful updates of the agent, TAdam can still reach a sub-optimal policy that may even be better than the one reached with smaller learning rates (Fig. 5, 5). This feature offered by TAdam not only allows for the use of higher learning rates in order to accelerate the learning process, but also reduces the difficulties related to the tuning of the learning rate, since the default learning rate can be directly used.

Also, as stated in the experimental settings section, no gradient norm clipping was used during the simulations. Without this trick, we can see that Adam fails altogether on the inverted double pendulum task, while TAdam naturally and automatically ignores or reduces the effect of large gradients, keeping the gradient (momentum) from overshooting during learning and making the gradient norm clipping stratagem unnecessary.

## V Conclusion and Future Work

In this letter, we proposed and described TAdam, a new stochastic gradient optimizer, which makes the Adam algorithm much more robust and provides a way to produce stable and efficient machine learning applications. TAdam is based on the robust mean estimate rule of the Student-t distribution as an alternative to the standard EMA. We verified that TAdam outperformed Adam in terms of robustness on supervised learning (regression and classification) tasks, and reinforcement learning tasks.

In this work, TAdam uses a fixed degrees of freedom which is equal to the dimension of the gradients, and therefore has a fixed robustness. A straightforward improvement is therefore to design a mechanism that automatically updates the parameter during the learning process, according to the presence or absence of outliers.

## Appendix

### V-a Proof of Theorem 1

First, we start by noticing that the basic bound of the regret from the convergence proof by Reddi et al. [29] also holds for TAdam, i.e.:

 RT=T∑t=1ft(θt)−ft(θ∗)≤T∑t=1{[∥^V1/4t(θt−θ∗)∥2−∥^V1/4t(θt+1−θ∗)∥2]2αt(1−β1t)+αt∥^V−1/4tmt∥2(1−β1t)+β1t∥^V1/4t(θt−θ∗)∥22αt(1−β1t)} (19)

However, to further refine this upper bound, we need to redefine the Lemma 2 used in the proof of Reddi et al, since does not hold anymore for all time step . For this purpose, we use the expected value of , , instead of , to define the upper bound and, following the same process as Reddi et al., define a similar expression to their Lemma 2 in the case of TAdam:

 T∑t=1αt∥^V−1/4tmt∥2 ≤α√1+logT(1−¯βw)(1−γ)√(1−β2)d∑i=1∥g1:T,i∥2 (20)

Based on this new lemma, the remaining steps are completely identical to the proof of Reddi et al., and the final regret bound of TAdam is given by:

 RT≤D2∞2αT(1−¯βw)d∑i=1^v1/2T,i+D2∞(1−¯βw)2T∑t=1d∑i=1β1t^v1/2t,iαt+α√1+logT(1−¯βw)2(1−γ)√(1−β2)d∑i=1∥g1:T,i∥2 (21)

### V-B Proof of Theorem 2

Assuming that the gradients ultimately follow an asymptotic normal distribution , then we know that , where is the degrees of freedom of the chi-squared distribution. Applying this to the Mahalanobis distance in TAdam, we have:

 Dt =∑j(gjt−mjt−1)2vt−1∼χ2(d) (22)

Now, we know that the expected value of the chi-squared distribution with degrees of freedom is and the expected value of the inverse-chi-squared distribution with the same degrees of freedom is given by . We can therefore define:

 Emin ≤E[1Dt+ν]≤Emax Emax =1E[D−1t]−1+ν=1d−2+ν≤1d−2 Emin =1E[Dt]+ν=1d+ν

This inequality comes from the Jensen’s inequality and from the fact that and are respectively convex and concave. The expected value of the weights in TAdam, can therefore be expressed as:

 1≤E[wt]=E[ν+dν+Dt]≤ν+dd−2 (23)

We can then infer the mean of the weighted sum :

 Wt =(β11−β1)[(2β1−1β1)t−1]+t−1∑i=1wi(2β1−1β1)t−1−i E[Wt] =(β11−β1)[at−1]+(β11−β1)E[wt](1−at−1) ≤(β11−β1)(at−1+E[wt](1−at−1)) ≤(β11−β1)E[wt]≤(β11−β1)(ν+dd−2) (24)

Where we have defined and taken advantage of the monotonic decrease of the sequence towards , given that for . We move on to express the upper bound for where

. For this purpose, we make use of the Hartley and Ross unbiased estimator for the mean of the ratio between two random variables

[36, 37], which, based on the fact that the covariance between and is positive, gives:

 E[βw] ≤E[Wt−1]E[Wt−1+wt] ≤(β11−β1)(ν+dd−2)(β11−β1)(ν+dd−2)+(ν+dd−2)=β1 (25)

The last inequality is drawn from the relations depicted by Eq. 24.