Hyperbolic Discounting and Learning over Multiple Horizons

William Fedus, Carles Gelada, Yoshua Bengio, Marc G. Bellemare, Hugo Larochelle

Introduction

The standard treatment of the reinforcement learning (RL) problem is the Markov Decision Process (MDP) which includes a discount factor 0≤γ<10\leq\gamma<1 that exponentially reduces the present value of future rewards (Bellman, 1957; Sutton & Barto, 1998). A reward rtr_{t} received in tt-time steps is devalued to γtrt\gamma^{t}r_{t}, a discounted utility model introduced by Samuelson (1937). This establishes a time-preference for rewards realized sooner rather than later. The decision to exponentially discount future rewards by γ\gamma leads to value functions that satisfy theoretical convergence properties (Bertsekas, 1995). The magnitude of γ\gamma also plays a role in stabilizing learning dynamics of RL algorithms (Prokhorov & Wunsch, 1997; Bertsekas & Tsitsiklis, 1996) and has recently been treated as a hyperparameter of the optimization (OpenAI, 2018; Xu et al., 2018).

However, both the magnitude and the functional form of this discounting function implicitly establish priors over the solutions learned. The magnitude of γ\gamma chosen establishes an effective horizon for the agent, far beyond which rewards are neglected (Kearns & Singh, 2002). This effectively imposes a time-scale of the environment, which may not be accurate. However, less well-known and expanded on later, the exponential discounting of future rewards is consistent with a prior belief that there exists a known constant risk to the agent in the environment (Sozou (1998), Section 3.1). This is a strong assumption that may not be supported in richer environments.

Additionally, discounting future values exponentially and according to a single discount factor γ\gamma does not harmonize with the measured value preferences in humans and animals (Mazur, 1985; 1997; Ainslie, 1992; Green & Myerson, 2004; Maia, 2009). A wealth of empirical evidence has been amassed that humans, monkeys, rats and pigeons instead discount future returns hyperbolically, where dk(t)=11+ktd_{k}(t)=\frac{1}{1+kt}, for some positive k>0k>0 (Ainslie, 1975; 1992; Mazur, 1985; 1997; Frederick et al., 2002; Green et al., 1981; Green & Myerson, 2004).

As an example of hyperbolic time-preferences, consider the hypothetical: a stranger approaches with a simple proposition. He offers you 1Mimmediatelywithnorisk,butifyoucanwaituntiltomorrow,hepromisesyou1M immediately with no risk, but if you can wait until tomorrow, he promises you1.1M dollars. With no further information many are skeptical of this would-be benefactor and choose to receive 1Mimmediately.Mostrightlybelievethefuturepromiseholdsrisk.However,inanalternativeproposition,heinsteadpromisesyou1M immediately. Most rightly believe the future promise holds risk. However, in an alternative proposition, he instead promises you1M in 365 days or 1.1Min366days.Underthesenewtermsmanywillinsteadchoosethe1.1M in 366 days. Under these new terms many will instead choose the1.1M offer. Effectively, the discount rate has decreased further out, indicating the belief that it is less likely for the promise to be reneged on the 366th day if it were not already broken on the 365th day. Note that discount rates in humans have been demonstrated to vary with the size of the reward so this time-reversal might not emerge for 1versus1 versus1.1 (Myerson & Green, 1995; Green et al., 1997).

Hyperbolic discounting is consistent with these reversals in time-preferences (Green et al., 1994). Exponential discounting, on the other hand, always remains consistent between these choices and was shown in Strotz (1955) to be the only time-consistent sliding discount function. This discrepancy between the time-preferences of animals from the exponential discounted measure of value might be presumed irrational. However, Sozou (1998) demonstrates that this behavior is mathematically consistent with the agent maintaining some uncertainty over the hazard rate in the environment. In this formulation, rewards are discounted based on the possibility the agent will succumb to a risk and will thus not survive to collect them. Hazard rate, defined in Section 3, measures the per-time-step risk the agent incurs as it acts in the environment.

Hazard and its associated discount function. Common RL environments are also characterized by risk, but in a narrower sense. In deterministic environments like the original Arcade Learning Environment (ALE) (Bellemare et al., 2013) stochasticity is often introduced through techniques like no-ops (Mnih et al., 2015) and sticky actions (Machado et al., 2018) where the action execution is noisy. Physics simulators may have noise and the randomness of the policy itself induces risk. But even with these stochastic injections the risk to reward emerges in a more restricted sense. Episode-to-episode risk may vary as the value function and resulting policy evolve. States once safely navigable may become dangerous through catastrophic forgetting (McCloskey & Cohen, 1989; French, 1999) or through exploration the agent may venture to new dangerous areas of the state space. However, this is still a narrow manifestation of risk as the environment is generally stable and repetitive. In Section 4 we show that a prior distribution reflecting the uncertainty over the hazard rate, has an associated discount function in the sense that an MDP with either this hazard distribution or the discount function, has the same value function for all policies. This equivalence implies that learning policies with a discount function can be interpreted as making them robust to the associated hazard distribution. Thus, discounting serves as a tool to ensure that policies deployed in the real world perform well even under risks they were not trained under.

