Randomized Ensembled Double Q-Learning: Learning Fast Without a Model

Xinyue Chen, Che Wang, Zijian Zhou, Keith Ross

Introduction

Recently, model-based methods in continuous action space domains have achieved much higher sample efficiency than previous model-free methods. Model-based methods often attain higher sample efficiency by using a high Update-To-Data (UTD) ratio, which is the number of updates taken by the agent compared to the number of actual interactions with the environment. For example, Model-Based Policy Optimization (MBPO) (Janner et al., 2019), is a state-of-the-art model-based algorithm which updates the agent with a mix of real data from the environment and “fake” data from its model, and uses a large UTD ratio of 20-40. Compared to Soft-Actor-Critic (SAC), which is model-free and uses a UTD of 1, MBPO achieves much higher sample efficiency in the OpenAI MuJoCo benchmark (Todorov et al., 2012; Brockman et al., 2016). This raises the question of whether it is also possible to achieve such high performance without a model?

In this paper, we introduce a simple model-free algorithm called Randomized Ensemble Double Q learning (REDQ), and show that its performance is just as good as, if not better than, MBPO. The result indicates, that at least for the MuJoCo benchmark, simple model-free algorithms can attain the performance of current state-of-the-art model-based algorithms. Moreover, REDQ can achieve this performance using fewer parameters than MBPO, and with less wall-clock run time.

Like MBPO, REDQ employs a UTD ratio that is ≫1\gg 1, but unlike MBPO it is model-free, has no roll outs, and performs all updates with real data. In addition to using a UTD ratio that is ≫1\gg 1, it has two other carefully integrated ingredients: an ensemble of Q functions; and in-target minimization across a random subset of Q functions from the ensemble.

Through carefully designed experiments, we provide a detailed analysis of REDQ. We introduce the metrics of average Q-function bias and standard deviation (std) of Q-function bias. Our results show that using ensembles with in-target minimization reduces the std of the Q-function bias to close to zero for most of training, even when the UTD is very high. Furthermore, by adjusting the number of randomly selected Q-functions for in-target minimization, REDQ can control the average Q-function bias. In comparison with standard ensemble averaging and with SAC with a higher UTD, REDQ has much lower std of Q-function bias while maintaining an average bias that is negative but close to zero throughout most of training, resulting in significantly better learning performance. We perform an ablation study, and show that REDQ is very robust to choices of hyperparameters, and can work well with a small ensemble and a small number of Q functions in the in-target minimization. We also provide a theoretical analysis, providing additional insights into REDQ. Finally, we consider combining the REDQ algorithm with an online feature extractor network (OFENet) (Ota et al., 2020) to further improve performance, particularly for the more challenging environments Ant and Humanoid. We achieve more than 7x the sample efficiency of SAC to reach a score of 5000 for both Ant and Humanoid. In Humanoid, REDQ-OFE also greatly outperforms MBPO, reaching a score of 5000 at 150K interactions, which is 3x MBPO’s score at that point.

To ensure our comparisons are fair, and to ensure our results are reproducible (Henderson et al., 2018; Islam et al., 2017; Duan et al., 2016), we provide open source codeCode and implementation tutorial can be found at: https://github.com/watchernyu/REDQ. For all algorithmic comparisons, we use the same codebase (except for MBPO, for which we use the authors’ code).

Randomized Ensembled Double Q-learning (REDQ)

Janner et al. (2019) proposed Model-Based Policy Optimization (MBPO), which was shown to be much more sample efficient than popular model-free algorithms such as SAC and PPO for the MuJoCo environments. MBPO learns a model, and generates “fake data” from its model as well as “real data” through environment interactions. It then performs parameter updates using both the fake and the real data. One of the distinguishing features of MBPO is that it has a UTD ratio ≫1\gg 1 for updating its Q functions, enabling MBPO to achieve high sample efficiency.

We propose Randomized Ensembled Double Q-learning (REDQ), a novel model-free algorithm whose sample-efficiency performance is just as good as, if not better than, the state-of-the-art model-based algorithm for the MuJoCo benchmark. The pseudocode for REDQ is shown in Algorithm 1. REDQ can be used with any standard off-policy model-free algorithm, such as SAC (Haarnoja et al., 2018b), SOP (Wang et al., 2019), TD3 (Fujimoto et al., 2018), or DDPG (Lillicrap et al., 2015). For the sake of concreteness, we use SAC in Algorithm 1.

REDQ has the following key components: (i)(i) To improve sample efficiency, the UTD ratio GG is much greater than one; (ii)(ii) To reduce the variance in the Q-function estimate, REDQ uses an ensemble of NN Q-functions, with each Q-function randomly and independently initialized but updated with the same target; (iii)(iii) To reduce over-estimation bias, the target for the Q-function includes a minimization over a random subset M\cal{M} of the NN Q-functions. The size of the subset M\cal{M} is kept fixed, and is denoted as MM, and is referred to as the in-target minimization parameter. Since our default choice for MM is M=2M=2, we refer to the algorithm as Randomized Ensembled Double Q-learning (REDQ).

