14
1 Gradient Monitored Reinforcement Learning Mohammed Sharafath Abdul Hameed * , Gavneet Singh Chadha * , Andreas Schwung * , Steven X. Ding . * Department of Automation Technology South Westphalia University of Applied Sciences Soest, Germany. sharafath.mohammed, chadha.gavneetsingh, [email protected] Department of Automatic Control and Complex Systems University of Duisburg-Essen Duisburg, Germany. [email protected] Abstract—This paper presents a novel neural network train- ing approach for faster convergence and better generalization abilities in deep reinforcement learning. Particularly, we focus on the enhancement of training and evaluation performance in reinforcement learning algorithms by systematically reducing gradient’s variance and thereby providing a more targeted learn- ing process. The proposed method which we term as Gradient Monitoring(GM), is an approach to steer the learning in the weight parameters of a neural network based on the dynamic development and feedback from the training process itself. We propose different variants of the GM methodology which have been proven to increase the underlying performance of the model. The one of the proposed variant, Momentum with Gradient Monitoring (M-WGM), allows for a continuous adjustment of the quantum of back-propagated gradients in the network based on certain learning parameters. We further enhance the method with Adaptive Momentum with Gradient Monitoring (AM-WGM) method which allows for automatic adjustment between focused learning of certain weights versus a more dispersed learning depending on the feedback from the rewards collected. As a by- product, it also allows for automatic derivation of the required deep network sizes during training as the algorithm automatically freezes trained weights. The approach is applied to two discrete (Multi-Robot Co-ordination problem and Atari games) and one continuous control task (MuJoCo) using Advantage Actor-Critic (A2C) and Proximal Policy Optimization (PPO) respectively. The results obtained particularly underline the applicability and performance improvements of the methods in terms of generalization capability. Index Terms—Reinforcement Learning, Multi-Robot Co- ordination, Deep Neural Networks, Gradient Monitoring, Atari Games, MuJoCo, Open AI Gym I. I NTRODUCTION Research in deep Reinforcement Learning (RL) has seen tremendous progress in recent years with widespread success in various areas including video games [1], board games [2], robotics [3], industrial assembly [4] and continuous control tasks [5] among others. This rapid increase in interest in the re- search community can be particularly traced back to advances made in the training of Deep Neural Networks (DNN) in the last decade, as well as novel RL algorithms developed recently. Notable example of the latter include value function based methods like deep Q-networks [6], policy gradient methods like deep deterministic policy gradient [5], Advantage Actor Critic (A2C) [7], trust region policy optimization [8] and Proximal Policy Optimization (PPO) [9] to name a few. Also additional training components have helped in improving RL capabilities like improved exploration strategies [10], intrinsic motivation [11] and curiosity-driven methods [12]. Revisiting the training of DNN, regularization and better optimization methods have played a crucial role in improv- ing their generalization capabilities, where Batch Normal- ization [13], Dropout [14] and weight decay [15] are the most prominent examples which have become a standard in supervised learning. Surprisingly, little attention has been paid to methods for improving the generalization capabilities of DNN during reinforcement learning, although this appears to be crucial in supervised and unsupervised learning tasks. Regardless, most of the above mentioned approaches are also utilized in RL, although there are stark differences between supervised learning and RL. It must be noted however that the above methods nevertheless also assist in RL training [16]. Our goal however, is to develop a principled optimization and training approach for RL, especially considering its dynamic learning process. In literature, generalization in RL is usually done by testing the trained agent’s performance on an unseen variation of the environment, usually performed by procedurally generating new environments [16]. We however, want to improve the evaluation performance on the same environment rather than generating new and unseen environments for the agent. An introduction to the existing methods for generalization in RL is provided in Section II. As a related problem, the derivation of suitable network sizes for a particular RL problem is rarely addressed. In practice, the size, i.e. depth and width of the neural networks, is mainly adjusted by either random search or grid search methods [17]. The other recent methods usually tune other hyperparameters such as learning rate, entropy cost, and intrinsic reward and do not consider size of the network in RL [18]. Therefore, tuning for an optimal architecture requires knowledge on both the type of RL algorithm that is used and the application domain where the algorithms are applied, which inhibits fast deployment of the learning agents. An automatic adjustment of the required network parameters is highly desirable because of the long training times in RL together with the large number of hyperparameters to be tuned. arXiv:2005.12108v1 [cs.LG] 25 May 2020

Gradient Monitored Reinforcement Learning · Mohammed Sharafath Abdul Hameed , Gavneet Singh Chadha , Andreas Schwung , Steven X. Ding y. Department of Automation Technology South

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Gradient Monitored Reinforcement Learning · Mohammed Sharafath Abdul Hameed , Gavneet Singh Chadha , Andreas Schwung , Steven X. Ding y. Department of Automation Technology South

1

Gradient Monitored Reinforcement LearningMohammed Sharafath Abdul Hameed ∗, Gavneet Singh Chadha ∗, Andreas Schwung ∗, Steven X. Ding †.

∗ Department of Automation TechnologySouth Westphalia University of Applied Sciences

Soest, Germany.sharafath.mohammed, chadha.gavneetsingh, [email protected]

†Department of Automatic Control and Complex SystemsUniversity of Duisburg-Essen

Duisburg, [email protected]

Abstract—This paper presents a novel neural network train-ing approach for faster convergence and better generalizationabilities in deep reinforcement learning. Particularly, we focuson the enhancement of training and evaluation performancein reinforcement learning algorithms by systematically reducinggradient’s variance and thereby providing a more targeted learn-ing process. The proposed method which we term as GradientMonitoring(GM), is an approach to steer the learning in theweight parameters of a neural network based on the dynamicdevelopment and feedback from the training process itself. Wepropose different variants of the GM methodology which havebeen proven to increase the underlying performance of the model.The one of the proposed variant, Momentum with GradientMonitoring (M-WGM), allows for a continuous adjustment of thequantum of back-propagated gradients in the network based oncertain learning parameters. We further enhance the method withAdaptive Momentum with Gradient Monitoring (AM-WGM)method which allows for automatic adjustment between focusedlearning of certain weights versus a more dispersed learningdepending on the feedback from the rewards collected. As a by-product, it also allows for automatic derivation of the requireddeep network sizes during training as the algorithm automaticallyfreezes trained weights. The approach is applied to two discrete(Multi-Robot Co-ordination problem and Atari games) and onecontinuous control task (MuJoCo) using Advantage Actor-Critic(A2C) and Proximal Policy Optimization (PPO) respectively.The results obtained particularly underline the applicabilityand performance improvements of the methods in terms ofgeneralization capability.

Index Terms—Reinforcement Learning, Multi-Robot Co-ordination, Deep Neural Networks, Gradient Monitoring, AtariGames, MuJoCo, Open AI Gym

I. INTRODUCTION

Research in deep Reinforcement Learning (RL) has seentremendous progress in recent years with widespread successin various areas including video games [1], board games [2],robotics [3], industrial assembly [4] and continuous controltasks [5] among others. This rapid increase in interest in the re-search community can be particularly traced back to advancesmade in the training of Deep Neural Networks (DNN) in thelast decade, as well as novel RL algorithms developed recently.Notable example of the latter include value function basedmethods like deep Q-networks [6], policy gradient methodslike deep deterministic policy gradient [5], Advantage Actor

Critic (A2C) [7], trust region policy optimization [8] andProximal Policy Optimization (PPO) [9] to name a few. Alsoadditional training components have helped in improving RLcapabilities like improved exploration strategies [10], intrinsicmotivation [11] and curiosity-driven methods [12].

Revisiting the training of DNN, regularization and betteroptimization methods have played a crucial role in improv-ing their generalization capabilities, where Batch Normal-ization [13], Dropout [14] and weight decay [15] are themost prominent examples which have become a standard insupervised learning. Surprisingly, little attention has been paidto methods for improving the generalization capabilities ofDNN during reinforcement learning, although this appearsto be crucial in supervised and unsupervised learning tasks.Regardless, most of the above mentioned approaches are alsoutilized in RL, although there are stark differences betweensupervised learning and RL. It must be noted however thatthe above methods nevertheless also assist in RL training [16].Our goal however, is to develop a principled optimization andtraining approach for RL, especially considering its dynamiclearning process.

In literature, generalization in RL is usually done by testingthe trained agent’s performance on an unseen variation of theenvironment, usually performed by procedurally generatingnew environments [16]. We however, want to improve theevaluation performance on the same environment rather thangenerating new and unseen environments for the agent. Anintroduction to the existing methods for generalization in RLis provided in Section II. As a related problem, the derivationof suitable network sizes for a particular RL problem is rarelyaddressed. In practice, the size, i.e. depth and width of theneural networks, is mainly adjusted by either random searchor grid search methods [17]. The other recent methods usuallytune other hyperparameters such as learning rate, entropy cost,and intrinsic reward and do not consider size of the network inRL [18]. Therefore, tuning for an optimal architecture requiresknowledge on both the type of RL algorithm that is usedand the application domain where the algorithms are applied,which inhibits fast deployment of the learning agents. Anautomatic adjustment of the required network parameters ishighly desirable because of the long training times in RLtogether with the large number of hyperparameters to be tuned.