Hyperbolic discounting from TD-learning algorithms. We propose an algorithm that approximates hyperbolic discounting while building on successful Q-learning (Watkins & Dayan, 1992) tools and their associated theoretical guarantees. We show learning many Q-values, each discounting exponentially with a different discount factor γ\gamma, can be aggregated to approximate hyperbolic (and other non-exponential) discount factors. We demonstrate the efficacy of our approximation scheme in our proposed Pathworld environment which is characterized both by an uncertain per-time-step risk to the agent. The agent must choose which risky path to follow but it stands to gain a higher reward the longer, riskier paths. A conceptually similar situation might arise for a foraging agent balancing easily realizable, small meals versus more distant, fruitful meals. The setup is described in further detail in Section 7. We then consider higher-dimensional RL agents in the ALE, where we measure the benefits of our technique. Our approximation mirrors the work of Kurth-Nelson & Redish (2009); Redish & Kurth-Nelson (2010) which empirically demonstrates that modeling a finite set of μ\muAgents simultaneously can approximate hyperbolic discounting function which is consistent with fMRI studies (Tanaka et al., 2004; Schweighofer et al., 2008). Our method extends to other non-hyperbolic discount functions and uses deep neural networks to model the different Q-values from a shared representation.

Surprisingly and in addition to enabling new discounting schemes, we observe that learning a set of Q-values is beneficial as an auxiliary task (Jaderberg et al., 2016). Adding this multi-horizon auxiliary task often improves over strong baselines including C51 (Bellemare et al., 2017) and Rainbow (Hessel et al., 2018) in the ALE (Bellemare et al., 2013).

The paper is organized as follows. Section 3 recounts how a prior belief of the risk in the environment can imply a specific discount function. Section 4 formalizes hazard in MDPs. In Section 5 we demonstrate that hyperbolic (and other) discounting rates can be computed by Q-learning (Watkins & Dayan, 1992) over multiple horizons, that is, multiple discount functions γ\gamma. We then provide a practical approach to approximating these alternative discount schemes in Section 6. We demonstrate the efficacy of our approximation scheme in the Pathworld environment in Section 7 and then go on to consider the high-dimensional ALE setting in Sections 7, 9. We conclude with ablation studies, discussion and commentary on future research directions.

This work questions the RL paradigm of learning policies through a single discount function which exponentially discounts future rewards through two contributions:

Hyperbolic (and other non-exponential)-agent. A practical approach for training an agent which discounts future rewards by a hyperbolic (or other non-exponential) discount function and acts according to this.

Multi-horizon auxiliary task. A demonstration of multi-horizon learning over many γ\gamma simultaneously as an effective auxiliary task.

Related Work

Hyperbolic discounting in economics. Hyperbolic discounting is well-studied in the field of economics (Sozou, 1998; Dasgupta & Maskin, 2005). Dasgupta and Maskin (2005) proposes a softer interpretation than Sozou (1998) (which produces a per-time-step of death via the hazard rate) and demonstrates that uncertainty over the timing of rewards can also give rise to hyperbolic discounting and preference reversals, a hallmark of hyperbolic discounting. However, though alternative motivations for hyperbolic discounting exist we build upon Sozou (1998) for its clarity and simplicity.

Hyperbolic discounting was initially presumed to not lend itself to TD-based solutions (Daw & Touretzky, 2000) but the field has evolved on this point. Maia (2009) proposes solution directions that find models that discount quasi-hyperbolically even though each learns with exponential discounting (Loewenstein, 1996) but reaffirms the difficulty. Finally, Alexander and Brown (2010) proposes hyperbolically discounted temporal difference (HDTD) learning by making connections to hazard. However, this approach introduces two additional free parameters to adjust for differences in reward-level.

Behavior RL and hyperbolic discounting in neuroscience. TD-learning has long been used for modeling behavioral reinforcement learning (Montague et al., 1996; Schultz et al., 1997; Sutton & Barto, 1998). TD-learning computes the error as the difference between the expected value and actual value (Sutton & Barto, 1998; Daw, 2003) where the error signal emerges from unexpected rewards. However, these computations traditionally rely on exponential discounting as part of the estimate of the value which disagrees with empirical evidence in humans and animals (Strotz, 1955; Mazur, 1985; 1997; Ainslie, 1975; 1992). Hyperbolic discounting has been proposed as an alternative to exponential discounting though it has been debated as an accurate model (Kacelnik, 1997; Frederick et al., 2002). Naive modifications to TD-learning to discount hyperbolically present issues since the simple forms are inconsistent (Daw & Touretzky, 2000; Redish & Kurth-Nelson, 2010) RL models have been proposed to explain behavioral effects of humans and animals (Fu & Anderson, 2006; Rangel et al., 2008) but Kurth-Nelson & Redish (2009) demonstrated that distributed exponential discount factors can directly model hyperbolic discounting. This work proposes the μ\muAgent, an agent that models the value function with a specific discount factor γ\gamma. When the distributed set of μ\muAgent’s votes on the action, this was shown to approximate hyperbolic discounting well in the adjusting-delay assay experiments (Mazur, 1987). Using the hazard formulation established in Sozou (1998), we demonstrate how to extend this to other non-hyperbolic discount functions and demonstrate the efficacy of using a deep neural network to model the different Q-values from a shared representation.

Towards more flexible discounting in reinforcement learning. RL researchers have recently adopted more flexible versions beyond a fixed discount factor (Feinberg & Shwartz, 1994; Sutton, 1995; Sutton et al., 2011; White, 2017). Optimal policies are studied in Feinberg & Shwartz (1994) where two value functions with different discount factors are used. Introducing the discount factor as an argument to be queried for a set of timescales is considered in both Horde (Sutton et al., 2011) and γ\gamma-nets (Sherstan et al., 2018). Reinke et al. (2017) proposes the Average Reward Independent Gamma Ensemble framework which imitates the average return estimator.

