Reinforcement learning with imperceptible rewards

post by Vanessa Kosoy (vanessa-kosoy) · 2019-04-07T10:27:34.127Z · score: 16 (8 votes) · LW · GW · 1 comments

Contents

  Background
  Results
    Partially Observable MDPs with Imperceptible Rewards
      Example 1
    Instrumental States and Reward Functions
      Definition 1
      Definition 2
      Definition 3
      Definition 4
      Definition 5
      Definition 6
      Definition 7
      Proposition 1
      Proposition 2
      Definition 8
      Definition 9
      Definition 10
      Definition 11
      Definition 12
      Proposition 3
      Proposition 4
      Definition 13
      Definition 14
      Theorem 1
      Definition 15
      Definition 16
      Proposition 5
    A Regret Bound for RL with Instrumental Rewards
      Theorem 2
  Discussion
    More on the Regret Bound
    The Death of the Agent and Kamikaze Strategies
    Specifying Instrumental Reward Functions
  Proofs
      Proof of Proposition 1
      Proposition A.1
      Proof of Proposition A.1
      Proof of Proposition 2
      Proposition A.2
      Proof of Proposition A.2
      Proposition A.3
      Proof of Proposition A.3
      Proposition A.4
      Proof of Proposition A.4
      Proof of Proposition 3
      Proof of Proposition 4
      Proposition A.5
      Proof of Proposition A.5
      Proposition A.6
      Proof of Proposition A.6
      Proposition A.7
      Proof of Proposition A.7
      Proposition A.8
      Proof of Proposition A.8
      Proposition A.9
      Proof of Proposition A.9
      Proposition A.10
      Proof of Proposition A.10
      Proposition A.11
      Proof of Proposition A.11
      Proof of Theorem 1
      Proposition A.12
      Proof of Proposition A.12
      Proof of Proposition 5
      Proposition A.13
      Proof of Proposition A.13
      Proposition A.14
      Proof of Proposition A.14
      Proposition A.15
      Proof of Proposition A.15
      Proposition A.16
      Proof of Proposition A.16
      Proposition A.17
      Proof of Proposition A.17
      Proposition A.18
      Proof of Proposition A.18
      Proposition A.19
      Proof of Proposition A.19
      Proposition A.20
      Proof of Proposition A.20
      Proposition A.21
      Proof of Proposition A.21
      Proof of Theorem 2
  Appendix
      Definition B.1
      Definition B.2
      Proposition B.1
      Proof of Proposition B.1
None
1 comment

TLDR: We define a variant of reinforcement learning in which the reward is not perceived directly, but can be estimated at any given moment by some (possibly costly) experiment. The reward function is no longer a function of the observation history, but a different object that we call "instrumental reward function". We give two definitions of instrumental reward function and prove their equivalence. We also derive a regret bound for this setting.

Background

In "classical" reinforcement learning the agent perceives the reward signal on every round of its interaction with the environment, whether through a distinct input channel or through some given way to compute the reward from the interaction history so far. On the other hand, we can rather easily imagine agents that optimize properties of their environment that they do not directly perceive. For example, if Alice, who lives in Dominica, donates money to the Against Malaria Foundation in order to save someone in Africa, then the result is usually not visible to Alice at the time it occurs, if ever. Similarly, Clippy the paperclip maximizer doesn't always perceive all the paperclips in the universe. Moreover, we might want to design agents that, in order to estimate the reward, direct queries to humans (which is costly and cannot be done continuously non-stop).

Now, it is possible to define the perceived reward as the subjective expected value of the "true" imperceptible reward (see the Results section for details). Although this transformation preserves expected utility, it does not preserve Bayesian regret. Indeed, Bayesian regret is the difference between the expected utility attained by the agent and the expected utility attained by a "reference" agent that knows the true environment from the onset. However, after the transformation, the reference agent will behave as if it knows the observable dynamics of the true environment but still pretends not to know the true environment for the purpose of computing the reward. Therefore, regret analysis requires us to consider the imperceptible reward honestly. In fact, as we will see, certain assumptions about the imperceptible reward function are needed even to make the problem learnable at all. Finally, this transformation makes the reward function more complex and hence applying a "generic" reinforcement learning algorithm after the transformation (instead of exploiting the special form of the resulting reward function) might carry a significant computational complexity penalty.

