Year: 2021

Abstract:
The ability to learn reward functions plays an important role in enabling the deployment of intelligent agents in the real world. However, comparing reward functions, for example as a means of evaluating reward learning methods, presents a challenge. Reward functions are typically compared by considering the behavior of optimized policies, but this approach conflates deficiencies in the reward function with those of the policy search algorithm used to optimize it. To address this challenge, Gleave et al. (2020) propose the Equivalent-Policy Invariant Comparison (EPIC) distance. EPIC avoids policy optimization, but in doing so requires computing reward values at transitions that may be impossible under the system dynamics. This is problematic for learned reward functions because it entails evaluating them outside of their training distribution, resulting in inaccurate reward values that we show can render EPIC ineffective at comparing rewards. To address this problem, we propose the Dynamics-Aware Reward Distance (DARD), a new reward pseudometric. DARD uses an approximate transition model of the environment to transform reward functions into a form that allows for comparisons that are invariant to reward shaping while only evaluating reward functions on transitions close to their training distribution. Experiments in simulated physical domains demonstrate that DARD enables reliable reward comparisons without policy optimization and is significantly more predictive than baseline methods of downstream policy performance when dealing with learned reward functions.

heading: 1 INTRODUCTION
text: Reward functions provide a general way to specify objectives for reinforcement learning. Tasks such as game playing have simple, natural reward functions that enable learning of effective policies (Tesauro, 1995; Mnih et al., 2013; Silver et al., 2017); however, many tasks, such as those involving human interaction, multiple competing objectives, or high-dimensional state spaces, do not have easy to define reward functions (Knox et al., 2021; Holland et al., 2013; Cabi et al., 2019). In these cases, reward functions can be learned from demonstrations, explicit preferences, or other forms of reward supervision (Abbeel & Ng, 2004; Christiano et al., 2017; Cabi et al., 2019). However, evaluating the quality of learned reward functions, which may be too complicated to manually inspect, remains an open challenge.
Prior work on comparing reward functions typically involves a computationally expensive and indirect process of (i) learning a reward function, (ii) learning a policy on that reward function, and (iii) evaluating that policy on a known, ground-truth reward function. Gleave et al. (2020) refer to this as the “rollout method” for evaluating methods for learning reward functions. Furthermore, the rollout method can be potentially dangerous in safety critical environments because (i) it cannot distinguish deficiencies between the reward function and the policy optimization procedure, and (ii) rewards are evaluated on the distribution of transitions induced by an optimized policy, which may not capture all the transitions required to accurately quantify reward differences.
To address these challenges, Gleave et al. (2020) introduce Equivalent-Policy Invariant Comparison (EPIC). EPIC quantifies differences in reward functions directly, without learning policies. EPIC uses an offline dataset of transitions, and consists of two stages. First, transitions from this dataset are used to convert reward functions to a canonical form that is invariant to reward transformations that do not affect the optimal policy. Second, the correlation between reward values is computed on
transition samples, yielding a pseudometric capturing reward function similarity. However, when computing this canonical form, EPIC evaluates rewards on transitions between all state-state combinations, regardless of whether those state-state transitions are possible or not. While this makes it possible for EPIC to quantify reward distances that are robust to arbitrary changes in transition dynamics, in practice evaluating learned reward functions on physically impossible transitions leads to unreliable reward values, as these are outside the distribution of the transitions on which the reward functions are learned. We show empirically in Section 5 that these out-of-distribution reward evaluations can render EPIC an ineffective reward comparison metric.
To address this issue, we propose a new method for quantifying differences in reward functions, Dynamics-Aware Reward Distance (DARD), that transforms reward functions into a form allowing for reward-shaping-invariant comparisons while ensuring that learned reward functions are only evaluated on transitions that are physically realizable. We achieve this by assuming access to a transition model for the environment of interest, and evaluate reward functions on transitions sampled from this transition model. This ensures that reward functions are not evaluated on impossible transitions, which will necessarily be out-of-distribution, and is well motivated in a variety of physical environments in which transition models are unlikely to change significantly between learning and deployment. Experiments suggest that DARD better reflects reward function similarity than does EPIC in comparing learned reward functions in two simulated, physics-based environments: the first involving multi-agent navigation, and the second involving manipulating a robotic arm. Videos available at https://sites.google.com/view/dard-paper.

heading: 2 RELATED WORK

heading: 2.1 LEARNING REWARD FUNCTIONS
text: A variety of methods exist for learning reward functions, which can be categorized based on the form of supervision used. Rewards can be learned from supervision provided by explicit labels. For example, human-labeled preferences between demonstrations can be used to learn reward functions (Christiano et al., 2017). Rewards can also be labeled on a per-timestep basis, allowing for learning via supervised regression (Cabi et al., 2019).
Alternatively, inverse reinforcement learning (IRL) methods typically assume access to expert demonstrations, and attempt to find a reward function under which the expert is uniquely optimal (Ziebart et al., 2008; Abbeel & Ng, 2004). IRL is underconstrained in that many reward functions can make the expert policy appear optimal. This problem is often addressed by favoring reward functions that induce high-entropy optimal policies (Ziebart et al., 2008). Recent work in IRL focuses on learning reward functions with expressive function approximators such as neural networks, particularly in an adversarial formulation (Fu et al., 2017). There has also been recent interest in offline IRL methods (Lee et al., 2019). In this work, we study how these various reward learning methods can be evaluated efficiently and accurately in practice.

heading: 2.2 EVALUATING METHODS OF LEARNING REWARD FUNCTIONS
text: Reward functions are typically evaluated by first learning an optimal policy under the reward function. The value of the induced policy is found by aggregating the returns from online trajectory rollouts under the known, ground-truth reward function. This requirement of online rollouts from experimental policies is often prohibitive in safety-critical domains such as autonomous driving or decision making in healthcare (Thapa et al., 2005).
Off-policy evaluation (OPE) methods attempt to address these issues by estimating the value of a policy in a purely offline setting by using previously collected data. Traditional OPE methods address policy mismatch by using a form of importance sampling (Precup et al., 2000). While this approach can be effective, it is unbiased only if the underlying expert policy is known, and can often be subject to large variance. Direct OPE methods (Dudik et al. (2011); Voloshin et al. (2020)), apply regression-based techniques in either a model-based (Paduraru, 2013) or model-free setting (Le et al., 2019). Contemporary works combine these two methods using Doubly Robust Estimation, which originated in a contextual bandits setting (Dudik et al., 2011), and was later extended to reinforcement learning by Jiang & Li (2016). More recent works seek to forego models
and importance sampling entirely, such as Irpan et al. (2019), which recasts OPE as a positiveunlabeled classification problem with the Q-function as the decision function. An overview of all of these methods and empirical analysis of their performance can be found in Voloshin et al. (2020).
All OPE methods indirectly evaluate the reward by estimating the value of the induced optimal policy. This introduces additional complexity into the evaluation procedure and can obfuscate sources of error as resulting either from aspects of policy learning or due to the underlying reward function. EPIC (Gleave et al., 2020) seeks to circumvent these shortcomings by comparing reward functions directly. Our work builds on EPIC as covered in Section 4, but uses a transition model of the environment to significantly improve the accuracy of comparisons involving learned reward functions.

