Q UANTIFYING D IFFERENCES IN R EWARD F UNCTIONS
A BSTRACT
For many tasks, the reward function is too complex to be speciﬁed procedurally, and must instead be learned from user data.
Prior work has evaluated learned reward functions by examining rollouts from a policy optimized for the learned reward.
However, this method cannot distinguish between the learned reward function failing to reﬂect user preferences, and the reinforcement learning algorithm failing to optimize the learned reward.
Moreover, the rollout method is highly sensitive to the choice of evaluation environment, and so may fail to predict behavior in even a slightly different deployment environment.
To address these problems, we introduce the Equivalent-Policy Invariant Comparison (EPIC) distance to quantify the difference between two reward functions directly, without training a policy.
We prove EPIC is invariant on an equivalence class of reward functions that always induce the same optimal policy.
Furthermore, we ﬁnd EPIC can be precisely approximated and is more robust than baselines to the choice of coverage distribution.
Finally, we show that EPIC distance bounds the regret of optimal policies even under different transition dynamics, and conﬁrm empirically that it predicts policy training success.
Our source code is available at https: //github.com/
HumanCompatibleAI/evaluating-rewards .
I NTRODUCTION
Reinforcement learning (RL) has reached or surpassed human performance in many domains with clearly-deﬁned reward functions, such as games [20; 15; 23] and narrowly-scoped robotic manipulation tasks [16].
Unfortunately, the reward functions for most real-world tasks are difﬁcult or impossible to procedurally specify.
Even a task as simple as peg insertion from pixels has a non-trivial reward function that must usually be learned [22, IV.A].
Most real-world tasks have far more complex reward functions than this.
In particular, tasks involving human interaction depend on complex and user-dependent preferences.
These challenges have inspired work on learning a reward function, whether from demonstrations [13; 17; 26; 8; 3], preferences [1; 25; 6; 18; 27] or both [10; 4].
Prior work has usually evaluated the learned reward function ˆ R using the “rollout method”: training a policy π ˆ R to optimize ˆ R and then examining rollouts from π ˆ R .
Unfortunately, this method requires solving an RL problem, which is computationally expensive.
Furthermore, the method produces false negatives when the reward ˆ R matches user preferences, but the RL algorithm fails to optimize ˆ R .
The rollout method also produces false positives .
Of the many reward functions that induce the desired rollout in a given environment, only a small subset align with the user’s preferences.
For example, suppose the agent can reach states { A, B, C } .
If the user prefers A > B > C , but the agent instead learns A > C > B , the agent will still go to the correct state A .
However, if the initial state distribution or transition dynamics change, misaligned rewards may induce undesirable policies.
For example, if A is no longer reachable at deployment, the previously reliable agent would misbehave by going to the least-favoured state C .
We propose instead evaluating learned rewards via their distance from other reward functions, and summarize our desiderata for reward function distances in Table 1.
For benchmarks, it is usually possible to directly compare a learned reward ˆ R to the true reward function R .
Alternatively, benchmark creators can train a “proxy” reward function R P from a large human data set. This proxy can then be used as a stand-in for the true reward R when evaluating algorithms trained on a different or smaller data set.
[Table]
There is rarely a trusted reward function to compare to when learning rewards outside of benchmarks.
However, even in this challenging case, comparisons can at least be used to cluster reward models trained using different techniques or data.
Larger clusters are more likely to be correct, since multiple methods arrived at a similar result.
Moreover, our regret bound (Theorem 4.9) suggests we could use intepretability methods [12] on one model and get some guarantees for models in the same cluster.
We introduce the Equivalent-Policy Invariant Comparison (EPIC) distance that meets all the criteria in Table 1.
We believe EPIC is the ﬁrst method to quantitatively evaluate reward functions without training a policy.
EPIC (section 4) canonicalizes the reward functions’ potential-based shaping [14], then takes the correlation between the canonical rewards over a coverage distribution D of transitions.
We also introduce baselines NPEC and ERC (section 5) which partially satisfy the criteria.
EPIC works best when D has support on all realistic transitions.
In our experiments, we achieve this by using uninformative priors, such as rollouts of a policy taking random actions.
Moreover, we ﬁnd EPIC is robust to the exact choice of distribution D , producing similar results across a range of distributions, whereas ERC and especially NPEC are highly sensitive to the choice of D (section 6.2).
Moreover, low EPIC distance between a learned reward ˆ R and the true reward R predicts low regret.
That is, the policies π ˆ R and π R optimized for ˆ R and R obtain similar returns under R .
Theorem 4.
bounds the regret even in unseen environments; by contrast, the rollout method can only determine regret in the evaluation environment.
We also conﬁrm this result empirically (section 6.3).
R ELATED WORK
There exist a variety of methods to learn reward functions.
Inverse reinforcement learning (IRL; 13) is a common approach that works by inferring a reward function from demonstrations.
The IRL problem is inherently underconstrained: many different reward functions lead to the same demonstrations.
Bayesian IRL [17] handles this ambiguity by inferring a posterior over reward functions.
By contrast, Maximum Entropy IRL [26] selects the highest entropy reward function consistent with the demonstrations; this method has scaled to high-dimensional environments [7; 8].
An alternative approach is to learn from preference comparisons between two trajectories [1; 25; 6; 18].
T-REX [4] is a hybrid approach, learning from a ranked set of demonstrations.
More directly, Cabi et al.
[5] learn from “sketches” of cumulative reward over an episode.
To the best of our knowledge, there is no prior work that focuses on evaluating reward functions directly.
The most closely related work is Ng et al.
[14], identifying reward transformations guaranteed not to change the optimal policy.
However, a variety of ad-hoc methods have been developed to evaluate reward functions.
The rollout method – evaluating rollouts of a policy trained on the learned reward – is evident in the earliest work on IRL [13].
Fu et al.
[8] reﬁned the rollout method by testing on a transfer environment, inspiring our experiment in section 6.3.
Recent work has compared reward functions by scatterplotting returns [10; 4], inspiring our ERC baseline (section 5.1).
B ACKGROUND
This section introduces material needed for the distances deﬁned in subsequent sections.
We start by introducing the Markov Decision Process (MDP) formalism, then describe when reward functions induce the same optimal policies in an MDP, and ﬁnally deﬁne the notion of a distance metric .
Deﬁnition 3.1.
A Markov Decision Process (MDP) M = ( S , A , γ, d 0 , T , R ) consists of a set of states S and a set of actions A ; a discount factor γ ∈ [0 , 1] ; an initial state distribution d 0 ( s ) ; a transition distribution T ( s (cid:48) | s, a ) specifying the probability of transitioning to s (cid:48) from s after taking action a ; and a reward function R ( s, a, s (cid:48) ) specifying the reward upon taking action a in state s and transitioning to state s (cid:48) .
A trajectory τ consists of a sequence of states and actions, τ = ( s 0 , a 0 , s 1 , a 1 , · · · ) , where each s i ∈ S and a i ∈ A .
The return on a trajectory is deﬁned as the sum of discounted rewards, g ( τ ; R ) =
(cid:80) | τ | t =
γ t R ( s t , a t , s t +1 ) , where the length of the trajectory | τ | may be inﬁnite.
In the following, we assume a discounted ( γ < 1 ) inﬁnite-horizon MDP.
The results can be generalized to undiscounted ( γ = 1 ) MDPs subject to regularity conditions needed for convergence.
A stochastic policy π ( a | s ) assigns probabilities to taking action a ∈ A in state s ∈ S .
The objective of an MDP is to ﬁnd a policy π that maximizes the expected return, G ( π ) =
E τ ( π ) [ g ( τ ; R )] , where τ ( π ) is a trajectory generated by sampling the initial state s 0 from d 0 , each action a t from the policy π ( a t | s t ) and successor states s t +1 from the transition distribution T ( s t +1 | s t , a t ) .
An MDP M has a set of optimal policies π ∗ ( M ) that maximize the expected return, π ∗ ( M )
=
arg max π G ( π ) .
In this paper, we consider the setting where we only have access to an MDP\R, M − =
( S , A , γ, d 0 , T ) .
The unknown reward function R must be learned from human data.
Typically, only the state space S , action space A and discount factor γ are known exactly, with the initial state d 0 and transition dynamics T only observable from interacting with the environment M − .
Below, we describe an equivalence class whose members are guaranteed to have the same optimal policy set in any MDP\R M − with ﬁxed S , A and γ (allowing the unknown T and d 0 to take arbitrary values).
Deﬁnition 3.2.
Let γ ∈ [0 , 1] be the discount factor, and Φ : S → R a real-valued function.
Then
R ( s, a, s (cid:48) )
= γ Φ( s (cid:48) ) − Φ( s ) is a potential shaping reward, with potential Φ [14].
Deﬁnition 3.3 (Reward Equivalence) .
We deﬁne two bounded reward functions R A and R B to be equivalent , R A ≡ R B , for a ﬁxed ( S , A , γ ) if and only if there exists a constant λ > 0 and a bounded potential function Φ : S → R such that for all s, s (cid:48) ∈ S and a ∈ A : [Equation]
[Equation]
Note R
A − R B ≡ Zero (where Zero is the all-zero reward)
if and only if R A ≡ R B with λ = 1 .
Proposition 3.4.
The binary relation ≡ is an equivalence relation.
Let R A , R B , R C : S×A×S → R be bounded reward functions.
Then ≡ is reﬂexive, R A ≡ R A ; symmetric, R A ≡ R B implies
R B ≡ R A ; and transitive, ( R A ≡ R B )
∧ ( R B ≡ R C ) implies R A ≡ R C .
Proof.
See section A.3.1 in supplementary material.
The expected return of potential shaping γ Φ( s (cid:48) ) − Φ( s ) on a trajectory segment ( s 0 , · · · , s T ) is γ T Φ( s T ) − Φ( s 0 ) .
The ﬁrst term γ T Φ( s T ) → 0 as T → ∞ , while the second term Φ( s 0 ) only depends on the initial state, and so potential shaping does not change the set of optimal policies.
Moreover, any additive transformation that is not potential shaping will, for some reward R and transition distribution T , produce a set of optimal policies that is disjoint from the original [14].
The set of optimal policies is also invariant to a constant shift c ∈ R of the reward, however this can already be obtained by shifting Φ by cγ − 1 . * Scaling a reward function by a positive factor λ >scales the expected return of all trajectories by λ , leaving the set of optimal policies unchanged.
If R A ≡ R B , for some ﬁxed ( S , A , γ ) , then for any MDP\R M − = ( S , A , γ, d 0 , T ) we have π ∗ (( M − , R A ))
=
π ∗ (( M − , R B )) , where ( M − , R ) denotes the MDP speciﬁed by M − with reward function R .
In other words, R A and R B induce the same optimal policies for all initial state distributions d 0 and transition dynamics T .
Deﬁnition 3.5.
Let X be a set and d : X × X → [0 , ∞ ) a function.
d is a premetric if d ( x, x ) =for all x ∈ X .
d is a pseudometric if, furthermore, for all x, y, z ∈ X , d ( x, y ) =
d ( y, x ) and d ( x, z ) ≤ d ( x, y ) + d ( y, z ) .
d is a metric if, furthermore, for all x, y ∈ X , d ( x, y )
= 
 =
