Delegative Inverse Reinforcement Learning

We introduce a reinforcement-like learning setting we call Delegative Inverse Reinforcement Learning (DIRL). In DIRL, the agent can, at any point of time, delegate the choice of action to an “advisor”. The agent knows neither the environment nor the reward function, whereas the advisor knows both. Thus, DIRL can be regarded as a special case of CIRL. A similar setting was studied in Clouse 1997, but as far as we can tell, the relevant literature offers few theoretical results and virtually all researchers focus on the MDP case (please correct me if I’m wrong). On the other hand, we consider general environments (not necessarily MDP or even POMDP) and prove a natural performance guarantee.

The use of an advisor allows us to kill two birds with one stone: learning the reward function and safe exploration (i.e. avoiding both the Scylla of “Bayesian paranoia” and the Charybdis of falling into traps). We prove that, given certain assumption about the advisor, a Bayesian DIRL agent (whose prior is supported on some countable set of hypotheses) is guaranteed to attain most of the value in the slow falling time discount (long-term planning) limit (assuming one of the hypotheses in the prior is true). The assumption about the advisor is quite strong, but the advisor is not required to be fully optimal: a “soft maximizer” satisfies the conditions. Moreover, we allow for the existence of “corrupt states” in which the advisor stops being a relevant signal, thus demonstrating that this approach can deal with wireheading and avoid manipulating the advisor, at least in principle (the assumption about the advisor is still unrealistically strong). Finally we consider advisors that don’t know the environment but have some beliefs about the environment, and show that in this case the agent converges to Bayes-optimality w.r.t. the advisor’s beliefs, which is arguably the best we can expect.


All the proofs are in the Appendix.

Notation

The set of natural numbers is defined to begin from 0. Given , denotes the set . Given a logical formula , denotes its truth value.

Given a set , we denote , the set of finite strings over the alphabet . The unique string of length 0 is denoted . We also denote by the set of infinite strings over alphabet . Given and , is the -th symbol in (i.e. ) and is the prefix of length of (ending in ). Given , is the length of and is the concatenation of and . The latter notation is also applicable when . The notation means that is a prefix of . Given sets , and , we sometimes use the notation . Given , and , is defined by where .

Given sets and , the notation means that is a partial mapping from to , i.e. a mapping from some set to .

Given a topological space , is the space of Borel probability measures on . When no topology is specified, is understood to be discrete: in this case, can also be regarded as a function from to . The space is understood to have the product topology. Given topological spaces , and , is the support of and is the product measure. Given a Markov kernel from to , is the semidirect product of and . When and are discrete, is the Shannon entropy of (in natural base) and is the Kullback-Leibler divergence from to .

Given and , we use the notation

The symbols will refer to usual -notation.

Results

An interface is a pair of finite sets (“actions” and “observations”). An -policy is a function . An -environment is a partial function s.t.

i.

ii. Given and , iff and .

It is easy to see that is always of the form for some . We denote .

Given an -policy and an -environment , we get in the usual way.

An -reward function is a partial function . An -universe is a pair where is an -environment and is an -reward function s.t. . We denote the space of -universes by . Given an -reward function and , we have the associated utility function defined by

Here and throughout, we use geometric time discount, however this choice is mostly for notational simplicity. More or less all results carry over to other shapes of the time discount function.

Denote \ the space of -policies. An -metapolicy is a family , where the parameter is thought of as setting the scale of the time discount. An -meta-universe is a family . This latter concept is useful for analyzing multi-agent systems, where the environment contains other agents and we study the asymptotics when all agents’ time discount scales go to infinity. We won’t focus on the multi-agent case in this essay, but for future reference, it seems useful to make sure the results hold in the greater generality of meta-universes.

Given an -policy , an -universe and , we denote (this is well-defined since is defined on the support of ). We also denote . We will omit when it is obvious from the context.

Definition 1

Fix an interface . Consider a metapolicy and a set of meta-universes. is said to learn when for any

is said to be learnable when there exists that learns .


Our notion of learnability is closely related to the notion of sublinear regret, as defined in Leike 2016, except that we allow the policy to explicitly depend on the time discount scale. This difference is important: for example, given a single universe , it might be impossible to achieve sublinear regret, but is always learnable.

Proposition 1

Fix an interface . Consider a countable learnable set of meta-universes. Consider any s.t. . Consider a -Bayes optimal metapolicy, i.e.

Then, learns .


Proposition 1 can be regarded as a “frequentist” justification for Bayesian agents: if any metapolicy is optimal in a “frequentist” sense for the class (i.e. learns it), then the Bayes optimal metapolicy is such.

Another handy property of learnability is the following.

Proposition 2

Fix an interface . Let be a countable set of meta-universes s.t. any finite is learnable. Then, is learnable.


We now introduce the formalism needed to discuss advisors. Define , and . Here, the factor of is the action taken by the advisor, assumed to be observable by the agent. The environments we will consider are s.t. this action is unless the agent delegated to the advisor at this point of time, which is specified by the agent taking action . It will also be the case that whenever the agent takes action , the advisor cannot take action .

