far.in.net


~Reward function transformations

Positive linear scaling, potential shaping, and destination redistribution

The mapping between reward functions and their induced policies is not one-to-one. Indeed, a given reward function often has many equally optimal policies. Moreover, a given ordering over the space of policies may be induced by many distinct reward functions. In particular, the ordering induced on the space of policies is invariant to transformations like the following:

In fact, in an environment with no unreachable states, every two reward functions that induce the same ordering over the space of policies are related by the above transformations (or compositions of them; Skalse et al. 2023, Skalse and Abate, 2023).

This note reviews and expands on the definitions of these reward function transformations, including their group structure under composition, and gives a self-contained proof of this invariance completeness result.

Contents:

Word count: 6350

§Reinforcement learning preliminaries

First, a short primer on reinforcement learning concepts and the associated formalism (environments, reward functions, policies, evaluation, and value functions), plus occupancy measures and some standard identities and results we will use in later proofs.

§§Environments and reward

We model an environment as a reward-free Markov decision process (MDP), a tuple ⟨S,A,ι,τ⟩\langle{\mathcal{S}, \mathcal{A}, \iota, \tau}\rangle where:

Separately, a reward function is a function r:S×A×S→Rr : \mathcal{S}\times \mathcal{A}\times \mathcal{S}\to \mathbb{R} ascribing numerical reward to MDP transitions. The set of all reward functions is denoted R\mathcal{R}.

I remark that I separate the reward function from the “environment” for conceptual clarity:

In reward theory, we mainly consider a fixed interaction system from the perspective of different reward functions. Therefore, it’s useful to be able to refer to the fixed environment separately from the changing reward function.

§§Policies

Speaking of agent–environment interactions, we represent a particular class of agent behaviours using a policy. Formally, a policy is a conditional action distribution π:S→Δ ⁣(A)\pi : \mathcal{S}\to \Delta\!\left(\mathcal{A}\right) describing the probability that our agent will choose each action when placed in each state of the environment. The set of all policies is denoted Π\Pi.

Fixing a policy, we can sample trajectories of agent–environment interactions:

  1. First, sample an initial state s0∼ιs_0 \sim \iota.
  2. Next, sample an agent action a0∼π(s0)a_0 \sim \pi(s_0).
  3. Then, sample a new environment state s1∼τ(s0,a0)s_1 \sim \tau(s_0, a_0).
  4. Repeat from step 2, incrementing all subscripts by one. That is, at∼π(st),st+1∼τ(st,at).(t∈N>0) a_t \sim \pi(s_t), \quad s_{t+1} \sim \tau(s_t, a_t). \qquad \text{($t \in \mathbb{N}_{>0}$)}

Thus, a choice of policy induces a particular distribution over state–action trajectories.

§§Policy evaluation

If we now bring in a reward function r∈Rr \in \mathcal{R}, we can quantify the desirability of a policy by the kinds of trajectories it induces. In particular, fix also a discount rate γ∈(0,1)\gamma \in (0,1) (once again, I keep this out of the environment definition for conceptual reasons—there are other ways to score trajectories). Then the evaluation function Jr:Π→R\mathcal{J}^{r} : \Pi \to \mathbb{R}, encodes the expected cumulative discounted reward under each policy π∈Π\pi \in \Pi: Jr(π)=Eπ ⁣[ ∑t=0∞γtr(st,at,st+1) ], \mathcal{J}^{r}(\pi) = \mathbb{E}_{\pi}\!\left[\, \sum_{t=0}^\infty \gamma^t r(s_t, a_t, s_{t+1}) \,\right], where Eπ ⁣[ ⋅ ]\mathbb{E}_{\pi}\!\left[\,\cdot\,\right] denotes expectation taken over the distribution of trajectories induced by π\pi.

The objective of reinforcement learning (RL) methods is typically to find a policy that maximises the evaluation function for the given reward function. More generally, through the evaluation function, each reward function induces a total preorder on the space of policies. That is, given r∈Rr \in \mathcal{R}, we can define a relation ⪯r⊆Π×Π{\preceq_r} \subseteq \Pi \times \Pi such that π1⪯rπ2if and only ifJr(π1)≤Jr(π2). \pi_ 1 \preceq_r \pi_2 \qquad \text{if and only if} \qquad \mathcal{J}^{r}(\pi_1) \leq \mathcal{J}^{r}(\pi_2) . Call this relation the policy preorder. It represents the ranking of the desirability of all policies under the given reward function.

§§The value function and the Bellman equation

Because of the Markov assumptions, policy evaluation decomposes recursively into a system of per-state evaluations. First, we define a per-state evaluation function, called the value function. Given a reward function r∈Rr \in \mathcal{R}, and a policy π∈Π\pi \in \Pi, define the value function, vπr:S→Rv^{r}_{\pi} : \mathcal{S}\to \mathbb{R}, as the expected discounted cumulative reward achieved by the policy assuming trajectories originating in each state s∈Ss \in \mathcal{S}, vπr(s)=Eπ ⁣[ ∑t=0∞γtr(st,at,st+1) | s0=s ] v^{r}_{\pi}(s) = \mathbb{E}_{\pi}\!\left[\, \sum_{t=0}^\infty \gamma^t r(s_t, a_t, s_{t+1}) \,\middle|\, s_0 = s \,\right] (where by conditioning on s0=ss_0=s, I mean starting the sampling process in state ss, even if ι(s)=0\iota(s)=0). The evaluation function can then be written succinctly as Jr(π)=Es∼ι ⁣[ vπr(s) ].\mathcal{J}^{r}(\pi) = \mathbb{E}_{s \sim \iota}\!\left[\,v^{r}_{\pi}(s)\,\right].

Second, one can show that the value function satisfies a recurrence relation known as the Bellman equation, such that for s∈Ss \in \mathcal{S}, vπr(s)=Ea∼π(s),s′∼τ(s,a) ⁣[ r(s,a,s′)+γvπr(s′) ] v^{r}_{\pi}(s) = \mathbb{E}_{a\sim\pi(s), s'\sim\tau(s,a)}\!\left[\, r(s,a,s') + \gamma v^{r}_{\pi}(s') \,\right] (this is not hard to check by hand). Moreover, for a given reward–policy pair, the value function is the unique function satisfying this recurrence relation (this follows because, as an operator on the space of functions, the RHS is a contraction, and therefore its fixed point is unique). Many RL algorithms take advantage of the Bellman equation for finding (or approximating) optimal policies.

§§Occupancy measures and evaluation linearity

Another perspective on evaluation is that it display a certain amount of linear structure. To see this, let’s introduce a function encoding the expected number of times a given policy will enact a given transition when interacting with the environment.

Formally, fix a policy π∈Π\pi \in \Pi, and define the discounted transition occupancy measure, μπ:S×A×S→R≥0\mu_\pi : \mathcal{S}\times \mathcal{A}\times \mathcal{S}\to \mathbb{R}_{\geq 0} by μπ(s,a,s′)=Eπ ⁣[ ∑t=0∞γt[ ⁣[(st,at,st+1)=(s,a,s′)] ⁣] ] \mu_\pi(s,a,s') = \mathbb{E}_{\pi}\!\left[\, \sum_{t=0}^\infty \gamma^t [\![(s_t,a_t,s_{t+1})=(s,a,s')]\!] \,\right] where [ ⁣[⋅] ⁣][\![\cdot]\!] is an indicator function, here equal to 11 at timesteps where the particular transition is taken, or 00 otherwise. The non-negative number μπ(s,a,s′)\mu_\pi(s,a,s') counts the average number of occurrences of the transition (s,a,s′)(s,a,s') exhibited under the policy π\pi, with counts discounted according to their position in time.