⇒ x
= y .
We wish for d ( R A , R B )
=
whenever the rewards are equivalent, R A ≡ R B , even if they are not identical, R A (cid:54)
= R B .
This is forbidden in a metric but permitted in a pseudometric, while retaining other guarantees such as symmetry and triangle inequality that a metric provides.
Accordingly, a pseudometric is usually the best choice for a distance d over reward functions.
C OMPARING REWARD FUNCTIONS WITH EPIC
In this section we introduce the Equivalent-Policy Invariant Comparison (EPIC) pseudometric.
This novel distance canonicalizes the reward functions’ potential-based shaping, then compares the canonical representatives using Pearson correlation, which is invariant to scale.
Together, this construction makes EPIC invariant on reward equivalence classes.
See section A.3.2 for proofs.
We deﬁne the canonically shaped reward C D S , D A ( R ) as an expectation over some arbitrary distributions D S and D A over states S and actions A respectively.
This construction means that C D S , D A ( R ) does not depend on the MDP’s initial state distribution d 0 or transition dynamics T .
In particular, we may evaluate R on transitions that are impossible in the training environment, since these may become possible in a deployment environment with a different d 0 or T .
Deﬁnition 4.1 (Canonically Shaped Reward) .
Let R : S ×
A × S → R be a reward function.
Given distributions D S ∈ ∆( S ) and D A ∈ ∆( A ) over states and actions, let S and S (cid:48) be random variables independently sampled from D S and A sampled from D A .
We deﬁne the canonically shaped R to be:
[Equation]
Informally, if R (cid:48) is shaped by potential Φ , then increasing Φ( s ) decreases R (cid:48)
( s, a, s (cid:48) ) but increases E [ − R (cid:48)
( s, A, S (cid:48) )] , canceling.
Similarly, increasing Φ( s (cid:48) ) increases R (cid:48)
( s, a, s (cid:48) )
but decreases E [ γR (cid:48)
( s (cid:48) , A, S (cid:48) )] .
Finally, E [ γR ( S, A, S (cid:48) )] centers the reward, canceling constant shift.
Proposition 4.2 (The Canonically Shaped Reward is Invariant to Shaping) .
Let R : S ×
A × S → R be a reward function and Φ : S → R a potential function.
Let γ ∈ [0 , 1] be a discount rate, and
D S ∈ ∆( S ) and D A ∈ ∆( A ) be distributions over states and actions.
Let R (cid:48) denote R shaped by Φ : R (cid:48) ( s, a, s (cid:48) )
=
R ( s, a, s (cid:48) )
+ γ Φ( s (cid:48) )
− Φ( s ) .
Then the canonically shaped R (cid:48) and R are equal:
[Equation]
Proposition 4.2 holds for arbitrary distributions D S and D A .
However, in the following Proposition we show that the potential shaping introduced by the canonicalization C D S , D A ( R ) is more inﬂuenced by perturbations to R of higher joint probability transitions ( s, a, s (cid:48) ) .
This suggests choosing D S and
D A to have broad support, making C D S , D A ( R ) more robust to perturbations of any given transition.
Proposition 4.3.
Let S and A be ﬁnite, with |S| ≥ 2 .
Let D S ∈ ∆( S ) and D A ∈ ∆( A ) .
Let
R, ν : S ×
A × S → R be reward functions, with ν ( s, a, s (cid:48) )
=
λ I [( s, a, s (cid:48) )
= ( x, u, x (cid:48) )] , λ ∈ R , x, x (cid:48) ∈ S and u ∈ A .
Let Φ D S , D A ( R )( s, a, s (cid:48) ) =
C D S , D A
( R ) ( s, a, s (cid:48) )
− R ( s, a, s (cid:48) ) .
Then:
[Equation]
We have canonicalized potential shaping; next, we compare the rewards in a scale-invariant manner.
Deﬁnition 4.4.
The Pearson distance between random variables X and Y is deﬁned by the expression
D ρ ( X, Y ) =
(cid:112) 1 − ρ ( X, Y ) / √ 2 , where ρ ( X, Y ) is the Pearson correlation between X and Y .
Lemma 4.5.
The Pearson distance D ρ is a pseudometric.
Moreover, let a, b ∈ (0 , ∞ ) , c, d ∈ R and
X, Y be random variables.
Then it follows that 0 ≤ D ρ ( aX + c, bY + d ) =
D ρ ( X, Y ) ≤ 1 .
We can now deﬁne EPIC in terms of the Pearson distance between canonically shaped rewards.
Deﬁnition 4.6 (Equivalent-Policy Invariant Comparison (EPIC) pseudometric) .
Let D be some coverage distribution over transitions s a → s (cid:48) .
Let S, A, S (cid:48) be random variables jointly sampled from
D .
Let D S and D A be some distributions over states S and A respectively.
The Equivalent-Policy
Invariant Comparison (EPIC) distance between reward functions R A and R B is:
[Equation]
Theorem 4.7.
The Equivalent-Policy Invariant Comparison distance is a pseudometric.
Since EPIC is a pseudometric, it satisﬁes the triangle inequality.
To see why this is useful, consider an environment with an expensive to evaluate ground-truth reward R .
Directly comparing many learned rewards ˆ R to R might be prohibitively expensive.
We can instead pay a one-off cost: query R a ﬁnite number of times and infer a proxy reward R P with D EPIC ( R, R P ) ≤ (cid:15) .
The triangle inequality allows us to evaluate ˆ R via comparison to R P , since D EPIC (ˆ R, R ) ≤ D EPIC (ˆ R, R P ) + (cid:15) .
This is particularly useful for benchmarks, which can be expensive to build but should be cheap to use.
Theorem 4.8.
Let R A , R (cid:48)
A , R B , R (cid:48) B : S ×
A × S → R be reward functions such that R (cid:48)
A ≡ R A and R (cid:48)
B ≡ R B .
Then 0 ≤ D EPIC ( R (cid:48)
A , R (cid:48) B ) =
D EPIC ( R A , R B ) ≤ 1 .
The following is our main theoretical result, showing that D EPIC ( R A , R B ) distance gives an upper bound on the difference in returns under either R A or R B between optimal policies π ∗ R A and π ∗ R B .
In other words, EPIC bounds the R A regret of using π ∗ R B instead of π ∗ R A . Moreover, by symmetry D EPIC ( R A , R B ) also bounds the R B regret of using π ∗ R A instead of π ∗ R B .
Theorem 4.9.
Let M be a γ -discounted MDP\R with ﬁnite state and action spaces S and A .
Let R A , R B : S ×
A × S → R be rewards, and π ∗ A , π ∗ B be respective optimal policies.
Let
D π ( t, s t , a t , s t +1 )
denote the distribution over transitions S ×
A × S induced by policy π at time t , and D ( s, a, s (cid:48) ) be the coverage distribution used to compute D EPIC .
Suppose there exists K > 0 such that K D ( s t , a t , s t +1 ) ≥ D π ( t, s t , a t , s t +1 ) for all times t ∈ N , triples ( s t , a t , s t +1 )
∈ S
×
A × S and policies π ∈ { π ∗ A , π ∗ B } .
Then the regret under R A from executing π ∗ B instead of π ∗ A is at most
G R A ( π ∗ A ) − G R A ( π ∗ [Equation] ≤ [Equation]
K (cid:107)
[Equation]
EPIC ( R A , R B ) .
We generalize the regret bound to continuous spaces in theorem A.16 via a Lipschitz assumption, with Wasserstein distance replacing K .
Importantly, the returns of π ∗ A and π ∗ B converge as
D EPIC ( R A , R B ) → 0 in both cases, no matter which reward function you evaluate on.
The key assumption is that the coverage distribution D has adequate support for transitions occurring in rollouts of π ∗ A and π ∗ B .
The bound is tightest when D is similar to D π ∗ A and D π ∗ B .
However, computing π ∗ A and π ∗ B is often intractable.
The MDP M may be unknown, such as when making predictions about an unseen deployment environment.
Even when M is known, RL is computationally expensive and may fail to converge in non-trivial environments.
In ﬁnite cases, a uniform D satisﬁes the requirements with K ≤ |S| 2 |A| .
In general, it is best to choose D to have broad coverage over plausible transitions.
Broad coverage ensures adequate support for D π ∗ A and D π ∗ B .
Excluding transitions that are unlikely or impossible to occur gives tighter regret bounds due to a smaller K (ﬁnite case) or Wasserstein distance (continuous case).
While EPIC upper bounds policy regret, it does not lower bound it.
In fact, no reward distance can lower bound regret in arbitrary environments.
For example, suppose the deployment environment transitions to a randomly chosen state independent of the action taken.
In this case, all policies obtain the same expected return, so the policy regret is always zero, regardless of the reward functions.
To demonstrate EPIC’s properties, we compare the gridworld reward functions from Figure 1, reporting the distances between all reward pairs in Figure A.2.
Dense is a rescaled and shaped version of Sparse , despite looking dissimilar at ﬁrst glance, so D EPIC ( Sparse , Dense ) = 0 .
By contrast, D EPIC ( Path , Cliff ) = 0 . 27 .
In deterministic gridworlds, Path and Cliff have the same optimal policy, so the rollout method could wrongly conclude they are equivalent.
But in fact the rewards are fundamentally different: if there is a signiﬁcant risk of “slipping” in the wrong direction then the optimal policy for Cliff will walk along the top instead of middle row, incurring a − 1 penalty to avoid the risk of falling into the − 4 “cliff”.
For this example, we used state and action distributions D S and D A uniform over S and A , and coverage distribution D uniform over state-action pairs ( s, a ) , with s (cid:48) deterministically computed.
It is important these distributions have adequate support.
As an extreme example, if D S and D have no support for a particular state then the reward of that state has no effect on the distance.
We can compute
EPIC exactly in a tabular setting, but in general use a sample-based approximation (section A.1.1).
B ASELINE APPROACHES FOR COMPARING REWARD FUNCTIONS
Given the lack of established methods, we develop two alternatives as baselines: Episode Return
Correlation (ERC) and Nearest Point in Equivalence Class (NPEC).
Sparse Reward   - - - - - -  - - - - -  - - - - - -  -
Dense Reward   -   -  -   - -  -   - -  -    -   -  -    -  -
Path Reward   -   -  -   - -  -   - -  -    -   -  -    -  -
Cliff Reward - -
R ( s, s ) is given by the central circle in cell s .
Optimal action(s) (deterministic, inﬁnite horizon, discount γ = 0 . 99 ) have bold labels.
See Figure A.2 for the distances between all reward pairs.
5. E PISODE R ETURN C ORRELATION (ERC)
The goal of an MDP is to maximize expected episode return, so it is natural to compare reward functions by the returns they induce.
If the return of a reward function R A is a positive afﬁne transformation of another reward R B , then R A and R B have the same set of optimal policies.
This suggests using Pearson distance, which is invariant to positive afﬁne transformations.
Deﬁnition 5.1 (Episode Return Correlation (ERC) pseudometric) .
Let D be some distribution over trajectories.
Let E be a random variable sampled from D .
The Episode Return Correlation distance between reward functions R A and R B is the Pearson distance between their episode returns on D ,
D ERC ( R A , R B ) =
D ρ ( g ( E ; R A ) , g ( E ; R B )) .
Prior work has produced scatter plots of the return of R A against R B over episodes [4, Figure 3] and ﬁxed-length segments [10, section D].
ERC is the Pearson distance of such plots, so is a natural baseline.
We approximate ERC by the correlation of episode returns on a ﬁnite collection of rollouts.
ERC is invariant to shaping when the initial state s 0 and terminal state s T are ﬁxed.
Let R be a reward function and Φ a potential function, and deﬁne the shaped reward R (cid:48) ( s, a, s (cid:48) )
=
R ( s, a, s (cid:48) )
+ γ Φ( s (cid:48) )
− Φ( s ) .
The return under the shaped reward on a trajectory τ = ( s 0 , a 0 , · · · , s T ) is g ( τ ; R (cid:48) )
=
g ( τ ; R ) + γ T Φ( s T ) − Φ( s 0 ) .
Since s 0 and s T are ﬁxed, γ T Φ( s T ) − Φ( s 0 ) is constant.
It follows that ERC is invariant to shaping, as Pearson distance is invariant to constant shifts.
In fact, for inﬁnite-horizon discounted MDPs only s 0 needs to be ﬁxed, since γ T Φ( s T ) → 0 as T → ∞ .
However, if the initial state s 0 is stochastic, then the ERC distance can take on arbitrary values under shaping.
Let R A and R B be two arbitrary reward functions.
Suppose that there are at least two distinct initial states, s A and s B , with non-zero measure in D .
Choose potential Φ( s ) =everywhere except Φ( s A ) =
Φ( s B )
=
c , and let R (cid:48)
A and R (cid:48)
B denote R A and R B shaped by Φ .
As c → ∞ , the correlation ρ ( g ( E ; R (cid:48) A ) , g ( E ; R (cid:48) B )) → 1 .
This is since the relative difference tends to zero,
even though g ( E ; R (cid:48) A ) and g ( E ; R (cid:48) B ) continue to have the same absolute difference as c varies.
Consequently, the ERC pseudometric D ERC ( R (cid:48)
A , R (cid:48) B ) → 0 as c → ∞ .
By an analogous argument, setting Φ( s A ) =
c and Φ( s B ) = − c gives D ERC ( R (cid:48)
A , R (cid:48) B ) → 1 as c → ∞ .
5. N EAREST P OINT IN E QUIVALENCE C LASS (NPEC)
NPEC takes the minimum L p distance between equivalence classes.
See section A.3.3 for proofs.
Deﬁnition 5.2 ( L p distance) .
Let D be a coverage distribution over transitions s a → s (cid:48) and let p ≥be a power.
The L p distance between reward functions R A and R B is the L p norm of their difference:
[Equation] [Equation]
[Table]
S S
D D
M
R B
S S
D D
M
R A 0.00 0.51 0.00 0.51 0.
[Figure]
[Figure] [Figure]
[Figure] [Figure]
EPIC
S S
D D
M
R
[Figure]
[Figure] [Figure]
S S
D D
M
[Figure] [Figure]
[Figure]
Key : The agent has position x ∈ R , velocity ˙ x ∈ R and can accelerate ¨ x ∈ R , producing future position x (cid:48) ∈ R .
quadratic penalty on control ¨ x , no control penalty.
S is Sparse( x ) = 1 [ | x | < 0 . 05] , D is shaped Dense( x, x (cid:48) )
=
Sparse( x ) + | x (cid:48) | − | x | , while M is Magnitude( x ) =
−| x | .
The L p distance is affected by potential shaping and positive rescaling that do not change the optimal policy.
A natural solution is to take the distance from the nearest point in the equivalence class:
D U NPEC ( R A , R B ) =
inf R (cid:48)
A ≡ R A D L p , D ( R (cid:48)
A , R B ) .
Unfortunately, D U NPEC is sensitive to R B ’s scale.
It is tempting to instead take the inﬁmum over both arguments of D L p , D .
However, inf
[Equation] [Equation]
) =
since all equivalence classes come arbitrarily close to the origin in L p space.
Instead, we ﬁx this by normalizing D U NPEC .
Deﬁnition 5.3.
NPEC is deﬁned by D NPEC ( R A , R B ) =
D U NPEC
( R A , R B ) /D
U NPEC ( Zero , R B ) when D U NPEC ( Zero , R B ) (cid:54) = 0 , and is otherwise given by D NPEC ( R A , R B ) = 0 .
If D U NPEC ( Zero , R B )
=
then D U NPEC ( R A , R B ) = 0 since R A can be scaled arbitrarily close to
Zero .
Since all policies are optimal for R ≡ Zero , we choose D NPEC ( R A , R B )
=
in this case.
Theorem 5.4.
D NPEC is a premetric on the space of bounded reward functions.
Moreover, let
R A , R A (cid:48) , R B , R B (cid:48) :
S ×
A × S → R be bounded reward functions such that R
A ≡ R A (cid:48) and
R B ≡ R B (cid:48) .
Then 0 ≤ D NPEC ( R A (cid:48) , R B (cid:48) )
=
D NPEC ( R A , R B ) ≤ 1 .
Note that D NPEC may not be symmetric and so is not, in general, a pseudometric: see proposition A.3. The inﬁmum in D U NPEC can be computed exactly in a tabular setting, but in general we must approximate it using gradient descent.
This gives an upper bound for D U NPEC , but the quotient of upper bounds D NPEC may be too low or too high.
See section A.1.2 for details of the approximation.
E XPERIMENTS
We evaluate EPIC and the baselines ERC and NPEC in a variety of continuous control tasks.
In section 6.1, we compute the distance between hand-designed reward functions, ﬁnding EPIC to be the most reliable.
NPEC has substantial approximation error, and ERC sometimes erroneously assigns high distance to equivalent rewards.
Next, in section 6.2 we show EPIC is robust to the exact choice of coverage distribution D , whereas ERC and especially NPEC are highly sensitive to the choice of D .
Finally, in section 6.3 we ﬁnd that the distance of learned reward functions to a ground-truth reward predicts the return obtained by policy training, even in an unseen test environment.
6. C OMPARING HAND - DESIGNED REWARD FUNCTIONS
We compare procedurally speciﬁed reward functions in four tasks, ﬁnding that EPIC is more reliable than the baselines, and more computationally efﬁcient than NPEC.
Figure 2 presents results in the proof-of-concept PointMass task.
The results for Gridworld , HalfCheetah and Hopper , in section A.2.4, are qualitatively similar.
[Table]
In
[Table]
can accelerate left
[Table]
right on a line.
The reward functions include ( ) or exclude ( ) a quadratic penalty (cid:107) a (cid:107) 22 .
The sparse reward ( S ) gives a reward of 1 in the region around the goal state.
The dense reward ( D ) is a shaped version of the sparse reward.
The magnitude reward ( M ) is the negative distance of the agent from the goal.
We ﬁnd that EPIC correctly identiﬁes the equivalent reward pairs ( S - D and S - D ) with estimated distance < 1 × 10 − 3 .
By contrast, NPEC has substantial approximation error:
D NPEC ( D , S ) = 0 .
Similarly, D ERC ( D , S ) = 0 .
56 due to ERC’s erroneous handling of stochastic initial states.
Moreover, NPEC is computationally inefﬁcient: Figure 2(b) took 31 hours to compute.
By contrast, the ﬁgures for EPIC and ERC were each generated in under an hour.
See section A.2.6 for more information on runtimes.
6. S ENSITIVITY OF REWARD DISTANCE TO COVERAGE DISTRIBUTION
Reward distances should be robust to the choice of coverage distribution D .
In Table 2 (center), we report distances from the ground-truth reward ( GT ) to reward functions (rows) across coverage distributions D ∈ { π uni , π ∗ , Mix } (columns).
We ﬁnd EPIC is fairly robust to the choice of D with a similar ratio between rows in each column D .
By contrast, ERC and especially NPEC are substantially more sensitive to the choice of D .
We evaluate in the PointMaze MuJoCo task from Fu et al.
[8], where a point mass agent must navigate around a wall to reach a goal.
The coverage distributions D are induced by rollouts from three different policies: π uni takes actions uniformly at random, producing broad support over transitions; π ∗ is an expert policy, yielding a distribution concentrated around the goal; and Mix is a mixture of the two.
In EPIC, D S and D A are marginalized from D and so also vary with D .
We evaluate four reward learning algorithms: Regress ion onto reward labels [ target method from 6, section 3.3], Pref erence comparisons on trajectories [6], and adversarial IRL with a state-only ( AIRL
SO )
and state-action ( AIRL SA ) reward model [8].
All models are trained using synthetic data from an oracle with access to the ground-truth; see section A.2.2 for details.
We ﬁnd EPIC is robust to varying D when comparing the learned reward models: the distance varies by less than 2 × , and the ranking between the reward models is the same across coverage distributions.
By contrast, NPEC is highly sensitive to D : the ratio of AIRL SO ( 817 ) to Pref ( 8 . 51 ) is 96 :under π uni
but only 2 : 1 ( 2706 : 1333 ) under π ∗ .
ERC lies somewhere in the middle: the ratio is 22 : 1 ( 549 : 24 . 9 ) under π uni and 3 : 2 ( 523 : 360 ) under π ∗ .
We evaluate the effect of pathological choices of coverage distribution D in Table A.8.
For example,
Ind independently samples states and next states, giving physically impossible transitions, while Jail constrains rollouts to a tiny region excluding the goal.
We ﬁnd that the ranking of EPIC changes in only one distribution, whilst the ranking of NPEC changes in two cases and ERC changes in all cases.
However, we do ﬁnd that EPIC is sensitive to D on Mirage , a reward function we explicitly designed to break these methods.
Mirage assigns a larger reward when close to a “mirage” state than when at the true goal, but is identical to GT at all other points.
The “mirage” state is rarely visited by random exploration π uni as it is far away and on the opposite side of the wall from the agent.
The expert policy π ∗ is even less likely to visit it, as it is not on or close to the optimal path to the goal.
As a result, the EPIC distance from Mirage to GT (Table 2, bottom row) is small under π uni and π ∗ .
In general, any black-box method for assessing reward models – including the rollout method – only has predictive power on transitions visited during testing.
Fortunately, we can achieve a broad support over states with Mix : it often navigates around the wall due to π ∗ , but strays from the goal thanks to π uni .
As a result, EPIC under Mix correctly infers that Mirage is far from the ground-truth GT .
These empirical results support our theoretically inspired recommendation from section 4: “in general, it is best to choose D to have broad coverage over plausible transitions.”
Distributions such as π ∗ are too narrow, assigning coverage only on a direct path from the initial state to the goal.
Very broad distributions such as Ind waste probability mass on impossible transitions like teleporting.
Distributions like Mix strike the right balance between these extremes.
6. P REDICTING POLICY PERFORMANCE FROM REWARD DISTANCE
We ﬁnd that low distance from the ground-truth reward GT (Table 2, center) predicts high GT return (Table 2, right) of policies optimized for that reward.
Moreover, the distance is predictive of return not just in PointMaze-Train where the reward functions were trained and evaluated in, but also in the unseen variant PointMaze-Test .
This is despite the two variants differing in the position of the wall, such that policies for PointMaze-Train run directly into the wall in PointMaze-Test .
Both Regress and Pref achieve very low distances at convergence, producing near-expert policy performance.
The AIRL SO and AIRL SA models have reward distances an order of magnitude higher and poor policy performance.
Yet intriguingly, the generator policies for AIRL SO and AIRL
SA – trained simultaneously with the reward – perform reasonably in PointMaze-Train .
This suggests the learned rewards are reasonable on the subset of transitions taken by the generator policy, yet fail to transfer to the different transitions taken by a policy being trained from scratch.
Figure A.6 shows reward distance and policy regret during reward model training.
The lines all closely track each other, showing that the distance to GT is highly correlated with policy regret for intermediate reward checkpoints as well as at convergence.
Regress and Pref converge quickly to low distance and low regret, while AIRL SO and AIRL SA are slower and more unstable.
C ONCLUSION
Our novel EPIC distance compares reward functions directly, without training a policy.
We have proved it is a pseudometric, is bounded and invariant to equivalent rewards, and bounds the regret of optimal policies (Theorems 4.7, 4.8 and 4.9).
Empirically, we ﬁnd EPIC correctly infers zero distance between equivalent reward functions that the NPEC and ERC baselines wrongly consider dissimilar.
Furthermore, we ﬁnd the distance of learned reward functions to the ground-truth reward predicts the return of policies optimized for the learned reward, even in unseen environments.
Standardized metrics are an important driver of progress in machine learning.
Unfortunately, traditional policy-based metrics do not provide any guarantees as to the ﬁdelity of the learned reward function.
We believe the EPIC distance will be a highly informative addition to the evaluation toolbox, and would encourage researchers to report EPIC distance in addition to policy-based metrics.
Our implementation of EPIC and our baselines, including a tutorial and documentation, are available at https://github.com/HumanCompatibleAI/evaluating-rewards .
A CKNOWLEDGEMENTS
Thanks to Sam Toyer, Rohin Shah, Eric Langlois, Siddharth Reddy and Stuart Armstrong for helpful discussions; to Miljan Martic for code-review; and to David Krueger, Matthew Rahtz, Rachel
Freedman, Cody Wild, Alyssa Dayan, Adria Garriga, Jon Uesato, Zac Kenton and Alden Hung for feedback on drafts. This work was supported by Open Philanthropy
A S UPPLEMENTARY MATERIAL A. A PPROXIMATION P ROCEDURES A.1. S AMPLE - BASED APPROXIMATION FOR EPIC DISTANCE
We approximate EPIC distance (deﬁnition 4.6) by estimating Pearson distance on a set of samples, canonicalizing the reward on-demand.
Speciﬁcally, we sample a batch B V of N V samples from the coverage distribution D , and a batch B M of N M samples from the joint state and action distributions D
S × D A .
For each ( s, a, s (cid:48) )
∈ B V , we approximate the canonically shaped rewards (deﬁnition 4.1) by taking the mean over B M :
[Equation]
We drop the constant c from the approximation since it does not affect the Pearson distance; it can also be estimated in O ( N 2 M ) time by c =
γN 2 M (cid:80) ( x, · ) ∈ B M (cid:80) ( x (cid:48) ,u ) ∈
B M R ( x, u, x (cid:48) ) .
Finally, we compute the Pearson distance between the approximate canonically shaped rewards on the batch of samples
B V , yielding an O ( N V N M ) time algorithm.
A.1. O PTIMIZATION - BASED APPROXIMATION FOR NPEC DISTANCE
D NPEC ( R A , R B ) (section 5.2) is deﬁned as the inﬁmum of L p distance over an inﬁnite set of equivalent reward functions R ≡ R A .
We approximate this using gradient descent on the reward model
[Equation]
where ν, c ∈ R are scalar weights and w is a vector of weights parameterizing a deep neural network Φ w .
The constant c ∈ R is unnecessary if Φ w has a bias term, but its inclusion simpliﬁes the optimization problem.
We optimize ν, c, w to minimize the mean of the cost
[Equation]
on samples ( s, a, s (cid:48) ) from a coverage distribution D .
Note
[Equation]
upper bounds the true NPEC distance since R ν,c,w ≡ R A .
We found empirically that ν and c need to be initialized close to their optimal values for gradient descent to reliably converge.
To resolve this problem, we initialize the afﬁne parameters to ν ← log λ and c found by:
[Equation]
We use the active set method of Lawson & Hanson [11] to solve this constrained least-squares problem.
These initial afﬁne parameters minimize the L p distance D L p , D ( R ν,c, 0 ( s, a, s (cid:48) ) ,
R B ( s, a, s (cid:48) ))
when p = 2 with the potential ﬁxed at Φ 0 ( s ) = 0 .
A.1. C ONFIDENCE I NTERVALS
We report conﬁdence intervals to help measure the degree of error introduced by the approximations.
Since approximate distances may not be normally distributed, we use bootstrapping to produce a distribution-free conﬁdence interval.
For EPIC, NPEC and Episode Return (sometimes reported as regret rather than return), we compute independent approximate distances or returns over different
[Table]
All
[Table]
All
[Table]
All
[Table]
All
[Table]
All
[Table]
All
[Table]
All
[Table]
All
[Table]
All
[Table]
All
[Table]
All
[Table]
All
[Table]
All
[Table]
All
[Table]
All
[Table]
All
See Table A.2 for the policy training hyperparameters seeds, and then compute a bootstrapped conﬁdence interval for each seed.
We use 30 seeds for
EPIC, but only 9 seeds for computing Episode Return and 3 seeds for NPEC due to their greater computational requirements.
In ERC, computing the distance is very fast, so we instead apply bootstrapping to the collected episodes , computing the ERC distance for each bootstrapped episode sample.
A. E XPERIMENTS A.2. H YPERPARAMETERS FOR A PPROXIMATE D ISTANCES
Table A.1 summarizes the hyperparameters and distributions used to compute the distances between reward functions.
Most parameters are the same across all environments.
We use a coverage distribution of uniform random transitions D unif in the simple GridWorld environment with known determinstic dynamics.
In other environments, the coverage distribution is sampled from rollouts of a policy.
We use a random policy π uni for PointMass , HalfCheetah and Hopper in the handdesigned reward experiments (section 6.1).
In PointMaze , we compare three coverage distributions (section 6.2) induced by rollouts of π uni , an expert policy π ∗ and a Mix ture of the two policies, sampling actions from either π uni or π ∗ and switching between them with probability 0 .
05 per time step.
[Table] [Table]
[Table] [Table]
A.2. T RAINING L EARNED R EWARD M ODELS
For the experiments on learned reward functions (sections 6.3 and 6.2), we trained reward models using adversarial inverse reinforcement learning (AIRL; 8), preference comparison [6] and by regression onto the ground-truth reward [ target method from 6, section 3.3].
For AIRL, we use an existing open-source implementation [24].
We developed new implementations for preference comparison and regression, available at https://github.com/HumanCompatibleAI/ evaluating-rewards .
We also use the RL algorithm proximal policy optimization (PPO; 19) on the ground-truth reward to train expert policies to provide demonstrations for AIRL.
We useseeds, taking rollouts from the seed with the highest ground-truth return.
Our hyperparameters for PPO in Table A.2 were based on the defaults in Stable Baselines [9].
We only modiﬁed the batch size and learning rate, and disabled value function clipping to match the original PPO implementation.
Our AIRL hyperparameters in Table A.3 likewise match the defaults, except for increasing the total number of timesteps to 10 6 .
Due to the high variance of AIRL, we trained 5 seeds, selecting the one with the highest ground-truth return.
While this does introduce a positive bias for our AIRL results, in spite of this AIRL performed worse in our tests than other algorithms.
Moreover, the goal in this paper is to evaluate distance metrics, not reward learning algorithms.
For preference comparison we performed a sweep over batch size, trajectory length and learning rate to decide on the hyperparameters in Table A.4.
Total time steps was selected once diminishing returns were observed in loss curves.
The exact value of the regularization weight was found to be unimportant, largely controlling the scale of the output at convergence.
Finally, for regression we performed a sweep over batch size, learning rate and total time steps to decide on the hyperparameters in Table A.5.
We found batch size and learning rate to be relatively unimportant with many combinations performing well, but regression was found to converge slowly but steadily requiring a relatively large 10 × 10 6 time steps for good performance in our environments.
All algorithms are trained on synthetic data generated from the ground-truth reward function.
AIRL is provided with a large demonstration dataset of 100 000 time steps from an expert policy trained on the ground-truth reward (see Table A.3).
In preference comparison and regression, each batch is sampled afresh from the coverage distribution speciﬁed in Table A.1 and labeled according to the ground-truth reward.
A.2. C OMPUTING INFRASTRUCTURE
Experiments were conducted on a workstation (Intel i9-7920X CPU with 64 GB of RAM), and a small number of r5.24xlarge AWS VM instances, with 48 CPU cores on an Intel Skylake processor and 768 GB of RAM.
It takes less than three weeks of compute on a single r5.24xlarge instance to run all the experiments described in this paper.
A.2. C OMPARING HAND - DESIGNED REWARD FUNCTIONS
We compute distances between hand-designed reward functions in four environments: GridWorld ,
PointMass , HalfCheetah and Hopper .
The reward functions for GridWorld are described in Figure A.1, and the distances are reported in Figure A.2.
We report the approximate distances and conﬁdence intervals between reward functions in the other environments in Figures A.3, A.4 and A.5.
We ﬁnd the (approximate) EPIC distance closely matches our intuitions for similarity between the reward functions.
NPEC often produces similar results to EPIC, but unfortunately is dogged by optimization error.
This is particularly notable in higher-dimensional environments like HalfCheetah and Hopper , where the NPEC distance often exceeds the theoretical upper bound of 1 .
and the conﬁdence interval width is frequently larger than 0 . 2 .
By contrast, ERC distance generally has a tight conﬁdence interval, but systematically fails in the presence of shaping.
For example, it conﬁdently assigns large distances between equivalent reward pairs in PointMass such as S - D .
However, ERC produces reasonable results in
HalfCheetah and Hopper where rewards are all similarly shaped.
In fact, ERC picks up on a detail in Hopper that EPIC misses: whereas EPIC assigns a distance of around 0 .
71 between
[Table]
all rewards of different types (running vs backﬂipping)
, ERC lower distances when the rewards are in the same direction (forward or backward).
Given this, ERC may be attractive in some circumstances, especially given the ease of implementation.
However, we would caution against using it in isolation due to the likelihood of misleading results in the presence of shaping.
A.2. C OMPARING LEARNED REWARD FUNCTIONS
Previously, we reported the mean approximate distance from a ground-truth reward of four learned reward models in PointMaze (Table 2).
Since these distances are approximate, we report 95% lower and upper bounds computed via bootstrapping in Table A.7.
We also include the relative difference of the upper and lower bounds from the mean, ﬁnding the relative difference to be fairly consistent across reward models for a given algorithm and coverage distribution pair.
The relative difference is less than 1% for all EPIC and ERC distances.
However, NPEC conﬁdence intervals can be as wide as 50%: this is due to the method’s high variance, and the small number of seeds we were able to run because of the method’s computational expense.
A.2. R UNTIME OF D ISTANCE M ETRICS
We report the empirical runtime for EPIC and baselines in Table A.6, performing 25 pairwise comparisons across 5 reward functions in PointMass .
These comparisons were run on an unloaded machine running Ubuntu 20.04 (kernel 5.4.0-52) with an Intel i9-7920X CPU and 64 GB of RAM.
We report sequential runtimes: runtimes for all methods could be decreased further by parallelizing across seeds.
The algorithms were conﬁgured to use 8 parallel environments for sampling.
Inference and training took place on CPU.
All methods used the same TensorFlow conﬁguration, parallelizing operations across threads both within and between operations.
We found GPUs offered no performance beneﬁt in this setting, and in some cases even increased runtime.
This is due to the ﬁxed cost of CPU-GPU communication, and the relatively small size of the observations.
We ﬁnd that in just 17 seconds EPIC can provide results with a 95% conﬁdence interval < 0 . 023 , an order of magnitude tighter than NPEC running for over 8 hours.
Training policies for all learned rewards in this environment using PPO is comparatively slow, taking over 4 hours even with onlyseeds.
While ERC is relatively fast, it takes a large number of samples to achieve tight conﬁdence intervals.
Moreover, since PointMass has stochastic initial states, ERC can take on arbitrary values under shaping, as discussed in sections 5.1 and 6.3.
Sparse Reward - - - - - -  - - - - -  - - - - - -  -
Dense Reward         -      -       -
Penalty Reward
Center Reward      -   -  -   - -  -   - -  -    -   -  -    -  -
Path Reward   -   -  -   - -  -   - -  -    -   -  -    -  -
Cliff Reward - - - -      - - - -      - - - -
Sparse
Dense
Center
Penalty
Path
Cliff
[Table]
Sparse
Dense
Center
Penalty
Path
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
Sparse
Dense
Center
Penalty
Path
Cliff
[Table]
Sparse
Dense
Center
Penalty
[Table]
Cliff
[Table]
[Figure]
S S
D D
M
[Table]
B
S S
D D
M
R A
[Table]
[Table] [Table]
S S
D D
M
R B
S S
D D
M
[Table]
A 6e-5 2e-3 9e-5 2e-3 9e-
[Table]
2e
[Table]
3 6e-5 2e-3 5e-5 2e9e
[Table]
5 2e-3 7e
[Table]
5 2e
[Table]
3 9e
[Table]
3 5e
[Table]
5 2e
[Table]
3 5e
[Table]
5 2e
[Table]
9e
[Table]
4 2e
[Table]
4 2e
[Table]
5e
[Table] [Table]
S S
D D
M
R B 2e-5 9e
[Table]
3 3e
[Table]
2 2e-2 2e9e-2 9e-7 2e-1 4e-3 1e1e-
1e-2 1e-5 6e-3 1e6e-
2e-3 9e-2 2e-6 6e1e-
1e-1 3e-1 1e-2 4e-
[Figure]
NPEC CI Width
S S
D D
M
R B 7e-9 1e-2 4e-3 4e-3 3e1e-2 7e-9 6e-3 5e-
4e4e-3 6e-3 1e-8 1e-3 4e4e-
5e-3 1e-3 1e-8 4e3e-
4e-3 4e-3 4e-3 7e0 .0 .1 .
D W ( R A , R
B ) (f) ERC CI Width quadratic penalty on control ¨ x , no control penalty.
S is
M is
Conﬁdence Interval (CI) : 95% CI computed by bootstraping over 10 000 samples.
[Figure]
[Table]
[Figure]
[Table]
[Figure] [Table] [Table]
[Table] [Table]
[Table] [Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
EPIC Median
[Figure] [Figure]
Median
R B 0.00 0.02 1.00 1.
0 .0 .0 .0 .1 .¯
D ( R
A , R
B ) (c
[Figure]
ERC Median
[Figure]
A 5e-5 6e-4 1e-8 1e6e-4 5e-5 1e-4 4e1e-
1e-
5e-5 7e1e-4 4e-4 7e-4 6e-
[Figure]
R B 1e-2 1e-2 1e-1 3e2e-
1e-2 1e-2 1e2e-1 2e-1 1e-2 1e3e-1 8e-2 9e-3 1e-
[Figure]
Width
R B 1e-8 2e-4 1e-16 3e2e-4 1e-8 3e-6 1e1e-16 3e-6 1e-8 2e3e-
1e-5 2e-4 1e0 .0 .0 .0 .1 .
[Figure]
quadratic control penalty, no control penalty.
Conﬁdence Interval (CI) : 95% CI computed by bootstraping over 10 000 samples.
[Table]
[Figure]
[Table]
[Figure]
[Table] [Figure] [Table] [Figure]
[Table]
[Figure]
[Table] [Figure] [Table] [Table]
[Table] [Table] [Table] [Table]
−
[Table]
− [Table] [Table] [Table]
[Table] [Table] [Table] [Table]
[Table] [Table] [Table] −
[Table]
−
[Table] [Table] [Table] [Table]
[Table] [Table] [Table] [Table]
−
[Table]
− [Table] [Table] [Table]
−
[Table] [Table] [Table] [Table]
−
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
−
[Table]
−
[Table]
[Table]
−
[Table]
−
[Table]
[Table]
[Table]
[Table]
[Table]
<
[Table]
[Table] [Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
AIRL SO 573 541
[Table]
AIRL SA
[Table] [Table]
[Table] [Table]
[Table]
AIRL SO
[Table] [Table]
AIRL SA
[Table] [Table]
[Table] [Table]
AIRL SO
[Table]
AIRL SA
[Table]
Regress Training Progress (%) 0 .0 .1 .
D i s t a n ce
R e g r e t
EPIC
NPEC
ERC
RL Train
RL Test
[Figure]
Pref Training Progress (%) 0 .0 .1 .
D i s t a n ce
R e g r e t
EPIC
NPEC
ERC
RL Train
RL Test
[Figure] [Figure]
AIRL SO Training Progress (%
[Figure]
D i s t a n ce
R e g r e t
EPIC
NPEC
ERC
RL Train
RL Test
[Figure]
[Figure] [Figure]
D i s t a n ce
R e g r e t
EPIC
NPEC
ERC
RL Train
RL Test
[Figure] [Figure]
AIRL SA AIRL SO
Pref
Regress
[Figure]
Pref
Regress
[Figure]
Pref
[Figure]
A. P ROOFS A.3. B ACKGROUND
Proposition 3.4.
The binary relation ≡ is an equivalence relation.
Let R A , R B , R C : S×A×S → R be bounded reward functions.
Then ≡ is reﬂexive, R A ≡ R A ; symmetric, R A ≡ R B implies
R B ≡ R A ; and transitive, ( R A ≡ R B )
∧ ( R B ≡ R C ) implies R A ≡ R C .
Proof.
R A ≡ R A since choosing λ = 1 > 0 and Φ( s ) = 0 , a bounded potential function, we have
R A ( s, a, s (cid:48) )
=
λR A ( s, a, s (cid:48) )
+ γ Φ( s (cid:48) )
− Φ( s ) for all s, s (cid:48) ∈ S and a ∈ A .
Suppose R A ≡ R B .
Then there exists some λ > 0 and a bounded potential function Φ : S → R such that R B ( s, a, s (cid:48) )
=
λR A ( s, a, s (cid:48) )
+ γ Φ( s (cid:48) )
− Φ( s ) for all s, s (cid:48) ∈ S and a ∈ A .
Rearranging:
[Equation]
Since 1 λ > 0 and Φ (cid:48) ( s ) = − 1 λ Φ( s ) is a bounded potential function, it follows that R B ≡ R A .
Finally, suppose R A ≡ R B and R B ≡ R C .
Then there exists some λ 1 , λ 2 > 0 and bounded potential functions
Φ 1 , Φ 2 : S → R such that for all s, s (cid:48) ∈ S and a ∈ A :
[Equation]
Substituting the expression for R B into the expression for R C :
[Equation]
where λ = λ 1 λ 2 > 0 and Φ( s ) =
λ 2 Φ 1 ( s ) + Φ 2 ( s ) is bounded.
Thus R A ≡ R C .
A.3. E QUIVALENT -P OLICY I NVARIANT C OMPARISON (EPIC) PSEUDOMETRIC
Proposition 4.2 (The Canonically Shaped Reward is Invariant to Shaping) .
Let R : S ×
A × S → R be a reward function and Φ : S → R a potential function.
Let γ ∈ [0 , 1] be a discount rate, and
D S ∈ ∆( S ) and D A ∈ ∆( A ) be distributions over states and actions.
Let R (cid:48) denote R shaped by Φ : R (cid:48) ( s, a, s (cid:48) )
=
R ( s, a, s (cid:48) )
+ γ Φ( s (cid:48) )
− Φ( s ) .
Then the canonically shaped R (cid:48) and R are equal:
[Equation]
Proof.
Let s
[Equation]
a, s (cid:48)
∈ S ×
A × S .
Then by substituting in the deﬁnition of R (cid:48) and using linearity of expectations:
[Equation]
where the penultimate step uses E
[Φ( S (cid:48) )]
=
E [Φ( S )] since S and S (cid:48) are identically distributed.
Proposition 4.3.
Let S and A be ﬁnite, with |S| ≥ 2 .
Let D S ∈ ∆( S ) and D A ∈ ∆( A ) .
Let
R, ν : S ×
A × S → R be reward functions, with ν ( s, a, s (cid:48) )
=
λ I [( s, a, s (cid:48) )
= ( x, u, x (cid:48) )] , λ ∈ R , x, x (cid:48) ∈ S and u ∈ A .
Let Φ D S , D A ( R )( s, a, s (cid:48) ) =
C D S , D A
( R ) ( s, a, s (cid:48) )
− R ( s, a, s (cid:48) ) .
Then:
[Equation]
Proof.
Observe that:
[Equation]
where S and S (cid:48) are random variables independently sampled from D S , and A independently sampled from D A .
Then:
[Equation]
Now:
[Equation]
where the ﬁnal step follows by substituting s = x and s (cid:48) (cid:54)
=
x (using |S| ≥ 2 ).
Lemma 4.5.
The Pearson distance D ρ is a pseudometric.
Moreover, let a, b ∈ (0 , ∞ ) , c, d ∈ R and
X, Y be random variables.
Then it follows that 0 ≤ D ρ ( aX + c, bY + d ) =
D ρ ( X, Y ) ≤ 1 .
Proof.
For a non-constant random variable V , deﬁne a standardized (zero mean and unit variance) version:
[Equation]
[Equation]
The Pearson correlation coefﬁcient on random variables A and B is equal to the expected product of these standardized random variables:
[Equation]
Let W , X , Y be random variables.
Identity .
Have ρ ( X, X ) = 1 , so D
ρ ( X, X ) = 0 .
Symmetry .
Have ρ ( X, Y )
=
ρ ( Y, X ) by commutativity of multiplication, so D
ρ ( X, Y ) =
D ρ ( Y, X ) .
Triangle Inequality .
For any random variables A, B :
[Equation]
[Equation]
Since (cid:104) A, B (cid:105) =
E [ AB ] is an inner product over R , it follows by the Cauchy-Schwarz inequality that
E [ AB ] ≤ (cid:112) E
[ A 2 ] E [ B 2 ] .
So:
[Equation]
Taking the square root of both sides:
[Equation]
as required.
Positive Afﬁne Invariant and Bounded D ρ ( aX + c, bY + d )
=
D ρ ( X, Y ) is immediate from ρ ( X, Y ) invariant to positive afﬁne transformations.
Have − 1 ≤ ρ ( X, Y ) ≤ 1 , so 0 ≤ 1 − ρ ( X, Y ) ≤ 2 thus 0 ≤ D ρ ( X, Y ) ≤ 1 .
Theorem 4.7.
The Equivalent-Policy Invariant Comparison distance is a pseudometric.
Proof.
The result follows from D ρ being a pseudometric.
Let R A , R B and R C be reward functions mapping from transitions S ×
A × S to real numbers R .
Identity .
Have:
[Equation] [Equation]
since D ρ ( X, X ) = 0 .
Symmetry .
Have:
[Equation]
since D ρ ( X, Y ) =
D ρ ( Y, X ) .
Triangle Inequality .
Have:
[Equation]
since D ρ ( X, Z ) ≤ D ρ ( X, Y )
+ D ρ ( Y, Z ) .
Theorem 4.8.
Let R A , R (cid:48)
A , R B , R (cid:48) B : S ×
A × S → R be reward functions such that R (cid:48)
A ≡ R A and R (cid:48)
B ≡ R B .
Then 0 ≤ D EPIC ( R (cid:48)
A , R (cid:48) B ) =
D EPIC ( R A , R B ) ≤ 1 .
Proof.
Since D EPIC is deﬁned in terms of D ρ , the bounds 0 ≤ D EPIC ( R (cid:48)
A , R (cid:48) B ) and
D EPIC ( R A , R B ) ≤ 1 are immediate from the bounds in lemma 4.5.
Since R (cid:48)
A ≡ R A and R (cid:48)
B ≡ R B , we can write for X ∈ { A, B } :
[Equation] [Equation]
for some scaling factor λ X > 0 and potential function Φ X : S → R .
By proposition 4.2:
[Equation]
Moreover, since C D S , D A ( R ) is deﬁned as an expectation over R and expectations are linear:
[Equation]
Unrolling the deﬁnition of D EPIC and applying this result gives:
[Equation]
lemma 4.
[Equation]
A.3. N EAREST P OINT IN E QUIVALENCE C LASS (NPEC) PREMETRIC
Proposition A.1.
(1) D L p , D is a metric in L p space, where functions f and g are identiﬁed if they agree almost everywhere on D .
(2) D L p , D is a pseudometric if functions are identiﬁed only if they agree at all points.
Proof.
(1) D L p , D is a metric in the L p space since L p is a norm in the L p space, and d ( x, y )
= (cid:107) x − y (cid:107) is always a metric.
As f = g at all points implies f = g almost everywhere, certainly D L p , D ( R, R ) = 0 .
Symmetry and triangle inequality do not depend on identity so still hold.
Proposition A.2 (Properties of D U NPEC ) .
Let R A , R B , R C : S ×
A × S → R be bounded reward functions, and λ ≥ 0 .
Then D U NPEC :
• Is invariant under ≡ in source :
[Equation]
Invariant under scale-preserving ≡ in target
[Equation]
• Scalable in target :
[Equation]
• Bounded :
[Equation]
Proof.
We will show each case in turn.
Invariance under ≡ in source
If R A ≡ R B , then:
[Equation]
[Equation] [Equation]
[Equation]
61) since R ≡ R A if and only if R ≡ R B as ≡ is an equivalence relation.
Invariance under scale-preserving ≡ in target
If R B − R C ≡ Zero , then we can write R B ( s, a, s (cid:48) )
− R C ( s, a, s (cid:48) )
= γ Φ( s (cid:48) ) − Φ( s ) for some potential function Φ : S → R .
Deﬁne f ( R )( s, a, s (cid:48) )
=
R ( s, a, s (cid:48) ) − γ Φ( s (cid:48) )
+ Φ( s ) .
Then for any reward function R : S ×
A × S → R :
[Equation] [Equation]
Crucially, note f ( R ) is a bijection on the equivalence class
[ R ] .
Now, substituting this into the expression for the NPEC premetric:
[Equation] [Equation]
Scalable in target
First, note that D L p , D is absolutely scalable in both arguments:
[Equation]
E linear
[Equation] [Equation]
Now
[Equation]
for λ >
[Equation]
applying this to D U NPEC :
[Equation] [Equation]
In the case λ = 0 , then:
[Equation]
Rearranging, we have:
[Equation]
Bounded
Let d (cid:44) D NPEC ( Zero , R B ) .
Then for any (cid:15) > 0 , there exists some potential function Φ : S → R such that the L p distance of the potential shaping R ( s, a, s (cid:48) )
(cid:44) γ Φ( s ) − Φ( s ) from R B satisﬁes:
[Equation]
Let λ ∈
Deﬁne:
[Equation]
s
[Equation]
Now:
[Equation]
Since R A is bounded, D L p , D ( R A , Zero ) must be ﬁnite, so:
[Equation]
[Equation]
It follows that for any (cid:15) > 0 there exists some λ > 0 such that:
[Equation] [Equation]
Note that R
A ≡ R (cid:48) λ for all λ > 0 .
So:
[Equation] [Equation]
prop.
A.
[Equation] [Equation]
eq.
76 and eq.
[Equation] [Equation]
Since (cid:15) > 0 can be made arbitrarily small, it follows:
[Equation]
89) completing the proof.
Theorem 5.4.
D NPEC is a premetric on the space of bounded reward functions.
Moreover, let
R A , R A (cid:48) , R B , R B (cid:48) :
S ×
A × S → R be bounded reward functions such that R
A ≡ R A (cid:48) and
R B ≡ R B (cid:48) .
Then 0 ≤ D NPEC ( R A (cid:48) , R B (cid:48) )
=
D NPEC ( R A , R B ) ≤ 1 .
Proof.
We will ﬁrst prove D NPEC is a premetric, and then prove it is invariant and bounded.
Premetric
First, we will show that D NPEC is a premetric.
Respects identity:
[Equation]
If D U NPEC ( Zero , R A ) =
then D NPEC
( R A , R A )
= 0 as required.
Suppose from now on that
D U NPEC ( R A , R A ) (cid:54) = 0 .
It follows from prop A.1 that D L p , D ( R A , R A )
= 0 .
Since X ≡ X , 0 is an upper bound for D U
NPEC
( R A , R A ) .
By prop A.1 D L p , D is non-negative, so this is also a lower bound for D U
NPEC
( R A , R A ) .
So D U NPEC ( R A , R A )
=
and:
[Equation]
Well-deﬁned: D NPEC ( R A , R B ) ≥
By prop A.1, it follows that D L p , D ( R, R B ) ≥ 0 for all reward functions R : S ×
A × S .
Thus 0 is a lower bound for { D L p , D ( R, R B ) | R : S ×
A × S} , and thus certainly a lower bound for { D L p , D ( R, Y ) | R ≡ X } for any reward function X .
Since the inﬁmum is the greatest lower bound, it follows that for any reward function X :
[Equation] [Equation]
In the case that D U NPEC ( Zero , R B ) = 0 , then D NPEC ( R A , R B ) = 0 which is non-negative.
From now on, suppose that D U NPEC ( Zero , R B ) (cid:54) = 0 .
The quotient of a non-negative value with a positive value is non-negative, so:
[Equation]
Invariant and Bounded
Since R (cid:48)
B ≡ R B , we have R (cid:48)
B − λR B ≡ Zero for some λ > 0 .
By proposition A.2, D U NPEC is invariant under scale-preserving ≡ in target and scalable in target.
That is, for any reward R :
[Equation]
In particular, D U NPEC ( Zero , R B (cid:48) )
=
λD U NPEC
( Zero , R B ) .
As λ > 0 , it follows that
[Equation]
Suppose D U NPEC ( Zero , R B ) = 0 .
Then D NPEC ( R, R B ) =
= D NPEC ( R, R B (cid:48) ) for any reward
R , so the result trivially holds.
From now on, suppose D U NPEC ( Zero , R B ) (cid:54)
= 0 .
By proposition A.2, D U NPEC is invariant to ≡ in source.
That is, D U NPEC ( R A , R B ) =
D U NPEC ( R (cid:48)
A , R B ) , so:
[Equation]
By eq.
[Equation]
Since D NPEC is a premetric it is non-negative.
By the boundedness property of proposition A.2,
[Equation]
R
[Equation]
so:
[Equation]
which completes the proof.
Note when D L p , D is a metric, then D NPEC ( X, Y )
=
if and only if X = Y .
Proposition A.3.
D NPEC is not symmetric in the undiscounted case.
Proof.
We will provide a counterexample showing that D NPEC is not symmetric.
Choose the state space S to be binary { 0 , 1 } and the actions A to be the singleton { 0 } .
Choose the coverage distribution D to be uniform on s
→ s for s ∈ S .
Take γ = 1 , i.e. undiscounted.
Note that as the successor state is always the same as the start state, potential shaping has no effect on D L p , D , so WLOG we will assume potential shaping is always zero.
Now, take R A ( s )
= 2 s and R B ( s )
= 1 .
Take p = 1 for the L p distance.
Observe that
D L p , D ( Zero , R A ) = 12 ( | 0 | + | 2 | )
= 1 and D L p , D ( Zero , R B ) =
12 ( | 1 | + | 1 | )
= 1 .
Since potential shaping has no effect, D U NPEC ( Zero , R ) =
D L p , D ( Zero , R ) and so D NPEC ( Zero , R A ) =
and D NPEC ( Zero , R B ) = 1 .
Now:
[Equation]
with the inﬁmum attained at λ = 12 .
But:
[Equation]
where:
[Equation] [Equation]
[Equation]
Note that:
[Equation]
So f ( λ ) ≥ 2 on all of its domain, thus:
[Equation]
Consequently:
[Equation]
so D NPEC is not symmetric.
A. F ULL N ORMALIZATION V ARIANT OF EPIC
Previously, we used the Pearson distance D ρ to compare the canonicalized rewards.
Pearson distance is naturally invariant to scaling.
An alternative is to explicitly normalize the canonicalized rewards, and then compare them using any metric over functions.
Deﬁnition A.
(Normalized Reward) .
Let R : S ×
A × S → R be a bounded reward function.
Let (cid:107)·(cid:107) be a norm on the vector space of reward functions over the real ﬁeld.
Then the normalized R is:
[Equation]
Note that ( λR ) N = R N for any λ > 0 as norms are absolutely homogeneous.
We say a reward is standardized if it has been canonicalized and then normalized.
Deﬁnition A.5 (Standardized Reward) .
Let R : S ×
A × S → R be a bounded reward function.
Then the standardized R is:
[Equation]
Now, we can deﬁne a pseudometric based on the direct distance between the standardized rewards.
Deﬁnition A.6 (Direct Distance Standardized Reward) .
Let D be some coverage distribution over transitions s a → s (cid:48) .
Let D S and D A be some distributions over states S and A respectively.
Let
S, A, S (cid:48) be random variables jointly sampled from D .
The Direct Distance Standardized Reward pseudometric between two reward functions R A and R B is the L p distance between their standardized versions over D :
[Equation]
where the normalization step, R N , uses the L p norm.
For brevity, we omit the proof that D DDSR is a pseudometric, but this follows from D L p , D being a pseudometric in a similar fashion to theorem 4.7.
Note it additionally is invariant to equivalence classes, similarly to EPIC.
Theorem A.7.
Let R A , R A (cid:48) , R B and R B (cid:48) be reward functions mapping from transitions
S ×
A × S to real numbers R such that R
A ≡ R A (cid:48) and R B ≡ R B (cid:48) .
Then:
[Equation]
Proof.
The invariance under the equivalence class follows from R S being invariant to potential shaping and scale in R .
The non-negativity follows from D L p , D being a pseudometric.
The upper bound follows from the rewards being normalized to norm 1 and the triangle inequality:
[Equation]
Since both DDSR and EPIC are pseudometrics and invariant on equivalent rewards, it is interesting to consider the connection between them.
In fact, under the L 2 norm, then DDSR recovers EPIC.
First, we will show that canonical shaping centers the reward functions.
Lemma A.8 (The Canonically Shaped Reward is Mean Zero) .
Let R be a reward function mapping from transitions S ×
A × S to real numbers R .
Then:
[Equation]
Proof.
Let X , U and X (cid:48) be random variables that are independent of S , A and S (cid:48) but identically distributed.
[Equation]
[Equation]
= 0 , (119) where the penultimate step follows since A is identically distributed to U , and S (cid:48) is identically distributed to X (cid:48) and therefore to X .
Theorem A.9.
D DDSR with p = 2 is equivalent to D EPIC .
Let R A and R B be reward functions mapping from transitions S ×
A × S to real numbers R .
Then:
[Equation]
Proof.
Recall from the proof of lemma 4.5 that:
[Equation]
where (cid:107)·(cid:107) 2 is the L 2 norm (treating the random variables as functions on a measure space) and
Z ( U ) is a centered (zero-mean) and rescaled (unit variance) random variable.
By lemma A.
[Equation]
the canonically shaped reward functions are already centered under the joint distribution D S
× D
A × D S , and normalization by the L 2 norm also ensures they have unit variance.
Consequently:
[Equation]
completing the proof
[Equation]
A. R EGRET B OUND
In this section
[Equation]
we derive an upper bound on the regret in terms of the EPIC distance.
Speciﬁcally, given two reward functions R A and R B with optimal policies π ∗ A and π ∗ B , we show that the regret (under reward R A ) of using policy π ∗ B instead of a policy π ∗ A is bounded by a function of
D EPIC ( R A , R B ) .
First, in section A.5.1 we derive a bound for MDPs with ﬁnite state and action spaces.
In section A.6 we then present an alternative bound for MDPs with arbitrary state and action spaces and Lipschitz reward functions.
Finally, in section A.7 we show that in both cases the regret tends to 0 as D EPIC
( R A , R B ) → 0 .
A.5. D ISCRETE MDP S
We start in lemma A.10 by showing that L 2 distance upper bounds L 1 distance.
Next, in lemma A. we show regret is bounded by the L 1 distance between reward functions using an argument similar to [21].
Then in lemma A.12 we relate regret bounds for standardized rewards R S to the original reward R .
Finally, in theorem 4.9 we use section A.4 to express D EPIC in terms of the L 2 distance on standardized rewards, deriving a bound on regret in terms of the EPIC distance.
Lemma A.10.
Let (Ω , F , P ) be a probability space and f : Ω → R a measurable function whose absolute value raised to the n -th power for n ∈ { 1 , 2 } has a ﬁnite expectation.
Then the L 1 norm of f is bounded above by the L 2 norm:
[Equation]
Proof.
Let X be a random variable sampled from P , and consider the variance of f ( X ) :
[Equation]
[Equation] [Equation]
131) ≥
[Equation]
Rearranging terms, we have
[Equation]
Taking the square root of both sides gives:
[Equation]
134) as required.
Lemma A.11.
Let M be an MDP\R with ﬁnite state and action spaces S and A .
Let R A , R B :
S ×
A × S → R be rewards.
Let π ∗ A and π ∗ B be policies optimal for rewards R A and R B in M .
Let
D π ( t, s t , a t , s t +1 )
denote the distribution over trajectories that policy π induces in M at time step t .
Let D ( s, a, s (cid:48) ) be the (stationary) coverage distribution over transitions
S ×
A × S used to compute
D EPIC .
Suppose that there exists some K > 0 such that K D ( s t , a t , s (cid:48)
t +1 ) ≥ D π ( t, s t , a t , s (cid:48) t +1 ) for all time steps t ∈ N , triples s t , a t , s t +1 ∈ S
× A × S and policies π ∈ { π ∗ A , π ∗ B } .
Then the regret under R A from executing π ∗ B optimal for R B instead of π ∗ A is at most:
[Equation]
Proof.
Noting G R A ( π ) is maximized when π = π ∗ A , it is immediate that
[Equation]
[Equation]
We will show that both these terms are bounded above by K 1 − γ D L 1 , D ( R A , R B ) , from which the result follows.
First, we will show that for
[Equation]
Let T be the horizon of M .
This may be inﬁnite ( T = ∞ ) when γ < 1 ; note since S ×
A × S is bounded, so are R A , R B so the discounted inﬁnite returns G R A ( π ) , G R B ( π ) converge (as do their differences).
Writing τ =
( s 0 , a 0 , s 1 , a 1 , · · · ) , we have for any policy π :
[Equation]
[Equation] [Equation]
[Equation]
Let π ∈ { π ∗ A , π ∗ B } .
By assumption, D π ( t, s t , a t , s (cid:48)
t +1 ) ≤ K D ( s t , a t , s (cid:48) t +
[Equation]
, so:
[Equation] [Equation]
as required.
In particular, substituting π = π ∗ B gives:
[Equation]
Rearranging gives:
[Equation]
So certainly:
[Equation]
By a symmetric argument, substituting π = π ∗ A gives:
[Equation]
Eqs.
150 and 151 respectively give G R B ( π ∗ B ) − G R A ( π ∗ A ) ≤ K 1 − γ and G R A ( π ∗ A ) − G R B ( π ∗ B ) ≤ K 1 − γ .
Combining these gives:
[Equation]
Substituting inequalities 148 and 152 into eq.
138 yields the required result.
Note that if D = D unif , uniform over S ×
A × S , then K ≤ |S| 2 |A| .
Lemma A.12.
Let M be an MDP\R with state and action spaces S and A .
Let R A , R B : S×A×S → R be bounded rewards.
Let π ∗ A and π ∗ B be policies optimal for rewards R A and R B in M .
Suppose the regret under the standardized reward R SA from executing π ∗ B instead of π ∗ A is upper bounded by some U ∈ R :
[Equation]
Then the regret under the original reward R A is bounded by:
[Equation]
Proof.
Recall that
R
[Equation]
where C D S , D A
( R ) is simply R shaped with some (bounded) potential Φ .
It follows that:
[Equation]
where s 0 depends only on the initial state distribution d 0 .
† Since s 0 does not depend on π , the terms cancel when taking the difference in returns:
[Equation]
Combining this with eq 153 gives
[Equation]
Finally
[Equation]
we will bound (cid:107) C D S ,
D A
( R A ) (cid:107) 2 in terms of (cid:107) R A (cid:107) 2 , completing the proof.
Recall:
[Equation]
where S and S (cid:48) are random variables independently sampled from D S and A sampled from D A .
By the triangle inequality on the L 2 norm and linearity of expectations, we have:
[Equation]
where f ( s, a, s (cid:48) )
=
E [ R ( s (cid:48) , A, S (cid:48) )] , g ( s, a, s (cid:48) )
=
E [ R ( s, A, S (cid:48) )] and c = E [ R ( S, A, S (cid:48) )] .
Letting
X (cid:48) be a random variable sampled from D S independently from S and S (cid:48) , have
[Equation]
So (cid:107) f (cid:107) 2 ≤ (cid:107) R (cid:107) 2 and, by an analogous argument, (cid:107) g (cid:107) 2 ≤ (cid:107) R (cid:107) 2 .
Similarly
[Equation]
lemma A.10 .
[Equation]
Combining these results, we have
[Equation] [Equation]
Substituting eq.
170 into eq.
159 yields:
[Equation]
as required.
Theorem 4.9.
Let M be a γ -discounted MDP\R with ﬁnite state and action spaces S and A .
Let R A , R B : S ×
A × S → R be rewards, and π ∗ A , π ∗ B be respective optimal policies.
Let
D π ( t, s t , a t , s t +1 )
denote the distribution over transitions S ×
A × S induced by policy π at time t , and D ( s, a, s (cid:48) ) be the coverage distribution used to compute D EPIC .
Suppose there exists K > 0 such that K D ( s t , a t , s t +1 ) ≥ D π ( t, s t , a t , s t +1 ) for all times t ∈ N , triples ( s t , a t , s t +1 )
∈ S
×
A × S and policies π ∈ { π ∗ A , π ∗ B } .
Then the regret under R A from executing π ∗ B instead of π ∗ A is at most
[Equation]
Proof.
Recall from section A.4 that:
[Equation]
Applying lemma
A.10 we obtain:
[Equation]
[Equation]
Note that π ∗ A is optimal for R S A and π ∗ B is optimal for R S B since the set of optimal policies for R S is the same as for R .
Applying lemma A.11 and eq.
173 gives
[Equation]
Since S × A × S is bounded, R A and R B must be bounded, so we can apply lemma A.12, giving:
[Equation]
completing the proof.
A. L IPSCHITZ R EWARD F UNCTIONS
In this section, we generalize the previous results to MDPs with continuous state and action spaces.
The challenge is that even though the spaces may be continuous, the distribution D π ∗ induced by an optimal policy π ∗ may only have support on some measure zero set of transitions B .
However, the expectation over a continuous distribution D is unaffected by the reward at any measure zero subset of points.
Accordingly, the reward can be varied arbitrarily on transitions B – causing arbitrarily small or large regret – while leaving the EPIC distance ﬁxed.
To rule out this pathological case, we assume the rewards are Lipschitz smooth.
This guarantees that if the expected difference between rewards is small on a given region, then all points in this region have bounded reward difference.
We start by deﬁning a relaxation of the Wasserstein distance W α in deﬁnition A.13.
In lemma A. we then bound the expected value under distribution µ in terms of the expected value under alternative distribution ν plus W α ( µ, ν ) .
Next, in lemma A.15 we bound the regret in terms of the L 1 distance between the rewards plus W α ; this is analogous to lemma A.11 in the ﬁnite case.
Finally, in theorem A.16 we use the previous results to bound the regret in terms of the EPIC distance plus W α .
Deﬁnition A.13.
Let S be some set and let µ, ν be probability measures on S with ﬁnite ﬁrst moment.
We deﬁne the relaxed Wasserstein distance between µ and ν by:
[Equation] [Equation]
where Γ α ( µ, ν ) is the set of probability measures on S × S satisfying for all x, y ∈ S :
[Equation] [Equation]
Note that W 1 is equal to the (unrelaxed) Wasserstein distance (in the (cid:96) 1 norm).
Lemma A.14.
Let S be some set and let µ, ν be probability measures on S .
Let f : S
→ R be an
L -Lipschitz function on the (cid:96) 1 norm (cid:107)·(cid:107) 1 .
Then, for any α ≥ 1 :
[Equation] [Equation]
Proof.
Let p ∈
Γ α ( µ, ν ) .
Then:
[Equation]
deﬁnition of E (180)
[Equation]
µ is a marginal of p
[Equation] [Equation]
deﬁnition of E
[Equation]
Since this holds for all choices of p , we can take the inﬁmum of both sides, giving:
[Equation]
Lemma A.15.
Let M be an MDP\R with state and action spaces S and A .
Let R A , R B : S×A×S → R be L -Lipschitz, bounded rewards on the (cid:96) 1 norm (cid:107)·(cid:107) 1 .
Let π ∗ A and π ∗ B be policies optimal for rewards R A and R B in M .
Let D π,t
( s t , a t , s t +1 )
denote the distribution over trajectories that policy π induces in M at time step t .
Let D ( s, a, s (cid:48) ) be the (stationary) coverage distribution over transitions
S ×
A × S used to compute D EPIC .
Let α ≥ 1 , and let B α ( t ) = max π ∈{ π ∗ A ,π ∗ B } W α ( D π,t , D ) .
Then the regret under R A from executing π ∗ B optimal for R B instead of π ∗ A is at most:
[Equation]
Proof.
By the same argument as lemma A.11 up to eq.
144, we have for any policy π :
[Equation]
Let f ( s, a, s (cid:48) )
=
R A ( s, a, s (cid:48) )
− R B ( s, a, s (cid:48) ) , and note f is 2 L -Lipschitz and bounded since R A and
R B are both L -Lipschitz and bounded.
Now, by lemma A.14, letting µ = D π,t and ν = D , we have:
[Equation]
So, for π ∈ { π ∗ A , π ∗ B } , it follows that
[Equation]
By the same argument as for eq. 148 to 152 in lemma A.11, it follows that
[Equation]
completing the proof.
Theorem A.16.
Let M be an MDP\R with state and action spaces S and A .
Let R A , R B : S ×
A ×
S → R be bounded, L -Lipschitz rewards on the (cid:96) 1 norm (cid:107)·(cid:107) 1 .
Let π ∗ A and π ∗ B be policies optimal for rewards R A and R B in M .
Let D π ( t, s t , a t , s t +1 ) denote the distribution over trajectories that policy π induces in M at time step t .
Let D ( s, a, s (cid:48) ) be the (stationary) coverage distribution over transitions
S ×
A × S used to compute D EPIC .
Let α ≥ 1 , and let B α ( t ) =
max π ∈ π ∗ A ,π ∗ B W α ( D π,t , D ) .
Then the regret under R
A from executing π ∗ B optimal for R B instead of π ∗ A is at most:
[Equation]
Proof.
The proof for theorem 4.9 holds in the general setting up to eq. 173.
Applying lemma A.15 to eq.
173 gives
[Equation]
Applying lemma A.12 yields
[Equation]
as required.
A. L IMITING B EHAVIOR OF R EGRET
The regret bound for ﬁnite MDPs, Theorem 4.9, directly implies that, as EPIC distance tends to 0 , the regret also tends to 0 .
By contrast, our regret bound in theorem A.16 for (possibly continuous)
MDPs with Lipschitz reward functions includes the relaxed Wasserstein distance W α as an additive term.
At ﬁrst glance, it might therefore appear possible for the regret to be positive even with a zero EPIC distance.
However, in this section we will show that in fact the regret tends to 0 as
D EPIC ( R A , R B ) → 0 in the Lipschitz case as well as the ﬁnite case.
We show in lemma A.17 that if the expectation of a non-negative function over a totally bounded measurable metric space M tends to zero under one distribution with adequate support, then it also tends to zero under all other distributions.
For example, taking M to be a hypercube in Euclidean space with the Lebesque measure satisﬁes these assumptions.
We conclude in theorem A.18 by showing the regret tends to 0 as the EPIC distance tends to 0 .
Lemma A.17.
Let M =
( S, d ) be a totally bounded metric space, where d ( x, y )
= (cid:107) x − y (cid:107) .
Let ( S, A, µ ) be a measure space on S with the Borel σ -algebra A and measure µ .
Let p, q ∈ ∆( S ) be probability density functions on S .
Let δ > 0 such that p ( s ) ≥ δ for all s ∈ S .
Let f n : S → R be a sequence of L -Lipschitz functions on norm (cid:107)·(cid:107) .
Suppose lim n →∞ E X ∼ p
| f n ( X ) | ] = 0 .
Then lim n →∞ E Y ∼ q [ | f n ( Y ) | ] = 0 .
Proof.
Since M is totally bounded, for each r > 0 there exists a ﬁnite collection of open balls in S of radius r whose union contains M .
Let B r ( c )
=
{ s ∈ S | (cid:107) s − c (cid:107) < r } , the open ball of radius r centered at c .
Let C ( r ) denote some ﬁnite collection of Q ( r ) open balls:
[Equation]
such that (cid:83) B ∈ C ( r ) B = S .
It is possible for some balls B r ( c n ) to have measure zero, µ ( B r ( c n ))
= 0 , such as if S contains an isolated point c n .
Deﬁne P ( r ) to be the subset of C ( r ) with positive measure:
[Equation]
and let p r, 1 , · · · , p r,Q (cid:48) ( r ) denote the centers of the balls in P .
Since P ( r ) is a ﬁnite collection, it must have a minimum measure:
[Equation]
Moreover, by construction of P , α ( r ) > 0 .
Let S (cid:48)
( r ) be the union only over balls of positive measure:
[Equation]
Now, let D ( r ) =
S \ S (cid:48)
( r ) , comprising the (ﬁnite number of) measure zero balls in C ( r ) .
Since measures are countably additive, it follows that D ( r ) is itself measure zero: µ ( D ( r ))
= 0 .
Consequently:
[Equation]
for any measurable function g : S → R .
Since lim n →∞ E X ∼ p
[ | f n ( X ) | ] = 0 , for all r > 0 there exists some N r ∈ N such that for all n ≥ N r :
[Equation]
By Lipschitz continuity, for any s, s (cid:48) ∈ S :
[Equation]
In particular, since any point s ∈ S (cid:48) ( r ) is at most r distance from some ball center p r,i , then | f n ( p r,i )
| ≥ |
f n ( s ) | − Lr .
So if there exists s ∈ S (cid:48) ( r ) such that | f n ( s ) | ≥ 3 Lr , then there must exist a ball center p r,i with | f n ( p r,i ) | ≥ 2 Lr .
Then for any point s (cid:48)
∈ B r ( p r,i ) : | f n ( s (cid:48) )
| ≥ | f n ( p r,i ) | − Lr ≥ Lr.
Now, we have:
[Equation]
(cid:90) s ∈ S |
f n ( s ) | p ( s ) dµ ( s ) (205) =
(cid:90) s ∈ S (cid:48)
( r ) |
f n ( s ) | p ( s ) dµ ( s ) eq.(206) ≥ (cid:90) s ∈ B r ( p r,i ) | f n ( s ) | p ( s ) dµ ( s ) non-negativity of | f n ( s ) | (207) ≥ δ (cid:90)
s
∈ B r ( p r,i ) |
f n ( s ) | dµ ( s ) p ( s ) ≥ δ (208) ≥ δ · Lr (cid:90) s ∈ B r ( p r,i ) 1 dµ ( s ) eq.(209)
=
δLrµ ( B r ( p r,i )) integrating w.r.t.
µ (210) ≥ δLrα ( r ) α
( r ) minimum of µ ( B r ( p r,i )) .
But this contradicts eq.
202, and so can only hold if n < N r .
It follows that for all n ≥ N r and s ∈ S (cid:48) ( r ) , we have | f n ( s ) | < 3 Lr , and so in particular:
[Equation]
Let (cid:15) > 0 .
Choose r = (cid:15) 3 L .
Then for all n ≥ N r , E Y ∼ q [ | f n ( Y ) | ] < (cid:15) .
It follows that:
[Equation]
completing the proof.
Theorem A.18.
Let M be an MDP\R with state and action spaces S and A .
Let R A , R B : S ×
A ×
S → R be bounded rewards on some norm (cid:107)·(cid:107) on S ×
A × S .
Let π ∗ A and π ∗ B be policies optimal for rewards R A and R B in M .
Let D π ( t, s t , a t , s t +1 ) denote the distribution over trajectories that policy π induces in M at time step t .
Let D ( s, a, s (cid:48) ) be the (stationary) coverage distribution over transitions
S ×
A × S used to compute D EPIC .
Suppose that either:
Discrete : S and A are discrete .
Moreover, suppose that there exists some K > 0 such that K D ( s t , a t , s (cid:48)
t +1 ) ≥ D π ( t, s t , a t , s (cid:48) t +1 ) for all time steps t ∈ N , triples s t , a t , s t +1 ∈ S
× A × S and policies π ∈ { π ∗ A , π ∗ B } . 2.
Lipschitz : ( S ×
A × S , d ) is a totally bounded measurable metric space where d ( x, y )
= (cid:107) x − y (cid:107) .
Moreover, R A and R B are L -Lipschitz on (cid:107)·(cid:107)
Furthermore, suppose there exists some δ > 0 such that D ( s, a, s (cid:48) ) ≥ δ for all s, a, s (cid:48)
∈ S ×
A × S , and that
D π ( t, s t , a t , s t +1 ) is a non-degenerate probability density function (i.e. no single point has positive measure).
Then as D EPIC ( R A , R B ) → 0 , G R A ( π ∗ A ) − G R A
( π ∗ B ) → 0 .
Proof.
In case (1) Discrete , by theorem 4.9:
[Equation]
Moreover, by optimality of π ∗ A we have 0 ≤ G R A ( π ∗ A ) − G R A ( π ∗ B ) .
So by the squeeze theorem, as
D EPIC ( R A , R B ) → 0 , G R A ( π ∗ A ) − G R A ( π ∗ B ) → 0 .
From now on, suppose we are in case (2) Lipschitz .
By the same argument as lemma A.11 up to eq.
144, we have for any policy π :
[Equation]
Applying lemma A.12 we have:
[Equation]
By equation 173, we know that D L 1 , D
( R SA , R SB )
→ 0 as D EPIC ( R A , R B ) → 0 .
By lemma A.17, we know that D L 1 , D π,t ( R SA , R SB )
→ 0 as D L 1 , D ( R SA , R SB )
→ 0 .
So we can conclude that as
D EPIC ( R A , R B ) → 0 :
[Equation]
(217) as required.