arX

iv:2

005.

1210

8v1

[cs

.LG

] 2

5 M

ay 2

020

Page 2: Gradient Monitored Reinforcement Learning · Mohammed Sharafath Abdul Hameed , Gavneet Singh Chadha , Andreas Schwung , Steven X. Ding y. Department of Automation Technology South

2

To this end, we tackle the above described weaknesses incurrent RL methods, namely targeted training in the evolvinglearning setting and the automatic adjustment of the train-able parameters in the neural network. We present GradientMonitored Reinforcement Learning (GMRL), which maintainstrust regions and reduces gradient variance, from the initialtraining phase in two of those algorithms, for a targetedtraining. The original proposal for Gradient Monitoring (GM)with network pruning was originally introduced in [19] forsupervised training of DNN. We enhance the previous workby concentrating on the gradients flow in the network ratherthan the weights. Specifically, rather than pruning irrelevantweights, we focus on the adaptive learning of the most relevantweights during the course of training. We develop differentmethods for GMRL, starting with a method that requiresknowledge of the learning process and then developing amomentum based dynamic learning scheme which particularlysuits the sequential learning process of RL. We further developmethod to automatically adjust the GM hyperparameters,particularly the active network capacity required for a certaintask. It is important to note that the proposed approachesare independent from the type of RL algorithm used andare therefore, universally applicable. We apply and test theproposed algorithms in various continuous and discrete ap-plication domains. The proposed GM approaches with theA2C [7] algorithm is tested on a multi-robot manufacturingstation where the goal is a coordinated operation of twoindustrial robots, sometimes termed in literature as Job-ShopScheduling Problem (JSSP) [20]. Thereafter, we test theapproach on some well known reinforcement learning envi-ronments from OpenAI Gym [21] like the Atari games fromthe Arcade Learning Environment [22] and MuJoCo [23] bothwith the PPO [9] algorithm. The results obtained underlinethe improved generalization performance and the capability toautomatically adjust the network size allowing for successfultraining also in strongly over-parameterized neural networks.

The contributions of the work can be summarized as fol-lows:

• We introduce four novel GM methods, each successivelyincreasing the performance of the RL algorithm, namelyFrozen threshold with Gradient Monitoring (F-WGM),Unfrozen threshold with Gradient Monitoring (U-WGM),Momentum with Gradient Monitoring (M-WGM), Adap-tive Momentum with Gradient Monitoring (AM-WGM).

• The methods reduce the gradient variance helping inimproving the training performance during the initialphase of RL with the M-WGM and AM-WGM methodsacting as a replacement for gradient clipping in PPO.In addition to the superior evaluation performance, themethods are shown to expedite the convergence speed byincreasing the learning rates and increasing the ’k-epoch’updates in PPO.

• The proposed AM-WGM method allows for continuousadjustment of the network size by dynamically varyingthe number of active parameters during training by ad-justing the network capacity based on the feedback fromthe rewards collected during the learning progress.

• We conduct various experiments on different applicationdomains including a coordination problem of a multi-robot station, Atari games, and MuJoCo tasks to underlinethe performance gains and the general applicability of theproposed methods.

The paper is organized as follows. Related work is presentedin Section II. In Section III, the basics of the RL-frameworkemployed are introduced. The proposed GM methods andtheir integration with RL is presented in Section IV. SectionV presents a thorough comparison of the results obtainedfrom proposed methods on the various application domains.Section VI concludes the paper and an outlook for future work.

II. RELATED WORK

We first discuss general approaches in DNN training thathelp in better generalization capabilities and subsequentlyfocus on methods specifically for generalization in RL. Finally,we discuss approaches for tuning the network size in RL.

Generalization in DNN: Deep feed-forward neural net-works had been notoriously difficult to train in the past dueto various factors including vanishing gradient [24], highlynon-convex optimization problems [25] and the tendency toover-fit [26]. All of these short-comings have been virtu-ally mitigated in modern deep learning architectures througha myriad of techniques. They include initialization of thetrainable parameters [27], [28], the use of sparse and non-saturating activation functions such as ReLU [29] in thehidden layers and the use of more efficient stochastic gradientdescent optimization algorithms such as Adam [30]. The otherapproaches enhancing generalization capabilities are BatchNormalization [13] to overcome the internal co-variate shiftand Dropout[14] which masks the neural activations witha masking matrix drawn from a Bernoulli distribution. Fordropout, various variants improving on the vanilla dropouthave been developed including variational dropout [31] andtargeted dropout [32]. Similarly, individual weights insteadof hidden activations units are dropped in [33]. Recently, ithas been investigated that over-parameterization also leadsto better generalization performance in supervised learningwith DNN [34]–[36]. Another popular approach is the in-corporation of auxiliary loss functions into the main lossresulting in either L1 or L2 regularization. An increasingpopular method for optimizing neural network training isgradient clipping [37], originally developed for the explodinggradient problem in recurrent neural networks. It has beenproven to increase convergence speed in supervised learningin [38]. Also a multitude of approaches for network pruninghave been reported to help in the generalization performance.Generally, the pruning methods are applied iteratively based onmagnitude based [39], gradient or Hessian [40], [41]. Recentmethods such as [42], [43] calculate the sensitivity of eachconnection and prune the weights with a single shot approach.Please refer [44] for a recent overview of the various pruningmethods that have been developed for neural networks. Weemphasize that our approach does not include pruning weights,but freezing them by not allowing the gradients to flow tothe respective weights. Also a direct application of pruning

Page 3: Gradient Monitored Reinforcement Learning · Mohammed Sharafath Abdul Hameed , Gavneet Singh Chadha , Andreas Schwung , Steven X. Ding y. Department of Automation Technology South

3

methods in RL is not clear as these methods usually requirea retraining which is far-fetched for the evolving data-setscenario during RL training. Indeed, all of the above methodsthat have been used in RL, were specifically developed forsupervised learning, but just found themselves to be used inRL.

Variance Reduction and Generalization in RL: Variancereduction techniques for gradient estimates in RL have beenintroduced in [45] where control variate are used for estimatingperformance gradients. An Averaged Deep Q Network ap-proach has been proposed in [46] where averaging previouslylearned Q-values estimates leads to a more stable trainingprocedure. Also, variance reduction in the gradient estimate forpolicy gradient RL methods has been proposed in [47] with aninput-dependent baseline which is a function of both the stateand the entire future input sequence. Contrary to the previousapproaches, we consider variance reduction in the gradientestimate by freezing the gradient update of a particular weight.

Literature on generalization in RL usually focuses on theperformance of the trained agent in an unseen environ-ment [16], [48]–[50]. However, better generalization methodsfor evaluating the agent on the same environment is missing inliterature. This is especially the case in industrial productionenvironments where the production setup does not changedrastically with time. The proposed approach is focused onthis area where a fast and reliable training procedure has beendeveloped for discrete and continuous environments.

Neural Architecture Search: There are a number of hy-perparameters in neural network training, with the size of thenetwork being one of the most important ones. Apart fromgrid search and random search, there also exist a numberof approaches including Bayesian optimization [51], evolu-tionary methods [52], many-armed bandit [53], populationbased training [18] and RL [54]. All of the above methodssearch for neural architectures for a supervised learning setup.[55] present a multi-arm bandit approach for adaptive datageneration to optimize a proxy of the learning progress.We on the other hand, propose a method which makes thelearning process robust to the choice of the size of thenetwork. Furthermore, all the of the above methods search ina sequential and very computationally expensive manner. Ourproposed method on the other hand, start with a possibly over-parameterized network and increase or decrease the learningcapacity during training to adjust the learning procedure. Thisway we dynamically determine the actually relevant numberof parameters in each training phase.

III. INTRODUCTION TO REINFORCEMENT LEARNING

Reinforcement Learning (RL) is the branch of machinelearning that deals with training agents to take an action a,as a response to the state of the environment at that particulartime, st, to get a notion of reward, r. The objective of theRL agent is to maximize the collection of this reward. Suttonand Barto define RL as, “ learning what to do – how to mapsituations to actions – so as to maximize a numerical rewardsignal” [56].

A reinforcement learning system has two major compo-nents: the agent and the environment where the overall system

Fig. 1: The interaction of agent and environment as MDP

is characterized as a Markov Decision Process (MDP). Theagent is the intelligent learning system, while the environmentis where the agent operates. The dynamics of the MDP isdefined by the tuple (S,A,P,R, p0 ), with the set of statesS, the set of actions A, a transition model P, in which for agiven state s and action a, there exists a probability for the nextstate s′ ∈ S , a reward function R : S ×A × S −→ R whichprovides a reward for each state transition st −→ st+1. and a re-initialization probability p0. A policy π(a|s), provides an ac-tion aεA, for a state s presented by the environment. A policycould use state-value function, v(s) = E[Rt|St = s], which isthe expected return from the agent when starting from a state s,or an action-value function, q(s, a) = E[Rt|St = s,At = a],which is the expected return from the agent when starting froma state s, while taking action a. Here, Rt =