By regrouping terms in the definition of the evaluation function, policy evaluation can be viewed as a policy-dependent linear functional in the chosen reward function. For r∈Rr \in \mathcal{R}, we see Jr(π)=∑s,a,s′μπ(s,a,s′)r(s,a,s′). \mathcal{J}^{r}(\pi) = \sum_{s,a,s'} \mu_\pi(s,a,s') r(s,a,s'). This representation makes explicit that, for a fixed policy, evaluation is linear in the reward function. Moreover, while neither the occupancy measure nor the evaluation function is generally linear in the policy, the evaluation function is linear in the occupancy measure.

§§Marginal occupancy measures and occupancy identities

The transition occupancy measure is one of a family of similar occupancy measures. We can define other occupancy distributions given parts of a transition by marginalisation. For any policy π\pi, define four marginal occupancy measures: μπ(s,a)=∑s′μπ(s,a,s′),μπ(s)=∑aμπ(s,a)=∑a∑s′μπ(s,a,s′),μπ(a,s′)=∑sμπ(s,a,s′),μπ(s′)=∑aμπ(a,s′)=∑s∑aμπ(s,a,s′).\begin{align*} \mathrlap{\rule[0.55em]{0.55em}{0em}}\mu_\pi(s,a) &= \sum_{s'}\mu_\pi(s,a,s'), &\qquad \mathrlap{\rule[0.68em]{0.55em}{0em}}\mathrlap{\rule[0.55em]{0.55em}{0em}}\mu_\pi(s) &= \sum_a\mathrlap{\rule[0.55em]{0.55em}{0em}}\mu_\pi(s,a) = \sum_a\sum_{s'}\mu_\pi(s,a,s'), \\ \mathrlap{\rule[-0.31em]{0.55em}{0em}}\mu_\pi(a,s') &= \sum_s \mu_\pi(s,a,s'), &\qquad \mathrlap{\rule[-0.44em]{0.55em}{0em}}\mathrlap{\rule[-0.31em]{0.55em}{0em}}\mu_\pi(s') &= \sum_a \mathrlap{\rule[-0.31em]{0.55em}{0em}}\mu_\pi(a,s') = \sum_s \sum_a \mu_\pi(s,a,s'). \end{align*} These functions have natural interpretations. It is easy to show that they could alternatively have been defined as follows: μπ(s,a)=Eπ ⁣[ ∑t=0∞γt[ ⁣[(st,at)=(s,a)] ⁣] ],μπ(s)=Eπ ⁣[ ∑t=0∞γt[ ⁣[st=s] ⁣] ],μπ(a,s′)=Eπ ⁣[ ∑t=0∞γt[ ⁣[(at,st+1)=(a,s′)] ⁣] ],μπ(s′)=Eπ ⁣[ ∑t=0∞γt[ ⁣[st+1=s′] ⁣] ].\begin{align*} \mathrlap{\rule[0.55em]{0.55em}{0em}}\mu_\pi(s,a) &= \mathbb{E}_{\pi}\!\left[\, \sum_{t=0}^\infty \gamma^t [\![(s_t,a_t)=(s,a)]\!] \,\right], & \mathrlap{\rule[0.68em]{0.55em}{0em}}\mathrlap{\rule[0.55em]{0.55em}{0em}}\mu_\pi(s) &= \mathbb{E}_{\pi}\!\left[\, \sum_{t=0}^\infty \gamma^t [\![s_t=s]\!] \,\right], \\ \mathrlap{\rule[-0.31em]{0.55em}{0em}}\mu_\pi(a,s') &= \mathbb{E}_{\pi}\!\left[\, \sum_{t=0}^\infty \gamma^t [\![(a_t,s_{t+1})=(a,s')]\!] \,\right], & \mathrlap{\rule[-0.44em]{0.55em}{0em}}\mathrlap{\rule[-0.31em]{0.55em}{0em}}\mu_\pi(s') &= \mathbb{E}_{\pi}\!\left[\, \sum_{t=0}^\infty \gamma^t [\![s_{t+1}=s']\!] \,\right]. \end{align*}

In other words,

The structure of the sampling process gives us the following factorisation identities: μπ(s,a,s′)=μπ(s,a)⋅τ(s′∣s,a),μπ(s,a)=μπ(s)⋅π(a∣s). \mu_\pi(s,a,s') = \mathrlap{\rule[0.55em]{0.55em}{0em}}\mu_{\pi}(s,a) \cdot \tau(s'\mid s,a), \qquad \mathrlap{\rule[0.55em]{0.55em}{0em}}\mu_ {\pi}(s, a) = \mathrlap{\rule[0.68em]{0.55em}{0em}}\mathrlap{\rule[0.55em]{0.55em}{0em}}\mu_ {\pi}(s) \cdot \pi(a\mid s).

Notice also that μπ(s)\mathrlap{\rule[0.68em]{0.55em}{0em}}\mathrlap{\rule[0.55em]{0.55em}{0em}}\mu_\pi(s) and μπ(s′)\mathrlap{\rule[-0.44em]{0.55em}{0em}}\mathrlap{\rule[-0.31em]{0.55em}{0em}}\mu_\pi(s') can be related as follows. Intuitively, for every transition that enters a state, there must be a transition that leaves it. The converse is true except at time step 00, where the initial state distribution decides the start state without a transition. Thus it is easy to show that we have the following flow identity: for s∈Ss \in \mathcal{S}, μπ(s)=ι(s)+γμπ(s). \mathrlap{\rule[0.68em]{0.55em}{0em}}\mathrlap{\rule[0.55em]{0.55em}{0em}}\mu_\pi(s) = \iota(s) + \gamma \mathrlap{\rule[-0.44em]{0.55em}{0em}}\mathrlap{\rule[-0.31em]{0.55em}{0em}}\mu_\pi(s).

§Some reward function transformations

Formally, a reward function transformation is a function on the space of reward functions T:R→RT : \mathcal{R}\to \mathcal{R}. In this section, we will define the three families of reward function transformations mentioned in the introduction:

§§Positive linear scaling

For each positive constant α∈R>0\alpha \in \mathbb{R}_{> 0}, define a positive linear scaling reward function transformation TPLSα:R→RT_{\text{PLS}}^\alpha : \mathcal{R}\to \mathcal{R} such that for r∈Rr \in \mathcal{R}, TPLSα(r)=αr. T_{\text{PLS}}^\alpha (r) = \alpha r. That’s function multiplication: (αr)(s,a,s′)=αr(s,a,s′)(\alpha r)(s,a,s') = \alpha r(s,a,s'). Denote by TPLS=(TPLSα)α∈R>0\mathcal{T}_{\text{PLS}}= (T_{\text{PLS}}^\alpha)_{\alpha \in \mathbb{R}_{>0}} the family of positive linear scaling transformations.

Intuitively, there’s not much to explain here. TPLSαT_{\text{PLS}}^\alpha simply corresponds to scaling all of the rewards dispensed to an agent by a constant scale factor α>0\alpha > 0.

In practice, if you have two reward functions r1,r2∈Rr_1, r_2 \in \mathcal{R}, how can you tell if there exists a positive linear scaling transformation that will transform r1r_1 into r2r_2? You just have to show that you can find a single positive α\alpha ratio between all of the rewards, handling the case of zero carefully. In particular, the following two conditions suffice:

  1. Equal support: for all s,a,s′s, a, s', r1(s,a,s′)=0 if and only if r2(s,a,s′)=0,r_1(s,a,s') = 0\text{ if and only if }r_2(s,a,s') = 0, and

  2. Constant ratio: there is a fixed scalar α∈R>0\alpha \in \mathbb{R}_{>0} such that for all s,a,s′s,a,s' where r1(s,a,s′)≠0r_1(s,a,s') \neq 0, α=r2(s,a,s′)r1(s,a,s′).\alpha = \frac{r_ 2(s,a,s')}{r_ 1(s,a,s')}.

It’s easy to show that these two conditions are equivalent to ∃α∈R>0\exists \alpha \in \mathbb{R}_{>0} such that r2=αr1r_2 = \alpha r_1, or, in other words, equivalent to ∃T∈TPLS\exists T \in \mathcal{T}_{\text{PLS}} such that r2=T(r1)r_2 = T(r_1).

§§Potential shaping

The next family of transformations is a family called potential shaping transformations, first studied by Ng, Harada, and Russell (1999). It takes a couple of extra steps to define.

We’ll start by defining a potential function to be any real function on the state space: φ:S→R\varphi : \mathcal{S}\to \mathbb{R}. We don’t place any restrictions on these functions (in this note’s infinite horizon discounted setting). Call the set of all potential functions Φ\Phi. Intuitively, a potential function is intended to encode some amount of desirability associated with being in each state.

Secondly, we’ll define an auxiliary reward function related to each potential function. Recall that we fixed a discount rate γ∈(0,1)\gamma \in (0,1). Given a potential function φ∈Φ\varphi \in \Phi, define a potential difference reward function ∂φ∈R\partial\varphi \in \mathcal{R} such that for s,a,s′s, a, s', ∂φ(s,a,s′)=γφ(s′)−φ(s).\partial\varphi(s, a, s') = \gamma \varphi(s') - \varphi(s).

Intuitively, this reward function rewards the agent based on changes in state potential as it moves through the reward space. For a moment, ignore discounting (pretend the discount rate is γ=1\gamma=1).1 Upon leaving state ss and entering state s′s', the agent gains reward φ(s′)\varphi(s') based on the potential associated to state s′s' and loses the potential-based reward φ(s)\varphi(s) associated to the previous state. If the agent moves around in a circle and returns to its starting point, the net reward it will receive is zero. The agent can only achieve positive reward by moving from states of low potential to states of high potential.

Before we move on to defining potential shaping transformations themselves, let’s dwell here for a moment and explore some properties of this kind of reward function.

Hopefully that gives a richer sense of potential difference rewards. We will now use them to actually define potential shaping transformations. Given, a potential function φ∈Φ\varphi \in \Phi, define the potential shaping reward function transformation TPSφ:R→RT_{\text{PS}}^\varphi : \mathcal{R}\to \mathcal{R} as the transformation that adds the corresponding potential difference reward function to its input reward function: TPSφ(r)=r+∂φ.T_{\text{PS}}^\varphi (r) = r + \partial\varphi. That’s function addition, so, spelled out, we have (TPSφ(r))(s,a,s′)=r(s,a,s′)+γφ(s′)−φ(s).(T_{\text{PS}}^\varphi(r))(s,a,s') = r(s,a,s') + \gamma \varphi(s') - \varphi(s). Denote by TPS=(TPSφ)φ∈Φ\mathcal{T}_{\text{PS}}= (T_{\text{PS}}^\varphi)_{\varphi \in \Phi} the family of potential shaping reward function transformations.

Intuitively, by adding the potential difference reward function to the reward signal, in addition to whatever reward signal was in play beforehand, the new reward function also dispenses rewards based on changes in state potential as the agent moves through the state space, as described above.

In practice, if you have two reward functions r1,r2∈Rr_1, r_2 \in \mathcal{R}, how can you tell if there exists a potential shaping transformation that will transform r1r_1 into r2r_2? If they do, we’d be able to recover the potential difference reward function as the difference in reward functions: for all s,a,s′s,a,s', r2(s,a,s′)−r1(s,a,s′)=γφ(s′)−φ(s). r_2(s,a,s') - r_1(s,a,s') = \gamma \varphi(s') - \varphi(s). In the finite-state case, the above specifies a linear system of equations in φ∈Φ\varphi \in \Phi where φ(s)\varphi(s) for each s∈Ss \in \mathcal{S} is an unknown. If this equation has a solution, it’s φ\varphi. Or else, the reward functions can’t be related by a potential shaping transformation.

§§Destination redistribution

Last but not least, we have the family of destination redistribution2 transformations introduced in Skalse et al. (2023). I’ll introduce a modified definition for the purposes of this note, which is not exactly equivalent, but seems to be substantially clearer and preserves the final result.3

First, let’s define another kind of auxiliary reward function. Recall that we fixed the environment’s transition distribution τ:S×A→Δ(S)\tau : \mathcal{S}\times \mathcal{A}\to \Delta(\mathcal{S}). With this in mind, say that a reward function ω∈R\omega \in \mathcal{R} is transition-orthogonal if for all s∈Ss \in \mathcal{S}, a∈Aa \in \mathcal{A}, Es′∼τ(s,a) ⁣[ ω(s,a,s′) ]=0. \mathbb{E}_{s' \sim \tau(s,a)}\!\left[\,\omega(s,a,s')\,\right] = 0. Denote by Ω⊆R\Omega \subseteq \mathcal{R} the set of all transition-orthogonal reward functions.

Intuitively, transition-orthogonal reward functions have to produce rewards that average out to zero over the potential destinations of a random transition starting from a fixed state via a fixed action.

I use the term “orthogonal” for this because the condition amounts to orthogonality of the probability distribution τ(⋅∣s,a)\tau(\cdot | s,a) and the restricted reward function ω(s,a,⋅)\omega(s,a,\cdot) viewed as vectors in R∣S∣\mathbb{R}^{|\mathcal{S}|}: 0=Es′∼τ(s,a) ⁣[ ω(s,a,s′) ]=∑s′∈Sτ(s′∣s,a)⋅ω(s,a,s′)=⟨τ(⋅∣s,a),ω(s,a,⋅)⟩ 0 = \mathbb{E}_{s' \sim \tau(s,a)}\!\left[\,\omega(s,a,s')\,\right] = \sum_{s' \in \mathcal{S}} \tau(s' | s,a) \cdot \omega(s,a,s') = \langle \tau(\cdot | s,a) , \omega(s,a,\cdot) \rangle for each fixed (s,a)(s, a) pair.

A useful basic property of transition-orthogonal reward functions is that they have zero value. That is, for any policy π∈Π\pi \in \Pi, the value function for a transition-orthogonal reward function ω∈Ω\omega \in \Omega is always zero. To see this, observe that 0:S→R0 : \mathcal{S}\to \mathbb{R} solves the Bellman recurrence: Ea∼π(s),s′∼τ(s,a) ⁣[ ω(s,a,s′)+γ0 ]=Ea∼π(s) ⁣[ Es′∼τ(s,a) ⁣[ ω(s,a,s′) ] ]=Ea∼π(s) ⁣[ 0 ]=0\begin{align*} \mathbb{E}_{a\sim\pi(s), s'\sim\tau(s,a)}\!\left[\, \omega(s,a,s') + \gamma 0 \,\right] &= \mathbb{E}_{a\sim\pi(s)}\!\left[\, \mathbb{E}_{s'\sim\tau(s,a)}\!\left[\, \omega(s,a,s') \,\right] \,\right] \\&= \mathbb{E}_{a\sim\pi(s)}\!\left[\, 0 \,\right] \\&= 0 \end{align*} for all s∈Ss \in \mathcal{S}. Recall that this recurrence has a unique solution that coincides with the value function, thus vπω=0v^{\omega}_{\pi} = 0.

Anyway, having defined this family of reward functions, we can define destination redistribution. Given a transition-orthogonal reward function ω∈Ω\omega \in \Omega, define the destination redistribution reward function transformation TDRω:R→RT_{\text{DR}}^\omega : \mathcal{R}\to \mathcal{R} as the transformation that adds ω\omega to its input reward function: TDRω(r)=r+ω. T_{\text{DR}}^\omega(r) = r + \omega. Once again, that’s function addition, so, spelled out, we have (TDRω(r))(s,a,s′)=r(s,a,s′)+ω(s,a,s′).(T_{\text{DR}}^\omega(r))(s,a,s') = r(s,a,s') + \omega(s,a,s'). Denote by TDR=(TDRω)ω∈Ω\mathcal{T}_{\text{DR}}= (T_{\text{DR}}^\omega)_{\omega \in \Omega} the family of destination redistribution reward function transformations.

Intuitively, by adding a transition-orthogonal reward function, destination redistribution can redistribute the immediate reward that the agent could expect to receive from taking a given action aa in a given state ss, such that the overall expected reward is preserved but the amount of reward given for different random destinations is changed. For example, if there is one rare destination and one common one, it could add a small amount of positive reward to the common transition if it adds a proportionally larger amount of negative reward to the rare transition—enough to make sure the average stays the same.

More formally, we can show that if r2=TDRω(r1)r_2 = T_{\text{DR}}^\omega(r_1) for some ω∈Ω\omega \in \Omega, then for all s,as, a, Es′∼τ(s,a) ⁣[ r2(s,a,s′) ]=Es′∼τ(s,a) ⁣[ r1(s,a,s′)+ω(s,a,s′) ]=Es′∼τ(s,a) ⁣[ r1(s,a,s′) ]+Es′∼τ(s,a) ⁣[ ω(s,a,s′) ]=Es′∼τ(s,a) ⁣[ r1(s,a,s′) ].\begin{align*} \mathbb{E}_{s' \sim \tau(s,a)}\!\left[\,r_2(s,a,s')\,\right] &= \mathbb{E}_{s' \sim \tau(s,a)}\!\left[\,r_1(s,a,s') + \omega(s,a,s')\,\right] \\ &= \mathbb{E}_{s' \sim \tau(s,a)}\!\left[\,r_1(s,a,s')\,\right] + \mathbb{E}_{s' \sim \tau(s,a)}\!\left[\,\omega(s,a,s')\,\right] \\ &= \mathbb{E}_{s' \sim \tau(s,a)}\!\left[\,r_1(s,a,s')\,\right] . \end{align*}

Conversely, suppose we have two reward functions r1,r2∈Rr_1, r_2 \in \mathcal{R} satisfying Es′∼τ(s,a) ⁣[ r2(s,a,s′) ]=Es′∼τ(s,a) ⁣[ r1(s,a,s′) ]. \mathbb{E}_{s' \sim \tau(s,a)}\!\left[\,r_2(s,a,s')\,\right] = \mathbb{E}_{s' \sim \tau(s,a)}\!\left[\,r_1(s,a,s')\,\right]. Then, observe that ω=r2−r1\omega = r_2 - r_1 is transition-orthogonal: for s,as, a, Es′∼τ(s,a) ⁣[ ω(s,a,s′) ]=Es′∼τ(s,a) ⁣[ r2(s,a,s′)−r1(s,a,s′) ]=Es′∼τ(s,a) ⁣[ r2(s,a,s′) ]−Es′∼τ(s,a) ⁣[ r1(s,a,s′) ]=0.\begin{align*} \mathbb{E}_{s' \sim \tau(s,a)}\!\left[\,\omega(s,a,s')\,\right] &= \mathbb{E}_{s' \sim \tau(s,a)}\!\left[\,r_2(s,a,s') - r_1(s,a,s')\,\right] \\ &= \mathbb{E}_{s' \sim \tau(s,a)}\!\left[\,r_2(s,a,s')\,\right] - \mathbb{E}_{s' \sim \tau(s,a)}\!\left[\,r_1(s,a,s')\,\right] \\ &= 0 . \end{align*} Now r2=r1+(r2−r1)=r1+ω=TDRω(r1)r_2 = r_1 + (r_2 - r_1) = r_1 + \omega = T_{\text{DR}}^\omega(r_1), in other words, we can reach r2r_2 from r1r_1 via the destination redistribution TDRr2−r1T_{\text{DR}}^{r_2-r_1}.

§Transformation groups

Let’s explore how reward function transformations from these families behave under composition. We’ll do so using the framework of group theory.

§§Group structure via homomorphism

First, let’s show that each of the transformation families is an abelian group under composition. This means that each family behaves as follows:

  1. Composition: for any two transformations contained in the family, their composition is also contained in the family.
  2. Identity: the identity transformation id:R→R\text{id}: \mathcal{R}\to \mathcal{R} is contained in the family.
  3. Inverses: each transformation contained in the family is an invertible function and its inverse transformation is also contained in the family.
  4. Commutativity: for any two transformations contained in the family, composition is commutative.

Fortunately, these properties are well known to hold for the groups we used as indexing sets for defining the function families, with composition replaced by the appropriate binary operation:

If we can show that the indexing map for each family is consistent with these underlying group operations, we can automatically conclude that the families have similar group structure: the families are homomorphic to their indexing sets. Let us proceed:

  1. Positive linear scaling and positive reals: The indexing map is h:R>0→TPLSh : \mathbb{R}_{>0} \to \mathcal{T}_{\text{PLS}}, h(α)=TPLSαh(\alpha) = T_{\text{PLS}}^\alpha. We can easily show that this map is consistent. Let α,β∈R>0\alpha, \beta \in \mathbb{R}_{>0}. For r∈Rr \in \mathcal{R}, (h(α)∘h(β))(r)=(TPLSα∘TPLSβ)(r)=TPLSα(TPLSβ(r))=αβr=TPLSαβ(r)=(h(αβ))(r).\begin{align*} \bigl( h(\alpha) \circ h(\beta) \bigr) (r) &= \bigl(T_{\text{PLS}}^\alpha \circ T_{\text{PLS}}^\beta\bigr) (r) \\ &= T_{\text{PLS}}^\alpha (T_{\text{PLS}}^\beta (r)) \\ &= \alpha \beta r \\ &= T_{\text{PLS}}^{\alpha \beta} (r) = \bigl(h(\alpha\beta)\bigr) (r) .\end{align*} Thus h(α)∘h(β)=h(αβ)h(\alpha) \circ h(\beta) = h(\alpha \beta).

  2. Potential shaping and potential functions: The indexing map is h:Φ→TPSh : \Phi \to \mathcal{T}_{\text{PS}}, h(φ)=TPSφh(\varphi) = T_{\text{PS}}^\varphi. We can easily show that this map is consistent. Let φ,ψ∈Φ\varphi, \psi \in \Phi. For r∈Rr \in \mathcal{R}, (h(φ)∘h(ψ))(r)=(TPSφ∘TPSψ)(r)=TPSφ(TPSψ(r))=r+∂ψ+∂φ=r+∂(φ+ψ)=TPSφ+ψ(r)=(h(φ+ψ))(r).\begin{align*} \bigl( h(\varphi) \circ h(\psi) \bigr) (r) &= \bigl(T_{\text{PS}}^\varphi \circ T_{\text{PS}}^\psi\bigr) (r) \\ &= T_{\text{PS}}^\varphi (T_{\text{PS}}^\psi (r)) \\ &= r + \partial\psi + \partial\varphi \\ &= r + \partial(\varphi + \psi) \tag{exercise} \\ &= T_{\text{PS}}^{\varphi + \psi} (r) = \bigl(h(\varphi + \psi)\bigr) (r) .\end{align*} Thus h(φ)∘h(ψ)=h(φ+ψ)h(\varphi) \circ h(\psi) = h(\varphi + \psi).

  3. Destination redistribution and transition-orthogonal reward functions: The indexing map is h:Ω→TDRh : \Omega \to \mathcal{T}_{\text{DR}}, h(ω)=TDRωh(\omega) = T_{\text{DR}}^\omega. We can easily show that this map is consistent. Let ω,ο∈Ω\omega, \omicron \in \Omega. For r∈Rr \in \mathcal{R}, (h(ω)∘h(ο))(r)=(TDRω∘TDRο)(r)=TDRω(TDRο(r))=r+ο+ω=r+ω+ο=TDRω+ο(r)=(h(ω+ο))(r).\begin{align*} \bigl( h(\omega) \circ h(\omicron) \bigr) (r) &= \bigl(T_{\text{DR}}^\omega \circ T_{\text{DR}}^\omicron\bigr) (r) \\ &= T_{\text{DR}}^\omega (T_{\text{DR}}^\omicron (r)) \\ &= r + \omicron + \omega \\ &= r + \omega + \omicron \\ &= T_{\text{DR}}^{\omega + \omicron} (r) = \bigl(h(\omega + \omicron)\bigr) (r) .\end{align*} Thus h(ω)∘h(ο)=h(ω+ο)h(\omega) \circ h(\omicron) = h(\omega + \omicron).

It follows that each family is an abelian group:

§§Invertible indexing via isomorphism

The above homomorphism tells us a lot about how the group structure of the indexing groups is reflected in the structure of the transformation families. However, so far it’s a one-way reflection: we haven’t shown that each of the transformations corresponds to a unique index. Let’s fix this by showing that these indexing maps are injective. This gives us the stronger result that the transformation families are isomorphic to their indexing groups, meaning composition and the multiplication or addition operation in the underlying group are identical.

Given that we have a group homomorphism hh, to establish these isomorphisms it suffices to show that if h(x)=idh(x) = \text{id} for some index xx, then xx is the identity in the indexing group. This is easily done:

  1. For positive linear scaling, take α∈R>0\alpha \in \mathbb{R}_{>0} such that h(α)=idh(\alpha) = \text{id}. Evaluating both sides on the constant reward function 1∈R1 \in \mathcal{R} gives 1=id(1)=h(α)(1)=TPLSα(1)=α1.1 = \text{id}(1) = h(\alpha)(1) = T_{\text{PLS}}^\alpha(1) = \alpha 1. It follows that α=1∈R>0\alpha = 1 \in \mathbb{R}_{>0}.

  2. For potential shaping, take φ∈Φ\varphi \in \Phi such that h(φ)=idh(\varphi) = \text{id}. Evaluating both sides on the null reward function 0∈R0 \in \mathcal{R} gives 0=id(0)=h(φ)(0)=TPSφ(0)=0+∂φ=∂φ.0 = \text{id}(0) = h(\varphi)(0) = T_{\text{PS}}^\varphi(0) = 0 + \partial\varphi = \partial\varphi. ∂φ=0\partial\varphi = 0 implies in particular for each ss and any aa, 0=∂φ(s,a,s)=γφ(s)−φ(s)=(γ−1)φ(s).0 = \partial\varphi(s,a,s) = \gamma \varphi(s) - \varphi(s) = (\gamma - 1) \varphi(s). Since γ∈(0,1)\gamma \in (0,1), γ−1≠0\gamma-1 \neq 0, and we conclude φ=0∈Φ\varphi = 0 \in \Phi.

  3. For destination redistribution, take ω∈Ω\omega \in \Omega such that h(ω)=idh(\omega) = \text{id}. Evaluating both sides on the null reward function 0∈R0 \in \mathcal{R} gives 0=id(0)=h(ω)(0)=TDRω(0)=0+ω=ω.0 = \text{id}(0) = h(\omega)(0) = T_{\text{DR}}^\omega(0) = 0 + \omega = \omega. Thus ω=0∈Ω\omega = 0 \in \Omega.

In particular, this means that each transformation has a unique index within its family. For example, for each potential shaping transformation, there is a unique potential function to which it corresponds.

§§Commutation identities for the join

What if we compose transformations from different families? Define the joined family TPLS∨TPS∨TDR=⟨TPLS∪TPS∪TDR⟩\mathcal{T}_{\text{PLS}}\vee \mathcal{T}_{\text{PS}}\vee \mathcal{T}_{\text{DR}} = \langle \mathcal{T}_{\text{PLS}}\cup \mathcal{T}_{\text{PS}}\cup \mathcal{T}_{\text{DR}}\rangle as the group generated by the union of the families. This corresponds to the set of all transformations that can be formed as finite compositions of transformations from any of the families.

It turns out the resulting group isn’t abelian, but there is a simple set of commutation identities that allows us to exchange transformations of each family. We already know that transformations from the same family will commute freely. The same is actually true for potential shaping and destination redistribution:

For the remaining two possible combinations, we can define a commutative identity:

§§Normal form via simplification uniqueness

Using the above identities, it is possible to dramatically simplify an arbitrary finite composition of reward function transformations from any of the families.

  1. First, we can apply the identities to rearrange the sequence so that all of the positive linear scaling transformations happen first (say), followed by all of the potential shaping transformations, followed by all of the destination redistribution transformations.

  2. From there, since the individual groups are closed under composition, we can simplify the three segments of the sorted sequence of transformations to one transformation each.

So, any finite composition can be achieved with just a single ordered trio of transformations indexed by a triple (α,φ,ω)∈R>0×Φ×Ω(\alpha, \varphi, \omega) \in \mathbb{R}_{>0} \times \Phi \times \Omega. To close this section, let’s prove that such simplifications are unique, making this a normal form for reward function transformations in the joined family.

It suffices to show that any trio of transformations that equals the identity must be a trio of identity transformations: TDRω∘TPSφ∘TPLSα=id⟹ω=0, φ=0, α=1. T_{\text{DR}}^\omega \circ T_{\text{PS}}^\varphi \circ T_{\text{PLS}}^\alpha = \text{id} \Longrightarrow \omega = 0,\ \varphi=0,\ \alpha=1.

So, then, suppose (α,φ,ω)∈R>0×Φ×Ω(\alpha, \varphi, \omega) \in \mathbb{R}_{>0} \times \Phi \times \Omega such that TDRω∘TPSφ∘TPLSα=idT_{\text{DR}}^\omega \circ T_{\text{PS}}^\varphi \circ T_{\text{PLS}}^\alpha = \text{id}. In other words, for r∈Rr \in \mathcal{R}, (TDRω∘TPSφ∘TPLSα)(r)=id(r)(T_{\text{DR}}^\omega \circ T_{\text{PS}}^\varphi \circ T_{\text{PLS}}^\alpha)(r) = \text{id}(r). That is, αr+∂φ+ω=r.(∗) \alpha r + \partial\varphi + \omega = r. \tag{$\ast$} In particular this identity holds at r=0r = 0, giving us ∂φ+ω=0.(†) \partial\varphi + \omega = 0. \tag{$\dagger$} It follows from (∗\ast) and (†\dagger) that αr=r\alpha r = r, which implies α=1\alpha = 1. Moreover, from (†\dagger) we have that ω=−∂φ\omega = -\partial\varphi. This is an identity of two reward functions. Fixing an arbitrary policy π∈Π\pi \in \Pi, we can take the value functions of both sides to get vπω=−vπ∂φ(‡) v^{\omega}_{\pi} = -v^{\partial\varphi}_{\pi} \tag{$\ddagger$} where we have used linearity of expectation to extract the negation. Recall that earlier, we showed that for a potential difference reward function ∂φ\partial\varphi, the value function is vπ∂φ=−φv^{\partial\varphi}_{\pi} = -\varphi. On the other hand, for transition-orthogonal reward functions, vπω=0v^{\omega}_{\pi} = 0. Using these two identities together with (‡\ddagger), we conclude that φ=0\varphi = 0. It follows that ∂φ=0\partial\varphi = 0, and then by (†\dagger), we conclude that ω=0\omega = 0, as required.

§Some invariances of reinforcement learning

An invariance of the policy preorder is a reward function transformation T:R→RT : \mathcal{R}\to \mathcal{R} that doesn’t change the policy preorder—for all r∈Rr \in \mathcal{R}, ⪯r≡⪯T(r). {\preceq_r} \equiv {\preceq_{T(r)}}.

In this section, I show that transformations from the three families we have studied in this note are invariances of the policy preorder. This also means that any compositions of these transformations are invariances. In turn, any reward function that can be reached from some fixed starting reward function rr using these transformations has the same policy preorder as rr.

§§Invariance to positive linear scaling

First, we’ll show that the policy preorder is invariant to positive linear scaling transformations. This is quite straightforward since the evaluation function itself is linear in the reward.

Let α∈R>0\alpha \in \mathbb{R}_{>0}. Then for π∈Π\pi \in \Pi we have JTPLSα(r)(π)=Jαr(π)=αJr(π). \mathcal{J}^{T_{\text{PLS}}^\alpha (r)}(\pi) = \mathcal{J}^{\alpha r}(\pi) = \alpha \mathcal{J}^{r}(\pi). Thus, JTPLSα(r)=αJr\mathcal{J}^{T_{\text{PLS}}^\alpha(r)} = \alpha\mathcal{J}^{r}. Scaling Jr\mathcal{J}^{r} by a positive factor changes the evaluation function, but preserves all ordinal comparisons between policies, so we conclude ⪯r≡⪯TPLSα(r).{\preceq_r} \equiv {\preceq_{T_{\text{PLS}}^\alpha(r)}}.

§§Invariance to potential shaping

Next, we’ll show that the policy preorder is invariant to potential shaping transformations. Again, we use the linearity of the evaluation function in the reward.

Let φ∈Φ\varphi \in \Phi. Then for π∈Π\pi \in \Pi we have JTPSφ(r)(π)=Jr+∂φ(π)=Jr(π)+J∂φ(π).=Jr(π)+Es∼ι ⁣[ vπ∂φ(s) ]=Jr(π)+Es∼ι ⁣[ −φ(s) ].\begin{align*} \mathcal{J}^{T_{\text{PS}}^\varphi (r)}(\pi) &= \mathcal{J}^{r+\partial\varphi}(\pi) \\&= \mathcal{J}^{r}(\pi) + \mathcal{J}^{\partial\varphi}(\pi). \\&= \mathcal{J}^{r}(\pi) + \mathbb{E}_{s\sim\iota}\!\left[\,v^{\partial\varphi}_{\pi}(s)\,\right] \\&= \mathcal{J}^{r}(\pi) + \mathbb{E}_{s\sim\iota}\!\left[\,-\varphi(s)\,\right]. \end{align*} Thus, JTPSφ(r)=Jr+Es∼ι ⁣[ −φ(s) ]\mathcal{J}^{T_{\text{PS}}^\varphi(r)} = \mathcal{J}^{r} + \mathbb{E}_{s\sim\iota}\!\left[\,-\varphi(s)\,\right].

Note that Es∼ι ⁣[ −φ(s) ]\mathbb{E}_{s\sim\iota}\!\left[\,-\varphi(s)\,\right] is constant with respect to the policy. Thus, while potential shaping changes the evaluation function, it merely adds a constant, which again preserves all ordinal comparisons between policies. We conclude ⪯r≡⪯TPSφ(r).{\preceq_r} \equiv {\preceq_{T_{\text{PS}}^\varphi(r)}}.

§§Invariance to destination redistribution

Finally, we’ll show that the policy preorder is invariant to destination redistribution transformations. Once more we use linearity of the evaluation function in the reward.

Let ω∈Ω\omega \in \Omega. Then for π∈Π\pi \in \Pi we have JTDRω(r)(π)=Jr+ω(π)=Jr(π)+Jω(π).=Jr(π)+Es∼ι ⁣[ vπω(s) ]=Jr(π)+Es∼ι ⁣[ 0 ]=Jr(π).\begin{align*} \mathcal{J}^{T_{\text{DR}}^\omega (r)}(\pi) &= \mathcal{J}^{r+\omega}(\pi) \\&= \mathcal{J}^{r}(\pi) + \mathcal{J}^{\omega}(\pi). \\&= \mathcal{J}^{r}(\pi) + \mathbb{E}_{s\sim\iota}\!\left[\,v^{\omega}_{\pi}(s)\,\right] \\&= \mathcal{J}^{r}(\pi) + \mathbb{E}_{s\sim\iota}\!\left[\,0\,\right] \\&= \mathcal{J}^{r}(\pi). \end{align*} Thus, JTDRω(r)=Jr\mathcal{J}^{T_{\text{DR}}^\omega(r)} = \mathcal{J}^{r}.

In other words, destination redistribution doesn’t even change the policy evaluation function. We immediately conclude ⪯r≡⪯TDRω(r).{\preceq_r} \equiv {\preceq_{T_{\text{DR}}^\omega(r)}}.

§All invariances of reinforcement learning

To close this note, let’s explore a kind of converse result. For this section, we assume that our fixed MDP has no unreachable states (that is, we assume that all states have positive occupancy under some policy).4

Then, if a pair of reward functions r1,r2r_1, r_2 shares a policy preorder, then it is possible to reach r2r_2 from r1r_1 via some sequence of transformations from our three families. In light of our normal form result, this means that there is some α∈R>0\alpha \in \mathbb{R}_{>0}, φ∈Φ\varphi \in \Phi, ω∈Ω\omega \in \Omega such that r2=αr1+∂φ+ω. r_2 = \alpha r_1 + \partial\varphi + \omega.

This tells us that any invariance of the policy preorder can be described as a member of our joined family, or a pointwise selection of these transformations.

This result needs a more involved proof, but we can break it down into a sequence of interesting steps.

§§Policies achieve all intermediate evaluations

First, we will show that for any two policies π1,π2∈Π\pi_1, \pi_2 \in \Pi, and any interpolation parameter λ∈[0,1]\lambda \in [0,1], there exists a policy πλ∈Π\pi_\lambda \in \Pi that, for all reward functions r∈Rr \in \mathcal{R}, achieves an evaluation of exactly Jr(πλ)=(1−λ)Jr(π1)+λJr(π2). \mathcal{J}^{r}(\pi_\lambda) = (1-\lambda) \mathcal{J}^{r}(\pi_1) + \lambda \mathcal{J}^{r}(\pi_2). Note that the one policy π\pi is supposed to interpolate evaluation for all reward functions, and this result is supposed to hold despite policy evaluation not generally being linear in the choice of policy.

We’ll show this as a consequence of the linearity of evaluation in the transition occupancy measure induced by the input policies. In fact, all we need to prove is that the range of the map from policies to transition occupancy measures is convex: for any policies π1,π2∈Π\pi_1, \pi_2 \in \Pi and interpolation parameter λ∈[0,1]\lambda \in [0,1], we can find a policy πλ∈Π\pi_\lambda \in \Pi such that μπλ=(1−λ)μπ1+λμπ2. \mu_{\pi_\lambda} = (1-\lambda) \mu_{\pi_1} + \lambda \mu_{\pi_2}. The main result then follows using the same πλ\pi_\lambda, because for any r∈Rr \in \mathcal{R}, Jr\mathcal{J}^{r} is linear in the induced occupancy measure.

Without further ado, then, fixing π1\pi_1, π2\pi_2, and λ\lambda, we must construct a policy πλ∈Π\pi_\lambda \in \Pi with the target transition occupancy measure μ=(1−λ)μπ1+λμπ2.\mu = (1-\lambda)\mu_{\pi_1}+\lambda\mu_{\pi_2}. Note that we don’t yet know that this μ\mu is an occupancy measure for any policy. However, the definitions and identities of marginal occupancy measures are linear, so we can coherently define μ=(1−λ)μπ1+λμπ2\mathrlap{\rule[0.55em]{0.55em}{0em}}\mu = (1-\lambda) \mathrlap{\rule[0.55em]{0.55em}{0em}}\mu_{\pi_1} + \lambda \mathrlap{\rule[0.55em]{0.55em}{0em}}\mu_{\pi_2}, and similarly for μ\mathrlap{\rule[0.68em]{0.55em}{0em}}\mathrlap{\rule[0.55em]{0.55em}{0em}}\mu and μ\mathrlap{\rule[-0.44em]{0.55em}{0em}}\mathrlap{\rule[-0.31em]{0.55em}{0em}}\mu. Then, we can interpolate the first factorisation identities and the flow identities from μπ1\mu_{\pi_1} and μπ2\mu_{\pi_2} to obtain equivalent identities for our target μ\mu: μ(s,a,s′)=μ(s,a)⋅τ(s′∣s,a),μ(s)=ι(s)+γμ(s). \mu(s,a,s') = \mathrlap{\rule[0.55em]{0.55em}{0em}}\mu(s,a) \cdot \tau(s'\mid s,a), \qquad \mathrlap{\rule[0.68em]{0.55em}{0em}}\mathrlap{\rule[0.55em]{0.55em}{0em}}\mu(s) = \iota(s) + \gamma\mathrlap{\rule[-0.44em]{0.55em}{0em}}\mathrlap{\rule[-0.31em]{0.55em}{0em}}\mu(s).

The second factorisation identities involve the policy, so we can’t interpolate those ones. However, they do inspire us to try putting πλ(a∣s)=μ(s,a)μ(s)=(1−λ)μπ1(s,a)+λμπ2(s,a)(1−λ)μπ1(s)+λμπ2(s) \pi_\lambda(a | s) = \frac{\mathrlap{\rule[0.55em]{0.55em}{0em}}\mu(s,a)}{\mathrlap{\rule[0.68em]{0.55em}{0em}}\mathrlap{\rule[0.55em]{0.55em}{0em}}\mu(s)} = \frac{ (1-\lambda) \mathrlap{\rule[0.55em]{0.55em}{0em}}\mu_{\pi_1}(s,a) + \lambda \mathrlap{\rule[0.55em]{0.55em}{0em}}\mu_{\pi_2}(s,a) }{ (1-\lambda) \mathrlap{\rule[0.68em]{0.55em}{0em}}\mathrlap{\rule[0.55em]{0.55em}{0em}}\mu_{\pi_1}(s) + \lambda \mathrlap{\rule[0.68em]{0.55em}{0em}}\mathrlap{\rule[0.55em]{0.55em}{0em}}\mu_{\pi_2}(s) } for all a∈Aa \in \mathcal{A} for those s∈Ss \in \mathcal{S} such that μ(s)>0\mathrlap{\rule[0.68em]{0.55em}{0em}}\mathrlap{\rule[0.55em]{0.55em}{0em}}\mu(s)>0 (where μ(s)=0\mathrlap{\rule[0.68em]{0.55em}{0em}}\mathrlap{\rule[0.55em]{0.55em}{0em}}\mu(s)=0, choose any action distribution). This gives us the desired factorisation identity μ(s,a)=μ(s)πλ(a∣s)\mathrlap{\rule[0.55em]{0.55em}{0em}}\mu(s,a) = \mathrlap{\rule[0.68em]{0.55em}{0em}}\mathrlap{\rule[0.55em]{0.55em}{0em}}\mu(s) \pi_\lambda(a | s) by construction (exercise in the case μ(s)=0\mathrlap{\rule[0.68em]{0.55em}{0em}}\mathrlap{\rule[0.55em]{0.55em}{0em}}\mu(s)=0). It is also easy to check that πλ∈Π\pi_\lambda \in \Pi (exercise).

It only remains to show that μπλ=μ\mu_{\pi_\lambda} = \mu, where on the LHS here we mean the occupancy measure defined directly from πλ\pi_\lambda. This occupancy measure has its own marginals satisfying their own factorisation and flow identities, from which we derive the equation μπλ(s,a,s′)=(ι(s)+γμπλ(s))⋅πλ(a∣s)⋅τ(s′∣s,a).(∗) \mu_{\pi_\lambda}(s,a,s') = (\iota(s)+\gamma\mathrlap{\rule[-0.44em]{0.55em}{0em}}\mathrlap{\rule[-0.31em]{0.55em}{0em}}\mu_{\pi_\lambda}(s)) \cdot \pi_\lambda(a\mid s) \cdot \tau(s'\mid s,a). \tag{$\ast$} On the other hand, the factorisation and flow identities we constructed for our target interpolated occupancy measure μ\mu give us a similar equation μ(s,a,s′)=(ι(s)+γμ(s))⋅πλ(a∣s)⋅τ(s′∣s,a).(†) \mu(s,a,s') = (\iota(s)+\gamma\mathrlap{\rule[-0.44em]{0.55em}{0em}}\mathrlap{\rule[-0.31em]{0.55em}{0em}}\mu(s)) \cdot \pi_\lambda(a\mid s) \cdot \tau(s'\mid s,a). \tag{$\dagger$}

The only difference between (∗\ast) and (†\dagger) is the occupancy measure. We’ll show that this system of equations has a unique solution, so the two occupancy measures must coincide. Subtracting (∗)−(†)(\ast) - (\dagger) gives us, for each s,a,s′s,a,s', μπλ(s,a,s′)−μ(s,a,s′)=γ⋅(μπλ(s)−μ(s))⋅πλ(a∣s)⋅τ(s′∣s,a). \mu_{\pi_\lambda}(s,a,s') - \mu(s,a,s') = \gamma \cdot (\mathrlap{\rule[-0.44em]{0.55em}{0em}}\mathrlap{\rule[-0.31em]{0.55em}{0em}}\mu_{\pi_\lambda}(s) - \mathrlap{\rule[-0.44em]{0.55em}{0em}}\mathrlap{\rule[-0.31em]{0.55em}{0em}}\mu(s)) \cdot \pi_\lambda(a\mid s) \cdot \tau(s'\mid s,a). Since γ\gamma, πλ\pi_\lambda, and τ\tau are non-negative, taking absolute values gives us ∣μπλ(s,a,s′)−μ(s,a,s′)∣=γ⋅∣μπλ(s)−μ(s)∣⋅πλ(a∣s)⋅τ(s′∣s,a). \left|\mu_{\pi_\lambda}(s,a,s') - \mu(s,a,s')\right| = \gamma \cdot \left|\mathrlap{\rule[-0.44em]{0.55em}{0em}}\mathrlap{\rule[-0.31em]{0.55em}{0em}}\mu_{\pi_\lambda}(s) - \mathrlap{\rule[-0.44em]{0.55em}{0em}}\mathrlap{\rule[-0.31em]{0.55em}{0em}}\mu(s)\right| \cdot \pi_\lambda(a\mid s) \cdot \tau(s'\mid s,a).

The above identities hold for all transitions s,a,s′s,a,s'. If we sum over transitions we can unify the probability terms and ∑s,a,s′∣μπλ(s,a,s′)−μ(s,a,s′)∣=γ∑s∣μπλ(s)−μ(s)∣∑aπλ(a∣s)∑s′τ(s′∣s,a)=γ∑s∣μπλ(s)−μ(s)∣=γ∑s′∣μπλ(s′)−μ(s′)∣=γ∑s′∣∑s∑a(μπλ(s,a,s′)−μ(s,a,s′))∣≤γ∑s,a,s′∣μπλ(s,a,s′)−μ(s,a,s′)∣.\begin{align*} &\hspace{-2em} \sum_{s,a,s'}\left|\mu_{\pi_\lambda}(s,a,s') - \mu(s,a,s')\right| \\ &= \gamma \sum_s \left|\mathrlap{\rule[-0.44em]{0.55em}{0em}}\mathrlap{\rule[-0.31em]{0.55em}{0em}}\mu_{\pi_\lambda}(s) - \mathrlap{\rule[-0.44em]{0.55em}{0em}}\mathrlap{\rule[-0.31em]{0.55em}{0em}}\mu(s)\right| \sum_a \pi_\lambda(a\mid s) \sum_{s'} \tau(s'\mid s,a) \\ &= \gamma \sum_s \left|\mathrlap{\rule[-0.44em]{0.55em}{0em}}\mathrlap{\rule[-0.31em]{0.55em}{0em}}\mu_{\pi_\lambda}(s) - \mathrlap{\rule[-0.44em]{0.55em}{0em}}\mathrlap{\rule[-0.31em]{0.55em}{0em}}\mu(s)\right| \tag{$\tau,\pi_{\lambda}$ probabilities} \\ &= \gamma \sum_{s'} \left|\mathrlap{\rule[-0.44em]{0.55em}{0em}}\mathrlap{\rule[-0.31em]{0.55em}{0em}}\mu_{\pi_\lambda}(s') - \mathrlap{\rule[-0.44em]{0.55em}{0em}}\mathrlap{\rule[-0.31em]{0.55em}{0em}}\mu(s')\right| \tag{rename $s$ to $s'$} \\ &= \gamma \sum_{s'} \left| \sum_s \sum_a (\mu_{\pi_\lambda}(s,a,s') - \mu(s,a,s'))\right| \tag{expand $\mathrlap{\rule[-0.44em]{0.55em}{0em}}\mathrlap{\rule[-0.31em]{0.55em}{0em}}\mu_{\pi_\lambda}$ and $\mathrlap{\rule[-0.44em]{0.55em}{0em}}\mathrlap{\rule[-0.31em]{0.55em}{0em}}\mu$} \\ &\leq \gamma \sum_{s,a,s'} \left| \mu_{\pi_\lambda}(s,a,s') - \mu(s,a,s')\right|. \tag{triangle inequality} \end{align*}

Since γ<1\gamma<1, this sum of absolute differences between the entries of μπλ\mu_{\pi_\lambda} and of μ\mu must be zero. Thus μπλ=μ\mu_{\pi_\lambda} = \mu, as required.

§§Preserving the preorder implies positive affine evaluation change

Next, we’ll prove another intermediate result. We previously showed that our reward function transformations are invariances because their effect was to positively rescale the evaluation function or shift it by a constant, preserving the policy preorder. It turns out that any reward transformation that preserves the policy preorder must only induce a similar (positive affine) change in the evaluation function.

Formally, let r1,r2∈Rr_1, r_2 \in \mathcal{R}. Abbreviate J1=Jr1J_1 = \mathcal{J}^{r_1} and J2=Jr2J_2 = \mathcal{J}^{r_2}. Then, the claim is that ⪯r2≡⪯r1{\preceq_{r_2}} \equiv {\preceq_{r_1}} implies J2=aJ1+bJ_2 = a J_1 + b for some a∈R>0a \in \mathbb{R}_{>0} and b∈Rb \in \mathbb{R}.

To show this, define a best policy π+\pi_{+} and a worst policy π−\pi_{-} by π+∈arg max⁡π∈ΠJ1(π),π−∈arg min⁡π∈ΠJ1(π). \pi_{+} \in \argmax_{\pi\in\Pi}J_1(\pi), \qquad \pi_{-} \in \argmin_{\pi\in\Pi}J_1(\pi). Such extremal policies exist because policy space is compact and evaluation is continuous. Due to the shared policy preorder, these policies are also extremal for J2J_2.

In case the evaluations of the best and worst policies are equal, it must be that J1J_1 is constant. Since J2J_2 has the same preorder, it must also be constant. Then, set b=J2(π+)−J1(π+),a=1. b = J_2(\pi_{+}) - J_1(\pi_{+}), \qquad a = 1.

Otherwise, J1(π+)>J1(π−)J_1(\pi_{+}) > J_1(\pi_{-}) (and J2(π+)>J2(π−)J_2(\pi_{+}) > J_2(\pi_{-})). Let π∈Π\pi \in \Pi. Its evaluation lies somewhere between those of the worst and best policies. Let λ∈[0,1]\lambda \in [0,1] be the interpolation constant such that J1(π)=(1−λ)J1(π−)+λJ1(π+).(∗) J_1(\pi) = (1-\lambda) J_1(\pi_{-}) + \lambda J_1(\pi_{+}). \tag{$\ast$} By our previous interpolation result, there exists a policy π′∈Π\pi' \in \Pi achieving this same interpolation of the worst and best policies under all reward functions, including in particular r1r_1 and r2r_2: J1(π′)=(1−λ)J1(π−)+λJ1(π+),J2(π′)=(1−λ)J2(π−)+λJ2(π+).\begin{align*} J_1(\pi') &= (1-\lambda)J_1(\pi_{-}) + \lambda J_1(\pi_{+}), \tag{$\dagger$} \\ J_2(\pi') &= (1-\lambda)J_2(\pi_{-}) + \lambda J_2(\pi_{+}). \tag{$\ddagger$} \end{align*} By (∗\ast) and (†\dagger), we have J1(π)=J1(π′)J_1(\pi) = J_1(\pi'), an evaluation tie under r1r_1. Since r2r_2 induces the same policy preorder, the same must be true under r2r_2, that is, J2(π)=J2(π′)J_2(\pi) = J_2(\pi'). By (‡\ddagger) we then conclude J2(π)=(1−λ)J2(π−)+λJ2(π+).(⋆) J_2(\pi) = (1-\lambda)J_2(\pi_{-}) + \lambda J_2(\pi_{+}). \tag{$\star$} In other words, the evaluation of π\pi occupies the same relative position between that of the worst and best policies under r2r_2 as it did under r1r_1. We can rearrange (∗\ast) and (⋆\star) to eliminate λ\lambda and solve for J2(π)J_2(\pi) in terms of J1(π)J_1(\pi) in order to identify the appropriate positive affine transformation, resulting in: a=J2(π+)−J2(π−)J1(π+)−J1(π−),b=J2(π−)−aJ1(π−). a = \frac{J_2(\pi_{+}) - J_2(\pi_{-})}{J_1(\pi_{+}) - J_1(\pi_{-})}, \qquad b = J_2(\pi_{-}) - a J_1(\pi_{-}).

§§Positive affine evaluation change implies a joint transformation

We conclude that ⪯r2≡⪯r1{\preceq_{r_2}} \equiv {\preceq_{r_1}} implies Jr2=aJr1+b\mathcal{J}^{r_2} = a \mathcal{J}^{r_1} + b for some a∈R>0a \in \mathbb{R}_{> 0}, b∈Rb \in \mathbb{R}. Finally, in this section, we show that if all states are reachable, then Jr2=aJr1+b\mathcal{J}^{r_2} = a \mathcal{J}^{r_1} + b implies we can find α∈R>0\alpha \in \mathbb{R}_{>0}, φ∈Φ\varphi \in \Phi, and ω∈Ω\omega \in \Omega such that r2=αr1+∂φ+ωr_2 = \alpha r_1 + \partial\varphi + \omega.

Let’s try the following construction. Let π~∈Π\tilde\pi \in \Pi be the uniform policy, and then set α=a∈R>0,φ=−vπ~r2−αr1∈Φω=r2−αr1−∂φ∈R.\begin{align*} \alpha &= a \in \mathbb{R}_{>0}, &&& \varphi &= -v^{r_2-\alpha r_1}_{\tilde\pi} \in \Phi &&& \omega &= r_2 - \alpha r_1 - \partial\varphi \in \mathcal{R}. \end{align*} Note that r2=αr1+∂φ+ωr_2 = \alpha r_1 + \partial\varphi + \omega by construction. Thus, it only remains to show transition-orthogonality of r2−αr1−∂φr_2 - \alpha r_1 - \partial\varphi (which we have called ω\omega in anticipation of this property). That is, we must show that for all s,as,a, we have Es′∼τ(s,a) ⁣[ ω(s,a,s′) ]=0\mathbb{E}_{s'\sim\tau(s,a)}\!\left[\,\omega(s,a,s')\,\right] = 0.

First, let us explore the reward and potential function from which ω\omega is constructed. Abbreviating r2−αr1=r3r_2 - \alpha r_1 = r_3, note that this scaled difference reward function isolates the evaluation constant: Jr3=Jr2−αr1=Jr2−αJr1=aJr1+b−aJr1=b. \mathcal{J}^{r_3} = \mathcal{J}^{r_2 - \alpha r_1} = \mathcal{J}^{r_2} - \alpha \mathcal{J}^{r_1} = a \mathcal{J}^{r_1} + b - a \mathcal{J}^{r_1} = b.

Moreover, our potential function φ\varphi is defined as the negative value of states for the uniform policy under this reward function r3r_3. The value of the corresponding potential difference reward ∂φ\partial\varphi is then equal to this reference value function, vπ∂φ=−φ=vπ~r3, v^{\partial\varphi}_{\pi} = -\varphi = v^{r_3}_{\tilde\pi}, and its evaluation function is itself constant: for π∈Π\pi \in \Pi, J∂φ(π)=Es∼ι ⁣[ vπ∂φ(s) ]=Es∼ι ⁣[ −φ(s) ]=Es∼ι ⁣[ vπ~r3(s) ]=Jr3(π~)=b. \mathcal{J}^{\partial\varphi}(\pi) = \mathbb{E}_{s\sim\iota}\!\left[\,v^{\partial\varphi}_{\pi}(s)\,\right] = \mathbb{E}_{s\sim\iota}\!\left[\,-\varphi(s)\,\right] = \mathbb{E}_{s\sim\iota}\!\left[\,v^{r_3}_{\tilde\pi}(s)\,\right] = \mathcal{J}^{r_3}(\tilde\pi) = b.

Turning to ω=r3−∂φ\omega = r_3 - \partial\varphi, the above properties plus linearity of value/evaluation in the reward allow us to conclude two things. First, the uniform policy’s value function is zero at every state. Second, the evaluation function is zero for every policy. To wit: vπ~ω=vπ~r3−∂φJω(π)=Jr3−∂φ(π)=vπ~r3−vπ~∂φ=Jr3(π)−J∂φ(π)=vπ~r3−vπ~r3=b−b=0;=0.\begin{align*} v^{\omega}_{\tilde\pi} &=v^{r_3-\partial\varphi}_{\tilde\pi} &\qquad \mathcal{J}^{\omega}(\pi) &=\mathcal{J}^{r_3-\partial\varphi}(\pi) \\ &=v^{r_3}_{\tilde\pi} - v^{\partial\varphi}_{\tilde\pi} & &=\mathcal{J}^{r_3}(\pi)-\mathcal{J}^{\partial\varphi}(\pi) \\ &=v^{r_3}_{\tilde\pi} -v^{r_3}_{\tilde\pi} & &=b-b \\ &=0; & &=0. \end{align*}

The vanishing value function for the uniform policy is helpful because we can combine this with the Bellman equation to conclude that for every state s∈Ss \in \mathcal{S}, Ea∼π~(s) ⁣[ Es′∼τ(s,a) ⁣[ ω(s,a,s′) ] ]=0.(∗) \mathbb{E}_{a\sim\tilde\pi(s)}\!\left[\, \mathbb{E}_{s'\sim\tau(s,a)}\!\left[\,\omega(s,a,s')\,\right] \,\right]=0. \tag{$\ast$} This (∗\ast) is not quite enough: we still need to remove the averaging over actions and show that the inner expectation is zero for every state–action pair. But it will help when combined with the zero evaluation for all policies. Now we can isolate the contribution to the evaluation of increasingly taking an arbitrary action a⋆∈Aa_\star \in \mathcal{A} in an arbitrary state s⋆∈Ss_\star \in \mathcal{S}. Define π⋆∈Π\pi_\star \in \Pi to agree with π~\tilde\pi in all other states, but mix the action distribution in state s⋆s_\star towards δa⋆\delta_{a_\star} by some ε∈(0,1)\varepsilon \in (0,1): π⋆(s⋆)=(1−ε)π~(s⋆)+εδa⋆. \pi_\star(s_\star) = (1-\varepsilon)\tilde\pi(s_\star) + \varepsilon \delta_{a_\star}.

Because the uniform policy has zero value, the difference in evaluating this policy compared to the uniform policy comes from the expected immediate reward of the chosen action Es′∼τ(s⋆,a⋆) ⁣[ ω(s⋆,a⋆,s′) ]\mathbb{E}_{s' \sim \tau(s_\star,a_\star)}\!\left[\,\omega(s_\star,a_\star,s')\,\right]. Because the evaluation nevertheless remains zero, this expected reward must vanish. Formally, 0=Jω(π⋆)=∑s,a,s′μπ⋆(s,a,s′)ω(s,a,s′)=∑s,a,s′μπ⋆(s)π⋆(a∣s)τ(s′∣s,a)ω(s,a,s′)=∑sμπ⋆(s)Ea∼π⋆(s) ⁣[ Es′∼τ(s,a) ⁣[ ω(s,a,s′) ] ]=∑s≠s⋆μπ⋆(s)Ea∼π~(s) ⁣[ Es′∼τ(s,a) ⁣[ ω(s,a,s′) ] ]+(1−ε)μπ⋆(s⋆)Ea∼π~(s⋆) ⁣[ Es′∼τ(s⋆,a) ⁣[ ω(s⋆,a,s′) ] ]+εμπ⋆(s⋆)Es′∼τ(s⋆,a⋆) ⁣[ ω(s⋆,a⋆,s′) ]=∑s≠s⋆μπ⋆(s)⋅0+(1−ε)μπ⋆(s⋆)⋅0+εμπ⋆(s⋆)Es′∼τ(s⋆,a⋆) ⁣[ ω(s⋆,a⋆,s′) ]=εμπ⋆(s⋆)Es′∼τ(s⋆,a⋆) ⁣[ ω(s⋆,a⋆,s′) ].\begin{align*} 0 &=\mathcal{J}^{\omega}(\pi_\star) \\ &= \sum_{s,a,s'} \mu_{\pi_\star}(s,a,s') \omega(s,a,s') \\ &= \sum_{s,a,s'} \mathrlap{\rule[0.68em]{0.55em}{0em}}\mathrlap{\rule[0.55em]{0.55em}{0em}}\mu_{\pi_\star}(s) \pi_\star(a|s) \tau(s'|s,a) \omega(s,a,s') \tag{factorisation} \\ &= \sum_s \mathrlap{\rule[0.68em]{0.55em}{0em}}\mathrlap{\rule[0.55em]{0.55em}{0em}}\mu_{\pi_\star}(s) \mathbb{E}_{a\sim\pi_\star(s)}\!\left[\, \mathbb{E}_{s'\sim\tau(s,a)}\!\left[\,\omega(s,a,s')\,\right] \,\right] \\ &= \sum_{s\neq s_\star} \mathrlap{\rule[0.68em]{0.55em}{0em}}\mathrlap{\rule[0.55em]{0.55em}{0em}}\mu_{\pi_\star}(s) \mathbb{E}_{a\sim\tilde\pi(s)}\!\left[\, \mathbb{E}_{s'\sim\tau(s,a)}\!\left[\,\omega(s,a,s')\,\right] \,\right] \\ &\qquad + (1-\varepsilon) \mathrlap{\rule[0.68em]{0.55em}{0em}}\mathrlap{\rule[0.55em]{0.55em}{0em}}\mu_{\pi_\star}(s_\star) \mathbb{E}_{a\sim\tilde\pi(s_\star)}\!\left[\, \mathbb{E}_{s'\sim\tau(s_\star,a)}\!\left[\,\omega(s_\star,a,s')\,\right] \,\right] \\[1ex]&\qquad + \varepsilon \mathrlap{\rule[0.68em]{0.55em}{0em}}\mathrlap{\rule[0.55em]{0.55em}{0em}}\mu_{\pi_\star}(s_\star) \mathbb{E}_{s'\sim\tau(s_\star,a_\star)}\!\left[\,\omega(s_\star,a_\star,s')\,\right] \\[1ex] &= \sum_{s\neq s_\star} \mathrlap{\rule[0.68em]{0.55em}{0em}}\mathrlap{\rule[0.55em]{0.55em}{0em}}\mu_{\pi_\star}(s) \cdot 0 + (1-\varepsilon) \mathrlap{\rule[0.68em]{0.55em}{0em}}\mathrlap{\rule[0.55em]{0.55em}{0em}}\mu_{\pi_\star}(s_\star) \cdot 0 \tag{by $\ast$} \\[1ex]&\qquad + \varepsilon \mathrlap{\rule[0.68em]{0.55em}{0em}}\mathrlap{\rule[0.55em]{0.55em}{0em}}\mu_{\pi_\star}(s_\star) \mathbb{E}_{s'\sim\tau(s_\star,a_\star)}\!\left[\,\omega(s_\star,a_\star,s')\,\right] \\[1ex] &=\varepsilon \mathrlap{\rule[0.68em]{0.55em}{0em}}\mathrlap{\rule[0.55em]{0.55em}{0em}}\mu_{\pi_\star}(s_\star) \mathbb{E}_{s'\sim\tau(s_\star,a_\star)}\!\left[\,\omega(s_\star,a_\star,s')\,\right]. \end{align*} Note that reachability and γ>0\gamma > 0 ensure that μπ⋆(s⋆)>0\mathrlap{\rule[0.68em]{0.55em}{0em}}\mathrlap{\rule[0.55em]{0.55em}{0em}}\mu_{\pi_\star}(s_\star) > 0, since this mixture policy takes all actions with positive probability. Therefore, since also ε>0\varepsilon > 0, we must have Es′∼τ(s⋆,a⋆) ⁣[ ω(s⋆,a⋆,s′) ]=0. \mathbb{E}_{s'\sim\tau(s_\star,a_\star)}\!\left[\,\omega(s_\star,a_\star,s')\,\right]=0. Since s⋆,a⋆s_\star, a_\star were arbitrary, we conclude ω∈Ω\omega \in \Omega.