REDQ shares some similarities with Maxmin Q-learning (Lan et al., 2020), which also uses ensembles and also minimizes over multiple Q-functions in the target. However, Maxmin Q-learning and REDQ have many differences, e.g., Maxmin Q-learning minimizes over the full ensemble in the target, whereas REDQ minimizes over a random subset of Q-functions. Unlike Maxmin Q-learning, REDQ controls over-estimation bias and variance of the Q estimate by separately setting MM and NN. REDQ has many possible variations, some of which are discussed in the ablation section.

REDQ has three key hyperparameters, GG, NN, and MM. When N=M=2N=M=2 and G=1G=1, then REDQ simply becomes the underlying off-policy algorithm such as SAC. When N=M>2N=M>2 and G=1G=1, then REDQ is similar to, but not equivalent to, Maxmin Q-learning (Lan et al., 2020). In practice, we find M=2M=2 works well for REDQ, and that a wide range of values around N=10N=10 and G=20G=20 work well. To our knowledge, REDQ is the first successful model-free DRL algorithm for continuous-action spaces using a UTD ratio G≫1G\gg 1.

We now provide experimental results for REDQ and MBPO for the four most challenging MuJoCo environments, namely, Hopper, Walker2d, Ant, and Humanoid. We have taken great care to make a fair comparison of REDQ and MBPO. The MBPO results are reproduced using the author’s open source code, and we use the hyperparameters suggested in the MBPO paper, including G=20G=20. We obtain MBPO results similar to those reported in the MBPO paper. For REDQ, we use G=20G=20, N=10N=10, and M=2M=2 for all environments. We use the evaluation protocol proposed in the MBPO paper. Specifically, after every epoch we run one test episode with the current policy and record the performance as the undiscounted sum of all the rewards in the episode. A more detailed discussion on hyperparameters and implementation details is given in the Appendix.

Figure 1 shows the training curves for REDQ, MBPO, and SAC. For each algorithm, we plot the average return of 55 independent trials as the solid curve, and plot the standard deviation across 55 seeds as the transparent shaded region. For each environment, we train each algorithm for exactly the same number of environment interactions as done in the MBPO paper. Figure 1 shows that both REDQ and MBPO learn much faster than SAC, with REDQ performing somewhat better than MBPO on the whole. In particular, REDQ learns significantly faster for Hopper, and has somewhat better asymptotic performance for Hopper, Walker2d, and Humanoid. A more detailed performance comparison is given in the Appendix, where it is shown that, averaging across the environments, REDQ performs 1.4x better than MBPO half-way through training and 1.1x better at the end of training. These results taken together are perhaps counter-intuitive. They show that a simple model-free algorithm can achieve as good or better sample-efficiency performance as the state-of-the-art model-based algorithm for the MuJoCo environments.

Does REDQ achieve its sample efficiency using more computational resources than MBPO? We now compare the number of parameters used in REDQ and MBPO. With REDQ, for each Q network and the policy network, we use a multi-layer perceptron with two hidden layers, each with 256 units. For MBPO, we use the default network architectures for the Q networks, policy network, and model ensembles (Janner et al., 2019). The Appendix provides a table comparing the number of parameters: REDQ uses fewer parameters than MBPO for all four environments, specifically, between 26% and 70% as many parameters depending on the environment. Additionally, we measured the runtime on a 2080-Ti GPU and found that MBPO roughly takes 75% longer. In summary, the results in this section show that the model-free algorithm REDQ is not only at least as sample efficient as MBPO, but also has fewer parameters and is significantly faster in terms of wall-clock time.

Why does REDQ succeed whereas others fail?

REDQ is a simple model-free algorithm that matches the performance of a state-of-the-art model-based algorithm. Key to REDQ’s sample efficiency is using a UTD ≫1\gg 1. Why is it that SAC and ordinary ensemble averaging (AVG) cannot do as well as REDQ by simply increasing the UTD?