heading: 3 PRELIMINARIES

heading: 3.1 MARKOV DECISION PROCESSES
text: A Markov decision process (MDP) is a tuple (S , A, T , R, γ, d0) where S and A are the state and action spaces. The transition model T : S × A × S → [0, 1] maps a state and action to a probability distribution over next states, the reward R : S × A × S → R measures the quality of a transition. Finally, γ ∈ [0, 1] and d0 are respectively the discount factor and initial state distribution. A trajectory τ consists of a sequence of state-action pairs: τ = {(s0, a0), (s1, a1), ...}, and the return g of a trajectory is defined as the sum of discounted rewards along that trajectory: g(τ) =∑∞ t=0 γ
tR(st, at, st+1). The goal in an MDP is to find a policy π : S × A → [0, 1] that maximizes the expected return, E[g(τ)], where s0 ∼ d0, at ∼ π(at|st), and st+1 ∼ T (st+1|st, at). We denote a distribution over a space S as DS , and the set of distributions over a space S as ∆(S).

heading: 3.2 REWARD FUNCTION EQUIVALENCE
text: Our goal is to define a metric for comparing reward functions without learning policies. Nevertheless, the measure of similarity we are interested in is the extent to which the optimal policies induced by two reward functions are the same. Because different reward functions can induce the same set of optimal policies, we in fact seek a pseudometric as formalized in the following definition. Definition 3.1 (Pseudometric (Definition 3.5 from Gleave et al. (2020))). Let X be a set and d : X × X → [0,∞] a function. d is a premetric if d(x, x) = 0 for all x ∈ X . d is a pseudometric if, furthermore, it is symmetric, d(x, y) = d(y, x) for all x, y ∈ X ; and satisfies the triangle inequality, d(x, z) ≤ d(x, y) + d(y, z) for all x, y, z ∈ X . d is a metric if, furthermore, for all x, y ∈ X , d(x, y) = 0 =⇒ x = y.
Which rewards induce the same set of optimal policies? Ng et al. (1999) showed that without additional prior knowledge about the MDP only reward functions that are related through a difference in state potentials are equivalent. This “reward shaping” refers to an additive transformation F applied to an initial reward function R to compute a shaped reward R′: R′(s, a, s′) = R(s, a, s′) + F (s, a, s′). Reward shaping is typically applied in a reward design setting to produce denser reward functions that make policy optimization easier in practice (Ng et al., 2003; Schulman et al., 2015). Ng et al. (1999) showed that if F is of the form F (s, a, s′) = γΦ(s′) − Φ(s) for arbitrary state potential function Φ(s), the set of optimal policies under R and R′ are the same. This provides a definition for reward equivalence: Definition 3.2 (Reward Equivalence, Definition 3.3 from Gleave et al. (2020)). Bounded rewards RA and RB , are equivalent if and only if
∃λ > 0, and Φ : S → R bounded s.t. RB(s, a, s ′) = λRA(s, a, s ′) + γΦ(s′)− Φ(s) ∀s, s′ ∈ S, a ∈ A.
This form of equivalence is only possible in reward functions that depend on (s, a, s′), which motivates our focus on these types of rewards in this paper. This choice is further motivated by the fact that there are cases where conditioning on the next state s′ can make reward learning simpler, for example in highly stochastic MDPs, or in cases where rewards are a simple function of (s, a, s′), but not of (s, a). We next describe an existing pseudometric that in theory is capable of identifying these reward equivalence classes.

heading: 3.3 EQUIVALENT-POLICY INVARIANT COMPARISON (EPIC)
text: EPIC is a pseudometric for comparing reward functions and involves two stages. The first stage converts reward functions into a canonical form that removes the effect of reward shaping, and the second stage computes the correlation between the canonicalized rewards.
The following definition describes the canonicalization stage. Definition 3.3 (Canonically Shaped Reward (Definition 4.1 from Gleave et al. (2020))). Let R : S×A×S → R be a reward function. Given distributionsDS ∈ ∆(S) andDA ∈ ∆(A) over states and actions, let S and S′ be independent random variables distributed as DS and A distributed as DA. Define the canonically shaped R to be:
CDS ,DA(R)(s, a, s ′) = R(s, a, s′) + E[γR(s′, A, S′)−R(s,A, S′)− γR(S,A, S′)]. (1)
Fig. 1 visualizes this process. Informally, this operation computes the mean of the potentials of s and s′ with respect to S′ using only evaluations of the reward R, and subtracts/adds those averages from/to the original, shaped reward, thereby canceling out their effects. This cancellation behavior is formalized in the following proposition. Proposition 1 (The Canonically Shaped Reward is Invariant to Shaping (Proposition 4.2 from Gleave et al. (2020))). Let R : S × A × S → R be a reward function, and Φ : S → R a potential function. Let γ ∈ [0, 1] be a discount rate, andDS ∈ ∆(S) andDA ∈ ∆(A) be distributions over states and actions. Let R′ denote R shaped by Φ : R′(s, a, s′) = R(s, a, s′) + γΦ(s′)−Φ(s). Then the canonically shaped R′ and R are equal: CDS ,DA(R ′) = CDS ,DA(R).
This invariance means that canonicalized rewards can be compared without reward shaping impacting the comparison. In practice, canonicalization is performed over an offline dataset of transitions. The rewards for (s, a, s′) transitions are computed, and then canonicalized using (1). The distributions DS and DA are the marginal distributions of states and actions in the dataset on which evaluation proceeds. As we will discuss in the next section, this results in evaluating learned reward functions outside their training distribution, leading to inaccurate reward values.
EPIC’s second stage computes the Pearson distance between two canonicalized reward functions. Definition 3.4 (Pearson Distance (Definition 4.4 from Gleave et al. (2020))). The Pearson distance between random variables X and Y is defined by the expressionDρ(X,Y ) = √ 1− ρ(X,Y )/ √ (2), where ρ(X,Y ) is the Pearson correlation between X and Y.
In combining these two steps, EPIC is capable of quantifying the similarity of two reward functions while being invariant to shaping (due to canonicalization), and invariant to changes in shift and scale (due to the use of the Pearson distance). Definition 3.5 (EPIC pseudometric (Definition 4.6 from Gleave et al. (2020))). Let S, A, S′ be random variables jointly following some coverage transition distribution. Let DS , and DA respectively be the state and action distributions. The EPIC pseudometric between rewards RA and RB is:
DEPIC(RA, RB) = Dρ ( CDS ,DA(RA)(S,A, S ′), CDS ,DA(RB)(S,A, S ′) ) . (2)
Note that during the canonicalization stage, S, A, S′ are independent while in the stage computing the Pearson correlation between canonical rewards, the joint distribution of S, A, S′ is used.