Lattimore and Hutter (2011) generalizes the original discounting model through discount functions that vary with the age of the agent, expressing time-inconsistent preferences as in hyperbolic discounting. The need to increase training stability via effective horizon was addressed in François-Lavet, Fonteneau, and Ernst (2015) who proposed dynamic strategies for the discount factor γ\gamma. Meta-learning approaches to deal with the discount factor have been proposed in Xu, van Hasselt, and Silver (2018). Finally, Pitis (2019) characterizes rational decision making in sequential processes, formalizing a process that admits a state-action dependent discount rates. This body of work suggests growing tension between the original MDP formulation with a fixed γ\gamma and future research directions.

Operating over multiple time scales has a long history in RL. Sutton (1995) generalizes the work of Singh (1992) and Dayan and Hinton (1993) to formalize a multi-time scale TD learning model theory. Previous work has been explored on solving MDPs with multiple reward functions and multiple discount factors though these relied on separate transition models (Feinberg & Shwartz, 1999; Dolgov & Durfee, 2005). Edwards, Littman, and Isbell (2015) considers decomposing a reward function into separate components each with its own discount factor. In our work, we continue to model the same rewards, but now model the value over different horizons. Recent work in difficult exploration games demonstrates the efficacy of two different discount factors (Burda et al., 2018) one for intrinsic rewards and one for extrinsic rewards. Finally, and concurrent with this work, Romoff et al. (2019) proposes the TD(Δ)(\Delta)-algorithm which breaks a value function into a series of value functions with smaller discount factors.

Auxiliary tasks in reinforcement learning. Finally, auxiliary tasks have been successfully employed and found to be of considerable benefit in RL. Suddarth and Kergosien (1990) used auxiliary tasks to facilitate representation learning. Building upon this, work in RL has consistently demonstrated benefits of auxiliary tasks to augment the low-information coming from the environment through extrinsic rewards (Lample & Chaplot, 2017; Mirowski et al., 2016), (Jaderberg et al., 2016; Veeriah et al., 2018; Sutton et al., 2011)

Belief of Risk Implies a Discount Function

Sozou (1998) formalizes time preferences in which future rewards are discounted based on the probability that the agent will not survive to collect them due to an encountered risk or hazard.

Survival s(t)s(t) is the probability of the agent surviving until time tt.

A future reward rtr_{t} is less valuable presently if the agent is unlikely to survive to collect it. If the agent is risk-neutral, the present value of a future reward rtr_{t} received at time-tt should be discounted by the probability that the agent will survive until time tt to collect it, s(t)s(t).Note the difference in RL where future rewards are discounted by time-delay so the value is v(rt)=γtrtv(r_{t})=\gamma^{t}r_{t}.

Consequently, if the agent is certain to survive, s(t)=1s(t)=1, then the reward is not discounted per Equation 2. From this it is then convenient to define the hazard rate.

Hazard rate h(t)h(t) is the negative rate of change of the log-survival at time tt

or equivalently expressed as h(t)=−ds(t)dt1s(t)h(t)=-\frac{ds(t)}{dt}\frac{1}{s(t)}. Therefore the environment is considered hazardous at time tt if the log survival is decreasing sharply.

Sozou (1998) demonstrates that the prior belief of the risk in the environment implies a specific discounting function. When the risk occurs at a known constant rate than the agent should discount future rewards exponentially. However, when the agent holds uncertainty over the hazard rate then hyperbolic and alternative discounting rates arise.

We recover the familiar exponential discount function in RL based on a prior assumption that the environment has a known constant hazard. Consider a known hazard rate of h(t)=λ ≥0h(t)=\lambda\ \geq 0. Definition 3 sets a first order differential equation λ=−ddtlns(t)=−ds(t)dt1s(t)\lambda=-\frac{d}{dt}\text{ln}s(t)=-\frac{ds(t)}{dt}\frac{1}{s(t)}. The solution for the survival rate is s(t)=e−λts(t)=e^{-\lambda t} which can be related to the RL discount factor γ\gamma

This interprets γ\gamma as the per-time-step probability of the episode continuing. This also allows us to connect the hazard rate λ∈[0,∞]\lambda\in[0,\infty] to the discount factor γ∈[0,1)\gamma\in[0,1).

As the hazard increases λ→∞\lambda\rightarrow\infty, then the corresponding discount factor becomes increasingly myopic γ→0\gamma\rightarrow 0. Conversely, as the environment hazard vanishes, λ→0\lambda\rightarrow 0, the corresponding agent becomes increasingly far-sighted γ→1\gamma\rightarrow 1.

In RL we commonly choose a single γ\gamma which is consistent with the prior belief that there exists a known constant hazard rate λ=−ln(γ)\lambda=-\text{ln}(\gamma). We now relax the assumption that the agent holds this strong prior that it exactly knows the true hazard rate. From a Bayesian perspective, a looser prior allows for some uncertainty in the underlying hazard rate of the environment which we will see in the following section.

2 Uncertain Hazard Implies Non-Exponential Discount

We may not always be so confident of the true risk in the environment and instead reflect this underlying uncertainty in the hazard rate through a hazard prior p(λ)p(\lambda). Our survival rate is then computed by weighting specific exponential survival rates defined by a given λ\lambda over our prior p(λ)p(\lambda)