To address these questions, let Qπ(s,a)Q^{\pi}(s,a) be the action-value function for policy π\pi using the standard infinite-horizon discounted return definition. Let Qϕ(s,a)Q_{\phi}(s,a) be an estimate of Qπ(s,a)Q^{\pi}(s,a), which is defined as the average of Qϕi(s,a)Q_{\phi_{i}}(s,a), i=1,…,Ni=1,\ldots,N, when using an ensemble. We define the bias of an estimate at state-action pair (s,a)(s,a) to be Qϕ(s,a)−Qπ(s,a)Q_{\phi}(s,a)-Q^{\pi}(s,a). We are primarily interested in the accuracy of Qϕ(s,a)Q_{\phi}(s,a) over the state-action distribution of the current policy π\pi. To quantitatively analyze how estimation error accumulates in the training process, we perform an analysis that is similar to previous work (Van Hasselt et al., 2016; Fujimoto et al., 2018), but not exactly the same. We run a number of analysis episodes from different random initial states using the current policy π\pi. For each state-action pair visited, we obtain both the discounted Monte Carlo return and the estimated Q value using QϕQ_{\phi}, and then compute the difference to obtain an estimate of the bias for that state-action pair. We then calculate the average and std of these bias values. The average gives us an idea of whether QϕQ_{\phi} is in general overestimating or underestimating, and the std measures how uniform the bias is across different state-action pairs. We argue that the std is just as important as the average of the bias. As discussed in Van Hasselt et al. (2016), a uniform bias is not necessarily harmful as it does not change the action selection. Thus near-uniform bias can be preferable to a highly non-uniform bias with a small average value. Although average bias has been analyzed in several previous works (Van Hasselt et al., 2016; Fujimoto et al., 2018; Anschel et al., 2017), the std does not seem to have received much attention.

Since the MC return values can change significantly throughout training, to make comparisons more meaningful, we define the normalized bias of the estimate Qϕ(s,a)Q_{\phi}(s,a) to be (Qϕ(s,a)−Qπ(s,a))/∣Esˉ,aˉ∼π[Qπ(sˉ,aˉ)]∣(Q_{\phi}(s,a)-Q^{\pi}(s,a))/|E_{\bar{s},\bar{a}\sim\pi}[Q^{\pi}(\bar{s},\bar{a})]|, which is simply the bias divided by the absolute value of the expected discounted MC return for state-action pairs sampled from the current policy. We focus on the normalized bias in our analysis since it helps show how large the bias is, compared to the scale of the current MC return.

In this and the subsequent section, we compare REDQ with several algorithms and variants. We emphasize that all of the algorithms and variants use the same code base as used in the REDQ experiments (including using SAC as the underlying off-policy algorithm). The only difference is how the targets are calculated in lines 7 and 8 of Algorithm 1.

We first compare REDQ with two natural algorithms, which we call SAC-20 and ensemble averaging (AVG). SAC-20 is SAC but with GG increased from 1 (as in standard SAC) to 20. For AVG, we use an ensemble of Q functions, and when computing the Q target, we take the average of all Q values without any in-target minimization. In these comparisons, all three algorithms use a UTD of G=20G=20. In the later ablation section we also have a detailed discussion on experimental results with Maxmin, and explain why it does not work well for the MuJoCo benchmark when using a large ensemble.

Figure 2 presents the results for Ant; the results for the other three environments are consistent with those for Ant and are shown in the Appendix. For each experiment we use 5 random seeds. We first note REDQ learns significantly faster than both SAC-20 and AVG. Strikingly, relative to the other two algorithms, REDQ has a very low normalized std of bias for most of training, indicating the bias across different in-distribution state-action pairs is about the same. Furthermore, throughout most of training, REDQ has a small and near-constant under-estimation bias. The shaded areas for mean and std of bias are also smaller, indicating that REDQ is robust to random initial conditions.

SAC with a UTD ratio of 20 performs poorly for the most challenging environments Ant and Humanoid. For SAC-20, the high UTD ratio leads to an average bias that fluctuates during training. We also see a high normalized std of bias, indicating that the bias is highly non-uniform, which can be detrimental. The bias values also have large variance across random initial seeds, as indicated by the large shaded area, showing that the bias in SAC-20 is sensitive to initial conditions. Comparing AVG and SAC-20, we see AVG performs significantly better than SAC-20 in Ant and Humanoid. This can be explained again by the bias: due to ensemble averaging, AVG can achieve a lower std of bias; and when it does, its performance improves significantly faster than SAC-20.

REDQ has two critical components that allow it to maintain stable and near-uniform bias under high UTD ratios: an ensemble and in-target minimization. AVG and SAC-20 each has one of these components but neither has both. Thus the success of REDQ is largely due to a careful integration of both of these critical components. Additionally, as shown in the ablation study, the random selection of Q functions in the in-target minimization can give REDQ a further performance boost.

We now characterize the relation between the estimation error, the in-target minimization parameter MM and the size of the ensemble NN. We use the theoretical framework introduced in Thrun & Schwartz (1993) and extended in Lan et al. (2020). We do this for the tabular version of REDQ, for which the target for Qi(s,a)Q^{i}(s,a) for each i=1,…,Ni=1,\ldots,N is:

where A\mathcal{A} is the finite action space, (s,a,r,s′)(s,a,r,s^{\prime}) is a transition, and M\mathcal{M} is again a uniformly random subset from {1,…,N}\{1,\dots,N\} with ∣M∣=M|\mathcal{M}|=M. The complete pseudocode for tabular REDQ is provided in the Appendix.

Let Qi(s,a)−Qπ(s,a)Q^{i}(s,a)-Q^{\pi}(s,a) be the pre-update estimation bias for the iith Q-function, where Qπ(s,a)Q^{\pi}(s,a) is once again the ground-truth Q-value for the current policy π\pi. We are interested in how the bias changes after an update, and how this change is effected by MM and NN. Similar to Thrun & Schwartz (1993) and Lan et al. (2020), define the post-update estimation bias as the difference between the target (1) and the target when using the ground-truth:

Here we write ZM,NZ_{M,N} to emphasize its dependence on both MM and NN. Following Thrun & Schwartz (1993) and Lan et al. (2020), fix ss and assume each Qi(s,a)Q^{i}(s,a) has a random approximation error esaie_{sa}^{i}:

Note we make very weak assumptions on the distribution of the error term. Thrun & Schwartz (1993) and Lan et al. (2020) make a strong assumption, namely, the error term is uniformly distributed. Because our assumption is much weaker, our proof methodology in the Appendix is very different.

We also consider a variant of REDQ where instead of choosing a random set of size MM in the target, we calculate the target by taking the expected value over all possible subsets of size MM. In this case, the target in the tabular version becomes

We write the target here as YM,NY_{M,N} to emphasize its dependence on both MM and NN. We refer to this variant of REDQ as “Weighted” since we can efficiently calculate the target as a weighted sum of a re-ordering of the NN Q-functions, as described in the Appendix.

The following theorem shows that the variance of this target goes to zero as N→∞N\to\infty. We note, however, that in practice, some variance in the target may be beneficial in reducing overfitting or help exploration. We can retain some variance by keeping NN finite or using the unweighted REDQ scheme.

Also in the Appendix we show that the tabular version of REDQ convergences to the optimal Q function with probability one.

REDQ variants and ablations

In this section, we use ablations to provide further insight into REDQ. We focus on the Ant environment. We first look at how the ensemble size NN affects REDQ. The top row in Figure 3 shows REDQ with N=2,3,5,10,15N={2,3,5,10,15}. We can see that when we increase the ensemble size, we generally get a more stable average bias, a lower std of bias, and stronger performance. The result shows that even a small ensemble (e.g., N=5N=5) can greatly help in stabilizing bias accumulation when training under high UTD.

The middle row of Figure 3 shows how MM, the in-target minimization parameter, can affect performance. When MM is not an integer, e.g., M=1.5M=1.5, for each update, with probability 0.5 only one randomly-chosen Q function is used in the target, and with probability 0.5, two randomly-chosen functions are used. Similarly, for M=2.5M=2.5, for each update either two or three Q functions are used. Consistent with the theoretical result in Theorem 1, by increasing MM we lower the average bias. When MM gets too large, the Q estimate becomes too conservative and the large negative bias makes learning difficult.

M=2M=2, which has the overall best performance, strikes a good balance between average bias (small underestimation during most of training) and std of the bias (consistently small).

The bottom row of Figure 3 shows the results for different target computation methods. The Maxmin curve in the figures is a variant based on Maxmin Q-learning, where the min of all the Q networks in the ensemble is taken to compute the Q target. As the ensemble size increases, Maxmin Q-learning shifts from overestimation to underestimation (Lan et al., 2020); Figure 3 shows Maxmin with N=3N=3 instead of N=10N=10, since a large NN value will cause even more divergence of the Q values. When varying the ensemble size of Maxmin, we see the same problem as shown in the middle row of Figure 3. When we increase the ensemble size to be larger than 3, Maxmin starts to reduce the bias so much that we get a highly negative Q bias, which accumulates quickly, leading to instability in the Q networks and poor performance. In the Maxmin paper, it was mainly tested on Atari environments with a small finite action space, in which case it provides good performance. Our results show that when using environments with high-dimensional continuous action spaces, such as MuJoCo, the rapid accumulation of (negative) bias becomes a problem. This result parallels some recent research in offline (i.e., batch) DRL. In Agarwal et al. (2020), it is shown that with small finite action spaces, naive offline training with deep Q-networks (DQN) only slightly reduces performance. However, continuous action Q-learning based methods such as Deep Deterministic Policy Gradient and SAC suffer much more from Q bias accumulation compared to discrete action methods. Recent work shows that offline training with these methods often lead to poor performance, and can even entirely diverge (Fujimoto et al., 2019; Kumar et al., 2019).