heading: 4 DARD: DYNAMICS-AWARE REWARD DISTANCE
text: Here we present DARD, a new distance measure between learned reward functions that leverages information about system dynamics to prevent errors due to out-of-distribution queries of learned rewards. As described in 3.3, the EPIC distance measure first transforms reward functions as shown in equation (1). This transformation procedure involves computing expectations E[R(s′, A, S′)], E[R(s,A, S′)], and E[R(S,A, S′)] with independent random variables S and S′ distributed as DS , which in practice is the marginal distribution of states in the dataset. Thus, the resulting transitions may not actually be possible under the transition model of the environment of interest. Computing transformed rewards with these out-of-distribution transitions allows EPIC to be robust to (arbitrary) changes in the transition model. Moreover, without additional information about the transition
model, two reward functions that behave identically on in-distribution transitions, but differently on out-of-distribution transitions, could justifiably be regarded as different.
However, if these reward functions are learned from data, evaluating them on out-of-distribution transitions can lead to unreliable reward values, introducing errors into the reward distance computed by EPIC. For example, the reward value of a transition in which a home robot teleports across a room is likely to be arbitrarily incorrect, since no similar transition would be observed when the robot interacts with its environment. Because EPIC necessarily evaluates learned reward functions on out-of-distribution data when computing reward distances, these distances can have significant inaccuracies as we show empirically in Section 5.
To address this challenge, we assume access to a transition model of the environment (which may also be learned in practice), and propose Dynamics-Aware Reward Distance (DARD), a new reward distance measure, which builds on EPIC. DARD computes an alternative reward transformation that evaluates reward functions on transitions that are much closer to those observed in the environment. This helps to encourage evaluation of reward functions closer to the distribution of transitions on which they were trained while still providing a distance metric between reward functions that is invariant to potential shaping.
Definition 4.1 (Dynamics-Aware Transformation). Let R : S × A × S → R be a reward function. Given distributions DS ∈ ∆(S) and DA ∈ ∆(A) over states and actions, let S be a random variable distributed as DS , and A be a random variable distributed as DA. Furthermore, given a probabilistic transition model defining a conditional distribution over next states T (S′|S,A), let S′ and S′′ be random variables distributed as T (S′|s,A) and T (S′′|s′, A) respectively. Define the dynamics-aware transformation of R as follows:
CT (R)(s, a, s ′) = R(s, a, s′) + E[γR(s′, A, S′′)−R(s,A, S′)− γR(S′, A, S′′)]. (3)
By sampling next states from the transition model conditioning on the current state (either s or s′), this transformation is able to evaluate reward models at (s, a, s′) transitions that are closer to
their training distribution. In the case of the term E[R(S′, A, S′′)], the transitions evaluated are not perfectly in-distribution with respect to T . This is because S′′ is distributed conditionally on the original s′ as opposed to the random variable S′. These transitions are nevertheless much closer to physically realizable than those sampled in EPIC. In Section 5 we show that learned reward functions are relatively insensitive to these slight errors in practice. We select DA to densely cover the space of possible actions. We do this because during policy optimization, policies may select a wide range of possible actions, resulting in evaluating learned reward functions on this same distribution of actions. See Figure 1 for a visualization of our dynamics-aware transformation. Informally, this operation normalizes the reward values of a transition (s, a, s′) based on the reward values of nearby transitions sampled from the transition model. This normalization allows for a comparison between reward functions that is invariant to potential shaping.
Proposition 2 (The dynamics-aware transformed reward is invariant to shaping). Let R : S × A× S → R be a reward function, and Φ : S → R a state potential function. Let γ ∈ [0, 1] be a discount factor, and DS ∈ ∆(S) and DA ∈ ∆(A) be distributions over states and actions, and T : S × A → ∆(S) be a conditional distribution over next states. Let R′ denote R shaped by Φ : R′(s, a, s′) = R(s, a, s′) + γΦ(s′) − Φ(s). Then the transition-relative transformations of R′ and R are equal: CT (R′) = CT (R).
Proof: See Section A.4.
Definition 4.2 (DARD Distance Measure). Let S, A, S′ be random variables jointly following some coverage transition distribution, and let T be the transition model of the corresponding environment. We define the DARD pseudometric between rewards RA and RB as follows:
DDARD(RA, RB) = Dρ ( CT (RA)(S,A, S ′), CT (RB)(S,A, S ′) ) . (4)
We prove that the above distance measure is a pseudometric in Section A.4.
The key insight behind DARD is that we can use knowledge of transition dynamics to define a distance measure between reward functions that only evaluates those functions at realizable transitions. Though, unlike EPIC, DARD assumes knowledge of transition dynamics and that these dynamics will remain similar during deployment, DARD uses these additional assumptions to produce significantly more accurate and predictive distances between learned reward functions in practice.

heading: 5 EXPERIMENTS
text: In experiments we evaluate the following hypotheses: H1: EPIC is a poor predictor of policy return for learned reward functions due to its out-of-distribution evaluation of these reward functions. H2: DARD is predictive of policy return even for learned reward models, while maintaining EPIC’s invariance to reward shaping. H3: DARD is predictive of policy performance across diverse coverage distributions. H4: DARD is predictive of policy return when using learned, high-fidelity transition models. We test these hypotheses by computing each metric across a set of reward models, and then evaluate a policy trained on each reward model against a ground truth reward function through on-policy evaluation. We perform these steps across two environments as described next.

heading: 5.1 EXPERIMENTAL SETUP
text: Environments We evaluate DARD in two environments. We first study the Bouncing Balls environment, which requires an agent to navigate from a random initial position to a random goal position while avoiding a set of balls randomly bouncing around the scene. This environment captures elements of real-world, physical environments with multiple interacting agents, as is the case, for example, in autonomous driving. In these types of environments, EPIC samples transitions in a manner such that agents teleport around the scene, causing issues for learned reward models. The second environment is adapted from the Reacher environment from OpenAI Gym (Brockman et al., 2016). This environment captures aspects of robotic manipulation tasks where arbitrary changes in joint configuration between s and s′ can cause issues for learned reward models. Videos illustrating both environments can be found at https://sites.google.com/view/dard-paper.
Coverage Distributions In order to compute reward distances for DARD, we must sample transitions from the environments. In the experiments we consider two coverage distributions. The first is the distribution induced by a policy that takes actions uniformly at random across magnitude bounds (denoted by πuni). The second is the distribution over transitions of an expert policy π∗, which we learn in both environments using Proximal Policy Optimization (PPO) Schulman et al. (2017).
Action Sampling and Transition Models Both environments have a 2D, continuous action space. DARD samples actions from these spaces (i.e., defines DA) by defining an uniformly-spaced, 2D grid of action values within magnitude bounds.
We consider two versions of DARD in the experiments. The first uses (approximate) ground-truth transition models, and the second uses learned transition models, which we refer to as DARD-L in the results. For the ground-truth transition model in the Bouncing Balls environment we use a constant velocity model that deterministically samples next states conditional on each sampled action. For the Reacher environment, we use the underlying MuJoCo simulator (Todorov et al., 2012) as the transition model, again deterministically sampling next states.
We additionally learn neural network transition models for each environment. In the Bouncing Balls environment, we learn a transition model that independently predicts position deltas for each ball based on its physical state and the action (in the case of the controlled agent). In the Reacher environment, we learn a transition model that takes as input the state and action, and predicts a state delta used to produce the next state. See Appendix A.1.4 for model architecture and training details.
Reward Models For each environment, we define or learn the following reward models:
GROUND TRUTH: The reward function against which we perform on-policy evaluation. In both environments, this is a goal-based reward given when the agent position is within some range of the goal location. The Reacher environment also contains additive terms penalizing distance from the goal and large action magnitudes.
SHAPED: The ground truth reward function, shaped by a potential function. In both environments, we use a potential shaping based on the distance to the goal location. In the Bouncing Balls environment, we take the difference in the square root of the distance to goal (due to the large distance values). In the Reacher environment we use the difference of distances from the end effector to goal directly.
FEASIBILITY: A manually-defined reward model that returns the shaped reward function when evaluated with a dynamically-feasible transition, and returns unit Gaussian noise otherwise. This serves as a sanity check to illustrate that EPIC performs poorly on models that exhibit inaccurate reward values on OOD transitions.
REGRESS: A learned model trained via regression to the shaped reward model. We regress the shaped reward function because otherwise the metrics do not need to account for shaping (see Appendix A.2.1 for an example). Although simple, this method is used in practice in cases where people manually label reward functions (Cabi et al., 2019), and was used as a baseline in Christiano et al. (2017) (“target” method, section 3.3).
REGRESS OUT-OF-DISTRIBUTION: A model trained similarly to REGRESS, except that it is trained “out-of-distribution” in the sense that during training it samples (a, s′) pairs randomly from the dataset such that its training distribution matches the evaluation distribution of EPIC.
PREFERENCES: A reward model learned using preference comparisons, similar to the approach from Christiano et al. (2017). We synthesize preference labels based on ground-truth return.
All learned models are fully-connected neural networks. In the Bouncing Balls environment, the input to the network is a specific set of features designed to be susceptible to OOD issues (a squared distance is computed between s and s′ as one of the features). For the Reacher environment, we concatenate s, a, and s′ as in the learned-reward experiments in Gleave et al. (2020).
Baselines We compare with two baseline methods. First, we compare with EPIC. Second, we compare with a simple calculation of the Pearson distance (Dρ). We include this baseline in order to assess the extent to which reward shaping is an issue that needs to be accounted for in comparing rewards (see Appendix A.2.1 for additional motivation).