∑t γ

trt is thediscounted reward that the agent collects over t times steps andγ is the discount factor, where 0 ≤ γ ≤ 1. The policy thencan be defined by an ε − greedy strategy where the actionsare chosen based on π(a|s) = argmax(q(s,A)) for a greedyaction or a completely random action otherwise.Alternatively there are policy gradient methods that use aparameterized policy, π(a|s, θ), to take action without usingthe value functions to take actions. Value functions may stillbe used to improve the learning of the policy itself as seenin A2C. The objective of the agent is to find an optimalpolicy, π∗(a|s), that collects the maximum reward. To findthe optimal policy, the trainable parameters of the policyare updated in such a way that it seeks to maximize theperformance as defined by the cost function J(θt) as illustratedin Equation (1). There exists at least one policy, such thatπ∗(a|s) ≥ π(a|s), where π∗ is defined as the optimal policy.

θt+1 = θt + ρ∇J(θt), (1)

where θ are the parameters of the policy π and ρ is thelearning rate. There are different choices of J(θt) for differentalgorithms as explained in the sections below.

A. Advantage Actor-Critic

In this section we introduce the policy gradient algorithmAdvantage Actor Critic (A2C) [7]. A2C are policy gradientmethods that use the value function to reduce the variance inthe calculated cost function. Here, the actor refers to the policyπ(a|s, θ1) and the critic refers to the value function v(s, θ2),

Page 4: Gradient Monitored Reinforcement Learning · Mohammed Sharafath Abdul Hameed , Gavneet Singh Chadha , Andreas Schwung , Steven X. Ding y. Department of Automation Technology South

4

where θ1 and θ2 are the parameters of the actor and criticrespectively. The parameters θ1 and θ2 are partially shared incase of the A2C algorithm we use. The cost function for theactor and the critic of A2C algorithm is given by Eqn. (2) and(3) respectively.

J(θ) = E∼πθ

∑(st,at)ε

logπθ(at, st) . Aπθ (st, at)

(2)

Aπθ (st, at) = Qπθ (st, at)− Vπθ (st) (3)

We use two co-operative agents that use indirect com-munication channels to solve the multi robot coordinationenvironment. They are explained in detail in section V-A2.

B. Proximal Policy Optimization:

In this section, Proximal Policy Optimization (PPO) isexplained. In A2C, the focus of the algorithm was to geta good estimate of the gradients of the parameter θ. Butapplying multiple optimization steps on this, empirically leadsto large policy updates that destabilizes the learning process.A surrogate objective function in used in PPO to overcomethis.

maxθ

E∼πθ[min(rt(θ)At, clip(rt(θ), 1− ε, 1 + ε)At)

](4)

wherert(θ) =

πθ(st, at)

πθold(st, at)(5)

and At is the estimator of the advantage function at timestep t. Refer to [9] to have a full overview of the algorithm.Due to this controlled nature of the policy updates PPO arefound to work well with continuous control problems. Hence,PPO is used in MuJoCo and Atari Learning Environment.

IV. REINFORCEMENT LEARNING WITH GRADIENTMONITORING

Modern deep learning architectures are in general over-parameterized, i.e. the parameters drastically outnumber theavailable data set size [34], [57]. While this has been empiri-cally shown to improve the learning performance compared toshallow architectures, determining a suitable number of layersand neurons depending on the problem at hand remains to bean open issue. To circumvent the determination of networksize, successful workarounds have focused on reducing thenumber of actively learning parameters per iteration. Theyend up in reducing the degrees of freedom during the trainingusing methods like drop-out, drop connect and their varioussub-forms where network activations or weights are randomlyswitched off.Gradient monitoring follows a different approach in that itintends to steer the learning process of the DNN by ac-tively manipulating the backward pass of the training process.Specifically, we purposefully deactivate and activate the gradi-ents in the backward pass for a subset of weights based on thelearning conditions which is explained in the subsection below.

Although applicable to deep learning setting, we find GMparticular useful for reinforcement learning since it reducesthe variance in the gradient estimates during the crucial initialpart of the learning process and also introduces a dynamic wayto clip the gradients that is applied layer-wise as opposed tothe norm of the entire gradients popularly used.

A. Gradient Monitoring in DNN

To illustrate the training procedure with GM, we considerfully connected feed-forward DNN with more than one hiddenlayer trained with mini-batch gradient descent and gradientbased optimizers, although we found it most effective withmomentum based gradient optimizers like Adam [30]. How-ever, we emphasize that GM is universally applicable to othernetwork structures like convolutional or recurrent NN. Thetraining procedure in NN minimizes the loss function bycalculating the partial derivative of the loss functions withrespect to each of the weight parameters recursively. Hence,for a NN model with m ≥ 2 hidden layers we denote Wm

as the weight matrix for the mth layer and ∇LW1 , ∇LW2

.... ∇LWmdenote the gradients for each weight matrix. The

gradient calculated as per the Adam optimizer is shown inEquation (6)

∇LWt=

mt√vt + ε

. (6)

To deactivate the gradients, we set elements of the gradientmatrix ∇LWt

in (6) to zero. To accomplish this, we define amasking matrix M , whose values are either one or zero, andcalculate the new gradient matrix ∇LWt

as shown in (7).

∇LWt=MWt

◦ ∇LWt, (7)

where ◦ denotes the Hadamard product. The weight update isperformed then with a standard gradient descent update as inEquation (8)

Wt+1 =Wt − ρ∇LWt. (8)

The steering of the learning process is decided based onthe effect of each parameter on the forward as well asthe backward pass. Therefore, the masking matrix, MWt

, iscalculated based on a function that takes as input, the weightsWt, their respective gradients ∇LWt from the backward pass,a learning threshold µ(Wt,∇LWt), and a learning factor λ. Adecision matrix DWt

(Wt,∇LWt) is constructed to estimate

the learning process. This decision matrix DWt(Wt,∇LWt

)is compared with the learning threshold λµ(Wt,∇LWt

), inorder to make the decision if the masking value is active (1)or inactive (0). The decision matrix can be calculated usinglot of combinations like

∣∣∣∇LWtWt

∣∣∣, ∣∣∣ Wt

∇LWt

∣∣∣ or |∇LWt ◦Wt|. Weuse the absolute values since we are interested in the quantumof learning. Specifically, the masking matrix M can be definedas

MWt= H(DWt

(Wt,∇LWt)− λµ(Wt,∇LWt

)), (9)

where H is the Heaviside step function in which the gradientsof weight connections which do not reach the relative amountof learning are deactivated, i.e. receive no gradient during theback-pass. Note that due to the use of Adam optimizer, the

Page 5: Gradient Monitored Reinforcement Learning · Mohammed Sharafath Abdul Hameed , Gavneet Singh Chadha , Andreas Schwung , Steven X. Ding y. Department of Automation Technology South

5

TABLE I: Hyperparameters used in GM algorithms

Symbol Description VGM M-WGM AM-WGMλ Learning factor 3 3 3

ηstart Start of GM 3 7 3ηrepeat Mask update frequency 3 7 3ζ Masking momentum 7 3 3Mζ Momentum matrix 7 3 3αλ change rate of λ 7 7 3φ Reward collection rate 7 7 3R Rewards collected 7 7 3

decision for freezing gradients is not only based on the actualgradient calculated over a mini-batch but based on the decay-ing average of the previous gradients. We emphasize that GMis applied to each layer in the NN. The list of hyperparametersused along with their symbols and the algorithm they are usedin is given in table I

B. Vanilla Gradient Monitoring

The core of GM is the derivation of suitable conditionsfor activating and deactivating the gradients, ∇Lt, flow whichincludes deriving µ based on the actual status of learn-ing. To keep the representation simple Dt(Wt,∇LWt) andµ(Wt,∇LWt) will be simply written as Dt and µ respectivelyhenceforth. Obviously, keeping a constant integer value as thelearning threshold µ for all the gradients is not appropriate asthe proportion of learning represented in the gradients mighthave different distributions in different layers and differenttime-steps. Furthermore, choosing a single constant learningvalue for different learning tasks is not trivial. Hence, thelearning threshold is made adaptable by the use of functionslike the mean or the percentile of the values of the decisionmatrix DW . This provides a method that ensures that a certainportion of the gradients are allowed in any situation. We defineH such that all gradients above or below the learning conditionis deactivated. In this paper we use the mean of all the elementsdij in the decision matrix DWt

∈ Rn for each layer m as theµ function, and use

∣∣∣∇LWtWt

∣∣∣ as the D function. Concretely, wedeactivate all gradients below this learning condition:

µm =1

n

∑ij

dij (10)

