# 6

Inverse Reinforcement LearningReinforcement Learning
Personal Blog

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.

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, .

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