Random ensemble mixture (REM) is a method originally proposed to boost performance of DQN in the discrete-action setting. REM uses the random convex combination of Q values to compute the target: it is similar to ensemble average (AVG), but with more randomization (Agarwal et al., 2020).

For Weighted, the target is computed as the expectation of all the REDQ targets, where the expectation is taken over all NN-choose-2 pairs of Q-functions. This leads to a formula that is a weighted sum of the ordered Q-functions, where the ordering is from the lowest to the highest Q value in the ensemble, as described in the Appendix. Our baseline REDQ in Algorithm 1 can be considered as a random-sample version of Weighted. For the MinPair REDQ variant, we divide the 10 Q networks into 5 fixed pairs, and during an update we sample a pair of Q networks from these 5 fixed pairs.

From Figure 3 we see that REDQ and MinPair are the best and their performance is similar. For Ant, the performance of Weighted is much lower than REDQ. However, as shown in the Appendix, Weighted and REDQ have similar performance for the other three environments. The randomization might help alleviate overfitting in the early stage, or improve exploration. REM has performance similar to AVG, studied in Section 3. In terms of the Q bias, REM has a positive average bias, while REDQ, MinPair, and Weighted all have a small negative average bias. Overall these results indicate that the REDQ algorithm is robust across different mechanisms for choosing the functions, and that randomly choosing the Q functions can sometimes boost performance. Additional results and discussions are provided in the appendix.

We now investigate whether we can further improve the performance of REDQ by incorporating better representation learning? Ota et al. (2020) recently proposed the online feature extractor network (OFENet), which learns representation vectors from environment data, and provides them to the agent as additional input, giving significant performance improvement.

Is it possible to further improve the performance of REDQ with OFENet? We trained an OFENet together with REDQ to provide extra input, giving the algorithm REDQ-OFE. We found that OFENet did not help much for Hopper and Walker2d, which may be because REDQ already learns very fast, leaving little room for improvement. But as shown in Figure 4, online feature extraction can further improve REDQ performance for the more challenging environments Ant and Humanoid. REDQ-OFE achieves 7x the sample efficiency of SAC to reach 5000 on Ant and Humanoid, and outperforms MBPO with 3.12x and 1.26x the performance of MBPO at 150K and 300K data, respectively. A more detailed performance comparison table can be found in the Appendix.

Related Work

It has long been recognized that maximization bias in Q-learning can significantly impede learning. Thrun & Schwartz (1993) first highlighted the existence of maximization bias. Van Hasselt (2010) proposed Double Q-Learning to address maximization bias for the tabular case, and showed that in general it leads to an under-estimation bias. Van Hasselt et al. (2016) showed that adding Double Q-learning to deep Q networks (DQN) (Mnih et al., 2013; 2015) gives a major performance boost for the Atari games benchmark. For continuous-action spaces, Fujimoto et al. (2018) introduced clipped-double Q-learning (CDQ), which further reduces maximization bias and brings significant improvements over the deep deterministic policy gradient (DDPG) algorithm (Lillicrap et al., 2015). CDQ was later combined with entropy maximization in SAC to achieve even stronger performance (Haarnoja et al., 2018a; b). Other bias reduction techniques include using bias-correction terms (Lee et al., 2013), using weighted Q estimates (Zhang et al., 2017; Li & Hou, 2019), penalizing deterministic policies at early stage of training (Fox et al., 2015), using multi-step methods (Meng et al., 2020), performing weighted Bellman updates to mitigate error propagation (Lee et al., 2020), and truncating sampled Q estimates with distributional networks (Kuznetsov et al., 2020).

It has also long been recognized that using ensembles can improve the performance of DRL algorithms (Faußer & Schwenker, 2015; Osband et al., 2016). For Q-learning based methods, Anschel et al. (2017) use the average of multiple Q estimates to reduce variance. Agarwal et al. (2020) introduced Random Ensemble Mixture (REM), which enforces optimal Bellman consistency on random convex combinations of multiple Q estimates. Lan et al. (2020) introduced Maxmin Q-learning, as discussed in Sections 2-4. Although in discrete action domains it has been found that fine-tuning DQN variants, including the UTD, can boost performance, little experimental or theoretical analysis is given to explain how this improvement is obtained (Kielak, 2020; van Hasselt et al., 2019).

To address some of the critical issues in model-based learning (Langlois et al., 2019), recent methods such as MBPO combine a model ensemble with a carefully controlled rollout horizon to obtain better performance (Janner et al., 2019; Buckman et al., 2018). These model-based methods can also be enhanced with advanced sampling (Zhang et al., 2020), bidirectional models (Lai et al., 2020), or backprop through the model (Clavera et al., 2020), and be analyzed through new theoretical frameworks (Rajeswaran et al., 2020; Dong et al., 2020).

Conclusion