Beside the question which gradients to deactivate, we alsohave to answer the question when to deactivate the ineffectivegradients to make training most effective. This problem issolved in two ways. First, as with the learning rate, similarschedules for deactivating is set up depending on the problemat hand. The methods F-WGM and U-WGM use this setupwhich are together called Vanilla Gradient Monitoring (VGM).Alternatively, we introduce a momentum parameter on top ofthe masking matrix to alleviate the problem in deciding whento start deactivating the gradients. The methods M-WGM andAM-WGM use these methods. In this section, we furtherdiscuss only about the methods F-WGM and U-WGM, whileM-WGM and AM-WGM are discussed in the further sections.For F-WGM and U-WGM we have to define ηstart, which

Algorithm 1 Frozen and Unfrozen with Gradient Monitoring

1: Input: ∇Lt, Wt−1, ρ, λ, η, ηstart, ηrepeat2: Init: Masking Matrix M3: Sequence:4: if η >= ηstart then and ηrepeat%η == 05: for each layer m do6: Masking matrix M = H

(Dt − λµ

)7: Gradients: ∇Lt = ∇Lt ◦M8: Output: Weights Wt = Wt−1 + ρ∇Lt

defines after which epoch the masking matrix is applied, alongwith the λ parameter, which is the multiplication factor forthe learning condition µ. ηstart is a hyperparameter which istuned. But the start of the GM application can be automatedby giving it as the point of the first successful episode. This isthe point near which where we found empirically the highestamount of gradients being back propagated. So creating andapplying the first masking at this point makes sense. Thepseudo code for F-WGM and U-WGM is provided in 1. Theonly difference between F-WGM and U-WGM is that, in thecase of F-WGM the λ is kept constant and M is updated withthe same λ value for every few iterations (ηrepeat). While inU-WGM, the λ is made variable, decreasing in value afterevery update

The motivation behind the U-WGM is that the weightparameters which did not have a relative high impact onthe learning process during the initial phase of learning (tillepoch ηstart) might nevertheless have an impact later, e.g.once other weights have settled. Hence, by reducing thelearning condition threshold, those weights can participate inthe learning process again. The factor λ is a hyperparameterwhich in practice we found that halving, i.e. λ′ = λ/2 at everyηrepeat works well.

C. Momentum with GM

One of the disadvantages of the previous approaches isthat the performance of the algorithm is hugely dependanton the hyperparameters ηstart and ηrepeat. ηstart is at thefirst episode of convergence, since that was around wherethe absolute sum of gradients was at the maximum. Thisposes a problem when scaling up the use of GM RL to othercontinuous control long-horizon tasks, since we always needto decide in hindsight when to begin the application of GM.Hence a new version of GM RL was developed to tackle thesame called Momentum with Gradient Monitoring (M-WGM).Here we introduce a momentum matrix Mζ and a momentumhyperparameter ζ, where the momentum matrix applied tothe gradients right from the first episode and the momentumhyperparameter provides an intuitive control over the learningprocess. The pseudo code for M-WGM is give in Algorithm2.

The gradients and the masking matrix are calculated asusual, but the masking matrix M is not used directly. Weuse the momentum matrix Mζ which now keeps track of therunning momentum of the elements of the masking matrix.The momentum matrix is element-wise multiplied with the

Page 6: Gradient Monitored Reinforcement Learning · Mohammed Sharafath Abdul Hameed , Gavneet Singh Chadha , Andreas Schwung , Steven X. Ding y. Department of Automation Technology South

6

Algorithm 2 Momentum - Gradient Monitoring

1: Input: ∇Lt, Wt−1, ρ, λ, ζ2: Init: Mζ , M3: Sequence:4: for each layer do5: Masking matrix M = H

(Dt − λµ

)6: Momentum matrix: Mζ =Mζζ +M(1− ζ)7: Gradients: ∇Lt = ∇Lt ◦Mζ

8: Output: Weight Wt = Wt−1 + ρ∇Lt

gradients and the gradients are finally applied to the weights.The rationale behind this being that the gradients are updatedaccording to the frequency of their activation in the mask-ing matrix. So instead of applying the continuously varyingnoisy masking matrix, we instead use a controlled momentummatrix. The momentum method controls the variance in thegradient updates, especially in the early stages of the RLlearning process where this stability provides for convergenceto a better minima. Also in the later stages the momentummatrix still controls the sudden bursts of gradients that coulddestabilize the learning process and therefore provides muchbetter performance of the agents as shown empirically in theresults section. As such we use this method as a controlledreplacement for the global gradient clipping usually done inRL algorithms.

D. Adaptive Momentum with GM

The λ parameter in the M-WGM algorithm is kept constantthroughout the training. But as noticed in the U-WGM method,modifying the hyperparameter for learning condition threshold(λ) improves performance. Hence in this section, we introducethe algorithm Adaptive Momentum with Gradient Monitoring(AM-WGM), where instead of hand setting the thresholdfor masking matrix activation it is made adaptable based onthe performance (reward collection rate φ) of the agent. Forexample, if the agent performs worse than before then thethreshold is increased so that fewer gradients are active inthe masking matrix and vice-versa. This means when theperformance is bad, learning is restricted to fewer weights,while in case of improved performance, the agent is providedmore weights in the learning process. The pseudo code forthe AM-WGM is provided in Algorithm 3. To ensure stabilityin the initial training episodes, λ is not modified until a fewepisodes are completed, usually at about 30% of the totalepisodes, and it is also updated after every few episodes,usually at about 10% of the total episodes. These are alsodenoted by the hyperparameters ηstart, ηrepeat.

Rn =1

T

T∑i=1

rt (11)

So AM-WGM is similar to M-WGM in the initial stages ofthe learning process and it only activates after a certain numberof updates are applied and the learning process has stabilized.The algorithm initializes the parameters: reward collected incurrent episode (Rn), reward collected in previous episode

Algorithm 3 Adaptive Momentum with Gradient Monitoring

1: Input: ∇Lt, Wt−1, ρ, λ, ζ, αζ , η, ηstart, ηrepeat2: Init: Mζ , M , Ro, φn, φo, ηstart, ηrepeat3: Sequence:4: Update Rn5: if η >= ηstart and η%ηrepeat == 0 then6: φn = Rn / Ro7: if φn / φo >= 1 then8: change = -19: else if φn / φo < 1 then

10: change = 111: λ = clamp(λ+(αλ*change), 0, 1)12: φo = φn13: Ro = Rn14: for each layer do15: Masking matrix M = H

(Dt − λµ

)16: Momentum matrix Mζ =Mζζ +M(1− ζ)17: New Gradients: ∇Lt = ∇Lt ◦Mζ

18: Output: Weight Wt = Wt−1 + ρ∇Lt

(Ro), rate of reward collected in the current episode (φn), rateof reward collected in the previous episode (φo). The meanreward collected is stored for the current episode is storedas Rn. The rate of reward collected, φn, is the calculated. Ifthe rate of reward collection increased (φn / φo >= 1) thenwe reduce the threshold (λ) (which allows more gradientsto be used), while we increase the increase the threshold(λ) if the performance has degraded. The hyperparameter αλcontrols the amount of change in the λ value. The adaptablenature of the algorithm has empirically shown to increase theperformance of the agents.

E. Summary:

The GM methods explained above contribute mainly ontwo things on the algorithm level: provide an additionaltrust-region constraint for the policy updates and variancereduction of the gradients. The additional trust-region con-straint is provided by removing the noisy insignificant gradientcontributions. Noise in the gradients update is reduced by useof the masking matrix or the momentum matrix while theinsignificant contributions are removed by using the Heavi-side step function. So only the consistently high contributinggradients are propagated while the others are factored to havea low impact on the learning process. The removal of thesegradients also reduce the overall variance. This is especiallycritical for a stable learning in the initial stages of the learningprocess. Our results from the experiments corroborate this.

V. EXPERIMENTAL RESULTS

We test the GM-RL algorithms on a variety of differentenvironments to prove its applicability empirically. We discussand apply the proposed methods to a real world multi-robotcoordination environment with discrete state and action space.Further we apply two algorithms, M-WGM and AM-WGM,on the OpenAI Gym environments of Atari games (continuous

Page 7: Gradient Monitored Reinforcement Learning · Mohammed Sharafath Abdul Hameed , Gavneet Singh Chadha , Andreas Schwung , Steven X. Ding y. Department of Automation Technology South

7

Fig. 2: Schematic diagram of the multi-robot setup with thecommon operation region of both robots shown in grey stripes

state space and discrete action space) and MuJoCo simulations(continuous state space and continuous action space). This isbecause the algorithms, M-WGM and AM-WGM, perform thebest in multi-robot co-ordination problem and they can also bedirectly applied without any hindsight information. The resultsfrom the OpenAI Gym environments prove the general ’plugand play’ nature of the M-WGM and AM-WGM methods,wherein any previously proven algorithm can be improvedupon by usage of GM-RL. All the RL and proposed GMmethods have been developed using PyTorch [58].The results section is structured as follows. All the GM meth-ods introduced in the previous section (F-WGM, U-WGM, M-WGM, AM-WGM) are tested on the multi-robot coordinationenvironment. The results show that the algorithm gets pro-gressively better with each iteration. Then the applicable GMsolutions (M-WGM, AM-WGM) are applied in the OpenAIGym environments. The results obtained are compared withsimilar algorithms Without Gradient Monitoring (WOGM).The results are tested on various random seed initialization(Atari: 5 seeds and MuJoCo: 10 seeds) to test for stability ofthe algorithm.