Related Work: De Blanc 2011 studies so called "ontological crises". That is, de Blanc examines the problem of translating a reward function from one ontology into another. Here, we avoid this problem by considering reward functions that are automatically defined in all ontologies. That said, it might still be interesting to think about how to specify our type of reward function starting from a reward function that is only defined in one particular ontology. We will return to this in the Discussion section.

Krueger et al 2016 consider a setting where querying the reward is instantaneous and has a fixed cost. This is a special case of our setting, but we allow a much more general type of query and cost. Also, Krueger et al don't derive any theoretical regret bound (but they do present some experimental results).

Finally, multi-armed bandits with partial monitoring are closely related, see for example Bartok et al 2013. However, bandits by definition assume a stateless environment, and also our approach is rather different than what is usually studied in partial monitoring.

The literature study was very cursory and I will be glad to know about prior work I missed!

Results

Partially Observable MDPs with Imperceptible Rewards

Partially Observable Markov Decision Processes (POMDPs) serve as a natural starting point for thinking about imperceptible rewards. Indeed, it might seem like all we have to do is consider RL in a POMDP environment and let the reward to be a function of the (imperceptible) state. However, this setting is in general unlearnable even given assumptions that rule out traps.

A (finite) POMDP is defined by non-empty finite sets (states), (actions) and (observations), the transition kernel and the reward function . As opposed to the "classical" definition of POMDP, we allow the value of is to be imperceptible. The perceptible setting is a special case of the imperceptible setting: we can always encode the reward into the observation.

To formulate a learning problem, we assume , and to be fixed and an initial state to be given, while and are unknown and belong to some hypothesis class :

Such a problem can be unlearnable even if is known and there are no irreversible events that can happen:

Example 1

Suppose that , , , , and where for any

Since , there is no way to gain any information about which hypothesis is correct. Moreover, the optimal policies for the two hypotheses are different. Namely, for we should always take action and for we should always take action .

To formalize and illustrate the discussion in the Background section, suppose is Borel and is the prior. We can then define the "perceived effective reward" by

It is then easy to see that the operator preserves expected utility: given any policy and

and therefore, for any geometric time discount parameter

On the other hand, Bayesian regret is not preserved since, in general

Here is shorthand notation for the same probability distribution as before.

Indeed, in Example 1 the LHS of the above is since , whereas the RHS is .

The pathology of Example 1 comes about because reward is not only imperceptible but entirely unobservable. That is, no experiment can produce any information about whether the reward on a given round was 0 or 1. More specifically, the states and are assigned different rewards, but there is no observable difference between them. It is as if Alice would assign value, not to people in Africa (whose existence and well-being can be measured) but to some Flying Spaghetti Monster s.t. the world behaves exactly the same regardless of its existence or condition.

This observation suggests that, instead of assigning rewards to states which are just abstract labels in a model, we should assign rewards to states that are defined in terms of the observable consequences of the interaction of the agent with the environment. This leads us to the notion of "instrumental state", which we will now define formally.

Instrumental States and Reward Functions

First, we introduce some technical definitions for notational convenience.

Definition 1

is the category whose objects are pairs where is a real vector space and is a convex subset of , and whose morphisms are

We omit describing identity and composition of morphisms since they are obvious.

It is easy to see that has arbitrary limits. In particular, has a final object that we denote by (the one point set), products () and inverse limits of sequences. For any finite set , is an object in . Also, we will sometimes abuse notation by regarding as an object of instead of (i.e. making implicit).

Definition 2

The functor is defined by

Definition 3

For any , we define by

Note that is a natural transformation from to the constant functor with value .

Given and s.t. for , we denote .

Now, we are ready to define instrumental states. We fix the sets and .

Definition 4

For any , we define , the space of time step instrumental states, recursively by

Here, is a mapping from to . The inverse image of a convex set (in this case ) under an affine mapping (in this case ) is also a convex set.