Sozou (1998) shows that under an exponential prior of hazard p(λ)=1kexp(−λ/k)p(\lambda)=\frac{1}{k}\text{exp}(-\lambda/k) the expected survival rate for the agent is hyperbolic

We denote the hyperbolic discount by Γk(t)\Gamma_{k}(t) to make the connection to γ\gamma in reinforcement learning explicit. Further, Sozou (1998) shows that different priors over hazard correspond to different discount functions. We reproduce two figures in Figure 2 showing the correspondence between different hazard rate priors and the resultant discount functions. The common approach in RL is to maintain a delta-hazard (black line) which leads to exponential discounting of future rewards. Different priors lead to non-exponential discount functions.

Hazard in MDPs

To study MDPs with hazard distributions and general discount functions we introduce two modifications. The hazardous MDP now is defined by the tuple <S,A,R,P,H,d><\mathcal{S},\mathcal{A},R,P,\mathcal{H},d>. In standard form, the state space S\mathcal{S} and the action space A\mathcal{A} may be discrete or continuous. The learner observes samples from the environment transition probability P(st+1∣st,at)P(s_{t+1}|s_{t},a_{t}) for going from st∈Ss_{t}\in\mathcal{S} to st+1∈Ss_{t+1}\in\mathcal{S} given at∈Aa_{t}\in\mathcal{A}. We will consider the case where PP is a sub-stochastic transition function, which defines an episodic MDP. The environment emits a bounded reward r:S×A→[rmin,rmax]r:\mathcal{S}\times\mathcal{A}\rightarrow\left[r_{min},r_{max}\right] on each transition. In this work we consider non-infinite episodic MDPs.

The first difference is that at the beginning of each episode, a hazard λ∈[0,∞)\lambda\in[0,\infty) is sampled from the hazard distribution H\mathcal{H}. This is equivalent to sampling a continuing probability γ=e−λ\gamma=e^{-\lambda}. During the episode, the hazard modified transition function will be PλP_{\lambda}, in that Pλ(s′∣s,a)=e−λP(s′∣s,a)P_{\lambda}(s^{\prime}|s,a)=e^{-\lambda}P(s^{\prime}|s,a). The second difference is that we now consider a general discount function d(t)d(t). This differs from the standard approach of exponential discounting in RL with γ\gamma according to d(t)=γtd(t)=\gamma^{t}, which is a special case.

This setting makes a close connection to partially observable Markov Decision Process (POMDP) (Kaelbling et al., 1998) where one might consider λ\lambda as an unobserved variable. However, the classic POMDP definition contains an explicit discount function γ\gamma as part of it’s definition which does not appear here.

A policy π:S→A\pi:\mathcal{S}\rightarrow\mathcal{A} is a mapping from states to actions. The state action value function QπH,d(s,a)Q_{\pi}^{\mathcal{H},d}(s,a) is the expected discounted rewards after taking action aa in state ss and then following policy π\pi until termination.

In the hazardous MDP setting we observe the same connections between hazard and discount functions delineated in Section 3. This expresses an equivalence between the value function of an MDP with a discount and MDP with a hazard distribution.

For example, there exists an equivalence between the exponential discount function d(t)=γtd(t)=\gamma^{t} to the undiscounted case where the agent is subject to a (1−γ)(1-\gamma) per time-step of dying (Lattimore & Hutter, 2011). The typical Q-value (left side of Equation 9) is when the agent acts in an environment without hazard λ=0\lambda=0 or H=δ(0)\mathcal{H}=\delta(0) and discounts future rewards according to d(t)=γt=e−λtd(t)=\gamma^{t}=e^{-\lambda t} which we denote as Qπδ(0),γt(s,a)Q_{\pi}^{\delta(0),\gamma^{t}}(s,a). The alternative Q-value (right side of Equation 9) is when the agent acts under hazard rate λ=−ln⁡γ\lambda=-\ln\gamma but does not discount future rewards which we denote as Qπδ(−ln⁡γ),1(s,a)Q_{\pi}^{\delta(-\ln\gamma),1}(s,a).

where δ(x)\delta(x) denotes the Dirac delta distribution at xx. This follows from Pλ(s′∣s,a)=e−λP(s′∣s,a)P_{\lambda}(s^{\prime}|s,a)=e^{-\lambda}P(s^{\prime}|s,a)

Following Section 3 we also show a similar equivalence between hyperbolic discounting and the specific hazard distribution pk(λ)=1kexp(−λ/k)p_{k}(\lambda)=\frac{1}{k}\text{exp}(-\lambda/k), where again, λ∈[0,∞)\lambda\in[0,\infty) in Appendix A.

Computing Hyperbolic Q-Values From Exponential Q-Values

We show how one can re-purpose exponentially-discounted Q-values to compute hyperbolic (and other-non-exponential) discounted Q-values. The central challenge with using non-exponential discount strategies is that most RL algorithms use some form of TD learning (Sutton, 1988). This family of algorithms exploits the Bellman equation (Bellman, 1958) which, when using exponential discounting, relates the value function at one state with the value at the following state.

Being able to reuse the literature on TD methods without being constrained to exponential discounting is thus an important challenge.

Let’s start with the case where we would like to estimate the value function where rewards are discounted hyperbolically instead of the common exponential scheme. We refer to the hyperbolic Q-values as QπΓQ^{\Gamma}_{\pi} below in Equation 12