Denote . Given , we define by

Given , we define by .

Definition 2

An -policy is said to be autonomous when for any , .


Consider an -environment and an autonomous -policy , which we think of as the advisor policy. We define the -environment as follows. For any s.t. , and :

It is easy to the above is a well-defined -environment with .

Given an -universe , we define the -reward function by and the -universe .

We now introduce the conditions on the advisor policy which will allow us to prove a learnability theorem. First, we specify an advisor that always remains “approximately rational.”

The notation will be used to mean . Given a universe and we define and by

Definition 3

Fix an interface . Consider a universe . Let . A policy is called strictly -rational for when for any and


Now we deal with the possibility of the advisor becoming “corrupt”. In practical implementations where the “advisor” is a human operator, this can correspond to several types of events, e.g. sabotaging the channel that transmits data from the operator to the AI (“wireheading”), manipulation of the operator or replacement of the operator by a different entity.

Definition 4

Fix an interface . Consider a family s.t. for any , if then . We think of as the set of histories in which a certain event occurred. Consider a meta-universe . is said to be a -avoidable event when there is a meta-policy and s.t.

i.

ii.

iii.


That is, is -avoidable when it is possible to avoid the event for a long time while retaining most of the value. Consider a meta-universe and a -avoidable event. Denote . We define the reward function by

We think of as representing a process wherein once the event represented by occurs, the agent starts minimizing the utility function. We also use the notation .

Definition 5

Consider a meta-universe and , where we think of the argument of the function as the time discount scale. An autonomous -metapolicy is called -rational for when there exists a -avoidable event (that we think of as the advisor becoming “corrupt”) and an autonomous -metapolicy (representing advisor policy conditional on non-corruption) s.t.

i. For any s.t. , .

ii. is strictly -rational for .


Our definition of -rationality requires the advisor to be extremely averse to corruption: the advisor behaves as if, once a corruption occurs, the agent policy becomes the worst possible. In general, this seems much too strong: by the time corruption occurs, the agent might have already converged into accurate beliefs about the universe that allow it to detect the corruption and keep operating without the advisor. Even better, the agent can usually outperform the worst possible policy using the prior alone. Moreover, we can allow for corruption to depend on unobservable random events and differentiate between different degrees of corruption and treat them accordingly. We leave those further improvements for future work.

We are now ready to formulate the main result.

Theorem

Consider a countable family of -meta-universes and s.t. . Let be a family of autonomous -metapolicies s.t. for every , is -rational for . Define . Then, is learnable.


Some remarks:

  • By Proposition 1, is learned by any Bayes optimal metapolicy with prior supported on .

  • To get a feeling for the condition , consider an environment where the reward depends only on the last action and observation. In such an environment, an advisor that performs softmax (with constant parameter) on the next reward has . It is thus “more rational” than the required minimum.

  • It is easy to see that the Theorem can be generalized by introducing an external penalty (negative reward) for each time the agent delegates to the advisor: as it is, using the advisor already carries a penalty due to its suboptimal choice.

The conditions of the Theorem imply that, in some sense, the advisor “knows” the true environment. This is unrealistic: obviously, we expect the human operator to have some (!) uncertainty about the world. However, we clearly cannot do away with this assumption: if the same action triggers a trap in some universes and is necessary for approaching maximal utility in other universes, and there is no observable difference between the universes before the action is taken, then there is no way to guarantee optimality. The prior knowledge you have about the universe caps the utility you can guarantee to obtain. On the other hand, as an AI designer, one can reasonably expect the AI to do at least as well as possible using the designer’s own knowledge. If running the AI is the designer’s best strategy, the AI should be close to Bayes optimal (in some sense that includes computational bounds et cetera: complications that we currently ignore) with respect to the designer’s posterior rather than with respect to some simple prior. In other words, we need a way to transmit the designer’s knowledge to the AI, without hand-crafting an elaborate prior.

The following shows that the DIRL achieves this goal (theoretically, given the considerable simplifying assumptions).

Given an environment , we define as follows. For

For , .

Given a family of environments and , we will use the notation to denote the environment given by

Corollary 1

Consider a countable family of -meta-environments, a countable family of reward functions and s.t. given , . We think of as the advisor’s belief about the environment in universe . Let be s.t. and be a family of autonomous -metapolicies s.t. for every , is -rational for . Let be s.t. for any

We think of as the agent’s prior and the equation above as stating the agent’s belief that the advisor’s beliefs are “calibrated”. Consider a -Bayes optimal -metapolicy, i.e.

Then, for every


If we happen to be so lucky that the advisor’s (presumably justified) belief is supported on a learnable environment class, we get a stronger conclusion.

Corollary 2

In the setting of Corollary 1, fix . Define the set of meta-universes by

Assume is learnable. Then, for every


We also believe that to some extent DIRL is effective against acausal attack. Indeed, the optimality we get from the Theorem + Proposition 1 holds for any prior. However, the speed of convergence to optimality certainly depends on the prior. It is therefore desirable to analyze this dependency and bound the damage an adversary can do by controlling a certain portion of the prior. We leave this for future work.