The contributions of this paper are as follows. (1) We propose a simple model-free algorithm that attains sample efficiency that is as good as or better than state-of-the-art model-based algorithms for the MuJoCo benchmark. This result indicates that, at least for the MuJoCo benchmark, models may not be necessary for achieving high sample efficiency. (2) Using carefully designed experiments, we explain why REDQ succeeds when other model-free algorithms with high UTD ratios fail. (3) Finally, we combine REDQ with OFE, and show that REDQ-OFE can learn extremely fast for the challenging environments Ant and Humanoid.

References

Appendix A Theoretical Results

In the tabular algorithm below, for clarity we use G=1G=1.

Alternatively in Algorithm 2, at each iteration we could just update one of the QiQ^{i} functions.

A.2 Proof of Theorem 1

Let X1,X2,…X_{1},X_{2},\ldots be an infinite sequence of i.i.d. random variables. Let F(x)F(x) be the cdf of XmX_{m} and let τ=inf⁡{x:F(x)>0}\tau=\inf\{x:F(x)>0\}. Also let Ym=min⁡{X1,X2,…,Xm}Y_{m}=\min\{X_{1},X_{2},\ldots,X_{m}\}. Then Y1,Y2,…Y_{1},Y_{2},\ldots converges to τ\tau almost surely.

Let Fm(x)F_{m}(x) be the cdf of YmY_{m}. Since X1,...,XmX_{1},...,X_{m} are independent,

For x<τx<\tau, Fm(x)=0F_{m}(x)=0 since F(x)=0F(x)=0. For x>τx>\tau, Fm(x)→m→∞1F_{m}(x)\xrightarrow{m\to\infty}1. Therefore, YmY_{m} weakly converges to τ\tau.

Moreover, for each ω∈Ω\omega\in\Omega, {Ym(ω)}\{Y_{m}(\omega)\} is a decreasing sequence. So {Ym(ω)}\{Y_{m}(\omega)\} either converges to a real number or −∞-\infty. Therefore Ym→YY_{m}\to Y almost surely for some random variable YY. Combined with the result that Ym→dτY_{m}\xrightarrow{d}\tau, we can conclude that

Therefore, we have proved that max⁡amin⁡j∈B1Qj(s,a)\max_{a}\min_{j\in B_{1}}Q^{j}(s,a) and max⁡amin⁡j∈B2Qj(s,a)\max_{a}\min_{j\in B_{2}}Q^{j}(s,a) are identically distributed. Then

Since max⁡aQ1(s,a)≥Q1(s,a′)\max_{a}Q^{1}(s,a)\geq Q^{1}(s,a^{\prime}) for all a′∈Aa^{\prime}\in\mathcal{A}, we have

for all a′∈Aa^{\prime}\in\mathcal{A}. Consequently,

3. Since max⁡amin⁡1≤j≤MQj(s,a)≥max⁡amin⁡1≤j≤M+1Qj(s,a)\max_{a}\min_{1\leq j\leq M}Q^{j}(s,a)\geq\max_{a}\min_{1\leq j\leq M+1}Q^{j}(s,a),

4. Let Fa(x)F_{a}(x) be the cdf of Qj(s,a)Q^{j}(s,a) and let τa=inf⁡{x:Fa(x)>0}\tau_{a}=\inf\{x:F_{a}(x)>0\}. Here we assume the approximation error esaie_{sa}^{i} is non-trivial, which implies τa<Qπ(s,a)\tau_{a}<Q^{\pi}(s,a). Note that τa\tau_{a} can be equal to −∞-\infty. Let

From Lemma 1 we have YaMY_{a}^{M} converges to τa\tau_{a} almost surely for each aa. Because the action space is finite, it therefore follows that

converges almost surely to τ=max⁡aτa\tau=\max_{a}\tau_{a}. Furthermore, for each aa we have

from which it follows that YM≥YM+1Y^{M}\geq Y^{M+1}. Thus {YM}\{Y^{M}\} is a monotonically decreasing sequence. We also note that due to the assumption esai≤ce_{sa}^{i}\leq c for all aa and ii, and because Qπ(s,a)Q^{\pi}(s,a) is finite for all ss and aa, it follows that YM≤dY^{M}\leq d for all MM for a finite dd. Thus {YM}\{Y^{M}\} is a bounded-above, monotonically-decreasing sequence of random variables which converges almost surely to τ\tau. We can therefore apply the monotone convergence theorem, giving

where the last inequality follows from τa<Qπ(s,a)\tau_{a}<Q^{\pi}(s,a) for all actions aa.

A.3 Proof of Theorem 2

For convenience, define YB=max⁡a′min⁡j∈BQj(s′,a′)Y_{B}=\max_{a^{\prime}}\min_{j\in B}Q^{j}(s^{\prime},a^{\prime}). Suppose N>2MN>2M.