We may relate the hyperbolic QπΓQ^{\Gamma}_{\pi}-value to the values learned through standard QQ-learning. To do so, notice that the hyperbolic discount Γt\Gamma_{t} can be expressed as the integral of a certain function f(γ,t)f(\gamma,t) for γ=[0,1)\gamma=[0,1) in Equation 13.

The integral over this specific function f(γ,t)=γktf(\gamma,t)=\gamma^{kt} yields the desired hyperbolic discount factor Γk(t)\Gamma_{k}(t) by considering an infinite set of exponential discount factors γ\gamma over its domain γ∈[0,1)\gamma\in[0,1). We visualize the hyperbolic discount factors 11+t\frac{1}{1+t} (consider k=1k=1) for the first few time-steps tt in Figure 3.

Recognize that the integrand γkt\gamma^{kt} is the standard exponential discount factor which suggests a connection to standard Q-learning (Watkins & Dayan, 1992). This suggests that if we could consider an infinite set of γ\gamma then we can combine them to yield hyperbolic discounts for the corresponding time-step tt. We build on this idea of modeling many γ\gamma throughout this work.

We employ Equation 13 and return to the task of computing hyperbolic Q-values QπΓ(s,a)Q^{\Gamma}_{\pi}(s,a)Hyperbolic Q-values can generally be infinite for bounded rewards. We consider non-infinite episodic MDPs only.

where Γk(t)\Gamma_{k}(t) has been replaced on the first line by (∫γ=01γktdγ)\left(\int_{\gamma=0}^{1}\gamma^{kt}d\gamma\right) and the exchange is valid if ∑t=0∞γktrt<∞\sum_{t=0}^{\infty}\gamma^{kt}r_{t}<\infty. This shows us that we can compute the QπΓQ^{\Gamma}_{\pi}-value according to hyperbolic discount factor by considering an infinite set of QπγkQ^{\gamma^{k}}_{\pi}-values computed through standard QQ-learning. Examining further, each γ∈[0,1)\gamma\in[0,1) results in TD-errors learned for a new γk\gamma^{k}. For values of k<1k<1, which extends the horizon of the hyperbolic discounting, this would result in larger γ\gamma.

2 Generalizing to Other Non-Exponential Q𝑄Q-Values

Equation 13 computes hyperbolic discount functions but its origin was not mathematically motivated. We consider here an alternative scheme to deduce ways to model hyperbolic as well as different discount schemes through integrals of γ\gamma.

which we will refer to as the exponential weighting condition, then

where again the exchange is valid if ∑t=0∞γtR(st,at)<∞\sum_{t=0}^{\infty}\gamma^{t}R(s_{t},a_{t})<\infty. We can now see that the exponential weighting condition is satisfied for hyperbolic discounting and a list of other discounting that we might want to consider.

For instance, the hyperbolic discount can also be expressed as the integral of a different function f(γ,t)f(\gamma,t) for γ=[0,1)\gamma=[0,1) in Equation 23.

As before, an integral over a function f′(γ,t)=1kγ1/k+t−1=w(γ)γtf^{\prime}(\gamma,t)=\frac{1}{k}\gamma^{1/k+t-1}=w(\gamma)\gamma^{t} yields the desired hyperbolic discount factor Γk(t)\Gamma_{k}(t). This integral can be derived by recognizing Equation 6 as the Laplace transform of the prior H=p(λ)\mathcal{H}=p(\lambda) and then applying a change of variables γ=e−λ\gamma=e^{-\lambda}. Computing hyperbolic and other discount functions is demonstrated in detail in Appendix B. We summarize in Table 1 how a particular hazard prior p(λ)p(\lambda) can be computed via integrating over specific weightings w(γ)w(\gamma) and the corresponding discount function.

Approximating Hyperbolic Q𝑄Q-Values

Section 5 describes an equivalence between hyperbolically-discounted Q-values and integrals of exponentially-discounted Q-values requiring evaluating an infinite set of value functions. We now present a practical approach to approximate discounting Γ(t)=11+kt\Gamma(t)=\frac{1}{1+kt} using standard QQ-learning (Watkins & Dayan, 1992).

To avoid estimating an infinite number of QπγQ^{\gamma}_{\pi}-values we introduce a free hyperparameter (nγn_{\gamma}) which is the total number of QπγQ^{\gamma}_{\pi}-values to consider, each with their own γ\gamma. We use a practically-minded approach to choose G\mathcal{G} that emphasizes evaluating larger values of γ\gamma rather than uniformly choosing points and empirically performs well as seen in Section 7.

We previously proposed two equivalent approaches for computing hyperbolic Q-values, but for simplicity we consider the one presented in Lemma 5.1. The set of QQ-values permits us to estimate the integral through a Riemann sum (Equation 25) which is described in further detail in Appendix D.

where we estimate the integral through a lower bound. We consolidate this entire process in Figure 4 where we show the full process of rewriting the hyperbolic discount rate, hyperbolically-discounted Q-value, the approximation and the instantiated agent. This approach is similar to that of Kurth-Nelson & Redish (2009) where each μ\muAgent models a specific discount factor γ\gamma. However, this differs in that our final agent computes a weighted average over each Q-value rather than a sampling operation of each agent based on a γ\gamma-distribution.

Pathworld Experiments

The benefits of hyperbolic discounting will be greatest under:

Uncertain hazard. The hazard-rate characterizing the environment is not known. For instance, an unobserved hazard-rate variable λ\lambda is drawn independently at the beginning of each episode from H=p(λ)\mathcal{H}=p(\lambda).

