Delegative Inverse Reinforcement Learning

post by Vanessa Kosoy (vanessa-kosoy) · 2017-07-12T12:18:22.000Z · LW · GW · 13 comments

Contents

  Notation
  Results
    Definition 1
    Proposition 1
    Proposition 2
    Definition 2
    Definition 3
    Definition 4
    Definition 5
    Theorem
    Corollary 1
    Corollary 2
  Appendix
    Proposition A.0
      Proof of Proposition A.0
      Proof of Proposition 1
      Proof of Proposition 2
    Proposition A.1
      Proof of Proposition A.1
    Proposition A.2
      Proof of Proposition A.2
    Proposition A.3
      Proof of Proposition A.3
    Proposition A.4
      Proof of Proposition A.4
    Proposition A.5
      Proof of Proposition A.5
    Lemma A
      Proof of Lemma A
    Proposition A.6
      Proof of Proposition A.6
    Proposition A.7
      Proof of Proposition A.7
    Proof of Theorem
    Proof of Corollary 1
    Proof of Corollary 2
None
13 comments

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:

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.

13 comments

Comments sorted by top scores.

comment by Diffractor · 2017-12-27T08:06:52.000Z · LW(p) · GW(p)

A summary that might be informative to other people: Where does the requirement on the growth rate of the "rationality parameter" come from?

Well, the expected loss of the agent comes from two sources. Making a suboptimal choice on its own, and incurring a loss from consulting a not-fully-rational advisor. The policy of the agent is basically "defer to the advisor when the expected loss over all time of acting (relative to the optimal move by an agent who knew the true environment) is too high". Too high, in this case, cashes out as "higher than ", where t is the time discount parameter and is the level-of-rationality parameter. Note that as the operator gets more rational, the agent gets less reluctant about deferring. Also note that t is reversed from what you might think, high values of t mean that the agent has a very distant planning horizon, low values mean the agent is more present-oriented.

On most rounds, the agent acts on its own, so the expected all-time loss on a single round from taking suboptimal choices is on the order of , and also we're summing up over about t rounds (technically exponential discount, but they're similar enough). So the loss from acting on its own ends up being about .

On the other hand, delegation will happen on at most ~ rounds, with a loss of value, so the loss from delegation ends up being around .

Setting these two losses equal to each other/minimizing the exponent on the t when they are smooshed together gets you x=3. And then must grow asymptotically faster than to have the loss shrink to 0. So that's basically where the 2/3 comes from, it comes from setting the delegation threshold to equalize long-term losses from the AI acting on its own, and the human picking bad choices, as the time horizon t goes to infinity.

comment by Diffractor · 2017-12-27T06:51:33.000Z · LW(p) · GW(p)

I don't believe that was defined anywhere, but we "use the definition" in the proof of Lemma 1.

As far as I can tell, it's a set of (j,y) pairs, where j is the index of a hypothesis, and y is an infinite history string, rather like the set .

How do the definitions of and differ?

Replies from: vanessa-kosoy
comment by Vanessa Kosoy (vanessa-kosoy) · 2017-12-27T11:22:20.000Z · LW(p) · GW(p)

Hi Alex!

The definition of makes sense for any , that is, the superscript in this context is a mapping from finite histories to sets of pairs as you said. In the line in question we just apply this mapping to where is a bound variable coming from the expected value.

I hope this helps?

comment by Diffractor · 2017-12-27T05:59:38.000Z · LW(p) · GW(p)

What is , in the context of the proof of Lemma A? I don't believe it was defined anywhere else.

comment by Diffractor · 2017-12-21T04:29:40.000Z · LW(p) · GW(p)

By the stated definitions, "v-avoidable event" is pretty much trivial when the event doesn't lead to lasting utility loss. The conditions on "v-avoidable event" are basically:

The agent's policy converges to optimality.

There's a sublinear function D(t) where the agent avoids the event with probability 1 for D(t) time, in the limit as t goes to infinity.

By this definition, "getting hit in the face with a brick before round 3" is an avoidable event, even when the sequence of policies lead to the agent getting hit in the face with a brick on round 2 with certainty and it's possible to dodge it. Let the sublinear function be the constant 1, and let the sequence of policies converge to "dodge" on round 1 and "stay" on round 2, and let the brick incur sublinear utility loss.

This fulfills the conditions, so getting hit in the face with a brick before timestep 3 is a "v-avoidable" event despite certainly occuring. Thus, this condition is only meaningful about lasting failures that incur enough utility loss to prevent convergence to the optimal policy.

comment by tom4everitt · 2017-08-08T06:01:48.000Z · LW(p) · GW(p)

"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)."

This sounds quite nice. But how is it possible to achieve this if the advisor is a soft-maximiser? Doesn't that mean that there is a positive probability that the advisor falls into the trap?

Replies from: vanessa-kosoy
comment by Vanessa Kosoy (vanessa-kosoy) · 2017-08-09T08:57:39.000Z · LW(p) · GW(p)

Hi Tom!