terms. ((NM)2)\binom{\binom{N}{M}}{2} can be seen as a polynomial function of NN with degree 2M2M. The coefficient for the term N2MN^{2M} is 12(M!)2\frac{1}{2(M!)^{2}}. The coefficient for the term N2M−1N^{2M-1} is 12(M!)2⋅(−2∑i=0M−1i)\frac{1}{2(M!)^{2}}\cdot(-2\sum_{i=0}^{M-1}i).

Note that YB1Y_{B_{1}} and YB2Y_{B_{2}} are independent if B1∩B2=∅B_{1}\cap B_{2}=\varnothing. The total number of different pairs (B1,B2)(B_{1},B_{2}) such that B1∩B2=∅B_{1}\cap B_{2}=\varnothing is

This is again a polynomial function of NN with degree 2M2M. The coefficient of the term N2MN^{2M} is 12(M!)2\frac{1}{2(M!)^{2}}. The coefficient of the term N2M−1N^{2M-1} is 12(M!)2⋅(−∑i=02M−1i)\frac{1}{2(M!)^{2}}\cdot(-\sum_{i=0}^{2M-1}i). So the number of non-zero terms in AA is at most

Moreover, by Cauchy-Schwarz inequality, for any B1,B2⊂NB_{1},B_{2}\subset\mathcal{N}

A.4 Proof of convergence of tabular REDQ

Assuming that the step size satisfies the standard Robbins-Monro conditions, it is easily seen that the tabular version of REDQ converges with probability 11 to the optimal Q function. In fact, for our Weighted scheme, where we take the expectation over all sets of size MM, the convergence conditions in Lan et al. (2020) are fully satisfied.

For the randomized case, only very minor changes are needed in the proof in Lan et al. (2020). Note that in the case of REDQ, the underlying deterministic target is:

As in Lan et al. (2020), it follows from the contraction property and (2) that REDQ converges with probability 11 to the optimal Q function (Tsitsiklis, 1994; Bertsekas & Tsitsiklis, 1996).

Appendix B Hyperparameters and implementation details

Since MBPO builds on top of a SAC agent, to make our comparisons fair, meaningful, and consistent with previous work, we make all SAC related hyperparameters exactly the same as used in the MBPO paper (Janner et al., 2019). Table 1 gives a list of hyperparameter used in the experiments. For all the REDQ curves reported in the results section, we use a Q network ensemble size NN of 10. We use a UTD ratio GG of 20 on the four MuJoCo environments, which is the same value that was used in the MBPO paper. Thus most of the hyperparameters are made to be the same as in the MBPO paper to ensure fairness and consistency in comparisons.

For all the algorithms and variants, we also first obtain 5000 data points by randomly sampling actions from the action space without making parameter updates. In our experiments we found that using a high UTD from the very beginning with a very small amount of data can easily lead to complete divergence on SAC-20. Sampling a number of random datapoints at the start of training is also a common technique that has been used in previous model-free as well as model-based works (Haarnoja et al., 2018a; Fujimoto et al., 2018; Janner et al., 2019).

For the REDQ-OFE experiments, we implemented a minimal version of the OFENet in the original paper, with no batchnorm layers. We use the recommended hyperparameters as described in the original paper (Ota et al., 2020). Compared to REDQ without OFENet, the main difference is we now first collect 20,000 random data points (which is accounted for in the training curves), and then pre-train the OFENet for 100,000 updates, with the same learning rate and batch size. We then train OFENet together with REDQ agent, and the OFENet uses a UTD ratio of 4. We tried a simple hyperparameter search on Ant with 200,000, 100,000 and 50,000 pre-train updates, and learning rates of 1e-4, 3e-4, 5e-4, and a OFENet UTD of 1, 4 and 20. However, the results are not very different. It is possible that better results can be obtained through a more extensive hyperparameter search or other modifications.

In section 4 we provided experimental results for the Weighted version of REDQ. Recall that in this version, instead of sampling a random subset M{\cal M} in the target, we average over all subsets BB in {1,…,N}\{1,\ldots,N\} of size MM:

In practice, however, we do not need to sum over all NN choose MM subsets. Instead we can re-order the indices so that

for i=1,…,N−1i=1,\ldots,N-1. After the re-ordering, we can use the identity:

Appendix C Sample efficiency comparison for REDQ, SAC and MBPO

The sample efficiency claims made in the main paper are based on Table 2 and Table 3. Table 2 shows that compared to naive SAC, REDQ is much more sample efficient. REDQ reaches 3500 on Hopper with 8x sample efficiency, and reaches 5000 for Ant and Humanoid with 5x and 3.7x sample efficiency. After adding OFE, this becomes more than 7x on Ant and Humanoid. If we average all the numbers for the four environments, then REDQ is 5.0x as sample efficient, and 6.4x after including OFE results.