heading: 5.2 RESULTS AND DISCUSSION
text: Table 1 summarizes the experimental results, which provide support for H1 across both environments. We first note as a sanity check that EPIC assigns large distances between GROUND TRUTH and FEASIBILITY. This demonstrates EPIC’s tendency to assign large distances to reward functions that are equivalent when assuming a fixed transition model, but different under an arbitrary transition model. This behavior manifests with learned models in practice due to EPIC’s OOD evaluation of those models. For example, in both environments EPIC assigns large distances to the REGRESS model when, based on policy performance, we see that it is quite similar to the ground truth (disregarding shaping). This results from EPIC’s evaluation of these reward models with OOD transitions, which is illustrated by the fact that the metric is more much predictive of on-policy performance on the REGRESS OOD model (which does not suffer from OOD evaluation issues). Perhaps most importantly, EPIC fails to be predictive of episode return when comparing learned models. For example, in the Reacher environment, the metric assigns a lower distance to PREFERENCES (PREF) than REGRESS despite the lower episode returns of PREF.
The results from both environments also support H2. In the Bouncing Balls environment, DARD gives low distances for the well-fit models (FEASIBILITY, REGRESS, REGRESS OOD) as a result of only evaluating them in their training distribution. In the Reacher environment, DARD exhibits a gap between REGRESS and REGRESS OOD, which indicates that the algorithm’s evaluation of the reward model on slightly out-of-distribution transitions does hurt performance. Nevertheless, on the reward models that can be learned in practice (REGRESS, PREF) DARD produces distances that are more predictive of episode return compared to baseline methods.
The results also demonstrate that DARD is predictive of episode return across coverage distributions (H3). DARD is sensitive to the choice of coverage distribution because the transitions the metric samples are tightly grouped around this distribution. This is reflected in the different distance scales between πuni and π∗. Nevertheless, the relative value of DARD within a sampling distribution is still predictive of episode return. For example, the metric maintains a consistent ordering of the models across πuni and π∗ in both environments.
Finally, the results largely support the hypothesis (H4) that replacing ground truth transition models in DARD with high-fidelity learned ones still results in distance values predictive of policy return. This conclusion is supported by DARD-L’s predictiveness of policy return across both environments and coverage distributions. In most cases, the distance values of DARD-L closely match those of DARD. Three reasons for this close correspondence are: (i) high-fidelity transition models can be fit in the relatively low-dimensional environments considered, (ii) DARD uses transition models to make single-step predictions, which avoids the compounding errors that may occur when sampling rollouts, and (iii) the environments and coverage distributions considered generally produce reward functions insensitive to small errors in the predicted states. The lower distance values of DARD-L in the Reacher environment when using the expert coverage distribution are an exception to this trend. By analyzing the errors made by the learned transition model, we concluded that the lower distances of DARD-L result from the reward functions being quite sensitive to small errors in predicted states in this case (see Appendix A.3.2 for detailed analysis). Although the distance values are still predictive of policy return, this result is an instance of the false positive equivalence that can result from errors in the transition model (as discussed in Appendix A.3.1 (case 2.B)), and illustrates the importance of applying DARD with well-fit learned transitions models.
In our experiments, we discovered that DARD is poorly suited for reward comparison in environments where nearby transitions exclusively have similar reward values. This is the case, for example, in robotic domains with small timesteps and in which a smooth reward function is used (such as negative distance to the goal). We illustrate this behavior and explain why it occurs in Appendix A.2.1 with experiments on the Point Maze environment used by Gleave et al. (2020). In short, because DARD performs reward comparisons between transitions relative to a transition model, if all the transitions it considers (across all possible actions) have nearly-identical reward values, it can be sensitive to noise in the reward model. For this reason, DARD should be used in environments for which, at least for some parts of the state-action space, nearby transitions yield well-differentiated reward values.
Overall, these experiments demonstrate that in situations where we have confidence the transition model will not change significantly, as is the case in many physical settings, DARD allows for comparing learned reward functions with other reward functions without policy optimization.

heading: 6 CONCLUSION
text: The ability to reliably compare reward functions is a critical tool for ensuring that intelligent systems have objectives that are aligned with human intentions. The typical approach to comparing reward functions, which involves learning policies on them, conflates errors in the reward with errors in policy optimization. We present Dynamics-Aware Reward Distance (DARD), a pseudometric that allows for comparing rewards directly while being invariant to reward shaping. DARD uses knowledge of the transition dynamics to avoid evaluating learned reward functions far outside their training distribution. Experiments suggest that for environments where we can assume the transition dynamics will not change significantly between evaluation and deployment time that DARD reliably predicts policy performance associated with a reward function, even learned ones, without learning policies and without requiring online environment interaction.
There are a number of exciting areas for future work. First, DARD could be used to define benchmarks for evaluating reward learning methods (for example in autonomous driving). Second, DARD could be applied to high-dimensional (e.g., visual) domains where learned transition models are necessary and for which OOD evaluation issues are likely particularly challenging to overcome. Last, we are interested in investigating whether the rapid reward evaluation provided by DARD can be used to enable contrastive learning of reward functions.

heading: REPRODUCIBILITY STATEMENT
text: We have attempted to make the experimental results easily reproducible by providing the following: first, source code necessary to reproduce results is available in the supplementary material. Second, the software for this research is designed to allow for reproducing the results in the main body of the text through a single program execution. Third, results are computed over five random seeds and standard error values are reported in appendix A.1.7 to provide reasonable bounds within which
reproduced results should fall. Fourth, we have attempted to provide extensive details regarding the experimental setup in appendix A.1.