Non-trivial intertemporal decisions. The agent faces non-trivial intertemporal decision. A non-trivial decision is one between smaller nearby rewards versus larger distant rewards.A trivial intertemporal decision is one between small distant rewards versus large close rewards.

In the absence of both properties we would not expect any advantage to discounting hyperbolically. As described before, if there is a single-true hazard rate λenv\lambda_{\text{env}}, than an optimal γ∗=e−λenv\gamma^{*}=e^{-\lambda_{\text{env}}} exists and future rewards should be discounted exponentially according to it. Further, without non-trivial intertemporal trade-offs which would occur if there is one path through the environment with perfect alignment of short- and long-term objectives, all discounting schemes will yield the same optimal policy.

2 Pathworld Details

We note two sources for discounting rewards in the future: time delay and survival probability (Section 4). In Pathworld of 5, we train to maximize hyperbolically discounted returns (∑tΓk(t)R(st,at)\sum_{t}\Gamma_{k}(t)R(s_{t},a_{t})) under no hazard (H=δ(λ−0)\mathcal{H}=\delta(\lambda-0)) but then evaluate the undiscounted returns d(t)=1.0  ∀  td(t)=1.0\;\forall\;t with the paths subject to hazard H=1kexp(−λ/k)\mathcal{H}=\frac{1}{k}\text{exp}(-\lambda/k). Through this procedure, we are able to train an agent that is robust to hazards in the environment.

The agent makes one decision in Pathworld (Figure 5): which of the NN paths to investigate. Once a path is chosen, the agent continues until it reaches the end or until it dies. This is similar to a multi-armed bandit, with each action subject to dynamic risk. The paths vary quadratically in length with the index d(i)=i2d(i)=i^{2} but the rewards increase linearly with the path index r(i)=ir(i)=i. This presents a non-trivial decision for the agent. At deployment, an unobserved hazard λ∼H\lambda\sim\mathcal{H} is drawn and the agent is subject to a per-time-step risk of dying of (1−e−λ)(1-e^{-\lambda}). This environment differs from the adjusting-delay procedure presented by Mazur (1987) and then later modified by Kurth-Nelson & Redish (2009). Rather then determining time-preferences through varaible-timing of rewards, we determine time-preferences through risk to the reward.

3 Results in Pathworld

Figure 7 validates that our approach well-approximates the true hyperbolic value of each path when the hazard prior matches the true distribution. Agents that discount exponentially according to a single γ\gamma (as is commonly the case in RL) incorrectly value the paths.

We examine further the failure of exponential discounting in this hazardous setting. For this environment, the true hazard parameter in the prior was k=0.05k=0.05 (i.e. λ∼20exp(−λ/0.05)\lambda\sim 20\text{exp}(-\lambda/0.05)). Therefore, at deployment, the agent must deal with dynamic levels of risk and faces a non-trivial decision of which path to follow. Even if we tune an agent’s γ=0.975\gamma=0.975 such that it chooses the correct arg-max path, it still fails to capture the functional form (Figure 7) and it achieves a high error over all paths (Table 7). If the arg-max action was not available or if the agent was proposed to evaluate non-trivial intertemporal decisions, it would act sub-optimally.

In the next two experiments we consider the more realistic case where the agent’s prior over hazard does not exactly match the environment true hazard rate. In Figure 9 we consider the case that the agent still holds an exponential prior but has the wrong coefficient kk and in Figure 11 we consider the case where the agent still holds an exponential prior but the true hazard is actually drawn from a uniform distribution with the same mean.

Through these two validating experiments, we demonstrate the robustness of estimating hyperbolic discounted Q-values in the case when the environment presents dynamic levels of risk and the agent faces non-trivial decisions. Hyperbolic discounting is preferable to exponential discounting even when the agent’s prior does not precisely match the true environment hazard rate distribution, by coefficient (Figure 9) or by functional form (Figure 11).

Atari 2600 Experiments

With our approach validated in Pathworld, we now move to the high-dimensional environment of Atari 2600, specifically, ALE. We use the Rainbow variant from Dopamine (Castro et al., 2018) which implements three of the six considered improvements from the original paper: distributional RL, predicting n-step returns and prioritized replay buffers.

The agent (Figure 12) maintains a shared representation h(s)h(s) of state, but computes QQ-value logits for each of the NN γi\gamma_{i} via Qπ(i)(s,a)=f(Wih(s)+bi)Q_{\pi}^{(i)}(s,a)=f(W_{i}h(s)+b_{i}) where f(⋅)f(\cdot) is a ReLU-nonlinearity (Nair & Hinton, 2010) and WiW_{i} and bib_{i} are the learnable parameters of the affine transformation for that head.

We provide details on the hyperparameters in Appendix G. We consider the performance of the hyperbolic agent built on Rainbow (referred to as Hyper-Rainbow) on a random subset of Atari 2600 games in Figure 13.

We find that the Hyper-Rainbow agent (blue) performs very well, often improving over the strong-baseline Rainbow agent. On this subset of 19 games, we find that it improves upon 14 games and in some cases, by large margins. However, in Section 9 we seek a more complete understanding of the underlying driver of this improvement in ALE through an ablation study.

Multi-Horizon Auxiliary Task Results

To dissect the ALE improvements, recognize that Hyper-Rainbow changes two properties from the base Rainbow agent:

Behavior policy. The agent acts according to hyperbolic Q-values computed by our approximation described in Section 6

Learn over multiple horizons. The agent simultaneously learns Q-values over many γ\gamma rather than a Q-value for a single γ\gamma

The second modification can be regarded as introducing an auxiliary task (Jaderberg et al., 2016). Therefore, to attribute the performance of each properly we construct a Rainbow agent augmented with the multi-horizon auxiliary task (referred to as Multi-Rainbow and shown in orange) but have it still act according to the original policy. That is, Multi-Rainbow acts to maximize expected rewards discounted by a fixed γaction\gamma_{action} but now learns over multiple horizons as shown in Figure 12.

We find that the Multi-Rainbow agent performs nearly as well on these games, suggesting the effectiveness of this as a stand-alone auxiliary task. This is not entirely unexpected given the rather special-case of hazard exhibited in ALE through sticky-actions (Machado et al., 2018).

We examine further and investigate the performance of this auxiliary task across the full Arcade Learning Environment (Bellemare et al., 2017) using the recommended evaluation by (Machado et al., 2018). Doing so we find empirical benefits of the multi-horizon auxiliary task on the Rainbow agent as shown in Figure 14.

To understand the interplay of the multi-horizon auxiliary task with other improvements in deep RL, we test a random subset of 10 Atari 2600 games against improvements in Rainbow (Hessel et al., 2018). On this set of games we measure a consistent improvement with multi-horizon C51 (Multi-C51) in 9 out of the 10 games over the base C51 agent (Bellemare et al., 2017) in Figure 15.

Figure 15 indicates that the current implementation of Multi-Rainbow does not generally build successfully on the prioritized replay buffer. On the subset of ten games considered, we find that four out of ten games (Pong, Venture, Gravitar and Zaxxon) are negatively impacted despite (Hessel et al., 2018) finding it to be of considerable benefit and specifically beneficial in three out of these four games (Venture was not considered). The current prioritization scheme simply averaged the temporal-difference errors over all QQ-values to establish priority. Alternative prioritization schemes are offering encouraging preliminary results (Appendix E).

Discussion

This work builds on a body of work that questions one of the basic premises of RL: one should maximize the exponentially discounted returns via a single discount factor. By learning over multiple horizons simultaneously, we have broadened the scope of our learning algorithms. Through this we have shown that we can enable acting according to new discounting schemes and that learning multiple horizons is a powerful stand-alone auxiliary task. Our method well-approximates hyperbolic discounting and performs better in hazardous MDP distributions. This may be viewed as part of an algorithmic toolkit to model alternative discount functions.

Future Work

There is growing interest in the time-preferences of RL agents. Through this work we have considered models of a constant, albeit uncertain, hazard rate λ\lambda. This moves beyond the canonical RL approach of fixing a single γ\gamma which implicitly holds no uncertainty on the value of λ\lambda but this still does not fully capture all aspects of risk since the hazard rate may be a function of time. Further, hazard may not be an intrinsic property of the environment but a joint property of both the policy and the environment. If an agent purses a policy leading to dangerous state distributions then it will naturally be subject to higher hazards and vice-versa. We would therefore expect an interplay between time-preferences and policy. This is not simple to deal with but recent work proposing state-action dependent discounting (Pitis, 2019) may provide a formalism for more general time-preference schemes.

Acknowledgements

This research and its general framing drew upon the talents of many researchers at Google Brain, DeepMind and Mila. In particular, we’d like thank Ryan Sepassi for framing of the paper, Utku Evci for last minute Matplotlib help, Audrey Durand, Margaret Li, Adrien Ali Taïga, Ofir Nachum, Doina Precup, Jacob Buckman, Marcin Moczulski, Nicolas Le Roux, Ben Eysenbach, Sherjil Ozair, Anirudh Goyal, Ryan Lowe, Robert Dadashi, Chelsea Finn, Sergey Levine, Graham Taylor and Irwan Bello for general discussions and revisions.

References

Appendix A Equivalence of Hyperbolic Discounting and Exponential Hazard

Following Section 3 we also show a similar equivalence between hyperbolic discounting and the specific hazard distribution pk(λ)=1kexp(−λ/k)p_{k}(\lambda)=\frac{1}{k}\text{exp}(-\lambda/k), where again, λ∈[0,∞)\lambda\in[0,\infty)

Where the first step uses Equation 7. This equivalence implies that discount factors can be used to learn policies that are robust to hazards.

Appendix B Alternative Discount Functions

We expand upon three special cases to see how functions f(γ,t)=w(γ)γtf(\gamma,t)=w(\gamma)\gamma^{t} may be related to different discount functions d(t)d(t).

Delta hazard prior: p(λ)=δ(λ−k)p(\lambda)=\delta(\lambda-k)

Exponential hazard prior: p(λ)=1ke−λ/kp(\lambda)=\frac{1}{k}e^{-\lambda/k}

Uniform hazard prior: p(λ)=1kp(\lambda)=\frac{1}{k} for λ∈[0,k]\lambda\in[0,k]

For the three cases we begin with the Laplace transform on the prior p(λ)=∫λ=0∞p(λ)e−λtdλp(\lambda)=\int_{\lambda=0}^{\infty}p(\lambda)e^{-\lambda t}d\lambda and then chnage the variables according to the relation between γ=e−λ\gamma=e^{-\lambda}, Equation 5.