A. Multi-Robot Coordination Environment

This section describes the application of GM-RL algorithmon a cooperative, self-learning robotic manufacturing cell. Theenvironment along with the corresponding RL agent setup isdescribed in sections below, followed by the results achievedon the various trials.

1) Environment description: We use a simulation of thecooperative, self-learning robotic manufacturing cell to interactwith the RL agent. Training is done on the simulated environ-ment since training the RL agent on the real manufacturingcell is time consuming and it requires large amounts of data toconverge to a good minima [59]. The simulated environmentclosely resembles the actual environment, emulating all thenecessary features like position of work piece, status ofmachines etc., accelerating the learning process from takingweeks to few hours. The simulation environment is developedin Python.

Fig. 3: The multi-robot setup of two industrial robots and aworking platform

2) Learning Set-up: The multi-robot coordination problemis setup in the cooperative test-bed as shown in the Figure 3.The test-bed has a dual robot setup, consisting of AdeptCobra i600 SCARA robot and an ABB IRB1400 6-DOF-robot. The test-bed has six handling stations, two input buffers,three handling stations, and one output buffer as shown inFigure 2. There are two different types of work-pieces to behandled through the stations, Work-Piece-1 (WP1) and Work-Piece-2 (WP2), each with their respective input buffers. Boththe work pieces have their own pre-defined sequences thatare encoded into them through embedded RFID chips. Theschematic diagram of the test-bed is given in the Figure 2.The robots pick and place the work-pieces from one stationto the other. The work space where the handling stations arelocated is accessible to both the robots, hence it is possible tohave a shared working space denoted by the striped grey areain Figure 2. Each robot has its own proprietary software tocontrol its movements. Hence a supervisory control system isimplemented through Siemens S7 platform that controls andcoordinates the robot movements. This supervisory controlsystem sends signals to the robot’s on-board control systemwhere the actual action is taken by the robot. The task of theagents in this test-bed is to move a predefined number of workpieces through the handling stations within an optimal stepsor time-frame into the output buffer.

Agent, Environment and Reward Representation: In thispart, we discuss the agent-type, number of agents, the action-space and the state representation for the agents. The robotsare used as the agents, where both robots act independently ina multi-agent setup. The robots take the universal state of thesystem and output an action each. For the architecture of therobotic multi-agent, independent learners with communicationenabled between the agents was chosen since it is establishedthat communication between the agents helps in faster con-vergence [60]. This setup gives the RL-agent a good overviewof the global conditions and local conditions. For the action-space, the agent has only predefined movements of the work-piece paths since a supervisory control system takes care of thehardware level movements. Providing this information, insteadof the agent computationally finding the best movements isa practical choice as well because such a constraint already

Page 8: Gradient Monitored Reinforcement Learning · Mohammed Sharafath Abdul Hameed , Gavneet Singh Chadha , Andreas Schwung , Steven X. Ding y. Department of Automation Technology South

8

TABLE II: Rewards setup for multi-robot environment

State RewardEach step -1

Locked state -100Incomplete after 1000 steps -100

Unequal WP movement -30WP Output +50

Target achieved 500

exists as a part of the manufacturing document in the factory.The action-space by extension controls the input, output, andloading of the work-piece in the resources. Additionally, noProgrammable Logic Control (PLC) programming is requiredto implement the RL-agent. This eliminates ineffective actionsand the size of the action-space is reduced to 10 instances perrobot. The state-space is a piece of very important informationsince this is what the agent sees. The state of the resources waschosen to represent the state-space since it was independent ofthe work-order size, and also had the computational advantageof being in a discrete space. The state-space has 27 statesgiven by 33, three work stations and three job types (WP1,WP2, and empty). Additionally the work-piece completionpercentage is also given as part of the state-space. This acts asa communication channel between the agents to identify thework done by the other agent.

The setting-up of the rewards for a RL-agent is importantas it can influence the stability of the system. We setup thereward as follows. Every action taken by the robots incurred areward of -0.1. During the course of the study of environmenttwo states were identified as being locked, meaning no furthermovement of the job is possible. If the robot reached thesestates it gets a reward of -100. Also, if the agent is notable to reach the required target in 1000 steps, it receivesa reward of -100. To ensure that the equal quantities of WP1and WP2 are processed, a constraint was placed on the systemsuch that if one of the work-piece reaches completion withoutthe other work-piece reaching even 75% of its target, thenit gets a reward of -30 as this behaviour is not completelybad but something to be improved upon. Every individualoutput from the environment incurred a reward of +50, whilethe agent gets a reward of +500 if the global targets of bothagents are achieved. The reward for the individual output canbe characterised as an intermediate reward, which guides theagent to make more such actions that will eventually lead toachieving the global target. The global target is set as 20 work-pieces each of WP1 and WP2. The rewards are shown in tableII

We use a similar approach as presented in [7] with neuralnetwork architecture in the actor critic algorithm. The mainidea is to use multi-task learning [61], which constructs neuralnetworks that enable generalised learning of the tasks, inthe context of the actor-critic algorithm. The ‘multi-headedneural network’ also is known to generalise the tasks bytaking advantage of the system specific information from thesignals [61]. The primary hyper-parameters in focus here arethe network size, the learning rate, the batch size and then-step size. The values of hyper-parameters which gave the

TABLE III: Hyperparameters of A2C algorithm

Algorithm Hyperparameter ValueAll NN Input Size 29All Body - Network Layers 2All Body - Layer Neurons 10All Head - Network Layers 2All Head - Layer Neurons 10All Batch size 10

WOGM Learning rate (ρ) 1e-3VGM, M-WGM, AM-WGM Learning rate (ρ) 2e-3

All Learning Factor (λ) 0.5All Discount factor (γ) 0.99

AM-WGM Momentum value (ζ) 0.0005AM-WGM AM-WGM start (ηstart) 1500AM-WGM AM-WGM repeat (ηrepeat) 1000AM-WGM Masking Momentum (ζ) 0.999AM-WGM Threshold change (αζ ) 0.001

best results are shown in Table III which were set using grid-search. Although the network size can be arbitrarily large,we use this particular size which gave the best result for theWOGM algorithm. This is discussed in Robustness to Choiceof Network Size of the results section. The activation functionin the actor and critic layer is ReLU while those used in theshared layer is Sigmoid.

3) Results: In this section, we discuss the results in threesub-parts namely the gradients during the back-propagation,the amount of rewards the agents collected, and the tasktime and the number of work-piece outputs achieved byeach agent in the multi-robot environment. All the resultsprovided here are from the deployment of the agents after thetraining is complete, although we also notice that the GM-RLalgorithms improve the training performance, leading to fasterconvergence in all GM methods as shown in Figure 10. All theagents are trained for 5000 episodes where the convergence isachieved after 1000-2000 episodes in each of the algorithms,allowing for 3000 further episodes of learning. The agents areeventually tested for 4000 episodes.

Gradients: In this section, we discuss about the amountof gradients that back-propagate through the neural networkto analyse the targeted learning activity in the network. Sincethe gradient directions can be both positive and negative, in-order to get the actual quantum of the gradients, the absolutesum of the gradients for each backward pass is calculated.The absolute sum for the GM methods are calculated afterthe masking matrix is applied hence the quantum of gradientsback-propagated by the GM methods are considerably lessthan the WOGM method as can be seen in Figure 4. It canbe noted that in the case of U-WGM the gradients spikeis noted in the iterations at which the masking matrix isapplied. While the F-WGM and U-WGM are still prone tothe odd fluctuations in the gradients back-propagated, it shouldbe noted that the momentum based GM methods (M-WGMand AM-WGM) control their gradient variations well duringthe entire training process. The WOGM training is exposedto extensive variation in the amount of gradient flow. Thisvariance reduction eventually leads to a stable learning processwhich reflects in the rewards collected as well as illustrated inFigure 9. The AM-WGM algorithm collects the most rewards,

Page 9: Gradient Monitored Reinforcement Learning · Mohammed Sharafath Abdul Hameed , Gavneet Singh Chadha , Andreas Schwung , Steven X. Ding y. Department of Automation Technology South

9

Fig. 4: Gradients Propagating through the network

followed by the rest of the rest of the GM methods, with theWOGM algorithm collecting the least amount of rewards.