The semantics of Definition 4 is as follows. Any can be regarded as a pair consisting of some (the image of under ) and a mapping defined by . Given , is the probability distribution over observations resulting from taking action in state , whereas is the state resulting from taking action a in state conditional on observing . This semantics can be made more formal as follows:

Definition 5

Given , we define recursively as follows:

  1. For all , and : iff , and .

Definition 6

Given , and , and assuming that , we recursively define by

  1. For :

  2. For with some , and :

The point of defining in this manner is that (i) different points in correspond to states that are truly not equivalent, i.e. can be empirically distinguished (statistically) and (ii) convex combinations of points in correspond precisely to probabilistic mixtures. Formally, we have:

Definition 7

Given and (a policy), we define (probability distribution over histories resulting from following policy in state ) by

Proposition 1

Consider some and assume that for any , . Then, .

Proposition 2

Consider some , and . Then

is a bounded polytope but in general it is *not} a simplex: we cannot regard it as just probability distributions over some set. For example, if , then it's easy to see that is a square (one axis is the probability to get a given observation when taking one action, the other axis is the probability for the other action). On the other hand, if then is a simplex: it is canonically isomorphic to .

There are a natural morphisms whose semantics is forgetting about the behavior of the state at time step :

Definition 8

We define for any recursively. is the unique morphism from to . For any , is given by

We thereby get a sequence

Definition 9

We define , the space of (infinite time step) instrumental states by

We denote the canonical projections by .

Of course, can also be regarded as the space of all possible stochastic environments. Specifically, we have:

Definition 10

For any we define by

Definition 11

Given , and , we define by

Like in the finite time case, we have

Definition 12

Given and , we define by

Proposition 3

Consider some and assume that for any , . Then, .

Proposition 4

Consider some , and . Then

For each , is finite-dimensional and therefore has a natural topology. also becomes a topological space by equipping it with the inverse limit topology. Since the are closed and bounded they are compact, and therefore is also compact by Tychonoff's theorem. In the special case , and the inverse limit topology is the weak topology for probability measures, defined w.r.t. the product topology on .

We can now give the first definition of an instrumental reward function: a continuous affine function . Why affine? A convex linear combination of instrumental states is empirically indistinguishable from a probabilistic lottery. If we assign expected values to probabilistic lotteries (as we should by the VNM theorem), then we must also assign them to convex linear combinations of instrumental states: otherwise our reward again depends on entirely unobservable parameters of our model.

An alternative approach is to consider the notion of "experiment" explicitly.

We will use the notation . Given a logical condition , the symbol will denote 1 when is true and 0 when is false.

Definition 13

Given and , we define by

is said to be a terminable policy when for any

That is, a terminable policy is allowed to produce a special token which terminates the "experiment" (instead of choosing an action), and we require that, for any environment, this token will be eventually produced with probability 1.

Definition 14

Given a terminable policy and a bounded function , we define the function by

This gives us a second definition of instrumental reward functions. In fact, the two definitions are equivalent:

Theorem 1

For any terminable policy and bounded function , is continuous and affine. Conversely, for any continuous affine , there exists a terminable policy and s.t. .

Putting the second part of the theorem into words, for any instrumental reward function (in the sense of the first definition) there is some experiment the agent can do which yields an unbiased estimate of the reward for the instrumental state that existed at the beginning of the experiment.

The range is not optimal, but for the regret bound in the next subsection, it's only important that it is bounded by some fixed constant.

To illustrate this concept of instrumental reward function, imagine that Clippy has access to a black box with a collection of levers on its outside. Pulling the levers produces some sounds that hint at what happens inside the box, but are not enough to determine it with certainty. The box has a shuttered glass window, whose shutter can be opened from the outside. Through the window, Clippy can see a jumble of scrap metal, mechanical manipulators that are controlled by the levers (and can be used to shape the scrap metal), and also a few mice running around the box and wreaking havoc. However, it is not possible to control the manipulators while the shutter is open. Worse, while opening the shutter allows seeing a snapshot of the shape of the metal, it also causes the manipulators to move chaotically, ruining this shape. So, Clippy can experiment with the levers and occasionally open the shutter to test the result. However, in order to produce and maintain paperclips inside the box, the shutter has to be kept closed (and the paperclips hidden) most of the time.