heading: ETHICS STATEMENT
text: The ability to reliably and efficiently evaluate reward functions without executing policies in the environment has the potential to ensure that AI systems will exhibit behavior that is aligned with the objective of the system designer before risking deploying these systems for making safety critical decisions. This has the potential to facilitate the application of reinforcement learning algorithms in settings in which this might otherwise be too risky, such as healthcare, finance, and robotics.

heading: A SUPPLEMENTARY MATERIAL

heading: A.1 EXPERIMENTAL DETAILS
text: The following sub-sections provide details on the different components involved in the experiments.

heading: A.1.1 ENVIRONMENTS
text: Bouncing Balls Environment This is a custom environment with traits of multi-agent navigation environments such as autonomous driving. The agent attempts to navigate to a random goal location while avoiding a set of balls (other agents) bouncing around the scene. The state consists of the position and velocity of the balls (the agent included), as well as the goal location. The action space is a 2D continuous space of accelerations between [−5, 5] to apply to the agent state. The transition function applies the agent accelerations to its state, while the other agents apply random accelerations sampled from a zero-mean, low variance Gaussian distribution. The reward function gives a positive value once the agent is within some distance of the goal, which results in the agent and goal position being randomly moved. This environment executes for a fixed horizon of 400 timesteps to approximate a continuing, infinite horizon MDP. We make the environment approximately continuing in order to ensure that S and S′ are distributed identically as is required by EPIC. Sampling S and S′ from their marginal distributions in the dataset results in transitions where the agents in s have completely different positions and velocities as in s′, an issue that would be encountered in real-world multi-agent settings.
Reacher Environment This environment is adapted from the Reacher environment from OpenAI gym (Brockman et al., 2016). We adapt the environment in two ways. First, we add a goal-based reward component. Second, we increase the timesteps between states to 5 from an original 2. We make both these changes so that the rewards of nearby transitions are sufficiently differentiated (see A.2.1 for detailed motivation).

heading: A.1.2 POLICY LEARNING
text: We used the RLlib (Liang et al., 2018) implementation of Proximal Policy Optimization (PPO) for learning control policies (Schulman et al., 2017). Parameters are provided in table 2.

heading: A.1.3 DATA COLLECTION
text: We collect sets of datasets for use in reward learning and evaluation. Each set contains three subdatasets for (i) reward model training, (ii) reward model validation, and (iii) reward evaluation. We collect these dataset sets using two policies. The first policy (πuni) yields a uniform distribution on the action space. The second policy is an expert (π∗) trained as described in A.1.2. Table 3 gives the sizes of these datasets, which were set such that the validation and train losses were similar during reward learning.

heading: A.1.4 TRANSITION MODEL LEARNING
text: This section provides details regarding the architecture and training of the learned transition models.
For the Bouncing Balls transition model, we split the state (originally containing the concatenated information for each ball in the scene and the goal position) into states for each ball and predict the motion of each independently. We simplify the task in this manner in order to make learning the transition model easier, but a model that predicts the next state jointly could be learned instead. The absolute velocity of each ball is then passed to a fully-connected network, which outputs a position delta to be applied to the original state. In the case of the controlled ball, the action is also provided to the network. Given this formulation, the network is learning to translate a velocity into a change in position over some time period, optionally applying an acceleration value as well.
For the Reacher environment, we pass the concatenated state and action to a fully-connected network, and again predict changes in the state. We normalize the scale of each state dimension by dividing by its standard deviation across the dataset.
In both cases, we use a mean squared error loss computed between (i) the model output (i.e., state delta) applied to the original state and (ii) the ground truth next state. We train the transition model on data sampled from πuni, which is common in learning transition models (Ebert et al., 2018). Model and training hyperparameters are given in Table 4.

heading: A.1.5 REWARD LEARNING
text: Three methods of learning reward functions were considered in this research: (i) direct regression of per-timestep rewards (REGRESS), (ii) regression on a shuffled dataset matching the evaluation distribution of EPIC (REGRESS OOD), and (iii) preference-based learning of rewards. These methods each fit a fully-connected neural network, and their model and training hyperparameters are provided in table 5. We used early stopping based on validation loss for all models to determine the number of training epochs.
For the Bouncing Balls environment we input into the model a set of manually extracted features including distance of the agent to the goal in the current and next state, the difference in distances between states, an indicator of whether the goal has been reached, squared differences in position of other agents, and others. Features involving squared distances are what make these model susceptible to OOD issues. For the Reacher environment we concatenate the state, action, and next state, and pass that directly into the model. In either case, these features are normalized by subtracting their mean and dividing by their standard deviation.

heading: A.1.6 REWARD EVALUATION
text: EPIC We compute the sample-based approximation of EPIC described in section A.1.1 of Gleave et al. (2020). Table 6 gives the parameters we use in computing EPIC. We use the same values of NV and NM as Gleave et al. (2020), though use fewer seeds. In our case each seed represents a full execution of the pipeline (data collection, reward model training, reward evaluation), whereas in Gleave et al. (2020) it represents different sub-samplings of a single dataset. We take this approach in order to assess sensitivity to randomness in the data collection and reward learning processes.
DARD Similarly to EPIC, we compute a sample-based approximation of DARD in the experiments. We sample a batch BV of NV (s, a, s′) transitions. For computing the expectations E[R(s,A, S′)] and E[R(s′, A, S′′)] we sample NA actions u using a sampling policy (described in Appendix A.1.3). We then sample NT samples of S′ or S′′, x′ and x′′, conditional on s or s′ and u. For the last expectation, E[R(S′, A, S′′)], we sample actions and next states similarly for S′, but repeat the process for S′′, overall computing the mean over O((NANT )2) transitions. We compute the dynamics-aware transformation (definition 3) for each transition by averaging over these sampled actions and next states:
CT (R)(s, a, s ′) = R(s, a, s′) + E[γR(s′, A, S′′)−R(s,A, S′)− γR(S′, A, S′′)] (5)
≈ R(s, a, s′) + γ NANT NA∑ i=0 NT∑ j=0 R(s′, ui, x ′′ j )
− 1 NANT NA∑ i=0 NT∑ j=0 R(s, ui, x ′ j)
− γ N2AN 2 T NA∑ i=0 NT∑ j=0 NA∑ k=0 NT∑ l=0 R(x′ij , ukl, x ′′ kl).
(6)
Overall this yields an O(NVN2AN 2 T ) algorithm. In our experiments the transition model is assumed to be deterministic, making NT = 1. The actions are sampled from the N-dimensional action space by taking the cross product of linearly-sampled values for each dimension. For example, in the Bouncing Balls environment, we sample 8 actions linearly between [−5, 5] for each of the two dimensions, overall yielding NA = 64. The complexity of computing E[R(S′, A, S′′)] could be reduced by instead sampling NA actions and NT transitions for each of x′ and x′′.
For the Bouncing Balls environment, we approximate the transition function with a constant velocity model for all agents, implemented in Pytorch and executed on the GPU (Paszke et al., 2019). For the Reacher environment, we use the ground truth simulator, which we execute in parallel across 8 cores. See table 7 for a summary of the DARD parameters used in the experiments.
Policy Evaluation We compute average episode returns of policies trained on both manuallydefined and learned reward models. Training parameters are the same as those used for learning the expert policy (see Table 2). We evaluate policies for 1 million steps in the respective environment, and report the average, undiscounted episode return. Similarly to the other reward evaluation steps, we train one policy for each random seed (of which there are 5).