There is a positive probability that the advisor falls into the trap, but this probability goes to as the time discount parameter goes to (which is the limit I study here). This follows from the condition in the Theorem. To give a simple example, suppose that and the environment is s.t.:

  • When you take action 0, you fall into a trap and get reward 0 forever.

  • When you take action 1, you get reward 0 for the current round and remain in the same state.

  • When you take action 2, you get reward 1 for the current round (unless you are in the trap) and remain in the same state.

In this case, our advisor would have to take action 0 with probability and action 2 has to be more probable than action 1 by a factor of .

Replies from: tom4everitt
comment by tom4everitt · 2017-08-10T07:02:10.000Z · LW(p) · GW(p)

Hi Vanessa!

So basically the advisor will be increasingly careful as the cost of falling into the trap goes to infinity? Makes sense I guess.

What is the incentive for the agent not to always let the advisor choose? Is there always some probability that the advisor saves them from infinite loss, or only in certain situations that can be detected by the agent?

Replies from: vanessa-kosoy
comment by Vanessa Kosoy (vanessa-kosoy) · 2017-08-10T08:58:45.000Z · LW(p) · GW(p)

If the agent always delegates to the advisor, it loses a large fraction of the value. Returning again to the simple example above, the advisor on its own is only guaranteed to get expected utility (because it often takes the suboptimal action 1). On the other hand, for any prior over a countable set of environments that includes this one, the corresponding DIRL agent gets expected utility on this environment (because it will learn to only take action 2). You can also add an external penalty for each delegation, adjusting the proof is straightforward.

So, the agent has to exercise judgement about whether to delegate, using its prior + past observations. For example, the policy I construct in Lemma A delegates iff there is no action whose expected loss (according to current beliefs) is less than .

Replies from: tom4everitt
comment by tom4everitt · 2017-08-11T02:27:29.000Z · LW(p) · GW(p)

So this requires the agent's prior to incorporate information about which states are potentially risky?

Because if there is always some probability of there being a risky action (with infinitely negative value), then regardless how small the probability is and how large the penalty is for asking, the agent will always be better off asking.

(Did you see Owain Evans recent paper about trying to teach the agent to detect risky states.)

Replies from: vanessa-kosoy
comment by Vanessa Kosoy (vanessa-kosoy) · 2017-08-11T09:16:32.000Z · LW(p) · GW(p)

The only assumptions about the prior are that it is supported on a countable set of hypotheses, and that in each hypothesis the advisor is -rational (for some fixed ).

There is no such thing as infinitely negative value in this framework. The utility function is bounded because of the geometric time discount (and because the momentary rewards are assumed to be bounded), and in fact I normalize it to lie in (see the equation defining in the beginning of the Results section).

Falling into a trap is an event associated with loss (i.e. loss that remains constant as goes to ). Therefore, we can risk such an event, as long as the probability is (i.e. goes to as goes to ). This means that as grows, the agent will spend more rounds delegating to the advisor, but for any given , it won't delegate on most rounds (even on most of the important rounds, i.e. during the first -length "horizon"). In fact, you can see in the proof of Lemma A, that the policy I construct delegates on rounds.

As a simple example, consider again the toy environment from before. Consider also the environments you get from it by applying a permutation to the set of actions . Thus, you get a hypothesis class of 6 environments. Then, the corresponding DIRL agent will spend rounds delegating, observe which action is chosen by the advisor most frequently, and perform this action forevermore. (The phenomenon that all delegations happen in the beginning is specific to this toy example, because it only has 1 non-trap state.)

If you mean this paper, I saw it?

Replies from: tom4everitt
comment by tom4everitt · 2017-08-20T09:34:46.000Z · LW(p) · GW(p)

My confusion is the following:

Premises (*) and inferences (=>):

  • The primary way for the agent to avoid traps is to delegate to a soft-maximiser.

  • Any action with boundedly negative utility, a soft-maximiser will take with positive probability.

  • Actions leading to traps do not have infinitely negative utility.

=> The agent will fall into traps with positive probability.

  • If the agent falls into a trap with positive probability, then it will have linear regret.

=> The agent will have linear regret.

So when you say in the beginning of the post "a Bayesian DIRL agent is guaranteed to attain most of the value", you must mean that in a different sense than a regret sense?

Replies from: vanessa-kosoy
comment by Vanessa Kosoy (vanessa-kosoy) · 2017-08-20T18:38:48.000Z · LW(p) · GW(p)

Your confusion is because you are thinking about regret in an anytime setting. In an anytime setting, there is a fixed policy , we measure the expected reward of over a time interval and compare it to the optimal expected reward over the same time interval. If has probability to walk into a trap, regret has the linear lower bound .

On other hand, I am talking about policies that explicitly depend on the parameter (I call this a "metapolicy"). Both the advisor and the agent policies are like that. As goes to , the probability to walk into a trap goes to , so is a sublinear function.

A second difference with the usual definition of regret is that I use an infinite sum of rewards with geometric time discount instead of a step function time discount that cuts off at . However, this second difference is entirely inessential, and all the theorems work about the same with step function time discount.