It is also possible to consider reward functions of the more general form , required to be continuous and affine in the second argument. Such a reward function depends both on the current (unknown) instrumental state of the environment and the observable history so far. By Theorem 1, such a reward can be equivalently described in terms of a family of terminable policies and a family of bounded functions s.t.

This means that, the value of reward can be estimated empirically, but only if the agent remembers the entire observation history. If the history is forgotten at some point, it might never be able to estimate the reward again. We will such reward functions "semi-instrumental".

Although semi-instrumental reward functions are more general than instrumental reward functions, I think that there is some interest in studying the narrower class. Arguably, instrumental reward functions are a better model of what counts as "consequentialist" or "goal-directed" behavior, since they depend only on the state of the environment. Indeed, it is easy to construct a semi-instrumental reward function that makes any given policy Bayes-optimal for any given prior, so semi-instrumental reward functions are incapable (without further assumptions) to distinguish between "intelligent" and "unintelligent" behavior. On the other hand, optimality w.r.t. some instrumental reward function seems like a stronger condition.

In order to derive a regret bound, we will restrict attention to those reward functions for which the terminable policy can be made to terminate within time that has some finite and bounded expected value. I don't know an elegant way to characterize those reward functions in general, but we will describe one class of such functions.

Definition 15

Consider any . Then, we can define the total variation distance by

In general, is a pseudometric. Moreover, when is finite-dimensional and bounded, it is a metrization of the natural topology. For a finite set and , is just the usual total variation metric. For a ball of unit diameter in Euclidean space, is the Euclidean metric.

Definition 16

Consider any . We define the metric on by

For any , is a metrization of the inverse limit topology on .

Proposition 5

Consider any and affine and Lipschitz with respect to . Then there is a terminable policy and a bounded function s.t. and

Note that is a parameter reminiscent of geometric time discount that constraints the shape of the reward function. However, in the regret analysis that follows, it is not the same as the actual geometric time discount parameter . In particular, we consider the asymptotics in which the latter approaches 1, while the reward function is assumed to be fixed. It might be interesting to study regimes in which both approach 1, but we will not attempt it at present.

A Regret Bound for RL with Instrumental Rewards

Fix and . For any finite set and , there is a unique mapping s.t.

That is, is just the instrumental state corresponding to the POMDP state .

Given continuous affine, we get for any and the POMDP reward function . Hence, one natural setting for regret analysis is fixing and and considering a hypothesis class of transition kernels

However, regret analysis for POMDPs involves some technical complexity, and we prefer to start with a simpler setting. Hopefully, we will address the POMDP case in a followup essay.

Suppose that . Then, given any MPD transition kernel , we can define the POMDP transition kernel by

Fix continuous affine in the second argument (a type of semi-instrumental reward function). For any as above, we get the induced reward function given by . We can now consider the learning problem corresponding to a hypothesis class of MDP transition kernels

It might seem odd to consider a setting with fully observable states in the context of imperceptible rewards. However, we can think about it as follows: what we observe is only a label whose physical meaning is unknown. Only given the (unknown) transition kernel, such a label can be interpreted as assigned a reward.

For example, imagine a robot tasked with sorting balls into bins according to their weight. Some of the balls are solid gold and some of them are solid silver, so it's in principle possible to know their weight just by looking at them. However, the robot doesn't know a priori whether silver or gold is heavier. On the other hand, the robot can perform some experiment with a ball to determine its weight. In this situation, the reward is imperceptible even if the state (e.g. the locations, colors and sizes of the balls, the locations and shapes of the bins and the location of the robot and the state of its manipulators) is fully observable.

Using the concepts of MB dimension and RVO dimension we defined in a previous essay, we can formulate the regret bound.

Theorem 2

There is some s.t. the following holds.