§§Characterising all invariances

The above result shows that any two reward functions sharing a policy preorder can be related by a joint transformation. However, an invariance of the policy preorder need not apply the same joint transformation to all input reward functions. If not, the invariance might fail to equal any single joint transformation for all reward functions.

However, we have effectively shown that any invariant transform will equal a joint transformation pointwise. Formally, we have the following characterisation of the invariances of the policy preorder. Assume, again, that our fixed MDP has no unreachable states. Then T:R→RT : \mathcal{R}\to \mathcal{R} is an invariance of the policy preorder if and only if there exists a per-reward scalar α:R→R>0\alpha : \mathcal{R}\to \mathbb{R}_{>0}, a per-reward potential function φ:R→Φ\varphi : \mathcal{R}\to \Phi, and a per-reward transition-orthogonal reward function ω:R→Ω\omega : \mathcal{R}\to \Omega such that for all r∈Rr \in \mathcal{R}, T(r)=α(r)⋅r+∂(φ(r))+ω(r). T(r) = \alpha(r) \cdot r + \partial \bigl(\varphi(r)\bigr) + \omega(r).

The forward proof follows by applying the pointwise result to every input reward function r1=rr_1 = r and the corresponding r2=T(r)r_2 = T(r), which share a policy preorder as TT is an invariance.

