Abstract
State-of-the art deep reinforcement learning has enabled autonomous agents to learn complex strategies from scratch on many problems including continuous control tasks. Deep Q-networks (DQN) and deep deterministic policy gradients (DDPGs) are two such algorithms which are both based on Q-learning. They therefore all share function approximation, off-policy behavior, and bootstrapping—the constituents of the so-called deadly triad that is known for its convergence issues. We suggest to take a graph perspective on the data an agent has collected and show that the structure of this data graph is linked to the degree of divergence that can be expected. We further demonstrate that a subset of states and actions from the data graph can be selected such that the resulting finite graph can be interpreted as a simplified Markov decision process (MDP) for which the Q-values can be computed analytically. These Q-values are lower bounds for the Q-values in the original problem, and enforcing these bounds in temporal difference learning can help to prevent soft divergence. We show further effects on a simulated continuous control task, including improved sample efficiency, increased robustness toward hyperparameters as well as a better ability to cope with limited replay memory. Finally, we demonstrate the benefits of our method on a large robotic benchmark with an industrial assembly task and approximately 60 h of real-world interaction.
1. Introduction and motivation
Since deep (supervised) learning has been shown to be a very powerful method in areas like computer vision (Deng et al., 2009), neural networks have also been investigated as function approximators in reinforcement learning (Mnih et al., 2015). Because these algorithms are known to be very data hungry, most success stories are either based on simulation as in Mnih et al. (2015) or applied in cases for which abundant data could be collected over months, for example, Levine et al. (2016) in the domain of robotics. If applicable in robotics, many of the network-based approaches fall in the category of model-free methods. That is, they neither assume nor explicitly learn a model that predicts the effect of control input to the robot on its state. In the context of contact-rich manipulation such models are particularly hard to obtain because contacts are hard to model and required information, for example, about the different surfaces involved, may not be available. Model-free learning in such domains has therefore been shown to outperform model-based solutions (Fazeli et al., 2017; Levine et al., 2016).
Many of the state-of-the art deep reinforcement learning algorithms are based on Q-learning, including deep Q-networks (DQN, Mnih et al., 2015), deep deterministic policy gradient (DDPG, Lillicrap et al., 2015), and soft actor critic (SAC, Haarnoja et al., 2018). While these algorithms have reached impressive performance on many tasks, their major commonality—Q-learning—is not fully understood from a theoretical perspective. On the contrary, Q-learning even with linear function approximation is known for convergence issues (Baird, 1995). Deep Q-learning combines highly non-linear function approximation with off-policy learning and bootstrapping—a combination that has been termed deadly triad by Sutton and Barto (2018) because of the instabilities it is likely to induce. Empirically, deep Q-learning does not seem to fully exhibit these expected divergence issues (Van Hasselt et al., 2018): Its Q-estimates do not reach floating point NaN values, but instead Q-learning plateaus or oscillates at Q-values that are outside their theoretically derived bounds. Following Van Hasselt et al. (2016), we will refer to this phenomenon as “soft divergence.”
With this work, we first deepen our understanding of why and when deep Q-learning diverges: We propose to take a graph-perspective on the replay memory (see Figure 1 for illustration), which allows us to analyze the graph structure and show on small characteristic example problems how specific structures are linked to soft divergence. Graph structure of the replay memory (center) is linked to divergence issues in deep Q-learning. We extract a subgraph whose non-parametric information can be used to derive lower bounds to be enforced in temporal difference learning. A benchmark on an industrial-scale assembly task (foreground) shows that this prevents divergence and increases sample efficiency under adverse hyperparameters.
In a second step, we will show that the derived graph structure is useful beyond its descriptiveness. Under the assumption of deterministic transitions, non-parametric information from the graph can be used to compute lower bounds to Q-values in parametric network updates. Among other effects, this can prevent soft divergence and therefore on average increases sample efficiency in a series of experiments with DDPG and a simulated peg-insertion task. Finally, we will extend the evaluation to extensive experiments with a real robot and an industrial-scale contact rich manipulation task with substantial uncertainties and non-determinism (see https://youtu.be/Z_GcNbCWE-E).
This journal paper is an extended version of the paper presented at the International Conference on Intelligent Robots and Systems (Hoppe et al., 2020), which describes the application of our method to a non-deterministic industrial insertion task. Extensions mainly concern the first two parts of this paper, that is, the full background on how different types of transitions are linked to soft divergence including several toy examples and the full derivation of our method with empirical evaluations on a simulated insertion task including extended baselines and ablations.
2. Preliminaries
Reinforcement learning describes a problem setting in which an agent learns from interacting with its environment (Sutton and Barto, 2018). It has also been described as a “way of programming agents by reward and punishment without needing to specify how a task is to be achieved” (Kaelbling et al., 1996). The agent aims to maximize the amount of reward it is granted, which has even been hypothesized to be enough for intelligent behavior (Silver et al., 2021). When the target is reached, or when a maximum number of steps has been executed, the agent is reset to an initial state and can try again. One such trial is then referred to as an episode.
Formally, the setting is typically described as a Markov decision process (MDP) that consists of a state space
The state value V
π
(s) represents the expected return for an agent that starts at state s and follows policy π:
Q-iteration is a way to determine Q-values from data in discrete state and action spaces proposed in Watkins (1989): In each repetition k, Q-iteration iterates over all states and actions as follows:
If the transition probabilities
Building on the definitions for return, state value, and state-action value, the following properties can be derived for state values:
For γ < 1 and an infinite trajectory with constant reward r, the return forms a geometric series:
Thus, under the assumption of a policy π which induces such an infinite trajectory with constant reward, also the state value converges:
The state action value converges analogously:
This also means, that if the reward function is bounded by Rmin and Rmax, the smallest and largest possible Q-value can be computed as follows:
Analogously, the state(-action) value for loops with different rewards can be derived. Let’s assume one loop consists of ever-repeating transitions (s1, a1, r1, s2) to (s
n
, a
n
, r
n
, s1) which are induced by a policy π and rewarded equally in each loop traversal. Then the state value can be computed as follows:
When deep reinforcement learning is used, Q is represented by a network that is trained using TD learning as follows: The TD target value is computed as in equation (2) and then a mean-squared error loss function can be applied to modify the network parameters θ such that the predicted Q-values are moved toward the TD target:
In settings with continuous actions—as typically required for robotics applications—an actor–critic architecture called deep deterministic policy gradient (DDPG) can be used (Lillicrap et al., 2015): The network that takes both state and action as an input and predicts the Q-value for this pair is referred to as critic. The actor is represented as a network that maps states to the optimal action to take. The critic is trained using TD learning as in equation (8). The current estimate of the critic is then also used as a training signal for the actor network which in other words means that the actor network π is trained to maximize the Q-value that the critic predicts: π(s) = max a Q (s, a). Once an actor network has been trained, it is computationally much more efficient to evaluate the network at test time than it would be to maximize the highly non-linear Q-function on the fly.
3. Related work
Reinforcement learning based on Q-learning has been known to be unstable even with linear function approximation for more than 20 years (Baird, 1995). While the problem to date is not fully understood, in particular for more complex non-linear settings, there are several approaches to characterizing instability and prevent it.
3.1. Instabilities in reinforcement learning: The deadly triad
The combination of function approximation, bootstrapping, and off-policy reinforcement learning has been called the deadly triad by Sutton and Barto (2018) because of its tendency to diverge. While deep reinforcement learning methods within the deadly triad tend to be hard to reproduce and evaluate empirically (Henderson et al., 2018), it seems to exhibit soft divergence only (Van Hasselt et al., 2018): that is, following the authors’ definitions, deep reinforcement learning does not actually reach floating point NaN values but instead plateaus or oscillates at Q-values that are outside of the theoretically derived bounds as given in equation (6). Van Hasselt et al. (2018) further show that using target networks as well as counteracting the overestimation bias in Q-learning through double Q-learning (Van Hasselt et al., 2016) helps to prevent divergence but cannot fully stabilize the learning process.
To understand causes and remedies against divergence in the deadly triad, all three properties of the triad have been the focus of investigations.
Different networks for function approximation and update schemes have been linked to convergence: Fu et al. (2019) found large neural networks with compensation for overfitting to be beneficial for learning stability. Mnih et al. (2015) introduced target networks: These are a second function approximator that is only updated slowly or periodically and therefore serves as a low-pass filter on the network parameters. Its values are more stable and thus lead to more stable target Q-values in temporal difference learning. Besides, a second network can help to counteract maximization bias in Q-learning (Van Hasselt et al., 2016). We will use this easy-to-implement method as one of our baselines. Also, other methods that delay (Fujimoto et al., 2018) or average target values (Anschel et al., 2017) have been shown to stabilize learning. Achiam et al. (2019) theoretically link generalization properties of the Q-function approximator to the stability of learning. We empirically confirm and provide further intuition about this effect in our experiments.
For Q-learning in continuous state and action spaces, many extensions and alternatives to DDPG have been developed. One popular extension of DDPG is TD3 (Fujimoto et al., 2018) which adds three components to the algorithm: double Q-learning similar to the baseline we use based on Van Hasselt et al. (2016), delayed policy updates (similar to the target networks that Van Hasselt et al. (2018) found to delay but not prevent divergence), and target policy smoothing. Soft actor critic (Haarnoja et al., 2018) is a similar actor–critic architecture which is mainly different from DDPG through a stochastic policy, which is trained to maximize not only return but also the entropy of the policy. Notably, the critic in DDPG, TD3 as well as SAC is very similar; differing mainly in whether or not double Q-learning is applied. Although our evaluation is based on DDPG, our algorithm may thus also be applied to TD3 and SAC.
In policy gradient methods, reducing the impact of off-policy data has been beneficial for stability, for example, by mixing on- and off-policy (Gu et al., 2017) or by constraining the gradient update through a proximity term (Touati et al., 2020). The field of “offline reinforcement learning” is entirely focused on learning behavior policies from previously collected data sets without additional online interaction (Levine et al., 2020). Several research works in this area also address learning stability. For example, in DQN and DDPG, restricting the action space to achieve lower levels of off-policy data has been explored (Fujimoto et al., 2019). Constrained action selection when computing the target Q-values can also stabilize deep reinforcement learning (Kumar et al., 2019).
Kumar et al. (2020b) propose to learn a conservative Q-function that leads to a policy with a performance that is lower-bounded by its predicted value. However, in contrast to our work, no explicit bounds and clipping mechanisms are introduced.
Kumar et al. (2020a) emphasize that the interaction of off-policy learning and bootstrapping can lead to cases where a state is visited frequently and yet its incorrectly estimated Q-value is not updated because the state that the target value depends on is not visited. They refer to this phenomenon as “lack of corrective feedback” and derive a re-weighting of transitions from the replay buffer that is supposed to mitigate this issue. The full version of our proposed method, using zero actions, will be able to improve performance with such tail ends of data distributions without downweighting the associated transitions, without an additional error model, and without constraining the action selection.
However, while off-policy data seems to have a negative impact on learning stability, some questions remain: Correcting off-policy samples may also have adverse effects, for example, as reported by Hernandez-Garcia and Sutton (2019) for SARSA. Fedus et al. (2020) found that counter-intuitively, n-step return updates which are not corrected for policy differences are beneficial in off-policy deep reinforcement learning despite being theoretically ungrounded.
Q-learning uses bootstrapping as in equation (2) to estimate a Q-function, that is, the estimate at one iteration is used to derive the update for the next iteration’s estimates. Alternatives to bootstrapping include fixed-horizon temporal difference methods (De Asis et al., 2019) and finite-horizon Monte Carlo updates, in which a Q-value is estimated based on observed returns from each state. While the resulting estimator for the Q-function has low bias, it comes with high variance. Introducing eligibility traces of different lengths, a spectrum of methods between TD and Monte Carlo methods can be spanned (Precup et al., 2000; Sutton and Barto 2018), also in a deep learning setting (Amiranashvili et al., 2018; Munos et al., 2016; Mnih et al., 2016). Similar to Monte Carlo estimates, our proposed method propagates information along full trajectories. However, we do not apply return values as high-variance targets but use them to derive a lower bound for each target Q-value instead.
3.2. Graph perspective on training data
Monte Carlo updates can be seen as a special case of graph-perspective: Data from full episodes is used to derive updates along a trajectory. Episodic backward updates are classical TD updates that are executed along trajectories in a reverse order, such that information is quickly propagated through consecutive states (Lee et al., 2019). To prevent errors from sequential updates of correlated states, a diffusion coefficient is introduced.
Zhu et al. (2019) take a full graph perspective on the agent’s experience: Using a learned state embedding, episodes with shared states are identified and can benefit from inter-episode information, that is, the algorithm can combine multiple trajectories from experience. State embeddings have also been combined with k-nearest neighbors as a method to estimate Q-values for unseen states (Blundell et al., 2016). Corneil et al. (2018) use a network model to map states to an abstract tabular model where planning can be easily applied; Eysenbach et al. (2019) apply planning through graph search directly on the replay buffer. In our approach, we also use a graph perspective but without a learned embedding. Inter-episodic information is therefore only exchanged if the exact same state is revisited (up to floating point precision). Note however, that in many cases there are points which are very likely re-visited, for example, physical corners between objects.
3.3. Constrained Q-learning
Q-learning can be stabilized by introducing constraints on the change in either target values or network parameters (Durugkar and Stone, 2018; Ohnishi et al., 2019). However, constraining change rates in a learning system may also limit the rate at which an agent can improve.
He et al. (2017) take an episode-wise trajectory perspective on the data a reinforcement learning agent has collected and derive the following lower and upper bounds for the true Q-values Q* and K steps of future and past experience on a trajectory:
During training however, the optimal Q-value Q* is not known yet. Therefore, the authors suggest to compute the lower and upper bounds using the current estimate for Q. Computing these bounds then requires multiple additional forward passes in each update step and, more crucially, the resulting bounds need not be correct in general. In contrast, we will derive correct lower bounds for π∗ in near-deterministic settings and show that incorrect empirical bounds can even have adverse effects on the learning process.
Tang (2020) offers the intuition that lower bounds encourage the algorithm to focus on the best actions so far and thereby speed up learning. This idea is in line with Zhang et al. (2019) who introduce a separate replay buffer that only holds the best episodes and empirically improves learning performance on a range of simulated continuous control tasks.
3.4. Sample efficiency and industrial assembly
Eventually, we will show that divergence in Q-learning-based deep learning is a problem not only on contrived examples but also for real-world challenges. We have chosen an industrial shaft fitting task for evaluation with significant friction forces. Finding a model accurate enough for such contact-rich manipulation tasks is challenging, even for data-driven approaches (Fazeli et al., 2017). Residual networks, in which only an offset to an analytical model is learned, have been shown to be a particularly efficient solution (Kloss et al., 2017). Residual policies transfer this idea to reinforcement learning (Johannink et al., 2019; Silver et al., 2018) and will also be applied in this work.
Especially in the context of industrial robotics, much effort is spent on providing hardware solutions for reliably executing insertion tasks. Successful examples are the active and controllable remote center compliance elements from Rueb and Becker (US Patent US10480923B2, November 2016) or the vibration device presented in Kilikevičius and Bakšys (2011). Torque-controlled robots as well as manipulators equipped with force/torque sensors can be used to implement force-controlled approaches to peg insertion. Often, an analytic point of view is adopted, trying to model and understand the contact physics and then deriving control strategies (Bruyninckx et al., 1995; Li, 1997). A crucial element of these methods is the accurate estimation of contact states, which is challenging but pivotal to the success of the insertion (Fei and Zhao, 2003). Once a contact has been established, compliant controllers are used to perform the insertion itself (Lefebvre et al., 2005). Most classical methods require the specification of a sequence of contact states and careful controller design. There have been efforts to lessen the manual engineering work using black-box optimization for controller tuning (Johannsmeier et al., 2019). Nevertheless, they are typically not robust to variations of model parameters like (static) friction or force limits. Also, they still require an intricate manual strategy design and significant tuning effort to work for specific instances of the problem.
Only few model-free reinforcement learning approaches have addressed industrially relevant tasks and often make additional assumptions such as the availability of CAD models (Schoettler et al., 2019; Thomas et al., 2018; Wirnshofer et al., 2018). In Inoue et al. (2017), a peg-insertion task is learned from discrete actions in a Q-learning formulation using LSTMs. Our approach uses a continuous action space and therefore also deals with more intricate optimization processes in DDPG.
4. Data graph structure and divergence
Despite the continuous state-action space, the networks in DDPG are updated based on a finite set of transitions from the replay memory. It is therefore possible to take a graph perspective on this data: A transition
4.1. Characterizing transitions
To evaluate the link between different data graph structures and divergence, let us first define different types of transitions (for illustration of the definitions see the graphs in Figure 2). 1. If st+1 is terminal, target Q-values for temporal difference learning equal the observed reward r (see equation (2)) and thus reinforcement learning reduces to supervised learning. We thus hypothesized that Q-values for such directly connected transitions are very unlikely to diverge. 2. Transitions that end in a non-terminal state from which a terminal state is reachable are referred to as (indirectly) connected. This class of transitions can further be parameterized by the length of the shortest path that is known to reach a terminal state. 3. If no terminal state is reachable from st+1 but there is at least one infinite path from st+1, this transition is referred to as disconnected. Such an infinite path means in practice that there is at least one loop on the path ahead of st+1. If this loop is deterministically induced by a policy and rewarded equally across loop iterations, the resulting state values can be analytically derived using equation (7). 4. If no terminal state is reachable from st+1 and there is no infinite path from st+1, the transition is referred to as a loose end. These transitions occur, for instance, at the end of each episode in episodic learning setups, when the agent does not succeed but is reset to a starting position. Selected subsets of the data graph in our toy example that consists of three states (with state 0 being terminal) and four transitions, which are colored based on the graph structure as directly connected to a terminal state (blue), indirectly connected (orange), disconnected but infinite paths (red), or loose ends (green).

It is insightful to note that Q-values for such transitions are conceptually ill-defined in tabular Q-learning where a state without successors would be defined as terminal. For non-terminal states, a Q-value could be determined under the assumption that further transitions exist (and just have not been discovered yet), but then the Q-value is estimated using bootstrapping from another Q-value that has never been explicitly updated. This phenomenon is one example for what has been referred to as a lack of corrective feedback (Kumar et al., 2020a). In other words, the estimate depends only on network initialization and generalization from data for other state-action pairs; cf. also Achiam et al. (2019) who analyze the theoretical link between approximator generalization properties and learning stability.
4.2. Introductory example
We will demonstrate how different types of transitions interact with divergence of Q-values in deep off-policy model-free reinforcement learning on a series of toy examples. The examples differ in the data graph they work on, that is, they consist of different types of transitions following the definitions in the previous section.
The following offline policy evaluation task was set up: An agent can maneuver in a 2D continuous state space with 2D actions such that adding state and action yields the next state st+1 = s t + a. For each step, the agent receives a reward of −1 and 0 at the terminal state. The replay memory stays fixed, that is, is not extended, while a DDPG-like critic network is trained to find an approximation to the Q-function. The policy π is not approximated by an actor network as in DDPG but instead defined based on the replay memory such that for a given state it selects the action from the full graph that is currently associated with the highest Q-value prediction. Like in DDPG, this means that the actor may choose an action that has not been observed before. As in DQN and DDPG, all network updates are solely derived from the finitely many samples in the replay memory. The network consists of two layers with four hidden states each, ReLU activations (except on the output) and Xavier initialization. We compare results to a second version that uses “double Q-learning” (Van Hasselt et al., 2016) which is a common extension applied in Q-learning-based learning schemes. No target networks or further bells and whistles were used.
4.3. Experimental results
All results in the following sections were in line with the finding in Van Hasselt et al. (2018), according to which no unbounded divergence occurs (which would cause floating point NaNs). Instead, we argue about occurrences of soft divergence, that is, Q-values beyond the realizable range as given by equation (6).
4.3.1. Empirically assessing soft divergence
The training procedure was repeated with 10 random seeds that were drawn uniformly from [0, 1000]. For further analysis, we propose to compute the standard deviation of Q-values that were predicted from networks based on different random seeds as a measure of (soft) divergence: If Q-learning for a transition converges, all Q-values should be identical and thus have a standard deviation close to zero. The more divergence occurs however, the larger the standard deviation becomes. Even if all trials diverge, it is highly unlikely that the resulting Q-values are identical.
Types of Transitions
Let us first illustrate the types of transitions with an exemplar data graph:
It consists of three states, one of which is terminal (double circle). To learn a Q-function from data which can be represented by this graph, we assigned 2D coordinates to each state as follows: s0 = [0, 0], s1 = [−1, 1], and s2 = [1, 1] Furthermore, let’s assume that the agent could possibly have collected any subset of the four transitions on the graph. This creates 24 = 16 subsets; one of which is empty and therefore ignored. Moreover, each subset contains different types of transitions. These types are illustrated for some exemplary subsets by a color coding in Figure 2: Directly connected transitions, that is, those leading to the terminal state 0, are shown in blue. In our example, this is only ever the transition between states 1 and 0. Indirectly connected states are those for which a longer path to the terminal state exists. They are illustrated in orange in Figure 2. Here, it can be highlighted that the type of a transition depends on the context: The transition from state 2 to state 1 is indirectly connected to the terminal state, only if the transition from state 1 to state 0 exists as well. Otherwise, if the transition from state 1 to state 0 is not present, the transition from state 2 to state 1 becomes a loose end (illustrated in green, e.g., the top left example in Figure 2). Loose ends are those transitions that end in a non-terminal state from which no further transitions are known. The remaining transitions, highlighted in red in Figure 2, are disconnected transitions: From their end state no path to a terminal state is known, but at least one infinite path (i.e., loop) exists.
To verify that these transition types are linked to different divergence behaviors in deep model-free reinforcement learning, the training has been repeated with multiple random seeds for each of the 15 subsets of the data graph. To empirically assess soft divergence, we evaluated the predicted Q-values for each transition after the training process as follows: First, the standard deviation over Q-value predictions for one specific transition in one example subset from different random seeds was computed. Second, the distribution of standard deviations computed from predicted Q-values for all transitions of a specific type was illustrated in a boxplot in Figure 3. The line inside each box represents the median, the box extends to the quartiles, and the whiskers cover 1.5 times the inter quartile range. Standard deviation over predicted Q-values for each type of transition from all 15 possible subsets of the educational example. The pastel colored bars on the right of each transition type correspond to the setting with double Q-learning.
Evaluating the distribution of standard deviations reveals a clear link between the structure of the Q-graph and soft divergence: Q-values for transitions which directly end in a terminal state (“directly connected”) are estimated almost perfectly, most likely because Q-learning is reduced to supervised learning in these cases (cf. Equation (2)).
Q-values for transitions ending in states with a longer path to a terminal state, the connected transitions, exhibit only slightly more variance than the directly connected transitions. Presumably, the reachable terminal state still acts as an anchor for the Q-value (as long as all transitions on the path are regularly used for updates). Transitions without such an anchor congruously have caused much more variance in their predictions: loose ends and disconnected transitions.
Loose ends, whose Q-values are conceptually ill-defined for tabular Q-learning as discussed above, caused high variance in predictions—a finding which is in line with other works (Achiam et al., 2019; Kumar et al., 2020a).
Disconnected transitions occur frequently in practical applications of reinforcement learning, for example, when the robot gets stuck in a non-terminal state. Such disconnected transitions caused the highest variance in our experiment. In contrast to loose ends however, the Q-value for these transitions is well-defined under the assumption that all possible transitions are known and can even be computed analytically (cf. Equation (7)).
The pastel colored bars for each transition type in Figure 3 show the divergence behavior for double Q-learning which improves convergence slightly but does not alter the overall impact of transition types.
Chains of Transitions
In the last example, only few states and relatively short paths have been examined (except for the infinite paths on loops). Transitions with a short path to a terminal state barely caused soft divergence. In real-world applications however, data graphs tend to be much larger and more complex. From the previous example, it remains unclear how this interacts with divergence.
Depending on the learning formulation or domain of application, the structure of the graph can vary. Residual formulations, for example, tend to produce paths which often still end in a terminal state, but it may take much more than the one step in the previous example to reach a terminal state.
Therefore, we designed a second example to investigate the impact of long chains of transitions. As mentioned before, this can be seen as examining an additional parameterization of indirectly connected transitions by the length of the chain ahead.
In this example, we thus created a data graph which could have been induced by a replay memory with a single episode of 100 steps. The self-loops are additional options that the policy has when choosing a new action.
Using the same setup as in the previous example, we trained a number of critic networks on data from this fixed replay memory to predict the Q-function, that is, a reward of −1 for each step and a mapping from states to coordinates as
The results shown in Figure 4 illustrate that the distance between the end state st+1 of a transition and the terminal state plays an important role: The longer the path to the anchor, the higher the variance in predictions. Distribution of predicted Q-values for transitions of the chain example.
5. Q-graph-based lower bounds
In the previous section, we have used the graph perspective on training data to derive a link between graph structure and divergence in Q-learning-based reinforcement learning. However, as we will show in this section, the graph perspective can be used constructively to improve the stability of learning processes.
5.1. Method
Let us again start from the data graph that represents the data a reinforcement learning agent has collected. From the edges in the data graph, the largest subset is selected such that it induces a well-defined MDP with finitely many discrete states and transitions: The subset of transitions from the data graph forms a new graph
Selecting a subgraph such that the finite
On the finite MDP
5.1.1. Q-graph implementation
The Q-function
5.1.2. Zero actions
As discussed, loose ends are discarded when a Q-graph is constructed. It would still be desirable to include loose-end transitions into the Q-graph however. In many settings, this is possible through zero actions a
z
: those are actions that do not change the agent’s state, for example, moving by 0 units or applying 0 force. If those are applicable in all states, a self-loop can be added to every single node in the data graph (without actually executing an additional action). This effectively eliminates all loose ends and turns them into disconnected states. In other words, it allows the Q-graph
5.2. Q-graph values as lower bounds
In general, the original MDP
Assume w.l.o.g. that at least two transitions (s0, a1, r1, s1) and (s1, a2, r2, s2) are known and part of the Q-graph
In the original MDP with potentially continuous state and action spaces, unseen states and transitions may exist. Still, for deterministic MDPs
Thus, each Q-value for a transition in the Q-graph
Note that the max operation in equation (13) operates on a discrete space and can thus be computed by a simple look-up and comparison of all known transitions from s1. The max operation in equation (12) does not need to be evaluated additionally.
For non-deterministic dynamics, potentially less tight bounds can be established under additional assumptions: If for any state and any series of actions
Since non-deterministic environments are quite common and δ may not be known, we will additionally evaluate the empirical performance of our method under violation of the determinism assumption.
5.3. Q-graph-bounded Q-learning
Bounds on Q-values, for instance, those computed in equation (13), can be enforced in temporal difference (TD) learning by clipping target values from equation (2) as follows:
He et al. (2017) have not applied clipping as we suggest here but encoded the constraints into the loss function from equation (8):
We refer to our suggested method of enforcing Q-values from the Q-graph
6. Experimental settings
We have evaluated the proposed method in a series of experiments for which we used three tasks: one classical toy example in the literature (Baird’s 7-star problem); one simulated continuous control task that allowed us to perform extensive studies with many hyperparameter settings; and finally a challenging real-world assembly task with substantial uncertainties and non-determinism.
We will first introduce the technical details for all settings and then use them in the next section to assess various aspects of our proposed method.
6.1. Baird’s star problem
The 7-state star problem (Figure 5) was proposed by Baird (1999) to demonstrate convergence issues in value iteration with (linear) function approximation and often serves as a baseline task for approaches against divergence (e.g., Durugkar and Stone (2018)). The agent receives a reward of zero for each action, and thus the correct solution to the problem is to set all weights to zero and obtain state-values of zero. If all weights are initially positive and w0 is larger than the others, this causes oscillatory behavior of both state values and weights. We reproduced the exact setting and result plots for Figure 4.2 in Baird (1999). Graph-based bounds quickly lead to the correct solution (blue, solid) on the 7-state star problem after Baird (1999), for which states and weights spiral out to infinity under vanilla TD learning (orange, dotted).
Applying the proposed graph view to the problem, we can derive a lower bound of zero for V7 because it has a self-loop with reward 0; and thus this lower bound recursively leads to a lower bound of 0 + γV7 = 0 for all other states. These graph-based bounds can be applied in TD learning in analogy to equation (15) as Vt+1 (s t ) = max (LB = 0, r t + γV t (st+1)).
6.2. Simulated clearance fit
To allow for extensive hyperparameter studies, we evaluated our proposed method on a simulated continuous control task in terms of sample efficiency and robustness to hyperparameters.
The simulation environment was implemented using PyBullet
1
and is illustrated in Figure 6. The blue peg is always upright and controlled in task space: An action represents the three-dimensional offset to the next position. To execute an action, the new reference position is set and the simulation stepped forward until a stable new position is reached. The actions are box-constrained to [−1, 1] in each dimension which corresponds to a movement of 1 cm. Simulated clearance fit peg in hole task.
The green object has a width of 5 cm and is placed on the bottom of a cubic state space with a side length of 20 cm. The peg has a diameter of 1 cm, and the hole’s diameter is 2 cm. The agent receives a distance-based reward r = exp (−Δ/0.03) − 1, where Δ is the Euclidean distance to the goal position in meters. This reward was shaped such that all possible positive distances lead to a reward in
6.2.1. Network details
We used the following instance of a standard DDPG actor–critic architecture for learning: The critic network consists of three fully connected layers with 200 nodes each. For the inner layers, ReLU activations were used. The network was initialized with weights sampled from
Each experiment was repeated 10 times with different random seeds. In our plots, all learning curves are summarized such that the solid line represents the mean performance over all runs, and the shaded area highlights the standard deviation of the mean estimator, that is,
6.2.2. Hyperparameter tuning
We tested vanilla DDPG for 300 episodes on a grid of learning rates for actor and critic in {10−2, 10−3, 10−4} and chose three sets of hyperparameters for the up-coming experiments that are representative for the spectrum of DDPG performance (see Figure 7). Performance of vanilla DDPG on the full grid of learning rates. Three representative parameters were identified (solid lines) and used for all following experiments.
6.3. Industrial form fit
We consider a realistic industrial manufacturing step taken from a Bosch eBike motor plant. The task is to achieve a tight fit between a shaft and a ball bearing in a motor housing (see Figure 8). This requires both high accuracy and significant force when solved using classical machinery: High accuracy is required to precisely align the bearing and the shaft. High force is required to overcome significant resistance of the fitting process originating from the mechanical specification and static friction effects. The accompanying video (https://youtu.be/Z_GcNbCWE-E) shows the insertion as performed by a human, which requires force greater than 10 N and a determined push to reach the final configuration. Note that the motor housing is turned upside down for the videos to obtain a better field of view around the ball bearing. In manufacturing lines, the fitting process is realized using a hydraulic press operated by a human, combined with high-accuracy alignment equipment designed to ensure perfect centering of the shaft. In the plant process, between 10 and 15 s of time is available for the fitting. The assembly of such a tight fit appears to be a particularly interesting benchmarking problem for robot learning approaches: While it is simple enough to be reproducible at any time, it comes with interesting challenges due to the stochasticity of the reaction forces. Close-up view on an e-Bike drive unit. The task was to insert the shaft into a tight ball bearing inside the drive unit’s housing, which is turned upside down for images and the video to capture the relevant areas from a more natural angle. The colored arrows illustrate the end effector’s coordinate system. Figure 1 shows the full robot and task space.
Our objective is not to investigate the entire process including grasping the shaft and positioning it in the vicinity of the ball-bearing—these steps are beyond the scope of the paper. Instead, we focus on performing the insertion step: It starts in loose, randomly oriented contact with the ball bearing, requires significant interaction force, and ends with the shaft being completely inserted with some predefined accuracy.
This task can be considered a variant of classical peg-in-hole insertion, which belongs to the most extensively studied assembly problems in robotics. In contrast to the simulated peg-in-hole task however, this form fit task involves a lot of friction and contact between different objects which the robot can only perceive through a force-torque sensor at the wrist. Additionally, the shaft to insert into the hole is freely grasped and thus can slip between the grippers.
6.3.1. Residual formulation
One of the major drivers for sample complexity in many reinforcement learning problems is exploration (Plappert et al., 2017). Residual policies can incorporate known rough solution strategies for a task, for example, in our case a predominant movement in the z-direction (Johannink et al., 2019; Silver et al., 2018): The agent then does not learn the full behavior from scratch but an addition to a fixed policy. In this spirit, we model the insertion task as a Markov decision process (MDP) with the following definitions: 1. States:
A state is defined as 2. Actions:
The actions in this MDP represent task-space torques
These actions are combined together with a constant policy component which exerts a force f z = −15 N in z-direction of the end-effector frame.
The torques from the network are combined with the constant policy component into a feedforward wrench
When executing the policy, an action is considered completed once the robot’s end effector reaches a steady state with velocities below a pre-defined threshold. In essence, this leads to the robot applying constant force in z-direction of the shaft, while the residual policy allows to apply torque to the shaft and rotate the end effector in space.
Lastly, the controller allows to impose a limit onto the orientation of the tool. In this work, we limit the maximum tool tilt to be equal to π/4 w.r.t. the horizontal ground plane, which essentially allows the learning algorithm to safely explore all end-effector orientations within a cone of π/2 opening angle w.r.t. the table. 3. Reward:
We investigate two different reward functions: sparse and dense rewards.
In the sparse reward setting, we use a reward of r = −1 for each transition and r = 0 if the terminal state is reached.
The dense reward is designed to be proportional to the distance error between the current end-effector pose and a target end-effector pose (corresponding to a fully inserted peg). The distance error in position Δ
P
is computed as the l2 norm of the Euclidean position difference vector. The distance error in orientation Δ
R
is computed as the l2 norm of the angle-axis error in x- and y-rotations, since the insertion task is invariant to z-orientation. The combined reward is then computed as follows:
With manually tuned scaling factors σ P = 0.015 and σ R = 0.7. This formulation guarantees that r is always in [−1, 0].
6.3.2. Q-graph-bounded DDPG
Employing the residual policy, the agent eventually reaches the goal in many episodes—so instead of loose ends or disconnected transitions, the predominant type of transitions in our problem is long chains of indirectly connected transitions. As shown, the degree of soft divergence that is introduced into DDPG by indirectly connected transitions largely depends on the length of the path between a state and the nearest terminal state. In our experiment, the maximum number of steps in an episode was set to 1000 for training. In addition to the Q-graph-based lower bounds at the core of our method, we also apply an a priori lower and upper bound based on the minimum and maximum reward: rmin = −1/1 − γ ≤ Q ≤ rmax = 0/1 − γ = 0. We also add zero actions to the Q-graph, in this case residuals with zero torques. The constant force in the z-direction remains but since an action is executed until a steady state is reached, it will not have an effect without changes in the torque.
6.3.3. Robot and control setup
All experiments were performed on a Franka Emika Panda CoBot, where we controlled the joint torques at 1 kHz using a custom control toolchain. For rigid body kinematics, dynamics, and for efficiently computing its derivatives, we employed the open-source library “Pinocchio” (Carpentier et al., 2015). The required inertial parameters of our Panda robot were identified using a linear matrix inequality (LMI) approach as presented in Sousa and Cortesão (2019). The end-effector contact wrench was estimated at 1 kHz real time using an extended Kalman filter-based disturbance observer implementation taken from Giftthaler et al. (2018). The gripper was controlled to grasp the shaft with a constant gripping force. In order to ensure a safe grasp, we used custom-printed finger tips shaped such that a variety of cylindrical objects can be centered and grasped robustly (see Figure 8).
All experiments in the following build on the same setup: The training phase consisted of 40 episodes. To start an episode, the end effector was manually set to one out of eight initial poses with different inclinations (see video attachment). Note that these manual resets introduce additional noise on the initial poses and only the rough orientation of the shaft was fixed. The initial poses were alternated in a fixed order such that metrics like the average number of steps it takes the robot to reach the goal can be averaged with a kernel width of eight to average out the impact of different initial poses. Each episode was stopped when either the target state or a maximum of 1000 steps was reached. We implemented a pose-based heuristic to verify whether the target state is reached but always confirmed this by detailed inspection and manual feedback because of possible slippage between the shaft and gripper fingers. The network was trained after every cycle consisting of 20 steps; the number of training steps after each cycle is one of the hyperparameters under investigation.
The test phase consisted of eight more episodes also covering all initial positions. A test episode was stopped after 200 steps if the target is not reached, and the remaining setup remained unchanged to the training phase.
Due to the stochasticity of the experiments, we ran each experiment three times with different random seeds. All plots illustrating these results show the mean as a solid line surrounded by a shaded area representing the standard deviation of the mean estimator, that is,
6.3.4. Network details
All networks were implemented in TensorFlow (Abadi et al., 2015). Both the actor and critic network consist of three fully connected layers, where the two hidden layers contain 100 nodes. The actor network has tanh-activations on all layers and a two-dimensional output; all weights were initialized from a Glorot uniform distribution (Glorot and Bengio, 2010). The critic network has ReLU activations on the first two layers and no non-linearity on the one-dimensional output; the weights are initialized from an He uniform distribution (He et al., 2015). The forces and torques which served as state descriptors to the critic network were linearly scaled such that all values were in [−1, +1]. For optimization, the Adam optimizer was used—different learning rates and the number of training steps per cycle were tuned on a grid of hyperparameters. For consistency and following the argumentation in Van Hasselt et al. (2018), no target networks were used since they are known to delay but not prevent divergence.
6.3.5. Task difficulty and baselines
For meaningful comparisons of the upcoming results, we first evaluated a number of random baselines: Instead of the actor net output, the residual policy consists of randomly sampled actions in the same output range. We compare uniform sampling and two of the standard noise processes for exploration in reinforcement learning (Hoppe et al., 2019; Plappert et al., 2017), namely, Gaussian noise (“normal”) and Ornstein–Uhlenbeck (“ou”), both with different σ. For Ornstein–Uhlenbeck noise, we fixed θ = 1 and dt = 0.01.
As Figure 9 shows, the uniformly sampled random actions show the best performance and solve the task in 32 steps on average. On first glance, it may seem surprising that uniform sampling performs best but in this case it is due to the residual formulation: Uniform sampling leads to a wiggling kind of behavior with particularly large amplitudes, which is the most successful trivial behavior for an insertion. Random baseline performance: Distribution of the number of steps per episode for different random actions. Each episode was stopped after 1000 steps if not successful, and the experiment consisted of up to 3000 steps in total.
7. Experimental results
In the following sections, we present empirical results on five clusters of experiments: divergence and sample efficiency; non-deterministic transitions; zero actions; baselines and trivial bounds; as well as interaction with further task properties (sparse rewards and replay memory capacity).
7.1. Divergence and sample efficiency
We designed the first sequence of experiments to test the following hypotheses: 1. Our method would prevent soft divergence. One indication for this could be—in analogy to our introductory example above—if the standard deviation of predicted Q-values is lower for Q-graph-bounded Q-learning than for vanilla DDPG. 2. If at least some cases of soft divergence can be prevented, this should lead to increased sample efficiency on average over many hyperparameter settings. This could then also be interpreted as increased robustness to adverse hyperparameters. 3. We have shown that Q-graph-based lower bounds correctly limit the range of Q-values. Thus, we should expect that these bounds barely have any impact in cases when vanilla Q-learning works well because our method as described in equation (15) reduces to standard TD learning when no bound is violated. In other words, this implies that Q-graph-bounded Q-learning should never decrease performance.
7.1.1. Baird’s star problem
A part of hypothesis (1) is confirmed by the results on Baird’s star problem: The proposed approach using graph-based lower bounds converges to the correct state values rather than spiraling out to infinity as Figure 5 illustrates. Note however that this does not include the full actor–critic setup we developed.
This is still a notable effect because the lower bound here not only stops divergence to minus infinity but also an oscillatory behavior.
7.1.2. Simulated clearance fit
Next, we evaluated divergence and sample efficiency on a simulated example with our full actor–critic approach (Q-graph-bounded Q-learning). We compared learning curves of Q-graph-bounded Q-learning (“QG”) to those of vanilla DDPG (see Figure 10). Note that the hyperparameters were tuned for vanilla DDPG only, while QG was applied on the top without tuning. As expected in hypothesis (2), Q-graphs speed up learning for all examined learning rates. The effect size varies and is larger for those learning rates that lead to relatively poor performance in vanilla DDPG, which is in line with hypothesis (3). This decreases the gap in performance between different learning rates and can therefore be interpreted as an indicator for increased robustness to hyperparameters. Representative parameters from Figure 7 (“vanilla,” solid lines) were compared to the proposed method (“QG,” dotted lines).
To explicitly assess if this increase in performance is due to similar effects as in the proposed educational examples (and hypothesis (1)), we evaluated the variance in predicted Q-values at the end of each experiment under the learning rate with largest effect size (10−4). We covered the state space with a regular grid of 27 states and evaluated the learned Q-value for each of these states with a set of 11 given actions (“given”) as well as with the action that the actor network suggests for each state (“pi”).
For the boxplot in Figure 11, we collected the standard deviations over the predicted Q-values for each state-action pair from 10 runs with different random seeds. The orange line indicates the median value, the box extends from the lower to the upper quartile value, the whiskers cover 1.5 times the inter quartile range, and outliers are shown as circles. The results show very clearly that Q-graph runs resulted in significantly less variance for predicted Q-values, indicating that Q-graph-bounded Q-learning does indeed prevent cases of soft divergence. Standard deviation of predicted Q-values.
7.2. Non-determinism
The Q-graph-derived lower bounds are based on the assumption that all transitions are deterministic. In case of non-deterministic transitions, correct lower bounds can be derived if for any state and any series of actions
7.2.1. Simulated clearance fit
We first introduced artificial noise in our simulated clearance fit task: Each action was sampled from a Gaussian around the actor output with different σ: Performance under increasingly non-deterministic transitions (with σ ∈ [0.0, 0.2, 0.4, 0.6, 0.8].
7.2.2. Industrial form fit
Since the noise in the previous example was artificially introduced and well-distributed, we also evaluated sample efficiency and divergence on our industrial insertion task with real world non-determinism due to hardly predictable reaction forces and grasp slippage.
To obtain a broad overview of learning performance, we tuned those hyperparameters that are most related to sample efficiency on a grid: learning rates for actor and critic networks, as well as the number of training steps per cycle.
We tested learning rates in [10−5, 10−4, 10−3, 10−2] for the critic and used one-tenth of this learning rate for the actor. In pre-studies, a smaller learning rate for the actor than the critic seemed advantageous for sample efficiency. Either 10 or 50 training iterations per cycle were used.
Each of these eight combinations of hyperparameters was tested with three random seeds and both algorithms, leading to robot interactions of approximately 48 h for this particular experiment. Figure 13 shows the mean number of steps needed to successfully complete the task at test time for each combination of hyperparameters. Bearing in mind that the best baseline solved the task within 32 episodes, one can see that vanilla DDPG outperforms uniformly sampled action under only one particular set of hyperparameters. Q-graph-bounded DDPG however performs better than the best random baseline in six out of eight cases. Performance comparison on full grid of hyperparameters, measured as steps needed to solve the task. Lower (darker) is better, and entries beating all random baselines are highlighted by*. While classical DDPG outperforms the random baseline in just one out of eight cases, QG-DDPG achieves this in six cases.
For closer inspection, Figure 14 depicts learning curves for the most favorable and unfavorable hyperparameters for both algorithms and plots the development of train and test performance. The shaded area represents the standard deviation of the mean estimator for performance during training episodes, and the intervals on the right show the same confidence interval for test time results. Best and worst case performances for vanilla DDPG and Q-graph-bounded DDPG (QG). The x-axis shows the number of episodes and at each tick, the performance of eight episodes has been averaged. The y-axis extends to 200, which is the worst possible test time performance in our setting. The green dotted line illustrates QG’s performance on a more general and time-consuming task, where the orientation of the motor housing is changed for every fourth training episode and every second test episode.
For the best case hyperparameters, we can see that both algorithms’ test time performances are quite close, which is in line with the findings from our simulated control task hypothesis (3). Interestingly, the variance during training is lower for Q-graph-bounded DDPG, potentially indicating higher reliability and reproducibility. For the worst case hyperparameters, one can observe that DDPG does not solve the task even once (at 200, the episodes were stopped if not successful). Q-graph-bounded DDPG also decreases in performance but still solves the task.
The dotted green line illustrates anecdotal results from a single run of Q-graph-bounded DDPG in an extended setting where not only the initial shaft orientation was changed but also the ball-bearing orientation changed after four episodes (and every second episode at test time). This evaluation is shown in the video attachment (https://youtu.be/Z_GcNbCWE-E).
7.3. Relation to soft divergence
Since Q-graph-bounded DDPG resulted from observations about soft divergence that we empirically measured using the variance in predicted Q-values (also see second part of hypothesis (1)), we also evaluated whether the differences in performance from the previous section correlate with variance in predicted Q-values. Figure 15 plots the predicted mean Q-value for each batch in training over time. Only for DDPG and unfavorable hyperparameters the Q-values diverge over time, while even bad trials of Q-graph-bounded DDPG do not lead to divergence. Evolution of mean Q-values over training episodes for the same hyperparameters as in Figure 14. Only DDPG diverges under bad hyperparameters while QG-DDPG is robust against those. The line represents the mean over all trials, and the shaded area spans the full range between minimum and maximum.
7.4. Zero actions
In this section, we aimed to assess the impact of zero actions in Q-graph-bounded Q-learning. This experiment was conducted for the simulated control task only.
A zero action does not change the agent’s state, in this case the offset in position by zero meters. We compared DDPG on the replay memory as is (“vanilla”) to DDPG on enhanced data that was created by adding zero actions after each transition (“vanilla-ZA”). This improves the structure of the data graph by turning loose ends into disconnected transitions. The results in Figure 16 show that adding zero actions does lead to a slight improvement, even without any Q-graph—emphasizing the importance of the data graph structure for Q-learning in general. Zero actions (ZAs) eliminate loose ends and thus complete the Q-graph. A theoretical transition using a zero action can be added to a vanilla DDPG replay memory (dotted lines) or combined with Q-graph-bounded DDPG (QG, solid lines).
We also compared Q-graph-bounded DDPG (“QG”) with and without zero actions (solid lines) which barely shows any effect. The largest gap in Figure 16 is clear between vanilla-ZA and either version of QG. This indicates that while the data graph structure matters, the propagation of information through the Q-graph and the integration of lower bounds into TD-learning are the main benefits of the proposed method.
7.5. Baseline bounds
In this section, we compare our method to a list of alternative bounds: from literature (He et al., 2017), trivial bounds, or heuristic bounds. Since the experiments required some computationally expensive hyperparameter tuning, we only performed those in simulation.
7.5.1. Baseline tuning
We first tuned hyperparameters for one of the main baselines: the bounds from He et al. (2017). All experiments were performed with the best set of learning rates we identified in Figure 10, that is, both learning rates were fixed to 10−4. Using the same additional hyperparameters He et al. (2017) report in the paper (λ = K = 4) did not perform well on our task and reward function. Instead, much smaller values for λ turned out useful for performance. Figure 17 shows the results of tuning the method with a grid of hyperparameters where λ ∈ {0.001, 0.005, 0.01, 0.05, 0.1, 0.5, 1.0} and K ∈ {4, 8}. Additionally, we experimented with clipping Q-targets as in equation (15) rather than using λ and a regularization term. Since the data in our replay memory was stored as a graph already, we sampled K steps in the future and past from this graph for each update step. It is theoretically possible that experience from multiple trajectories has been mixed if they shared a state. Performance of the He et al. (2017) baseline on the full grid of hyperparameters.
7.5.2. Baseline comparisons
We compared our proposed theoretically grounded Q-graph-based lower bounds to various baselines: 1. We included the best case performance for the approach by He et al. (2017) (K = 8, λ = 0.01) from the previous tuning procedure. 2. For a given range of possible rewards 3. For empirical bounds, we determined rmin and rmax as the currently lowest and highest reward from the replay memory and then used equation (6) to derive lower and upper bounds. These bounds may not be correct in general.
Both a priori and empirical bounds can be used with vanilla DDPG: In this case, the target values are clipped by the given bounds. However, additional bounds can also be combined with Q-graph-bounded Q-learning: Then, the target values are clipped by the tightest available bounds, that is, using the highest lower and the lowest upper bound.
Adding further bounds to the Q-graph-based method mainly adds upper bounds to the learning process because the Q-graph-derived lower bounds are available for all transitions except loose ends already. Note that the empirical bounds may be incorrect and could therefore clip the target value to wrong ranges.
We first compare unbounded DDPG (“vanilla”) to DDPG with a priori and empirical bounds. As the dotted lines in Figure 18 show, there are only marginal differences, but incorrect empirical bounds perform worst. Using bounds based on the current Q-estimates as in He et al. (2017) outperforms all tested variants of vanilla DDPG. Baselines: Q-graph-bounded Q-learning (“QG,” solid lines) versus vanilla DDPG (Lillicrap et al. (2015), dotted), both combined with empirical and a priori bounds; as well as the bounds from He et al. (2017) (dashed) which are based on n-step returns and the currently predicted Q-values.
However, comparing the proposed Q-graph-based bounds (solid lines) shows that Q-graph-bounded Q-learning outperforms both the empirical bounds and He et al. (2017)’s bounds. Using incorrect empirical bounds has a significant adverse effect on QG; adding a priori bounds to the proposed method does not seem to have any significant effect. We hypothesize that this may be because mainly upper bounds are added, but the behavior of a Q-learning system differs for under- and over-estimated states: While under-estimated states may be rarely visited, over-estimated states are likely to be visited using the currently estimated optimal policy. Therefore, lower bounds correcting under-estimated states may be more important than upper bounds which would correct over-estimated states. Overall, we conclude that the tight transition-specific lower bounds from the Q-graph are key.
7.6. Limited graph capacity and sparse rewards
In deep reinforcement learning, the replay memory is typically an FIFO-buffer (“first in, first out”), that is, those elements that were added first are overwritten first when the buffer is full. For a data graph, it is possible to delete single transitions, but there are two possible effects: On the one hand, some information from deleted transitions can be implicitly contained in its predecessors’ Q-values on the Q-graph, which could imply that the proposed method is more robust to small memory capacities. On the other hand, cuts from deleted transitions can stop information propagation through the Q-graph, which could in turn slow down further progress. We therefore empirically compare the drop in performance for vanilla DDPG and Q-graph-bounded Q-learning in the following.
7.6.1. Simulated clearance fit
On the simulated control task, we first evaluated performance for graph capacities of 1000 and 5000 transitions. For comparison, the average graph in the previous unlimited setting contained roughly 30,000 unique transitions at the end of the 300 episode experiments. As Figure 19 illustrates, a Q-graph-based method that is limited to only 1000 samples still performs on par with unlimited vanilla DDPG, while the vanilla DDPG performance decreases for a limit of 1000 transitions. Performance with limited graph capacity.
7.6.2. Industrial form fit
To successfully apply reinforcement learning in practice, robustness is not only desirable w.r.t. hyperparameters but also regarding other design choices. Exemplarily, we here assess a drastic change in the reward function to sparse rewards, and a replay memory buffer that is limited to only 300 transitions. Sparse rewards are a natural formulation for our setting because they reflect more precisely our evaluation criterion (the number of steps) and at the same time circumvent all issues related to reward shaping because the end-effector pose of the robot only partially reflects the shaft pose. Limited memory availability is particularly interesting in industrial robotics as it creates a setting that is closer to the requirements of embedded AI.
Figure 20 summarizes the results for both sparse rewards and limited memory capacity under their respective best hyperparameter configurations. We can observe that Q-graph-bounded DDPG still performs better than random on average for both settings while DDPG does not. Additionally, Q-graph-bounded DDPG keeps the relatively low variance in performance, while the variance for DDPG increases significantly compared to its peak performance as in Figure 14. Robustness to changes in the learning setting: sparse rewards (blue) and limited memory capacity (orange) for vanilla DDPG (dashed) and Q-graph-bounded DDPG (“QG,” solid lines). Both axes are scaled as in Figure 14 for comparison.
8. Conclusion
Since updates for the neural networks that are used to estimate Q-values in DQN and DDPG are only based on a finite replay memory, the data it contains can be represented as a graph. We have shown that the structure of this graph is linked to soft divergence: Loops without connections to a terminal state were more likely to lead to soft divergence than other types of transitions although their Q-value can be computed analytically if the graph is interpreted as a finite MDP. This graph perspective on the data leads to a non-parametric representation which holds information about the graph structure. This representation is complementary to the parametric approach that is taken in function approximation, for instance, in DDPG where each state is a multi-dimensional vector. Our approach can therefore be seen as combining parametric information for function approximation with non-parametric information from the graph structure.
We have shown that this analytically derived Q-value is a lower bound to the actual Q-value in the continuous MDP due to the max operation in TD learning (equation (13)). Enforcing these bounds in TD learning empirically prevents cases of soft divergence on continuous control tasks, both in simulation and an industry-scale assembly task.
Preventing soft divergence as the proposed method does also increases sample efficiency on average and has its strongest impact under unfavorable hyperparameters; in other words, the proposed method increases robustness to adverse hyperparameters. We have also demonstrated that the Q-graph can serve as an additional implicit memory holding information from transitions that have already been overwritten in the replay memory and thus, the algorithm is able to cope better with restricted memory capacity. In contrast to prior work which has only derived either relatively loose bounds which are equal for each transition (Lee and Kim, 2015) or bounds that are based on the currently predicted Q-values (He et al., 2017), the bounds we have derived for Q-graph-bounded Q-learning are correct in general. Empirically, the method also works in non-deterministic settings despite being derived under the assumption of deterministic transitions.
With more than 60 h of real-world interaction, we have provided empirical evidence that Q-graph-bounded DDPG can also prevent soft divergence in real-world applications: We have shown that all trials using Q-graph-bounded DDPG and the few trials in which DDPG performs well do not show any signs of soft divergence, while those runs of DDPG with worse performance clearly diverge. This indicates that Q-graph-bounded DDPG is not only effective in increasing stability of the learning process but also that the underlying reasoning and assumptions transfer from toy examples to real industrial tasks with substantial uncertainty.
8.1. Limitations and directions for future work
Only lower bounds can be derived by our method, while upper bounds are either unknown or independent of the transition at hand. We leave it for future work to derive tighter upper bounds or examine heuristics in their place. Whether graph information can be lifted to higher level aggregated states also remains an interesting route for future research and may enable extensions toward hierarchical learning.
There may also be further ways to utilize the information on Q-graphs, for example, to guide exploration to areas with particularly adverse graph structures. This leads to the more general question of how to determine what good training data is, and how this definition can be linked to properties of the learning algorithm.
Soft divergence in deep off-policy reinforcement learning remains not fully understood. For instance, it is unclear which further factors beyond the graph structure have an impact on divergence. Given further insights on this topic, one may be able to derive guidelines on how to design an MDP for stable learning. If soft divergence occurs, it is also not understood in which cases it diverges to plus and in which cases to minus infinity; and in which cases the weights to update spiral out to infinity as in Baird (1999)’s star example.
Footnotes
Declaration of conflicting interests
The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
Funding
The author(s) received no financial support for the research, authorship, and/or publication of this article.
