Dueling RL: Reinforcement Learning with Trajectory Preferences
Aldo Pacchiano, Aadirupa Saha, Jonathan Lee
Introduction
Classical reinforcement learning (RL) with absolute reward feedback is a well-studied framework which is a sequential experience-driven learning process to optimize an accumulated long-term reward (Sutton and Barto, 2018; Auer et al., 2009; Singh et al., 2002). Over the years, several works have addressed RL in terms of both the optimal sample complexity for finding the best policy (Azar et al., 2013; Dann and Brunskill, 2015; Dann et al., 2017; Domingues et al., 2020a; Lattimore and Hutter, 2012) and minimizing regret via balancing exploration and exploitation (Zhang and Ji, 2019; Azar et al., 2017; Ortner, 2020; Talebi and Maillard, 2018; Efroni et al., 2020; Domingues et al., 2020b).
However, a major limitation of the standard RL setting is that its success crucially depends on the prior knowledge encoded into the definition of the reward function. The learned policy can often be sensitive to small changes of the reward, possibly yielding very different behaviors depending on the relative values of the rewards. The choice of reward function in applications such as robotics consequently entails a high amount of non-trivial effort in reward engineering, leading to challenges such as reward shaping, reward hacking, infinite rewards, and multi-objective outcomes (Wirth and Fürnkranz, 2013; Wirth et al., 2017).
The framework of Preference-based Reinforcement Learning (PbRL) (Busa-Fekete et al., 2014; Wirth et al., 2016, 2017) has been proposed as a fix to this problem, to enforce learning from non-numerical, relative feedback which need not suffer from issues due to the inaccuracy of reward modeling or engineering. This framework widely applies to multiple areas including robot training, stock-prediction, recommender systems, clinical trials, etc. (Novoseller et al., 2019; Sadigh et al., 2017; Christiano et al., 2017; Kupcsik et al., 2018; Jain et al., 2013; Wirth et al., 2017).
While the problem of PbRL was introduced almost a decade ago, most work in it has been primarily applied or experimental in nature (Jain et al., 2013; Busa-Fekete et al., 2014; Christiano et al., 2017; Wirth and Fürnkranz, 2013; Wirth et al., 2016, 2017; Kupcsik et al., 2018). There have also been attempts to design suitable algorithms based on varying preference models and problem objectives (Novoseller et al., 2019; Xu et al., 2020), but, to the best of our knowledge, existing theoretical guarantees on PbRL literature are sparse. The performance guarantees of most of the proposed algorithms are not well-understood (Wirth et al., 2017; Xu et al., 2020) except for some very recent attempts (Novoseller et al., 2019; Xu et al., 2020) as discussed below in the section on related work. We consider the problem of provably finding the best finite-horizon policy (i.e., one with highest expected reward) for an unknown Markov decision process (MDP), but with only relative preference feedback on -length trajectories.
To the best of our knowledge, we are the first to formulate and analyze the finite time regret guarantee for preference-based linear bandits problem with non-Markovian reward models (Sec. 2).
We further generalize our algorithm to the case of unknown models and propose an algorithm with regret guarantee (Sec. 4).
Related Work. Over the last two decades the problem of learning from preference feedback in bandits, known as dueling bandits, has gained much attention (Yue et al., 2012; Zoghi et al., 2014b, 2015). Dueling bandits generalizes the standard multi-armed bandit (MAB) (Auer et al., 2002). The goal is to identify a set of ’good’ arms from a larger fixed set of arms by querying preference feedback for pairs of actively chosen arms. Yue and Joachims (2009, 2011); Saha and Krishnamurthy (2022); Ghoshal and Saha (2022); Saha and Gopalan (2018a) The setting is relevant in various real-world systems which aim to collect information from user preferences, including recommender systems, retail management, search engine optimization, job scheduling, etc. Towards these goals, several algorithms have been proposed (Ailon et al., 2014; Zoghi et al., 2014a; Komiyama et al., 2015; Gajane et al., 2015; Saha and Gopalan, 2018b, 2019).
Though there has been a fair amount of research for preference-based bandits (no state information), few works consider incorporating preference feedback in the reinforcement learning (RL) framework, which considers the problem of long-term objectives over a markov decision process (Singh et al., 2002; Ng et al., 2006; Talebi and Maillard, 2018; Ortner, 2020; Zhang and Ji, 2019; Zanette and Brunskill, 2019). However the classical RL setup assumes access to reward feedback for each state-action pair which might be impractical in many real world scenarios. Few very recent works considered training RL agents based on general trajectory-based reward which are available only at the end of each trajectory (Efroni et al., 2021; Chatterji et al., 2021), but their setting still assumes access to absolute reward feedback, unlike the case in PbRL. Some initial works consider the applied PbRL problem inspired by the problems of reward hacking, reward shaping, difficulty to model infinite rewards or multi-objective trade-offs (Busa-Fekete et al., 2014; Wirth et al., 2016, 2017; Christiano et al., 2017) etc.
Novoseller et al. (2019) made the first attempt to analyze the finite -round regret guarantee for the PbRL problem with trajectory preference feedback, where the learner is allowed to run two independent trajectories in parallel and receive preference feedback after every such -length roll out. Assuming an underlying MDP model, the preference between two -length trajectories is modeled as being proportional to the accumulated reward of the corresponding trajectories. The authors propose a Double Posterior Sampling (DPS) technique with asymptotically sublinear regret.
Xu et al. (2020) models reward-free trajectory preferences and analyses the sample complexity of finding the -best-policy. Their proposed algorithm crucially depends on an underlying dueling bandit black box whose performance guarantee is restricted to preference structures like Strong Stochastic Transitivity and Stochastic Triangle Inequality. Furthermore, the algorithms proposed in this work are not shown to enjoy provably optimal sample complexity, and, moreover, the fundamental performance limit of sample complexity is also not explicitly analyzed.
The literature of multi-agent reinforcement learning in Markov games closely relates to the setup of PbRL which attempts the problem of reaching Nash equilibrium of a simultaneous move markov game based on per-state win-loss feedback of the two (or multiple) players. Bai and Jin (2020); Bai et al. (2020); Liu et al. (2021) address the problems from finite action two player markov games, while Xie et al. (2020) extended this setting to zero sum games with linear function approximation. However all these works analyzed the episodic sample complexity of the learning algorithm towards finding an -approximate Nash equilibrium which is fairly unrelated to the regret objective of PbRL problem we considered in this paper.
Another closely related sub-field of RL, imitation learning, addresses the objective of learning optimal behavior from trajectories suggested by an expert. In Ng et al. (2000); Boularias et al. (2011); Neu and Szepesvári (2012); Wulfmeier et al. (2015), inverse reinforcement learning problems have been considered, where the objective is to extract (unknown) reward function from the trajectories given by an oracle or expert. Once the reward functions are computed, any RL algorithm could, in principle, be applied to compute the optimal policy. Ho and Ermon (2016) propose a generative adversarial network based imitation learning algorithm that computes the optimal policy directly from the trajectories of expert. Our work is fundamentally different in the sense that we do not receive trajectories or optimal actions from an expert. Instead, we get preferences over sample trajectories that are posed as queries to a system expert for preference feedback.
Problem Setup
Policy embedding. The above feature embedding also leads to a natural mean embedding of any policy given by .
Equation LABEL:eq:pref_logistic says the probability of any trajectory being preferred over is essentially proportional to the score difference of the individual trajectories, assuming the score for any trajectory is defined as the function
Non markovian policy class. The performance of all our algorithms will be measured against the policy that maximizes . Since may be a non-markovian function of the trajectory, the policy optimizing this objective need not be markovian. We therefore set as the set of all history dependent policies. In contrast with standard markovian RL works, this is one of the main sources of technical complexity of our setting.
[Bounded parameter] We assume that for some known .
[Bounded feature maps] For all trajectories we assume that for some known .Note could essentially depend on the trajectory-length .
The degree of non-linearity of the sigmoid over the parameter space (denoting the first derivative of by ) is given by
Objective: Alternative: The objective of the learner is to minimize regret by finding policies to maximize the sum of their expected scores over rounds. At each round , the learner proposes two policies, and , which are executed in the MDP generating trajectories and . The learner then receives feedback in the form of the Bernoulli variable which specifies whether is preferred () or is preferred (). The preference feedback is distributed according to . We measure the learner’s performance via its pseudo-regret w.r.t. policy class , which we define as:
where . This essentially measures the performance of the learner at round in terms of average score of the played policies w.r.t. the score maximizing policy .
One may think of using our preference model (Equation LABEL:eq:pref_logistic_policies) to define an alternative notion of regret:
Fortunately, these two notions of regret can be shown to be ‘equivalent’ in the following sense,
Claim 1. Let . Then also achieves the in Eqn. 4.
This argument can also be used to show and are equivalent up to constant factors when . The proof is given in Appendix A.
Claim 2. .
We conclude that a strategy that attains sublinear regret also has sublinear regret.
Preference-Based Learning with Known Model
Then, the projected parameter, along with its confidence set, is given by
where . We restate a bound by Faury et al. (2020) that shows the probability of being in for all can be lower bounded.
2 Algorithm and Analysis
We are now ready to state the Logistic Preference based Reinforcement Learning (LPbRL) algorithm with known model, shown in Algorithm 1. Before any interaction or feedback, we initialize identical data matrices , being a regularization parameter. , as defined before, is designed to track the exact covariates used in the maximum likelihood estimation. (Line 10) on the other hand tracks a similar quantity, but instead uses the expected features under a given policy.
At each round , we then compute an estimate and determine a set of candidate policies for which no other policy significantly outperforms a member of . The threshold for what constitutes “significant” is determined by the uncertainty in the estimate of . We then search over this set to identify two policies, and , with expected features that maximize the uncertainty determined by , precisely by choosing . Both policies are deployed, inducing trajectories and and feedback is received. We then update the data matrices and with the trajectory features and expected features , respectively. The procedure is repeated for each round .
Let and . Then, with probability at least , the expected regret of Algorithm 1 can be bounded by
Note there is no dependence on the size of the state or action spaces on account of the model being known in this setting. Furthermore, we note that any dependence on the horizon is effectively accounted for in the size of the constant that bounds the norm of the trajectory features . For example, if decomposes in a per-timestep fashion as where each satisfies , then a trivial bound would give . However, Assumption 2 allows for greater generality.
Theorem 1 shows that for a sufficiently large choice of the regularization parameter , the pseudo-regret of Algorithm 1 is at most . Importantly, the regret scales nearly optimally with dependency given existing lower bounds for linear bandits (Lattimore and Szepesvári, 2020) and known reductions between the standard and preference regret Saha (2021). Assuming to be constant, we pay the additional factors in and due to non-Markovian rewards which are only indirectly revealed to the learner in terms of preferences.
3 Regret Analysis: Proof Sketch of Thm. 1
We now sketch the proof of Theorem 1. Details and proofs of supporting results can be found in Appendix B.1. The main idea of the proof is to ensure that contains only candidate policies that are predicted to be “sufficiently good” under the learned model using the size of the confidence set . We must also verify that always contains the optimal policy . Thus, as long as the set shrinks at a sufficiently fast rate, our algorithm will have sublinear regret.
However, in order to judge the uncertainty in predictions of the expected value of a policy , we must relate the data matrix that controls the accuracy of the learned parameter (see Lemma 1), and its expected counterpart (used to define ). The set is characterized via because this way it allows us to relate it to the algorithm’s regret, a quantity that depends on the expected features of the played policies. Corollary 1 establishes that distances weighted by are not too far from the same distances weighted by . Let
Under Assumption 1, conditioned on event , for any
The proof of above is given in Appendix B. Leveraging this relationship, we can establish that the confidence set of policies defined in line 5 of Algorithm 1 will contain the optimal policy.
Conditioned on event , ,
The remainder of the proof now consists of showing the instantaneous regret can be bounded in terms of the size of the confidence sets and the uncertainty values . We defer the final details to Appendix B.3.
Unknown model: Algorithm and Analysis
Algorithm description. The LPbRL algorithm for unknown dynamics models works in a similar way to Algorithm 1. The main differences lay in the definition of the set . Whereas in Algorithm 1 this set of policies can be defined without taking into account the model uncertainty, in this case the set of policies to optimize over needs to be carefully constructed in such a way that it can be shown to contain (see Lemma 4). With this in mind we start by introducing the necessary technical tools that will be used throughout this section to deal with model uncertainty.
Our confidence intervals will use a Mahalanobis norm defined by this covariance matrix. Throughout this section we will make heavy use of some of the results from Chatterji et al. (2021). With that in mind we will define a variety of bonus terms. Given any define,
Similar to the previous theorem, we must relate and . We do this via a series of Lemmas.
The proof of Lemma 3 is in Appendix C.2. We now proceed to define the set . To do so, it will be useful to introduce the following confidence radius multiplier
Algorithm 2 shares the structure of Algorithm 1. The main difference lies in the definition of and in the optimization problem to find . We can prove a result similar to Lemma 2 and show that .
The proof of Lemma 4 can be found in Appendix C.3. The next step in the proof is to exhibit a bound on the instantaneous regret,
Similarly, as a consequence of Lemma 12 and a union bound, setting , with probability at least
Armed with the results of Lemma 4 we can show the following bound for the regret.
With probability at least the regret is bounded by,
The proof of Lemma 6 can be found in Appendix C.4. The derivation follows from a repeated use of the instantaneous regret upper bound derived from Lemma 5.
The regret of satisfies,
The complete version of Theorem 2 can be found in Appendix C. Similar to Theorem 1, the leading term in the regret scales as due to estimation based on the preferences. In addition to this, we now have dependence on and unlike before. These arise due to the tabular nature of the problem since the transition dynamics are unknown in this case.
Discussions and Future Scopes
In this work we addressed the problem of reinforcement learning from relative preference feedback where the agent does not get to see the absolute reward of actions taken at each state but instead observes the relative preferences between trajectories. We modeled the preference feedback in terms of the underlying non-Markovian linear reward model and proposed algorithms for both known as well as unknown MDP transition models. Precisely the regret guarantees of our proposed algorithms are analyzed to be respectively and for the case of known and unknown transition models.
As discussed in the introduction, preference-based reinforcement learning has applications in several fields including training robots, stock market, recommender systems, two player games, chatbot interactions, etc. Thus there are plenty of scopes to extend the above setup to incorporate the corresponding system requirements, e.g. generalizing dueling trajectory preferences to subsets, considering alternative preference feedback without assuming an underlying reward model, extending to infinite horizon settings with more complex state-actions spaces, etc. Analyzing the fundamental performance limits of the PbRL regret minimization problem and designing algorithms with tighter performance guarantees would also be another interesting direction to investigate.
Acknowledgment
AS gratefully thanks Aditya Gopalan and Raghuram Bharadwaj Diddigi (IISc Bangalore) for the initial discussions on preference based reinforcement learning literature.
References
Supplementary for \papertitle
Appendix A Appendix for Section 2
Claim 2. .
Recall by Eq. (2), Eq. (4) and Claim .
Now assume . Then for any two policies and , such that , we have:
On the other hand denoting we get:
The claim now follows combining the above two inequalities and noting that by definition . ∎
Appendix B Appendix for Section 3
The primary mechanism behind Corollary 1 is the following lemma for matrix concentration.
Let . Then, with probability , for all , it holds that
Note that the conditional variance of the individual terms may be bounded above by
By (Bartlett et al., 2008, Lemma 2), we have, with probability at least ,
where the third line applied the AM-GM inequality. Rearranging shows that
This holds for a fixed . We now show that it approximately holds for all such that via a covering argument.
Let . Note that by definition. Let be arbitrary and let be the closest vector in the cover so that . Then,
under the good event and choosing . Since this holds for all , we conclude that
with probability at least . Finally, by Jensen’s inequality we have . Then, we apply the union bound over , which gives the result. ∎
The proof of the corollary now follows immediately as a consequence.
Assuming that holds, we have that . Furthermore, Lemma 7 gives
B.2 Proof of Lemma 2
Condition on . By definition of , we have for any arbitrary . This implies
where the second line follows from Corollary 1. ∎
B.3 Proof of Theorem 1
We require a standard determinant bound to complete the proof.
Since , we have that . Therefore, from Lemma 19.4 of Lattimore and Szepesvári (2020)
Armed with the supporting results, we now focus on completing the proof of Theorem 1. The result may be shown by bounding the instantaneous regret. Condition on the event . Then,
The last two terms in the above sum can be bounded using Corollary 1 as follows:
The first two terms leverage the optimistic bonus, using the fact that :
In summary, we have that the instantaneous regret is upper bounded as
where the last inequality follows from the fact that by Lemma 2 and since and were chosen the maximizer of the weighted difference . The regret is therefore
where the second inequality follows from Cauchy-Schwarz and the last inequality applies Lemma 8. ∎
Appendix C Appendix for Section 4
In this section we will use the notation to denote the number of times action was executed at state up to time . Recall the bonus terms,
and the empirical average of bonuses,
Additionally we also define the error terms
In contrast with the definition of bonus this quantity depends on an extra parameter . These erorr terms induce the the following ‘bonus’ function,
Here the expectation is under the true MDP dynamics.
Once we have established the validity of Lemma 6, and therefore that with probability at least ,
it remains to show the terms are small. We’ll do so by showing that for any and and for all policies simultaneously we can bound the empirical expected bonuses in terms of the population quantities ,
Since for all , and is monotonic in we conclude that,
Combining these inequalities the result follows.
Where . In order to bound the remaining empirical error terms, we to the following standard result,
For the empirical sum of errors satisfies the following bound
Let’s rewrite this sum by instead summing over states and actions,
We will use Lemma 10 with . As a consequence of Lemma 10 and Lemma 6 we see that when holds
Therefore with high probability for ,
Therefore with probability ,
Let’s rewrite this sum by instead summing over states and actions,
Therefore with probability ,
The main takeaway from this lemma is that the sum of the square errors grows only logarithmically in . Applying this bound to and setting we obtain,
Applying this bound to and setting we obtain,
Combining these observations we can derive our main result,
If holds then the regret of satisfies,
We will make use of the following Lemma (see Lemma B.1 in Chatterji et al. (2021)),
We will also make use of the following Lemma (see Lemma B.2 from Chatterji et al. (2021) ) corresponding to the uniform version of lemma 12.
We will make use of the following standard bound on the covering number of the ball.
C.2 Proof of Lemma 3
Recall that as a result of assumption 1 and the definition of we can bound . Let be such that .
Let’s consider ,
Invoking Lemma 14 and setting applying it to
Setting and using the fact that all we have ,
C.3 Proof of Lemma 4
By definition of , for any arbitrary . Therefore,
In particular this implies that with probability at least for and any ,
Since holds, by Lemma 3
Since is assumed to hold Corollary 1 implies that and therefore,
Thus implying . Taking a union bound between and the probability event from Equation 25 yields the result.
C.4 Proof of Lemma 6
If the regret is bounded by,
We first condition on . Let’s start by showing the following bound on the instantaneous regret,
Since we are conditioning on , by Lemma 5 follows that for all ,
Since holds, the last two terms in the sum above can be bounded using Lemma 3 and Corollary 1 by
The first two terms on the right hand side of inequality 26 leverage the optimistic bonus, using the fact that and therefore,
Putting these together we can conclude that,
Recall that whenever holds, and that as a result of how are chosen (see Algorithm 2)
The regret is therefore upper bounded by,
Where the last inequality follows from Lemma 8.
Appendix D Miscelaneous Technical Lemmas
Observe that . By invoking a time-uniform Hoeffding-style concentration inequality (Howard et al., 2020, Equation (11)) we find that
Rounding up the constants for the sake of simplicity we get