Conversely, any such TT is an invariance, because invariance is defined pointwise and for r∈Rr \in \mathcal{R}, the concrete joint transformation indexed by (α(r),φ(r),ω(r))∈R>0×Φ×Ω(\alpha(r), \varphi(r), \omega(r)) \in \mathbb{R}_{>0} \times \Phi \times \Omega preserves the policy preorder. (This direction doesn’t require reachability.)

§Conclusion

That’s probably much more detail than you needed about reward function transformations. I will close briefly with some notes on why I cared enough to write this.

First, my colleague Miguel and I have been studying the related topic of reward function canonicalisation, which is the study of maps that standardise reward functions to remove the effects of the above reward function transformations. This matters for all sorts of things; if you think you have two different reward functions, you ought to know if they have real differences that would affect their preferences between different policies, or if they only differ by positive linear scaling, potential shaping, or destination redistribution. We’re gearing up to write some results about this, and I wanted to review what we know about these transformations to begin with before tackling that writeup.

Second, ever since I wrote that first paper on characterising invariances with Joar Skalse, I haven’t been at ease with the way we set up the definition of reward function transformations. In this note, several years later, I feel immense satisfaction that I finally got to the bottom of my unease by realising that it was about the difference between explicit and implicit definitions of the transformations. This time, I put a name on the data of the transformations, especially the data specifying a destrination redistribution transformation (the transition-orthogonal reward function; it’s fairly commonplace to refer to the scale factor or the potential function), as well as naming the potential difference function as a reward function in its own right. I feel like this move immediately levelled up my ability to understand these transformations and their properties. Names are power. Or, you could say, infrastructure is everything.