A delta prior p(λ)=δ(λ−k)p(\lambda)=\delta(\lambda-k) on the hazard rate is consistent with exponential discounting.

where δ(λ−k)\delta(\lambda-k) is a Dirac delta function defined over variable λ\lambda with value kk. The change of variable γ=e−λ\gamma=e^{-\lambda} (equivalently λ=−ln⁡γ\lambda=-\ln\gamma) yields differentials dλ=−1γdγd\lambda=-\frac{1}{\gamma}d\gamma and the limits λ=0→γ=1\lambda=0\rightarrow\gamma=1 and λ=∞→γ=0\lambda=\infty\rightarrow\gamma=0. Additionally, the hazard rate value λ=k\lambda=k is equivalent to the γ=e−k\gamma=e^{-k}.

where we define a γk=e−k\gamma_{k}=e^{-k} to make the connection to standard RL discounting explicit. Additionally and reiterating, the use of a single discount factor, in this case γk\gamma_{k}, is equivalent to the prior that a single hazard exists in the environment.

B.2 Exponential Hazard Prior

Again, the change of variable γ=e−λ\gamma=e^{-\lambda} yields differentials dλ=−1γdγd\lambda=-\frac{1}{\gamma}d\gamma and the limits λ=0→γ=1\lambda=0\rightarrow\gamma=1 and λ=∞→γ=0\lambda=\infty\rightarrow\gamma=0.

where p(⋅)p(\cdot) is the prior. With the exponential prior p(λ)=1kexp(−λ/k)p(\lambda)=\frac{1}{k}\text{exp}(-\lambda/k) and by substituting λ=−lnγ\lambda=-\text{ln}\gamma we verify Equation 23

B.3 Uniform Hazard Prior

Finally if we hold a uniform prior over hazard, 1k\frac{1}{k} for λ∈[0,k]\lambda\in[0,k] then Sozou (1998) shows the Laplace transform yields

Use the same change of variables to relate this to γ\gamma. The bounds of the integral become λ=0→γ=1\lambda=0\rightarrow\gamma=1 and λ=k→γ=e−k\lambda=k\rightarrow\gamma=e^{-k}.

Appendix C Determining the γ𝛾\gamma Interval

We provide further detail for which γ\gamma we choose to model and motivation why. We choose a γmax\gamma_{\text{max}} which is the largest γ\gamma to learn through Bellman updates. If we are using kk as the hyperbolic coefficient in Equation 7 and we are approximating the integral with nγn_{\gamma} our γmax\gamma_{\text{max}} would be

However, allowing γmax→1\gamma_{\text{max}}\rightarrow 1 get arbitrarily close to 1 may result in learning instabilities Bertsekas (1995). Therefore we compute an exponentiation base of b=exp(ln(1−γmax1/k)/nγ)b=\text{exp}(\text{ln}(1-\gamma_{\text{max}}^{1/k})/n_{\gamma}) which bounds our γmax\gamma_{\text{max}} at a known stable value. This induces an approximation error which is described more in Appendix F.

Appendix D Estimating Hyperbolic Coefficients

As discussed, we can estimate the hyperbolic discount in two different ways. We illustrate the resulting estimates here and resulting approximations. We use lower-bound Riemann sums in both cases for simplicity but more sophisticated integral estimates exist.

1𝑘𝑡1/(1+kt) for time tt. (b) Alternative form for approximating hyperbolic coefficients which is sharply peaked as γ→1\gamma\rightarrow 1 which led to larger errors in estimation under our initial techniques. As noted earlier, we considered two different integrals for computed the hyperbolic coefficients. Under the form derived by the Laplace transform, the integrals are sharply peaked as γ→1\gamma\rightarrow 1. The difference in integrals is visually apparent comparing in Figure 16.

Appendix E Performance of Different Replay Buffer Prioritization Scheme

As found through our ablation study in Figure 15, the Multi-Rainbow auxiliary task interacted poorly with the prioritized replay buffer when the TD-errors were averaged evenly across all heads. As an alternative scheme, we considered prioritizing according to the largest γ\gamma, which is also the γ\gamma defining the QQ-values by which the agent acts.

The (preliminaryThese runs have been computed over approximately 100 out of 200 iterations and will be updated for the final version.) results of this new prioritization scheme is in Figure 17.

To this point, there is evidence that prioritizing according to the TD-errors generated by the largest gamma is a better strategy than averaging.

Appendix F Approximation Errors

Instead of evaluating the upper bound of Equation 23 at 1 we evaluate at γmax\gamma_{\text{max}} which yields γmaxkt/(1+kt)\gamma_{\text{max}}^{kt}/(1+kt). Our approximation induces an error in the approximation of the hyperbolic discount.

This approximation error in the Riemann sum increases as the γmax\gamma_{\text{max}} decreases as evidenced by Figure 19. When the maximum value of γmax→1\gamma_{\text{max}}\rightarrow 1 then the approximation becomes more accurate as supported in Table 19 up to small random errors.

Appendix G Hyperparameters

For all our experiments in DQN Mnih et al. (2015), C51 Bellemare et al. (2017) and Rainbow Hessel et al. (2018), we benchmark against the baselines set by Castro et al. (2018) and we use the default hyperparameters for each of the respective algorithms. That is, our Multi-agent uses the same optimization, learning rates, and hyperparameters as it’s base class.

Appendix H Auxiliary Task Results

Final results of the multi-horizon auxiliary task on Rainbow (Multi-Rainbow) in Table 3.