heading: A.1.7 STANDARD ERROR OF RESULTS
text: Tables 8 and 9 provide the standard errors in the estimates of the mean distances and episode returns, computed over 5 random seeds.

heading: A.2 ADDITIONAL EXPERIMENTS

heading: A.2.1 POINT MAZE EXPERIMENTS
text: In this section we present results for the Point Maze environment considered in Gleave et al. (2020). These results illustrate a disadvantage of DARD. As discussed in section 5, because DARD performs reward comparisons between transitions relative to a transition model, if all the transitions it considers (across all possible actions) have near-identical reward values, it can be sensitive to noise in the reward model. The Point Maze environment fits this description, and DARD performs poorly on it as a result (see table 10). We provide evidence for the hypothesis that the lack of reward-differentiated transitions causes this poor performance by also providing results for an adapted Point Maze environment, which is identical to the original except that we increase the time difference between timesteps by a factor of 5 (such that nearby transitions yield different reward values). In this adapted case, DARD and EPIC distances are significantly closer than in the original environment.
Two additional traits of the environment are relevant. First, the ground truth reward is only a function of the current state and action, but not the next state. As a result, learned reward models tend to ignore the next state, which minimizes the effect of the OOD reward evaluations performed by EPIC. Second, in these experiments (unlike those in section 5) we train reward models to fit the ground truth reward model (as opposed to a shaped version of it). We do this to be consistent with the experiments provided in Gleave et al. (2020); however, this results in the learned reward models exhibiting little shaping (as illustrated by the low distance values of Dp). This is a property of the reward learning algorithm and specific environment in which it is applied, but learned reward models may exhibit significant shaping in general (Fu et al., 2017).

heading: A.2.2 METRIC SAMPLE SIZE SENSITIVITY
text: How sensitive are reward comparison metrics to the size of the dataset on which they are computed? The answer depends on the specific environment, reward functions, and comparison metric under consideration. As such, in this section we evaluate the sensitivity to sample size variations of DARD and EPIC in the Bouncing Balls and Reacher environments across a variety of manually defined and learned reward functions.
Evaluation Procedure Because we do not have “ground-truth” values that each metric should assume for reward functions in general, we focus instead on the variability of each reward comparison metric for a given sample size. We quantify this variability by computing, for each metric, a 95% confidence interval (CI) of the mean reward distance across different sample sizes. In this context, a smaller CI width indicates that a metric is less sensitive to the random variations in the sampling of the data. We compute the CI by sampling K = 100 datasets of size N for varying N from a much
larger population of samples (we use the reward evaluation dataset described in Appendix A.1.3). For each dataset, we compute each metric comparing each reward function to the ground-truth reward function. We compute the CI based on the K resulting distances for each sample size N. For the evaluation datasets, we use π∗ for the Bouncing Balls environment, and πuni for the Reacher environment. We use π∗ for Bouncing Balls because the reward is sufficiently sparse that for small sample sizes, N, the metric values are frequently undefined (due to only having samples with zero reward). Using π∗ instead of πuni increases the fraction of transitions within the goal threshold addressing the problem.
Reward Functions We compare a set of manually defined and learned reward functions. For the manually defined reward functions, we desire a set of rewards that smoothly vary in similarity to the ground-truth reward. To accomplish this, we use a noisy version of the ground-truth reward defined as Rnoisy(s, a, s′) = R(s, a, s′) + for ∼ N (0, σ). By increasing σ we produce a sequence of reward functions that are increasingly different from the ground-truth reward. For the learned rewards, we use the REGRESS and REGRESS OOD reward models introduced in Section 5. Recall that REGRESS is trained on transitions sampled from a dataset of demonstrations collected from the environment, whereas REGRESS OOD is trained on the distribution of transitions resulting from sampling actions and next states independently from the starting state. The resulting training distribution matches that used by EPIC in comparing rewards.
Results Fig. 2 shows the results of the experiment, with each row corresponding to a different reward function, and each column corresponding to a different environment (Bouncing Balls on the left and Reacher on the right). We see that the 95% CI width for DARD and EPIC are quite similar for the noisy ground-truth reward functions (top three rows of the figure) across all sample sizes. This indicates that, for these types of reward functions, the two metrics are similarly sensitive to the size of the dataset. Note that as the amount of noise increases so does the width of the CI, but the similarity of results across metrics holds.
For the learned reward models we do observe different behavior between the metrics. In the case of the REGRESS model (4th row from the top), we see that DARD yields significantly smaller CI widths than does EPIC. The reason for this is that EPIC evaluates the reward function at transitions outside its training distribution, which can yield arbitrary values. The additional randomness (with respect to the random sampling of the data subset) incurred in these reward calculations results in more variation in the reward distance, which produces larger CIs. In contrast, DARD avoids these OOD evaluations of the reward, instead staying close to the reward function training distribution where it is more consistent (across data subsets), producing smaller CIs.
For the REGRESS OOD reward model (bottom row), we observe the inverse: EPIC produces smaller CI widths than does DARD. This is because the reward model training distribution matches the one used by EPIC. As a result, the “imagined” transitions of EPIC effectively increase the size of the evaluation dataset producing less variation for a given sample size. DARD also uses “imagined” transitions, but only from the distribution of transitions encountered in practice in the environment.
Conclusion We evaluated the sensitivity of DARD and EPIC to variations in sample size across different environments and reward models. We found that for noisy ground-truth reward functions, the two metrics performed similarly, and that for learned reward functions, the relative sensitivity of the metrics depends on the training distribution of the reward function under consideration.

