~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:
- scaling a reward function by a positive constant,
- adding a so-called “potential shaping” term, and
- redistributing expected reward between transition destinations.
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:
- Reinforcement learning preliminaries
- Some reward function transformations
- Transformation groups
- Some invariances of reinforcement learning
- All invariances of reinforcement learning
- Conclusion
- References
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 where:
- is a non-empty, finite set of environment states,
- is a non-empty, finite set of agent actions,
- is an initial state distribution, and
- is a conditional transition distribution encoding the environment dynamics.
Separately, a reward function is a function ascribing numerical reward to MDP transitions. The set of all reward functions is denoted .
I remark that I separate the reward function from the “environment” for conceptual clarity:
- The reward-free MDP defines the space of possible agent–environment interactions. Importantly, it is neutral as to which interactions are desirable.
- The reward function is used to quantify how desirable different interactions are.
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 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 .
Fixing a policy, we can sample trajectories of agent–environment interactions:
- First, sample an initial state .
- Next, sample an agent action .
- Then, sample a new environment state .
- Repeat from step 2, incrementing all subscripts by one. That is,
Thus, a choice of policy induces a particular distribution over state–action trajectories.
§§Policy evaluation
If we now bring in a reward function , we can quantify the desirability of a policy by the kinds of trajectories it induces. In particular, fix also a discount rate (once again, I keep this out of the environment definition for conceptual reasons—there are other ways to score trajectories). Then the evaluation function , encodes the expected cumulative discounted reward under each policy : where denotes expectation taken over the distribution of trajectories induced by .
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 , we can define a relation such that 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 , and a policy , define the value function, , as the expected discounted cumulative reward achieved by the policy assuming trajectories originating in each state , (where by conditioning on , I mean starting the sampling process in state , even if ). The evaluation function can then be written succinctly as
Second, one can show that the value function satisfies a recurrence relation known as the Bellman equation, such that for , (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 , and define the discounted transition occupancy measure, by where is an indicator function, here equal to at timesteps where the particular transition is taken, or otherwise. The non-negative number counts the average number of occurrences of the transition exhibited under the policy , 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 , we see 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 , define four marginal occupancy measures: These functions have natural interpretations. It is easy to show that they could alternatively have been defined as follows:
In other words,
- is the expected discounted number of times the agent takes action in state ;
- is the expected discounted number of times the agent transitions out of state ;
- is the expected discounted number of times the agent takes action , from any state, and lands in state ; and
- is the expected discounted number of times the agent transitions into state .
The structure of the sampling process gives us the following factorisation identities:
Notice also that and 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 , 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 ,
§Some reward function transformations
Formally, a reward function transformation is a function on the space of reward functions . In this section, we will define the three families of reward function transformations mentioned in the introduction:
- scaling a reward function by a positive constant,
- adding a so-called “potential shaping” term, and
- redistributing expected reward between transition destinations.
§§Positive linear scaling
For each positive constant , define a positive linear scaling reward function transformation such that for , That’s function multiplication: . Denote by the family of positive linear scaling transformations.
Intuitively, there’s not much to explain here. simply corresponds to scaling all of the rewards dispensed to an agent by a constant scale factor .
In practice, if you have two reward functions , how can you tell if there exists a positive linear scaling transformation that will transform into ? You just have to show that you can find a single positive ratio between all of the rewards, handling the case of zero carefully. In particular, the following two conditions suffice:
Equal support: for all , and
Constant ratio: there is a fixed scalar such that for all where ,
It’s easy to show that these two conditions are equivalent to such that , or, in other words, equivalent to such that .
§§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: . We don’t place any restrictions on these functions (in this note’s infinite horizon discounted setting). Call the set of all potential functions . 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 . Given a potential function , define a potential difference reward function such that for ,
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 Upon leaving state and entering state , the agent gains reward based on the potential associated to state and loses the potential-based reward 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.
Potential value telescoping: The value function corresponding to a potential difference reward function is pleasingly simple. Fix any policy and let be a potential function. Then
Policy-agnosticism: Notice that this value function does not depend on the choice of policy . It follows that for a given potential function , the policy evaluation function for the associated potential difference reward function is constant with respect to : As a consequence, for a given potential difference reward function, all policies are considered optimal.
Expressivity: The above results shed light on the expressivity of potential difference reward functions. In a given environment, it is typically possible to express reward functions for which not all policies are equally optimal. Therefore, there must be reward functions in that are not expressible as potential difference reward functions for any potential function .
Moreover, in our finite-state setting, observe that is isomorphic to , whereas is isomorphic to . The map is from to , and its image can have dimensionality at most .
On the other hand, our first result shows that for a given policy , through the choice of the right potential function it is possible to create a potential difference reward function for an arbitrary value function . Namely, put , then .
Constant rewards: Potential difference reward functions are about changes in potential. But due to discounting, it is actually possible to define a potential function for which the potential difference reward function is any constant. Let . Recall we have assumed . Set Then we have
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 , define the potential shaping reward function transformation as the transformation that adds the corresponding potential difference reward function to its input reward function: That’s function addition, so, spelled out, we have Denote by 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 , how can you tell if there exists a potential shaping transformation that will transform into ? If they do, we’d be able to recover the potential difference reward function as the difference in reward functions: for all , In the finite-state case, the above specifies a linear system of equations in where for each is an unknown. If this equation has a solution, it’s . 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 . With this in mind, say that a reward function is transition-orthogonal if for all , , Denote by 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 and the restricted reward function viewed as vectors in : for each fixed pair.
A useful basic property of transition-orthogonal reward functions is that they have zero value. That is, for any policy , the value function for a transition-orthogonal reward function is always zero. To see this, observe that solves the Bellman recurrence: for all . Recall that this recurrence has a unique solution that coincides with the value function, thus .
Anyway, having defined this family of reward functions, we can define destination redistribution. Given a transition-orthogonal reward function , define the destination redistribution reward function transformation as the transformation that adds to its input reward function: Once again, that’s function addition, so, spelled out, we have Denote by 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 in a given state , 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 for some , then for all ,
Conversely, suppose we have two reward functions satisfying Then, observe that is transition-orthogonal: for , Now , in other words, we can reach from via the destination redistribution .
§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.
We will show that each of the three families has the structure of an abelian group. This means that the transformation families are closed under composition and inversion and contain the identity transformation, and that composition within each family is commutative.
One particular consequence is that any composition of transformations from a given family can always be represented by a single composition from the family.
In fact, each family is isomorphic to its indexing set:
composition of positive linear scaling transformations behaves analogously to multiplication in the multiplicative group of positive scalars ,
composition of potential shaping transformations behaves analogously to addition in the additive group of potential functions , and
composition of destination redistribution transformations behaves analogously to addition in the additive group of transition-orthogonal functions .
One particular consequence is that each transformation (or composition of transformations) within each family is represented by a unique index.
The join of the three families—containing all finite compositions of transformations from any of the three families—is not abelian, but it does permit a simple set of commutation identities. That is, for any composition of transformations from two different families, we find an equivalent composition in the other order, but we might have to use a different transformation within each family,
One particular consequence is that we can simplify any finite composition of transformations until it is expressed as a sequence of three transformations, one of each type, in an arbitrary fixed order.
In fact, we will show that for a given transformation in the join, such a simplification is unique. (Formally, this is essentially to say that the join is isomorphic to a semidirect product of the indexing sets, but explaining that connection is out of scope.)
§§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:
- Composition: for any two transformations contained in the family, their composition is also contained in the family.
- Identity: the identity transformation is contained in the family.
- Inverses: each transformation contained in the family is an invertible function and its inverse transformation is also contained in the family.
- 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:
- The indexing set of positive linear scaling transformations, positive reals , is a standard example of an abelian group under multiplication.
- The indexing set of potential shaping transformations, potential functions , has a vector space structure and is therefore an abelian group under addition.
- The indexing set of destination redistribution transformations, transition-orthogonal reward functions , is the orthogonal complement of the transition distribution, and as such it is a vector subspace of the space of reward functions and therefore also an abelian group under addition.
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:
Positive linear scaling and positive reals: The indexing map is , . We can easily show that this map is consistent. Let . For , Thus .
Potential shaping and potential functions: The indexing map is , . We can easily show that this map is consistent. Let . For , Thus .
Destination redistribution and transition-orthogonal reward functions: The indexing map is , . We can easily show that this map is consistent. Let . For , Thus .
It follows that each family is an abelian group:
Composition: That the families are closed under function composition is implicit in the compatibility proofs, which construct the composite transform on the way to showing it’s indexed by the combination of the indices.
Identity: Consistency also implies that the families contain the identity reward transformation, since this is the only reward transformation that could be consistent with the identity index in each group. In fact, we can verify directly that
Inverses: given any transformation , we can compute an inverse in the indexing group and use consistency to show that .
Commutativity: Function composition is not commutative in general. However, consistency allows us to lift commutativity from the underlying groups to these transformation groups: where is the indexing group’s operation (multiplication or addition).
§§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 , to establish these isomorphisms it suffices to show that if for some index , then is the identity in the indexing group. This is easily done:
For positive linear scaling, take such that . Evaluating both sides on the constant reward function gives It follows that .
For potential shaping, take such that . Evaluating both sides on the null reward function gives implies in particular for each and any , Since , , and we conclude .
For destination redistribution, take such that . Evaluating both sides on the null reward function gives Thus .
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 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:
- Potential shaping and destination redistribution commute: Let , . Then for : Thus,
For the remaining two possible combinations, we can define a commutative identity:
Positive linear scaling and potential shaping: Let , . Then for : Thus, Equivalently,
Positive linear scaling an destination redistribution: Similarly, Let , . Then for : Thus, Equivalently,
§§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.
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.
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 . 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:
So, then, suppose such that . In other words, for , . That is, In particular this identity holds at , giving us It follows from () and () that , which implies . Moreover, from () we have that . This is an identity of two reward functions. Fixing an arbitrary policy , we can take the value functions of both sides to get where we have used linearity of expectation to extract the negation. Recall that earlier, we showed that for a potential difference reward function , the value function is . On the other hand, for transition-orthogonal reward functions, . Using these two identities together with (), we conclude that . It follows that , and then by (), we conclude that , as required.
§Some invariances of reinforcement learning
An invariance of the policy preorder is a reward function transformation that doesn’t change the policy preorder—for all ,
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 using these transformations has the same policy preorder as .
§§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 . Then for we have Thus, . Scaling by a positive factor changes the evaluation function, but preserves all ordinal comparisons between policies, so we conclude
§§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 . Then for we have Thus, .
Note that 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
§§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 . Then for we have Thus, .
In other words, destination redistribution doesn’t even change the policy evaluation function. We immediately conclude
§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 shares a policy preorder, then it is possible to reach from via some sequence of transformations from our three families. In light of our normal form result, this means that there is some , , such that
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 , and any interpolation parameter , there exists a policy that, for all reward functions , achieves an evaluation of exactly Note that the one policy 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 and interpolation parameter , we can find a policy such that The main result then follows using the same , because for any , is linear in the induced occupancy measure.
Without further ado, then, fixing , , and , we must construct a policy with the target transition occupancy measure Note that we don’t yet know that this is an occupancy measure for any policy. However, the definitions and identities of marginal occupancy measures are linear, so we can coherently define , and similarly for and . Then, we can interpolate the first factorisation identities and the flow identities from and to obtain equivalent identities for our target :
The second factorisation identities involve the policy, so we can’t interpolate those ones. However, they do inspire us to try putting for all for those such that (where , choose any action distribution). This gives us the desired factorisation identity by construction (exercise in the case ). It is also easy to check that (exercise).
It only remains to show that , where on the LHS here we mean the occupancy measure defined directly from . This occupancy measure has its own marginals satisfying their own factorisation and flow identities, from which we derive the equation On the other hand, the factorisation and flow identities we constructed for our target interpolated occupancy measure give us a similar equation
The only difference between () and () is the occupancy measure. We’ll show that this system of equations has a unique solution, so the two occupancy measures must coincide. Subtracting gives us, for each , Since , , and are non-negative, taking absolute values gives us
The above identities hold for all transitions . If we sum over transitions we can unify the probability terms and
Since , this sum of absolute differences between the entries of and of must be zero. Thus , 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 . Abbreviate and . Then, the claim is that implies for some and .
To show this, define a best policy and a worst policy by 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 .
In case the evaluations of the best and worst policies are equal, it must be that is constant. Since has the same preorder, it must also be constant. Then, set
Otherwise, (and ). Let . Its evaluation lies somewhere between those of the worst and best policies. Let be the interpolation constant such that By our previous interpolation result, there exists a policy achieving this same interpolation of the worst and best policies under all reward functions, including in particular and : By () and (), we have , an evaluation tie under . Since induces the same policy preorder, the same must be true under , that is, . By () we then conclude In other words, the evaluation of occupies the same relative position between that of the worst and best policies under as it did under . We can rearrange () and () to eliminate and solve for in terms of in order to identify the appropriate positive affine transformation, resulting in:
§§Positive affine evaluation change implies a joint transformation
We conclude that implies for some , . Finally, in this section, we show that if all states are reachable, then implies we can find , , and such that .
Let’s try the following construction. Let be the uniform policy, and then set Note that by construction. Thus, it only remains to show transition-orthogonality of (which we have called in anticipation of this property). That is, we must show that for all , we have .
First, let us explore the reward and potential function from which is constructed. Abbreviating , note that this scaled difference reward function isolates the evaluation constant:
Moreover, our potential function is defined as the negative value of states for the uniform policy under this reward function . The value of the corresponding potential difference reward is then equal to this reference value function, and its evaluation function is itself constant: for ,
Turning to , 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:
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 , This () 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 in an arbitrary state . Define to agree with in all other states, but mix the action distribution in state towards by some :
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 . Because the evaluation nevertheless remains zero, this expected reward must vanish. Formally, Note that reachability and ensure that , since this mixture policy takes all actions with positive probability. Therefore, since also , we must have Since were arbitrary, we conclude .
§§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 is an invariance of the policy preorder if and only if there exists a per-reward scalar , a per-reward potential function , and a per-reward transition-orthogonal reward function such that for all ,
The forward proof follows by applying the pointwise result to every input reward function and the corresponding , which share a policy preorder as is an invariance.
Conversely, any such is an invariance, because invariance is defined pointwise and for , the concrete joint transformation indexed by 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.
This intuition ignores the inclusion of the discount rate in the expression . 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: Regrettably, I don’t actually have a great intuition for this inclusion myself.↩︎
In Skalse, Farrugia-Roberts, et al. (2023), we introduced this family of transformations under the name -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.↩︎
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 (-Redistribution). Let and be reward functions. Given transition dynamics , we say that is produced by -redistribution of if
-redistribution is simply any transformation that preserves .
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.↩︎
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.↩︎