Robustness to Choice of Network Size: Another importantadvantage of using the GM methods is the higher degreeof freedom or robustness to the size of the network cho-sen. This is because the threshold-function (λµ) explainedin Algorithm 1 adaptively selects only the required neuronsfor learning and ensures the learning is focused only onthem. In Figure. 5, the dynamic selection of the amountactive neurons from all the GM methods are illustrated overthe training progress. This dynamic selection accelerates thelearning process while removing the need for hyper-parametertuning for the number of neurons in the DNN. To provideadditional evidence for this phenomenon, we trained the samemulti-robot co-ordination problem with a randomly chosenbigger network size (3-layers, 20-neurons per layer) withthe M-WGM algorithm. Three simulations were made onewithout any GM method, one with M-WGM (threshold -0.5) and one with M-WGM (threshold - 0.75). As illustratedin Figure 6, the rewards collected by the WOGM methodwith more parameters, is considerably less to all the M-WGM methods when the network size is changed. The dropin performance is substantially less in the GM algorithms.Furthermore, Figure 7 illustrates the drastic increase in thenumber of steps required for the WOGM method to achievethe work-piece transportation goal. This shows the robustnessto the change in the size of the network. Fig. 8 illustrates theautomatic adjustment on the amount of active weights in theM-WGM methods. It can be observed that the for the samelearning factor (λ)value of 50%, the quantum of gradientsback-propagated in the smaller network is higher than in thebigger network, further proving the automatic usable networksize adjustment capability of the algorithm.

Task Time: Task time is the amount of steps required by theagents to move the 20 work-pieces through the production sys-tem. The figures show the episode wise steps taken (Figure 11)and jobs completed (Figure 12). WOGM performs the worst interms of number of steps required and is also not stable in workcompletion. F-WGM improves the task time while still beinga bit unstable in work-piece completion. U-WGM providesa very stable output at the same time reducing the task timefurther. While M-WGM provides the best task completion time

Fig. 5: Active neurons in back-prop

Fig. 6: Rewards collected by the agents of different networksizes

and is stable enough for deployment, AM-WGM provides thecombination of stability and task time completion. This alsoreflects in the amount of rewards collected.

B. MuJoCo

1) Environment Description:: The MuJoCo engine facili-tates accurate and fast simulations of physical systems for re-search and development. This engine, wrapped inside the Ope-nAI Gym environment, provides for a frequently used [62],[63] training and testing benchmark environment in the domainof RL. The already established baseline performance in theform of PPO algorithm helps in the direct comparison of theeffect of introducing GM methods. We test the M-WGM andAM-WGM on four randomly selected MuJoCo environmentsi.e. Half Cheetah, Ant, Humanoid and Inverted Double Pendu-lum (IDP). Each algorithm was run on the four environmentswith 10 random seed initialization. The learning setup is thesame as in [9], if not stated otherwise. The hyperparameterfor all the different algorithms are shown in table V.

2) Results: Since we are reducing the gradients back-propagated, the hyperparameters of the PPO algorithm aremodified to reflect that and take advantage of the reducedvariances. For example, the learning rate is increased com-pared to the original paper. This does not destabilize thelearning process like in the vanilla PPO implementation dueto the inherent variance reduction capabilities of the M-WGMand AM-WGM algorithms. It should be noted that we havealso not used the global gradient clipping implemented in

Page 10: Gradient Monitored Reinforcement Learning · Mohammed Sharafath Abdul Hameed , Gavneet Singh Chadha , Andreas Schwung , Steven X. Ding y. Department of Automation Technology South

10

Fig. 7: Output by different NN sizes

Fig. 8: Comparison of active gradient percentage by networksize

the vanilla PPO. The GM implementation provides a betterlayer-wise control over norm of the gradients. As illustratedin Fig. 13, during our trials both the GM methods performedbetter than WOGM. The M-WGM and AM-WGM algorithmsboth performed on average better in all of the four gamesacross the 10 random seeds. It should be noted that the AM-WGM provides the best normalized improvement over theWOGM. The final scores with the maximum average rewardcollected are presented in Table IV.

C. Atari

1) Environment Description: The Atari games were firstintroduced in [22] to aid the development of general domainindependent AI technology. The environment also providesfor a baseline where previous algorithms have been tested.We test a total 10 games, 6 of which were randomly selected(Battlezone, Frostbite, Gopher, Kangaroo, Timepilot, and Za-xxon). The other 4 (Montezuma’s Revenge, Pitfall, Skiing,and Solaris) are selected to specifically to test the long termcredit assignment problem of the algorithms. We use the raminformation as input to the network with no frames being

TABLE IV: Reward in MuJoCo environment

Environment PPO M-WGM AM-WGMHalf Cheetah 3600±1447 3744±1621 4037±1785

Ant 3151±584 3225±611 3183±758Humanoid 720±381 750±658 893±1007

IDP 7583±1151 8154±1063 8364±959

Fig. 9: Rewards collected by each algorithm

Fig. 10: Convergence speed of algorithms

skipped. The 10 games were run on the three algorithms(WOGM, M-WGM, and AM-WGM) over 5 random seedinitialization. The learning setup is the same as in [9], ifnot stated otherwise. The hyperparameter for all the differentalgorithms are shown in table VI.

2) Results: As with the implementation in MuJoCo en-vironment, we use a higher learning rate and do not usethe global clipping used in the vanilla PPO. We also foundthat increasing the k-epoch update in AM-WGM increases itsperformance significantly. As shown in the Figure 14, the M-WGM method performs better than WOGM in 4 out of the 6random games while AM-WGM performs better in 5 out of the6 random games. There was no performance improvement forthe algorithms in the difficult games except in Solaris, where

TABLE V: Hyperparameter Values for PPO in MuJoCo

Algorithm Hyperparameter ValueWOGM Learning rate 2.5e-4WOGM Hidden Units 64

M- & AM-WGM Learning rate 3e-4M- & AM-WGM Hidden Units 96

WOGM k-epoch updates 4M- & AM-WGM k-epoch updates 5M- & AM-WGM Momentum Value (ζ) 0.99, 0.9995M- & AM-WGM Threshold (λ) 0.5M- & AM-WGM Global Gradient clipping FalseM- & AM-WGM Momentum Matrix(Mζ ) Init 1

AM-WGM Threshold Change (αζ ) 0.05AM-WGM Adaptive start from 150AM-WGM Adaptive start for 50

Page 11: Gradient Monitored Reinforcement Learning · Mohammed Sharafath Abdul Hameed , Gavneet Singh Chadha , Andreas Schwung , Steven X. Ding y. Department of Automation Technology South

REFERENCES 11

Fig. 11: Steps taken to complete the given target

Fig. 12: Work-pieces completed in each episode

there is a drastic improvement made by the GM algorithms asshown in Figure 15.

VI. CONCLUSION

We propose four novel neural network training methodolo-gies called Gradient Monitoring in Reinforcement Learning,for a more robust and faster training progress. The proposedmethods incorporate a targeted training procedure in neuralnetwork by systematically reducing the gradient variance andadditional trust-region constraint for the policy updates. Theadaptive momentum method helps the network to chose theoptimal number of parameters required for a particular trainingstep based on the feedback from the rewards collected. Thisresults in the training algorithm being robust to the selection

TABLE VI: Hyperparameter Values for PPO in Atari games

Algorithm Hyperparameter ValueWOGM Learning rate 2.5e-4WOGM Hidden Units 64

M- & AM-WGM Learning rate 4e-4M- & AM-WGM Hidden Units 96M- & AM-WGM Momentum Value (ζ) 0.999M- & AM-WGM Threshold (λ) 0.5M- & AM-WGM Global Gradient clipping FalseM- & AM-WGM Momentum Matrix(Mζ ) Init 0

AM-WGM Threshold Change (αζ ) 0.1AM-WGM Adaptive start from 2000AM-WGM Adaptive start for 1000

Fig. 13: Percent Change in the performance of the M-WGMand AM-WGM with WOGM as baseline

Fig. 14: Percentage Performance improvement of the proposedmethods in 6 randomly selected games

of the size of the network. The proposed methods on average,outperform the standard A2C in the multi-robot co-operationapplication and the standard PPO algorithm in the Mujoco andAtari environment.

A potential limitation of the F-WGM and UF-WGM meth-ods is the occurrence of peaks in the the gradient duringtraining which can sometimes disturb the learning process.Another limitation of the AM-WGM is the selection of thehyperparameter ηstart .This can be eliminated by using feed-back from the reward collection during training. This will partof the future work. Subsequent research will also focus on theperformance improvement of the RL agent to generalize tounseen environment setup like in CoinRun [16], applicationto model free on-policy RL algorithms like trust region policyoptimization [8] and model free off-policy RL algorithms likedeep deterministic policy gradient [5].

REFERENCES

[1] G. Lample and D. S. Chaplot, “Playing fps games withdeep reinforcement learning,” in Proceedings of theThirty-First AAAI Conference on Artificial Intelligence,ser. AAAI’17, AAAI Press, 2017, pp. 2140–2146.