heading: A.2.3 RANDOMIZED REWARD FUNCTIONS
text: The results in Section 5 focus on a special set of reward functions that are relatively similar to the ground-truth reward function. In this section we instead attempt to address the question, how does DARD perform in the full range of reward similarity? We investigate this question by (i) randomly generating a large number of reward functions in the Reacher environment, (ii) optimizing a policy for each reward function, (iii) evaluating that policy against the ground-truth reward function, and (iv) computing the DARD distance between the randomly generated and ground-truth rewards.
Evaluation Procedure The rewards are generated by randomly sampling weights for the three reward components: distance from goal, action magnitude, goal-reached
indicator. Weights for the first two components are sampled uniformly between [0, 1]. The reason we disallow negative weights for these components is that they make policy optimization challenging or ill-posed: in the distance from goal case it creates a challenging exploration problem, and in the action magnitude case it encourages the policy to output increasingly large actions. Weights for the goal-reached indicator component are sampled uniformly from [−1, 1]. The reward function is then computed as a linear combination of the reward components weighted by these sampled values. We sample 128 reward functions in total. Policy optimization, reward evaluation, and policy evaluation are performed as described in Appendix A.1.
Results Fig. 3 visualizes the results from the experiment, computing DARD on the random (πuni) and expert (π∗) coverage distributions. We see that in both cases DARD is predictive of policy return as indicated by the association between small DARD distances and large policy return. The DARD distance and policy return are both heavily dependent on the sign of the goal-reached indicator weight, which we visualize by coloring points based on the sign of this weight. When the sign is negative, the policy learns to avoid getting too close to the goal, thereby dramatically reducing its expected return under the ground-truth reward. The πuni plot shows policy return decaying more quickly as a function of DARD distance than does the plot of π∗. The reason for this is that in the πuni case, the action magnitude contributes much more significantly to the DARD distance than in the π∗ case (because π∗ generally consists of small actions near the goal state).
There are some outliers in the plot, which seem to result from extreme combinations of weight values that can cause policy optimization issues. For example, cases of low DARD distance and low policy return in general tend to have small distance from goal weights and large, positive goal-reached indicator weights. In these cases, the reward is quite sparse, causing problems for policy optimization (based on prior experiments, the policy does eventually achieve high expected return, but only with more training timesteps). In the πuni case, instances of large DARD distance and high policy return tend to result from extremely small action magnitude weights and large, positive goal-reached indicator weights. In these cases, the optimized policy takes large magnitude actions to quickly reach the goal state. This incurs a large penalty over the first few timesteps of the episode, after which the agent remains mostly stationary, accruing the goal-reached reward. This trend does not hold for π∗, which demonstrates DARD’s sensitivity to the coverage distribution.
Conclusion In this section, we evaluated DARD on a large number of random reward functions in the Reacher environment, many of which differ significantly from the ground-truth reward. Results demonstrate that DARD maintains its predictiveness of policy return in this setting across both coverage distributions.

heading: A.3 ADDITIONAL DISCUSSION

heading: A.3.1 THE IMPACT OF TRANSITION MODEL ERRORS ON DARD
text: In this section, we discuss how errors made by the transition model can impact the performance of DARD. We organize our discussion of this topic around different cases of reward equivalence and different types of errors that a transition model might make. The high-level summary of the following discussion is that errors in the transition model only impact the performance of DARD on reward functions that are not equivalent everywhere (case 2 below), and in this case DARD may produce both false negative and false positive equivalences as a result of transition model errors.
Case 1: Equivalent Reward Functions Consider two reward functions that are equivalent across the full space of transitions accounting for reward shaping (this includes the case of identical rewards). The proof of Proposition 2 does not rely on any proprieties of the transition model. As a result, we can conclude that even arbitrary errors in the transition model will not result in two everywhere-equivalent reward functions being considered different. This logic indicates that errors in the transition model may only impact the performance of DARD when the reward functions are not everywhere-equivalent as discussed next.
Case 2: Different Reward Functions
SUBCASE A: REWARDS ARE EQUIVALENT ON ALL Realizable TRANSITIONS Given the ground truth transition model, DARD would correctly identify the two rewards as equivalent (with respect to realizable transitions). However, if the transition model erroneously samples unrealizable transitions on which the rewards differ, the transformation term of Eq. (3) could assume arbitrary values, thereby resulting in the two rewards being considered different. This might occur, for example, when dealing with learned reward functions for which sampled next states are OOD with respect to their training distribution.
SUBCASE B: REWARDS DIFFER ON SOME REALIZABLE TRANSITIONS Given the ground truth transition model and sampling of the full action space, DARD would correctly identify the two rewards as different (assuming states producing transitions on which the rewards differ exist in the dataset). However, if the transition model is incorrect in such a way that it never samples those transitions on which the reward models differ, DARD may produce false positive equivalences.
For example, suppose a transition model is learned for an autonomous driving environment. Because collisions are rare in this environment, the transition model might never sample transitions involving collisions. As a result, two reward models that differ only with respect to transitions involving collisions may be considered equivalent by DARD. In the preceding text, we say that DARD may produce false positive equivalences in this case because even with an erroneous transition model, if the dataset on which the rewards are compared itself contains transitions on which the rewards differ DARD will still recognize them as different (due to the R(s, a, s′) term of Eq. (3)). Continuing the autonomous driving example: if the dataset itself contains collisions, then the rewards will be identified as different even if the transition models do not sample collisions. This case illustrates the importance of using a comprehensive coverage distribution in comparing reward functions.
A.3.2 ANALYSIS OF DARD-L IN REACHER WITH π∗ COVERAGE DISTRIBUTION
This section provides a detailed analysis of the results for DARD-L in the Reacher environment when using the coverage distribution of the expert policy.
Unlike the πuni coverage distribution, the states sampled from the expert distribution in the Reacher environment generally have small distances between the end-effector and goal location. As a result, the reward is dominated by whether or not the end-effector is within the threshold distance at which
the “goal reached” reward is given. This causes the reward functions to be sensitive to small errors in the predicted state because those errors can move the end-effector in or out of range of the goal.
On average, the learned transition model predicts larger next state end-effector displacements than the ground truth transition model. This can be seen in Fig. 4 where we plot the histogram of ground truth and predicted displacements over a set of transitions for which the transformed reward differs the most between the ground truth and learned transition models. These erroneous, larger predicted distances result from using a mean squared error loss, which causes displacements near zero to contribute a minuscule amount to the loss.
As a result, the next states predicted by the learned transition model are on average easier to assign rewards to than those of the ground-truth transition model: they are more clearly beyond the limit of the “goal reached” threshold, and (due to being farther away) reward shaping (which is easier to predict) constitutes a larger fraction of the reward. Overall this results in the learned transition model yielding lower DARD distances than those of the ground truth transition model. This is an instance of Case 2.B in Appendix A.3.1: states at which the reward models differ more are sampled relatively less frequently due to errors in the learned transition model.

heading: A.3.3 APPLICATIONS OF REWARD COMPARISON METRICS
text: This section discusses two potential applications of reward comparison metrics.
Benchmarking Reward Learning Algorithms Suppose we have a large amount of (potentially suboptimal) demonstration data from which we would like to learn a reward function using one of a variety of potential IRL algorithms. Additionally, suppose that we have (through an expen-
sive process) manually labeled rewards in a relatively small set of demonstrations. Furthermore, assume that evaluating a policy online involves an expensive or dangerous process, and that learning a policy for this environment is itself challenging (e.g., sometimes fails or produces policies of highly-variable quality). Note that this setting might occur in practice in physical robotic domains such as autonomous driving or robotic manipulation.
In summary, we would like to know which of the set of possible IRL algorithms produces the best reward function using the large set of demonstrations, but we would prefer to avoid policy learning and evaluation. One way to accomplish this goal would be to learn a “benchmark” reward model on the small set of manually labeled rewards (e.g., through supervised learning as in Cabi et al. (2019)), and then to compare that with the rewards produced by the various IRL algorithms. If a reward function learned via IRL is similar to the benchmark reward function, this indicates that it is similar to the reward function manually defined by experts, and should therefore be preferred. In this way, we can evaluate the different IRL methods we are considering, and choose the best for our problem. Furthermore, this approach could be applied in creating an open benchmark enabling the comparison of reward learning methods.
Validating Learned Reward Functions Suppose that we have deployed a system that uses a learned reward function. With deployed learning systems, it is often necessary to continuously collect data and retrain models in order to account for changing data distributions arising from a variety of sources (Breck et al., 2017). As such, we would like to frequently retrain the reward function on newly-collected data; however, we would also like to ensure that the reward function has not changed “too much” from previous versions that we know to be of high quality (through expensive deployment). Similar to the previous application, suppose that online policy evaluation is expensive or dangerous, and that policy optimization is challenging.
Given this problem setting, we could use reward comparisons as follows. First, learn a new reward function on all the data collected so far. Second, compare that reward function with the old reward function on the validation dataset of the old reward. If the comparison yields a small distance between rewards, this indicates that the reward functions are likely quite similar, thereby providing support for continuing the process of deploying the new reward function. Alternatively, if the comparison yields a large distance between rewards, this indicates that the new reward is potentially quite different from the old one, and that we should carefully inspect the cases where the rewards differ before proceeding with deployment. In this way, we have defined (part of) a validation procedure for continuously learning and deploying reward functions.