Table 3 compares REDQ to SAC and MBPO. As in the MBPO paper, we train for 125K for Hopper, and 300K for the other three environments (Janner et al., 2019). The numbers in Table 3 show the performance when trained to half and to the full length of the MBPO training limits. When averaging the numbers, we see that REDQ reaches 4.5x and 2.1x the performance of SAC at 150K and 300K. REDQ is also stronger than MBPO, with 1.4x and 1.1x the performance of MBPO at 150K and 300K. If we include the results of REDQ-OFE, then the numbers become 5.5x and 2.3x the SAC performance at 150K and 300K, and 1.8x and 1.2x the MBPO performance at 150 and 300K.

Appendix D Number of parameters comparison

Table 4 gives the number of parameters for MBPO, REDQ and REDQ-OFE, for all four environments. As discussed in the main paper, REDQ uses fewer parameters than MBPO for all four environments: between 26% and 70% as many parameters depending on the environment. After adding OFENet, REDQ still uses fewer parameters than MBPO, with 80% and 35% as many parameters on Ant and Humanoid. In particular, it is surprising that REDQ-OFE can achieve a much stronger result on Humanoid with much fewer parameters.

Appendix E Additional results for REDQ, SAC-20, and AVG

Due to lack of space, Figure 2 in Section 3 only compared REDQ with SAC-20 and AVG for the Ant environment. Figure 5 presents the results for all four environments. We can see that in all four environments, REDQ has much stronger performance and much lower std of bias compared to SAC-20 and AVG. Note in terms of average normalized bias, AVG is slightly closer to zero in Ant compared to REDQ, and SAC-20 is a bit closer to zero in Humanoid compared to REDQ; however, their std of normalized bias is consistently higher. This shows the importance of having a low std of the bias in addition to a close-to-zero average bias.

Appendix F REDQ and SAC with and without policy delay

Note that in the REDQ pseudocode, the number of policy updates is always one for each data point collected. We set the UTD ratio for the policy update to always be one in order to isolate the effect of additional policy updates from Q updates. Note in this way, REDQ, SAC-20 and SAC-1 all take the same number of policy updates. This helps show that the performance gain mainly comes from the additional Q updates.

Having a lower number of policy updates can also be seen as a delayed policy update, or policy delay, and is a method that has been used in previous works to improve learning stability (Fujimoto et al., 2018). In this section we discuss how delayed policy update, or policy delay, impact the performance of REDQ and SAC (with UTD of 20). Figure 6 compares REDQ and SAC-20 with and without policy delay (NPD for no policy delay). We can see that having the policy delay consistently makes the bias and std of bias lower and more stable, although they have a smaller effect on REDQ than on SAC. Performance-wise SAC always gets a performance boost with policy delay, while REDQ sees improvement in Hopper and Humanoid, and becomes slightly worse in Walker2d and Ant. The results show that policy delay can be important under high UTD when the variance is not properly controlled. However, with enough variance reduction, the effect of policy delay is diminished, and in some cases having more policy update can give better performance.

Appendix G REDQ and SAC with different UTD ratios

How do different UTD ratio values GG impact the performance of REDQ and SAC? Figure 7 compares the two algorithms under UTD ratio values of 1, 5, 10 and 20 for the Ant environment. The results show that in the Ant environment, REDQ greatly benefits from larger UTD values, with UTD of 20 giving the best result. For SAC, performance improves slightly for UTD ratios of 5 and 10, but becomes much worse at 20. Looking at the normalized bias and the std of the bias, we see that changing the UTD ratio does not change the values very much for REDQ, while for SAC, we see that as the UTD ratio increases, both the mean and the std of the bias becomes larger and more unstable.

Appendix H Additional results for Weighted variant

In this section we provide additional results for the Weighted variant. Figure 8 shows the performance and bias comparison on all four environments. Results show that Weighted and REDQ have similar average bias and std of bias. In terms of performance, Weighed is worse in Ant and Hopper, similar in Humanoid and slightly stronger in Walker2d. Overall REDQ seems to have stronger performance and is more robust. Randomness in the networks might help alleviate overfitting in the early stage, or improve exploration, as shown in previous studies (Osband et al., 2016; Fortunato et al., 2018). This can be important since positive bias in Q learning-based methods can sometimes help exploration. This is commonly referred to as optimistic initial values, or optimism in the face of uncertainty (Sutton & Barto, 2018; Brafman & Tennenholtz, 2002). Thus conservative Q estimates in recent algorithms can lead to the problem of pessimistic underexploration (Ciosek et al., 2019). An interesting future work direction is to study how robust and effective exploration can be achieved without relying on optimistic estimates.