[2] D. Silver, J. Schrittwieser, K. Simonyan, I. Antonoglou,A. Huang, A. Guez, T. Hubert, L. Baker, M. Lai, A.Bolton, Y. Chen, T. Lillicrap, F. Hui, L. Sifre, G. vanden Driessche, T. Graepel, and D. Hassabis, “Masteringthe game of go without human knowledge,” Nature, vol.550, no. 7676, pp. 354–359, 2017.

Page 12: Gradient Monitored Reinforcement Learning · Mohammed Sharafath Abdul Hameed , Gavneet Singh Chadha , Andreas Schwung , Steven X. Ding y. Department of Automation Technology South

REFERENCES 12

Fig. 15: Performance improvement in difficult games

[3] S. Gu, E. Holly, T. Lillicrap, and S. Levine, “Deepreinforcement learning for robotic manipulation withasynchronous off-policy updates,” in 2017 IEEE inter-national conference on robotics and automation (ICRA),2017, pp. 3389–3396.

[4] T. Inoue, G. De Magistris, A. Munawar, T. Yokoya, andR. Tachibana, “Deep reinforcement learning for highprecision assembly tasks,” in 2017 IEEE/RSJ Interna-tional Conference on Intelligent Robots and Systems(IROS), 2017, pp. 819–825.

[5] Timothy P. Lillicrap, Jonathan J. Hunt, AlexanderPritzel, Nicolas Heess, Tom Erez, Yuval Tassa, DavidSilver, and Daan Wierstra, “Continuous control withdeep reinforcement learning,” in 2016 – 4th Interna-tional Conference on Learning.

[6] V. Mnih, K. Kavukcuoglu, D. Silver, A. A. Rusu, J.Veness, M. G. Bellemare, A. Graves, M. Riedmiller,A. K. Fidjeland, G. Ostrovski, S. Petersen, C. Beat-tie, A. Sadik, I. Antonoglou, H. King, D. Kumaran,D. Wierstra, S. Legg, and D. Hassabis, “Human-levelcontrol through deep reinforcement learning,” Nature,vol. 518, no. 7540, pp. 529–533, 2015.

[7] V. Mnih, A. P. Badia, M. Mirza, A. Graves, T. Lillicrap,T. Harley, D. Silver, and K. Kavukcuoglu, “Asyn-chronous methods for deep reinforcement learning,” inInternational conference on machine learning, 2016,pp. 1928–1937.

[8] J. Schulman, S. Levine, P. Abbeel, M. Jordan, and P.Moritz, “Trust region policy optimization,” in Interna-tional conference on machine learning, 2015, pp. 1889–1897.

[9] J. Schulman, F. Wolski, P. Dhariwal, A. Radford, andO. Klimov, “Proximal policy optimization algorithms,”ArXiv preprint arXiv:1707.06347, 2017.

[10] E. Conti, V. Madhavan, F. P. Such, J. Lehman, K. Stan-ley, and J. Clune, “Improving exploration in evolutionstrategies for deep reinforcement learning via a popula-tion of novelty-seeking agents,” in Advances in neuralinformation processing systems, 2018, pp. 5027–5038.

[11] S. Mohamed and D. J. Rezende, “Variational infor-mation maximisation for intrinsically motivated rein-forcement learning,” in Advances in neural informationprocessing systems, 2015, pp. 2125–2133.

[12] D. Pathak, P. Agrawal, A. A. Efros, and T. Darrell,“Curiosity-driven exploration by self-supervised predic-tion,” in Proceedings of the 34th International Confer-ence on Machine Learning - Volume 70, ser. ICML’17,JMLR.org, 2017, pp. 2778–2787.

[13] S. Ioffe and C. Szegedy, “Batch normalization: Accel-erating deep network training by reducing internal co-variate shift,” in Proceedings of the 32nd InternationalConference on International Conference on MachineLearning - Volume 37, ser. ICML’15, JMLR.org, 2015,pp. 448–456.

[14] N. Srivastava, G. E. Hinton, A. Krizhevsky, I. Sutskever,and R. Salakhutdinov, “Dropout: A simple way toprevent neural networks from overfitting,” Journal ofMachine Learning Research, vol. 15, no. 1, pp. 1929–1958, 2014.

[15] I. Goodfellow, Y. Bengio, and A. Courville, Deeplearning. MIT Press, 2016.

[16] K. Cobbe, O. Klimov, C. Hesse, T. Kim, and J.Schulman, “Quantifying generalization in reinforce-ment learning,” in International Conference on MachineLearning, 2019, pp. 1282–1289.

[17] J. Bergstra and Y. Bengio, “Random search for hyper-parameter optimization,” Journal of Machine LearningResearch, vol. 13, no. Feb, pp. 281–305, 2012.

[18] M. Jaderberg, V. Dalibard, S. Osindero, W. M.Czarnecki, J. Donahue, A. Razavi, O. Vinyals, T.Green, I. Dunning, K. Simonyan, et al., “Populationbased training of neural networks,” ArXiv preprintarXiv:1711.09846, 2017.

[19] G. S. Chadha, E. Meydani, and A. Schwung, “Regu-larizing neural networks with gradient monitoring,” inINNS Big Data and Deep Learning conference, 2019,pp. 196–205.

[20] D. Applegate and W. Cook, “A computational study ofthe job-shop scheduling problem,” ORSA Journal onComputing, vol. 3, no. 2, pp. 149–156, 1991, ISSN:0899-1499.

[21] Greg Brockman, Vicki Cheung, Ludwig Pettersson,Jonas Schneider, John Schulman, Jie Tang, and Woj-ciech Zaremba, Openai gym, 2016.

[22] M. G. Bellemare, Y. Naddaf, J. Veness, and M. Bowl-ing, “The arcade learning environment: An evaluationplatform for general agents,” Journal of Artificial Intel-ligence Research, vol. 47, pp. 253–279, 2013.

[23] E. Todorov, T. Erez, and Y. Tassa, “Mujoco: A physicsengine for model-based control,” in 2012 IEEE/RSJInternational Conference on Intelligent Robots and Sys-tems, 2012, pp. 5026–5033.

[24] S. Hochreiter, “The vanishing gradient problem duringlearning recurrent neural nets and problem solutions,”International Journal of Uncertainty, Fuzziness andKnowledge-Based Systems, vol. 6, no. 02, pp. 107–116,1998.

[25] M. Gori and A. Tesi, “On the problem of local min-ima in backpropagation,” IEEE Transactions on PatternAnalysis & Machine Intelligence, no. 1, pp. 76–86,1992.

Page 13: Gradient Monitored Reinforcement Learning · Mohammed Sharafath Abdul Hameed , Gavneet Singh Chadha , Andreas Schwung , Steven X. Ding y. Department of Automation Technology South

REFERENCES 13

[26] S. Lawrence, C. L. Giles, and A. C. Tsoi, “Lessons inneural network training: Overfitting may be harder thanexpected,” in AAAI/IAAI, 1997, pp. 540–545.

[27] X. Glorot and Y. Bengio, “Understanding the difficultyof training deep feedforward neural networks,” in Pro-ceedings of the thirteenth international conference onartificial intelligence and statistics, 2010, pp. 249–256.

[28] K. He, X. Zhang, S. Ren, and J. Sun, “Delving deepinto rectifiers: Surpassing human-level performance onimagenet classification,” in Proceedings of the IEEEinternational conference on computer vision, 2015,pp. 1026–1034.

[29] X. Glorot, A. Bordes, and Y. Bengio, “Deep sparserectifier neural networks,” in Aistats, vol. 15, 2011,p. 275.

[30] Diederik P. Kingma and Jimmy Ba, “Adam: A methodfor stochastic optimization,” in 3rd International Con-ference on Learning Representations, ICLR 2015, 2015.

[31] D. P. Kingma, T. Salimans, and M. Welling, “Varia-tional dropout and the local reparameterization trick,”in Advances in neural information processing systems,2015, pp. 2575–2583.

[32] A. N. Gomez, I. Zhang, K. Swersky, Y. Gal, andG. E. Hinton, “Learning sparse networks using targeteddropout,” ArXiv preprint arXiv:1905.13678, 2019.

[33] L. Wan, M. Zeiler, S. Zhang, Y. Le Cun, and R. Fergus,“Regularization of neural networks using dropconnect,”in International conference on machine learning, 2013,pp. 1058–1066.

[34] Behnam Neyshabur, Zhiyuan Li, Srinadh Bhojanapalli,Yann LeCun, and Nathan Srebro, “The role of over-parametrization in generalization of neural networks,” inInternational Conference on Learning Representations,2019.

[35] M. Belkin, D. Hsu, S. Ma, and S. Mandal, “Reconcil-ing modern machine-learning practice and the classicalbias-variance trade-off,” Proceedings of the NationalAcademy of Sciences, vol. 116, no. 32, pp. 15 849–15 854, 2019, ISSN: 0027-8424.

[36] A. Brutzkus and A. Globerson, “Why do larger mod-els generalize better? a theoretical perspective via thexor problem,” in International Conference on MachineLearning, 2019, pp. 822–830.