Consider any finite non-empty sets and , function continuous affine in the second argument , closed set and Borel probability measure on (prior). Suppose is s.t. for any , is terminable, and is a bounded function s.t.

Define the maximal expected reward estimation time by

Define the maximal bias span by

Define by

Denote and . Define the Bayesian regret by

Then, there is a family of policies s.t.

Discussion

More on the Regret Bound

It might appear odd that the regret bound in Theorem 2 depends on the dimensions of the class of reward functions, but not on the dimensions on the class of transition kernels, like in the perceptible case. The reason for this is that we only give the asymptotic form. Asymptotically, the leading term is and its coefficient depends only on those parameters that appear in Theorem 2. However, examining the proof reveals that there is also an term that has the same form as the regret bound in the perceptible case. For the sake of brevity and simplicity we will not attempt to write down a more precise regret bound that reflects the role of the dimensions of the class of transition kernels, but in principle it is not difficult. We must keep in mind, however, that in practice the other term might be significant: a priori the dimensions of the class of transition kernels are only bounded by a polynomial in and and the latter might be exponentially big for realistic models.

The Death of the Agent and Kamikaze Strategies

There is one potential application of defining rewards that are not a direct function of observations which seems not supported by instrumental rewards as we defined them. Namely, one can imagine agents that are motivated to follow a certain strategy that is designed to destroy the agent but produce some desirable results in the external world ("kamikaze strategy"). In other words, although survival is a convergent instrumental goal, it seems entirely reasonable for it to be sacrificed in certain specific scenarios. To give an example, imagine a bodyguard robot whose primary goal is keeping a certain person alive. If assassins shoot at the person, and the only wait to stop them is for the robot to block the bullets with its body, then it can be the optimal strategy, even if it will destroy the robot and prevent it from continuing its function as bodyguard (assuming that e.g. it will give the person a chance to escape or someone else a chance to stop the assassins).

Our formalism doesn't directly address the possibility of the agent's death, because the sequence of actions and observations is assumed to be infinite. One simple way to accommodate death is postulating a special observation s.t. it is never received before death and always received after death. If we do this, then death corresponds to a specific instrumental state and therefore its reward is a fixed constant. This seems incompatible with kamikaze strategies where the decision of self-sacrifice is contingent on conditions in the external world after death.

Another approach is assuming the agent becomes a "ghost": it keeps receiving observations which reflect the actual physical world but its actions have no effect. Such ghosts might theoretically be produced by a simplicity prior: for example, if the agent is an AI connected to a camera that monitors a room, then we can imagine a virtual video of the same room continuing beyond the AI's shutdown. This allows for different instrumental states after death and can potentially justify kamikaze strategies, but it seems like a very fragile construct and is unlikely to guarantee reasonable behavior.

The problem with death can be viewed from another perspective: our regret analysis assumes a no-traps condition () whereas death is usually a trap. Therefore, to guarantee rational behavior while accounting for death, we need to operate within a framework that allows for traps.