heading: A.4 PROOFS

heading: A.4.1 COMPARING LEARNED REWARD FUNCTIONS
text: Proposition 3 (The dynamics-aware transformed 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 DS ∈ ∆(S) and DA ∈ ∆(A) be distributions over states and actions, and T : S × A → ∆(S) be a conditional distribution over next states. Let R′ denote R shaped by Φ : R′(s, a, s′) = R(s, a, s′) + γΦ(s′) − Φ(s). Then the dynamics-aware transformations of R′ and R are equal: CT (R′) = CT (R).
Proof. Let s, a, s′ ∈ S × A× S . Then by substituting in the definition of R′ and using linearity of expectation:
CT (R ′)(s, a, s′) , R′(s, a, s′) + E[γR′(s′, A, S′′)−R′(s,A, S′)− γR′(S′, A, S′′)] (7)
= (R(s, a, s′) + γΦ(s′)− Φ) (8) + E[γR(s′, A, S′′) + γ2Φ(S′′)− γΦ(s′)] − E[R(s,A, S′) + γΦ(S′)− Φ(s)] − E[γR(S′, A, S′′) + γ2Φ(S′′)− γΦ(S′)]
= R(s, a, s′) + E[γR(s′, A, S′′)−R(s,A, S′)− γR′(S′, A, S′′)] (9) + (γΦ(s′)− Φ(s))− E[γΦ(s′)− Φ(s)] + E[γ2Φ(S′′)− γΦ(S′)]− E[γ2Φ(S′′)− γΦ(S′)]
= R(s, a, s′) + E[γR(s′, A, S′′)−R(s,A, S′)− γR′(S′, A, S′′)] (10) = CT (R)(s, a, s ′). (11)
Lemma A.1 (The Pearson distance Dρ is a pseudometric). (Lemma 4.5 from Gleave et al. (2020)) Namely, for X a set of random variables, Dρ satisfies the following properties:
Identity: Dρ(X,X) = 0 ∀X ∈ X , Symmetry: Dρ(X,Y )Dρ(Y,X) ∀X,Y ∈ X , and Triangle Inequality: Dρ(X,Z) ≤ Dρ(X,Y ) +Dρ(Y,Z) ∀X,Y, Z ∈ X .

heading: Proof: See Gleave et al. (2020)
text: Proposition 4 (The DARD distance metric is a pseudometric). Let S, A, S′ be random variables jointly following some coverage transition distribution, and let T be the transition model of the corresponding environment. We define the DARD pseudometric between rewards RA and RB as follows:
DDARD(RA, RB) = Dρ ( CT (RA)(S,A, S ′), CT (RB)(S,A, S ′) )
(12)
Proof. This proof closely follows the proof of Theorem 4.7 from Gleave et al. (2020). Namely, the result follows from direct application of Lemma A.1.
Let RA, RB , and RC be reward functions mapping from transitions S ×A× S to real numbers R. Identity: It immediately follows that DDARD(RA, RA) = Dρ ( CT (RA)(S,A, S ′), CT (RA)(S,A, S ′) )
= 0 since Dρ is a pseudometric, Dρ(X,X) = 0 ∀X ∈ X . Symmetry: This again immediately follows from the fact that Dρ is a pseudometric. We have that:
DDARD(RA, RB) = Dρ ( CT (RA)(S,A, S ′), CT (RB)(S,A, S ′) )
(13)
= Dρ ( CT (RB)(S,A, S ′), CT (RA)(S,A, S ′) )
(14)
= DDARD(RB , RA) (15) since Dρ(X,Y ) = Dρ(Y,X) because Dρ is a pseudometric.
Triangle Inequality: This again immediately follows from the fact that Dρ is a pseudometric. We have that:
DDARD(RA, RC) = Dρ ( CT (RA)(S,A, S ′), CT (RC)(S,A, S ′) )
(16) ≤ Dρ ( CT (RA)(S,A, S ′), CT (RB)(S,A, S ′) ) (17)
+Dρ ( CT (RB)(S,A, S ′), CT (RC)(S,A, S ′) )
(18)
= DDARD(RA, RB) +DDARD(RB , RC) (19) since Dρ(X,Z) ≤ Dρ(X,Y ) +Dρ(Y, Z) because Dρ is a pseudometric.

Review summaries:
This paper considers a reward comparison method in RL, where the goal is to evaluate how close an alternative reward function is to the ground truth reward function in terms of how well the set of optimal policies for each reward function is aligned. The proposed method (DARD) builds upon EPIC [Gleave et al.] and addresses an issue of EPIC by taking into account the actual dynamics of the environment when canonicalizing/transforming reward function as opposed to considering all possible (s, a, r') triples in EPIC. This allows DARD to be more robust to out-of-distribution transitions compared to EPIC while still being invariant to reward shaping like EPIC. The empirical results on Bouncing Balls and Reacher environments show that DARD can represent the reward distance more reliably EPIC does.

The paper proposes a new reward pseudometric called Dynamics Aware Reward Distance (DARD) which uses approximate transition model of the environment to compare reward functions while being indifferent to reward shaping. Previous work Equivalent Policy Invariant Comparison (EPIC) addresses the same problem, but it uses all possible state transitions feasible or not. The authors show that this can cause problems for reward functions that are technically equivalent in the feasible state transition state, but unequal on the infeasible transitions (which should not matter). The authors evaluate the method in "bouncing balls" (a discrete navigation task) and "reacher"  (robotic manipulation) environments. The results show that the proposed distance is more accurate compared to EPIC (distance is zero for "FEASIBILITY", 2 reward functions that are technically different but practically the same) and the distances are more aligned with the learned policies scores.

The paper proposes a new reward pseudometric (DARD), which is invariant to reward shaping and computationally efficient. Assuming access to the transition model of the environment, DARD could avoid the error due to samples out of the training distribution. The numerical results in simulated physical domains show that DARD outperforms previous methods. 

This paper proposes a novel method for comparing reward functions without policy optimization, the Dynamics-Aware Reward Distance. DARD improves on the state-of-the-art EPIC distance by using an approximate transition model to evaluate reward functions on transitions close to the training distribution, while EPIC evaluates on arbitrary transitions (which can be infeasible). The authors prove that DARD is also invariant to reward shaping, and experimentally demonstrate on the Bouncing Balls and Reacher environments that DARD is a better predictor of policy return than EPIC and works for coverage distributions induced by either random or expert actions.