[37] R. Pascanu, T. Mikolov, and Y. Bengio, “On the diffi-culty of training recurrent neural networks,” in 2013International conference on machine learning, 2013,pp. 1310–1318.

[38] Jingzhao Zhang, Tianxing He, Suvrit Sra, and Ali Jad-babaie, “Why gradient clipping accelerates training: Atheoretical justification for adaptivity,” in InternationalConference on Learning Representations, 2020.

[39] S. Han, J. Pool, J. Tran, and W. Dally, “Learning bothweights and connections for efficient neural network,”in Advances in neural information processing systems,2015, pp. 1135–1143.

[40] B. Hassibi and D. G. Stork, “Second order derivativesfor network pruning: Optimal brain surgeon,” in Ad-

vances in neural information processing systems, 1993,pp. 164–171.

[41] Y. Le Cun, J. S. Denker, and S. A. Solla, “Optimal braindamage,” in Advances in Neural Information ProcessingSystems 2, San Francisco, CA, USA: Morgan KaufmannPublishers Inc, 1990, pp. 598–605.

[42] Namhoon Lee, Thalaiyasingam Ajanthan, and PhilipTorr, “Snip: Single-shot network pruning based onconnection sensitivity,” in International Conference onLearning Representations, 2019.

[43] Namhoon Lee, Thalaiyasingam Ajanthan, StephenGould, and Philip H. S. Torr, “A signal propagation per-spective for pruning neural networks at initialization,” inInternational Conference on Learning Representations,2020.

[44] D. Blalock, J. J. Gonzalez Ortiz, J. Frankle, and J.Guttag, “What is the state of neural network pruning?”In Proceedings of Machine Learning and Systems 2020,2020, pp. 129–146.

[45] E. Greensmith, P. L. Bartlett, and J. Baxter, “Variancereduction techniques for gradient estimates in reinforce-ment learning,” Journal of Machine Learning Research,vol. 5, no. Nov, pp. 1471–1530, 2004.

[46] O. Anschel, N. Baram, and N. Shimkin, “Averaged-dqn:Variance reduction and stabilization for deep reinforce-ment learning,” in Proceedings of the 34th InternationalConference on Machine Learning - Volume 70, ser.ICML’17, JMLR.org, 2017, pp. 176–185.

[47] Hongzi Mao, Shaileshh Bojja Venkatakrishnan, MalteSchwarzkopf, and Mohammad Alizadeh, “Variance re-duction for reinforcement learning in input-driven en-vironments,” in International Conference on LearningRepresentations, 2019.

[48] N. Justesen, R. R. Torrado, P. Bontrager, A. Khalifa,J. Togelius, and S. Risi, “Illuminating generalization indeep reinforcement learning through procedural levelgeneration,” ArXiv preprint arXiv:1806.10729, 2018.

[49] Xingyou Song, Yiding Jiang, Stephen Tu, Yilun Du,and Behnam Neyshabur, “Observational overfitting inreinforcement learning,” in International Conference onLearning Representations, 2020.

[50] M. Igl, K. Ciosek, Y. Li, S. Tschiatschek, C. Zhang,S. Devlin, and K. Hofmann, “Generalization in rein-forcement learning with selective noise injection andinformation bottleneck,” in Advances in Neural Infor-mation Processing Systems, 2019, pp. 13 956–13 968.

[51] J. Bergstra, D. Yamins, and D. D. Cox, “Making ascience of model search: Hyperparameter optimizationin hundreds of dimensions for vision architectures,”in Proceedings of the 30th International Conferenceon International Conference on Machine Learning -Volume 28, ser. ICML’13, JMLR.org, 2013, pp. I–115–I–123.

[52] S. R. Young, D. C. Rose, T. P. Karnowski, S.-H.Lim, and R. M. Patton, “Optimizing deep learninghyper-parameters through an evolutionary algorithm,”in Proceedings of the Workshop on Machine Learn-ing in High-Performance Computing Environments, ser.

Page 14: Gradient Monitored Reinforcement Learning · Mohammed Sharafath Abdul Hameed , Gavneet Singh Chadha , Andreas Schwung , Steven X. Ding y. Department of Automation Technology South

14

MLHPC ’15, New York, NY, USA: Association forComputing Machinery, 2015, ISBN: 9781450340069.

[53] L. Li, K. Jamieson, G. DeSalvo, A. Rostamizadeh,and A. Talwalkar, “Hyperband: A novel bandit-basedapproach to hyperparameter optimization,” J. Mach.Learn. Res., vol. 18, no. 1, pp. 6765–6816, 2017, ISSN:1532-4435.

[54] B. Baker, O. Gupta, N. Naik, and R. Raskar, “Designingneural network architectures using reinforcement learn-ing,” in International Conference on Learning Repre-sentations, 2017.

[55] T. Schaul, D. Borsa, D. Ding, D. Szepesvari, G.Ostrovski, W. Dabney, and S. Osindero, “Adapt-ing behaviour for learning progress,” ArXiv preprintarXiv:1912.06910, 2019.

[56] R. S. Sutton and A. G. Barto, Reinforcement learning:An introduction / richard s. sutton and andrew g.barto, ser. Adaptive computation and machine learning.Cambridge, Mass. and London: MIT Press, 1998, ISBN:0262193981.

[57] S. Arora, N. Cohen, and E. Hazan, “On the optimizationof deep networks: Implicit acceleration by overparam-eterization,” in Proceedings of the 35th InternationalConference on Machine Learning, ser. Proceedings ofMachine Learning Research, vol. 80, PMLR, 2018,pp. 244–253.

[58] A. Paszke, S. Gross, F. Massa, A. Lerer, J. Bradbury,G. Chanan, T. Killeen, Z. Lin, N. Gimelshein, L. Antiga,et al., “Pytorch: An imperative style, high-performancedeep learning library,” in Advances in Neural Informa-tion Processing Systems, 2019, pp. 8024–8035.

[59] Y. Zhu, R. Mottaghi, E. Kolve, J. J. Lim, A. Gupta,L. Fei-Fei, and A. Farhadi, “Target-driven visual navi-gation in indoor scenes using deep reinforcement learn-ing,” in 2017 IEEE international conference on roboticsand automation (ICRA), IEEE, 2017, pp. 3357–3364.

[60] L. Panait and S. Luke, “Cooperative multi-agent learn-ing: The state of the art,” Autonomous agents and multi-agent systems, vol. 11, no. 3, pp. 387–434, 2005.

[61] R. Caruana, “Multitask learning,” Machine Learning,vol. 28, no. 1, pp. 41–75, 1997.

[62] T. Haarnoja, A. Zhou, P. Abbeel, and S. Levine,“Soft actor-critic: Off-policy maximum entropy deepreinforcement learning with a stochastic actor,” in In-ternational Conference on Machine Learning, 2018,pp. 1861–1870.

[63] S. Fujimoto, H. Hoof, and D. Meger, “Addressingfunction approximation error in actor-critic methods,” inInternational Conference on Machine Learning, 2018,pp. 1587–1596.

Mohammed Sharafath Abdul Hameed receivedthe M.Sc. degree in 2019 from the South WestphaliaUniversity of Applied Sciences, Soest, Germany. Heis currently working as an research assistant at thedepartment of automation technology at the SouthWestphalia University of Applied Sciences,Soest andworking towards his PhD. His research interestsinclude deep reinforcement learning, automation,production planning, and smart manufacturing.

Gavneet Singh Chadha received the M.Sc. degreein 2016 from the South Westphalia University ofApplied Sciences, Soest, Germany. He is currentlyworking as an research assistant at the departmentof automation technology at the South WestphaliaUniversity of Applied Sciences,Soest and workingtowards his PhD. His research interests include deepneural networks, fault diagnosis, predictive mainte-nance and machine learning.

Andreas Schwung received the Ph.D. degree inelectrical engineering from the Technische Univer-sität Darmstadt, Darmstadt, Germany, in 2011. From2011 to 2015, he was an R&D Engineer with MANDiesel & Turbo SE, Oberhausen, Germany. Since2015, he has been a Professor of automation technol-ogy at the South Westphalia University of AppliedSciences, Soest, Germany. His research interestsinclude model based control, networked automationsystems, and intelligent data analytics with applica-tions in manufacturing and process industry.

Steven X. Ding received the Ph.D. degree in electrical engineering fromGerhard Mercator University of Duisburg, Duisburg, Germany, in 1992. From1992 to 1994, he was an R&D Engineer with Rheinmetall GmbH. From 1995to 2001, he was a Professor of control engineering with the University ofApplied Science Lausitz, Senftenberg, Germany, where he served as the VicePresident during 1998–2000. Since 2001, he has been a Professor of controlengineering and the Head of the Institute for Automatic Control and ComplexSystems (AKS) with the University of Duisburg-Essen, Duisburg. His researchinterests are model-based and data-driven fault diagnosis and fault tolerantsystems and their application in industry, with a focus on automotive systemsand mechatronic and chemical processes.