One such framework is requiring Bayes-optimality and giving up on learnability. This seems both too weak (because nothing is guaranteed for specific environments) and too strong (because it's computationally intractable). That said, I think this approach can be salvaged by requiring something somewhat weaker than Bayes-optimality and proving something somewhat weaker than learnability (hopefully I will write on that in a future essay). In any case, once we give up on learnability we can allow unobservable rewards (the general POMDP setting in the beginning of the Results section) which allow handling death and kamikaze strategies easily. Specifically, we can have a plethora of "dead" states that produce only the observation and whose transitions do no depend on the action, but which have different rewards. So, this approach "solves" the problem but at a high cost: no learnability or regret analysis.

Another framework for dealing with traps is Delegative Reinforcement Learning [LW · GW] (DRL). In DRL the agent interacts with an external advisor, and is thereby able to successfully navigate all traps that the advisor knows about. In other words, it converges to a policy that is Bayes-optimal with respect to the belief state of the advisor (while the advisor is not able to produce such a policy by itself). Combining DRL with the instrumental rewards formalism should allow accounting for death. Specifically, in any given POMDP hypothesis, the state space will be decomposed as , with the following assumptions:

Under these assumptions (or some variant thereof), it seems plausible that we should be able to prove learnability and derive a reasonable regret bound. Formalizing this line of thought is a task for future work.

The DRL approach to kamikaze strategies also has implications on corrigibility. Indeed, if the external advice is compatible with an admissible reward function that recommends shutting down the agent (i.e. upon delegation, the advisor acts to shut down the agent) then a DRL agent will assist with its own shutdown. This property is preserved by subagents, since creating a subagent is another potentially irreversible action (and therefore must be vetted [LW · GW] by the advisor).

Also, it is tempting to speculate about DRL as a model of human self-sacrifice. We have already speculated before that we can view DRL as model of human learning, where the human's social environment or humanity as a whole is regarded as playing the role of the advisor. Similarly, humans that sacrifice their lives for the sake of their loved ones or the "greater good" can be regarded as heeding that "advise" regarding the rewards of states in which the human doesn't exist. Under this model, we can make sense of self-sacrifices by individual humans but not of hypothetical self-sacrifice by humanity as a whole (potentially augmented by other minds with which we could communicate and find common ground), but, the latter restriction seems compatible with intuition.

Specifying Instrumental Reward Functions

It might be useful to find natural ways to specify instrumental reward functions. In particular, it is interesting to start with a reward function defined on a specific ontology (POMDP) and somehow extend it to a full instrumental reward function (which, like we said before, induces a reward function on any ontology via the mapping).

De Blanc suggests one way to extend reward functions from one POMDP to another, but I don't know whether this operation leads to an instrumental reward function, i.e. whether it is compatible with the constraints imposed by affine dependencies between the states (and I don't see any reason why it should).

Essentially, what we're looking for is a way to extend an affine function from an affine subspace to the entire affine space (the affine subspace is the affine span of the instrumental states corresponding to the states of the initial ontology; note that, if these instrumental states are not affine independent, then we have some constraint on this initial reward function). One natural way to do it is looking for an affine function whose differential (the linear function part) has minimal norm, or choosing some privileged projection operator from the entire space to the affine subspace. However, since the natural norms we have here are not inner product norms, these choices are usually non-unique, and it's possible we can't get much out of it.

A different natural approach is using Occam's razor, i.e. looking for an extension of minimal description length or the expected value of a random extension sampled from a conditional simplicity prior. This requires a natural way to describe instrumental reward functions. We do have such a way: assuming that the and guaranteed to exist by Theorem 1 can be chosen to be computable, the description is the program for those objects with respect to a fixed universal Turing machine (we consider a single program that computes both and to exploit possible mutual information between the two).

These questions are left for future research.

Proofs

Proof of Proposition 1

We proceed by induction on . For there is nothing to prove since so a priori. Now, suppose .

We need to show that for any and , . To show it for given and , we consider some s.t. . Since , we have

By Definition 7, we get,

By Definition 6, we get,

If this value vanishes then . Otherwise, consider any and define by

Definitions 6 and 7 imply that

and similarly for . We have and , which implies . By the induction hypothesis, we get . Combining this with , we get .

Proposition A.1

Consider any , and . Assume that

Then

Here, is understood to mean when and the same for .

Proof of Proposition A.1

Obvious from the definitions.

Proof of Proposition 2

Given and some , to show that it is sufficient to show that

  1. For any and ,

  1. For any and , if then for any

We will use this to prove the claim by induction on . For , there is nothing to prove. For , by Definition 7

By Definition 6

Furthermore, Definitions 6 and 7 imply that

Here, is defined by .

Denote

By Proposition A.1

We get

By the induction hypothesis, we get

Decomposing the right hand side and applying the same reasoning in reverse,

By Definition 6, can be written as

Multiplying the numerator and denominator by , we get

Combining this with the previous identity, we get

Given and defined by , we will denote .

Proposition A.2

Consider any and . Then,

Proof of Proposition A.2

Obvious from the definitions.

Proposition A.3

Consider any , and . Then,

Proof of Proposition A.3

Obvious from the definitions.

Proposition A.4

Consider any , , and s.t. . Then,