On a somehow-related note, I should acknowledge that some parts of the proofs in this post, especially in the final section, were developed with the assistance of ChatGPT 6 Astra. I am happy to admit that it saved me a lot of trouble understanding the space of possible arguments, and proud to say that I was still able to contribute a lot to refining the proofs into their present, fairly direct form with minimal, carefully-chosen notation. Any remaining mistakes are my own.

§References

Ng, Harada, and Russell, 1999, “Policy invariance under reward transformations: Theory and application to reward shaping,” ICML.

Skalse, Farrugia-Roberts, Russell, Abate, and Gleave, 2023, “Invariance in Policy Optimisation and Partial Identifiability in Reward Learning,” ICML.

Skalse and Abate, 2023, “Misspecification in Inverse Reinforcement Learning,” AAAI.


  1. This intuition ignores the inclusion of the discount rate in the expression γφ(s′)−φ(s)\gamma \varphi(s') - \varphi(s). This is the same intuitive motivation as Ng, Harada, and Russell (1999) in the original paper. Unfortunately, they don’t seem to offer an intuitive reason why the discount rate should be there. Mathematically, it clearly needs to be there for everything to work out (as we’ll see when discussing the properties of these terms). It also pleasingly mirrors the value function difference expression in the temporal difference error: δ=r(s,a,s′)+γv(s′)−v(s). \delta = r(s,a,s') + \gamma v(s') - v(s). Regrettably, I don’t actually have a great intuition for this inclusion myself.↩︎

  2. In Skalse, Farrugia-Roberts, et al. (2023), we introduced this family of transformations under the name S′S'-redistribution. I regret that choice of name: I am more cautious about including mathematical expressions in terminology I want to use beyond one paper, because terminology should be agnostic to notation choices and self-documenting. So, I now propose to call this family destination redistribution.↩︎

  3. Indeed, I also regret the way we defined destination redistribution transformations in the original paper. I think we should have used the definition I use in this note, because it’s more explicit about what different transformations are possible.

    Translating into the notational conventions of this note, here’s how we wrote the definition:

    Definition 2.6 (S′S'-Redistribution). Let r1r_1 and r2r_2 be reward functions. Given transition dynamics τ\tau, we say that r2r_2 is produced by S′S'-redistribution of r1r_1 if ES′∼τ(s,a) ⁣[ r1(s,a,S′) ]=ES′∼τ(s,a) ⁣[ r2(s,a,S′) ].\mathbb{E}_{S' \sim \tau(s,a)}\!\left[\,r_1(s,a,S')\,\right] = \mathbb{E}_{S' \sim \tau(s,a)}\!\left[\,r_2(s,a,S')\,\right].

    S′S'-redistribution is simply any transformation that preserves ES′∼τ(s,a) ⁣[ r(s,a,S′) ]\mathbb{E}_{S' \sim \tau(s,a)}\!\left[\,r(s,a,S')\,\right].

    This definition makes it easy to check if two reward functions can be related by an destination redistribution, but leaves the actual transformations entirely implicit. In this note, I prefer to start with the redistribution scheme and explicitly define the transformations and the family in these terms, and then from that derive the conditions under which you can see that two reward functions are relatable. This then mirrors the situation for positive linear scaling and potential shaping, and makes it easier later to talk about canonicalisation.

    The definition for destination redistribution I propose in this note is actually subtly different than the implicit definition in the original paper. There, you can have transformations that use different ways of redistributing reward for different reward functions. In my new definition, you insist that a given transformation redistributed reward the same way regardless of which reward functions it is being applied to. This is actually also the case for the paper’s implicit definitions of potential shaping and positive linear scaling, compared to the definitions I give here. This means that the paper’s definitions are more expressive.

    Fortunately, from the perspective of characterising the sets of reward functions that have equivalent policy preorders, this difference doesn’t matter. Both the implicit, more expressive definitions and the explicit, less expressive definitions of the family of transformations induce the same partitions on the space of reward functions, because these partitions only depend on pointwise transformability. I touch on this in the penultimate section of the post.↩︎

  4. It is fairly common for an MDP to have unreachable states, particularly before a distribution shift. This may create additional invariances since rewards in unreachable states do not affect the evaluation function. Skalse et al. (2023) characterise these invariances by a mask operation that can pin the reward assigned to any unreachable transition to any fixed value. I omit treatment of this kind of invariance because I think it’s less interesting than the three families we have studied. However, that’s not to say it isn’t practically relevant: if there are parts of your environment that are unreachable, then you have no control over the reward function there, and this can matter if those parts of the environment eventually become reachable.↩︎