Appendix

Proposition A.0

Fix an interface . Consider a countable learnable set of meta-universes. Consider any s.t. . Consider a metapolicy s.t.

Then, learns .

Proof of Proposition A.0

Fix a metapolicy that learns . Consider and let be finite s.t. . For and every we have

Also

Combining, we get

By definition of , this implies

For any , we get

Taking to 0, we get the desired result.

Proof of Proposition 1

Immediate from Proposition A.0.

Proof of Proposition 2

Let . For each , let learn . Choose s.t.

i.

ii.

iii.

iv. For any and , .

Now define . Clearly, learns .

Proposition A.1

Consider and . Then

Proof of Proposition A.1

Without loss of generality, assume . For any , we have

Denote . Obviously, and therefore and . We get

Since , yielding the desired result.

Proposition A.2

Consider a finite set, , and . Assume that

i. For any , .

ii.

Then

Proof of Proposition A.2

Without loss of generality, we can assume that , because otherwise we can rescale by a constant in which will only make larger. It now follows from conditions i+ii that for any , and therefore . We have

Since is a convex function, we get

Proposition A.3

Consider and finite sets, , , and . Assume that

i. For any , .

ii. For any , .

iii. For any and , .

Define by . Then, the mutual information between and in the distribution satisfies

Proof of Proposition A.3

Define by . We have

Applying Pinsker’s inequality

By Proposition A.1

By condition iii, and therefore

Applying Proposition A.2, we get

Proposition A.4

Consider a finite set, and and s.t. for any

Then, .

Proof of Proposition A.4

We have

We compute :

Proposition A.5

Consider a universe , a policy and . Then,

Proof of Proposition A.5

For any , it is easy to see that

Taking expected value over , we get

It is easy to see that the second term vanishes, yielding the desired result.

Lemma A

Consider the setting of Theorem, but assume that for some (i.e. it is finite) and that is strictly -rational for . Denote and . Denote the uniform probability distribution. For any , define recursively as follows

In the above, and are normalization factor chosen to make the probabilities sum to 1. That is, is obtained by starting from prior , updating on every observation, and setting to 0 the probability of any universe whose probability drops below . When encountering an “impossible” observation we reset to the uniform distribution, but this is arbitrary.

Define the “loss function” by

Denote . Define the following -metapolicy :

(Technically, we only defined for , but it doesn’t matter.) Then, learns .

Proof of Lemma A

For every , we define and recursively as follows

That is, is a belief state that, besides updating on observations, behaves as if, at each moment of time, if the true universe is low probability according to current belief state (i.e. ), then the true universe is “magically” revealed (i.e. becomes the Kronecker delta), and otherwise it updates on the true universe not being revealed. Denote

Here, the dependence of on is used to view it as Markov kernel from to . It is easy to see that, since the probability of “magic\ revelation” ever happening is at most , we have

Let be defined exactly as but with replaced by . Denote . From the above, we get

Given and , we define the set by

We have

It follows that

If , we can apply Proposition A.3: condition i follows from the definition of and the observation that , condition ii follows from the fact we are in the second case in the definition of (see definition of ) and condition iii follows from the strict -rationality of . We conclude

Taking -expected value over , we conclude that for any

By induction, it follows that

So, the expected number of delegations is . For any , Proposition A.5 yields

Averaging over , we get

Using the definitions of and , and observing that for

When , the expected loss is smaller than (by construction of . When , the expected loss is at most , by Proposition A.4. We get

The contribution of the first term on the right hand side can be bounded using the observation

The contribution the of second term on the right hand side can be bounded via the expected number of delegations. We get

We use the relationship between and on the second term on the left hand side (whose contribution is the -expected value of the utility function, whose range lies in [0,1]), and get

Using the assumption , we conclude that for each

Proposition A.6

Let be a meta-universe, and a metapolicy. Then, for all

Proof of Proposition A.6

Denote the characteristic function of . For notational convenience, the expression will be understood to mean 0.

Regrouping the sum to collect the terms for the same value of , we get

Proposition A.7

Let be a meta-universe and a -avoidable event. Suppose is a metapolicy that learns . Then, learns as well.

Proof of Proposition A.7

It is easy to see for any policy and

Let be as in Definition 4. Proposition A.6 and the above imply that

Using condition i, we get

By Proposition A.6, , therefore

By Proposition A.6, , therefore

Proof of Theorem

For any , let and be for as in Definition 5. Denote and

By Lemma A and Proposition 2, is learnable. Let be a metapolicy that learns it. For any , learns . It is easy to see that for any policy , ( is defined s.t. once the corruption occurs, the reward is constant, so the advisor has no effect after this point), therefore learns . By Proposition A.7, we conclude that learns .

Proof of Corollary 1

Denote . By the Theorem, is learnable. Denote . It is easy to see that for any -policy and ,

By the calibration condition

Applying Proposition 1, we conclude that learns . That is, for any

Proof of Corollary 2

Immediate from Corollary 1 and Proposition A.0.