# Notes on Internal Objectives in Toy Models of Agents

*Thanks to Jeremy Gillen and Arun Jose for discussions related to these ideas.*

Summary
=======

***WARNING:** The quality of this post is low. It was sitting in my drafts folder for a while, yet I decided to post it because some people found these examples and analyses helpful in conversations. I tidied up the summary, deleted some sections, and added warnings related to parts of the post that could be confusing.*

These notes are the result of reflecting on how Internal Objectives/Internal Target Information might be represented in simple theoretical models of agents. This reflection aimed to inform [how we might detect these Internal Objectives via interpretability](https://www.lesswrong.com/posts/tFYGdq9ivjA3rdaS2/high-level-interpretability-detecting-an-ai-s-objectives).

Note: Insights are over-indexed on these particular models of agents.

Insights include:

*   Target information might be stored in some internal valuation function. The best way to extract the target information may be to search over inputs to this function (in the form of world model information) to observe which world state is highly valued. This requires advanced interpretability tools needed to isolate the value function.
*   These fixed objective models are retargetable by modifying world model information.
*   Retargetable models might have their objective represented as a (collection of) variables that can be naturally retargeted.
*   It might be possible to train probes to map from internal variables to outcomes agents produce. By performing interpretability on these probes, we might find compact representations of the Internal Objective/Target Information.

Introduction
============

Internal Target Information/Internal Objectives
-----------------------------------------------

[*Internal Target Information*](https://www.lesswrong.com/posts/hhKpXEsfAiyFLecyF/internal-target-information-for-ai-oversight) *(ITI)* or an [*Internal Objective*](https://www.lesswrong.com/posts/tFYGdq9ivjA3rdaS2/high-level-interpretability-detecting-an-ai-s-objectives) is information about an agent's target used by the agent's internals to differentiate between actions that lead to the target outcome and actions that don’t.

The hope is that by developing interpretability methods to detect and interpret this information, we can directly detect misalignment.

![](https://lh7-us.googleusercontent.com/MdxDge-GuW8vjjLjVhbDcb-3VYibJB9KRmwyClmooyTUbUakBfpBHyWHqw5V_6y9dBN-jjmQmDUbvBJ6lsYffqQyvycf-GPpVqAz3XQKJkpZ4lpCqoSGwGg6ivtuhEsSKHPrRlRkLpzB800xM8OlQmA)

Toy Models of Agents
--------------------

In this post, we explore two toy models of agents and how ITI is internally represented within these models. Our models are neural-network-based with static objectives. We sometimes reflect on what these models would look like if their objectives were [retargetable](https://www.lesswrong.com/posts/w4aeAFzSAguvqA5qu/how-to-go-from-interpretability-to-alignment-just-retarget) but do not consider this in detail.

These models are not implemented in practice but are considered in theory for speed of analysis.

Toy Model: Thermostat
=====================

The Thermostat
--------------

Consider a Thermostat $y=f(T)$ whose input $T\in \mathbb R$ is the room's current temperature (as measured by a thermometer), and whose output is one of the two following actions: $a_1=$"Turn the radiator on" or $a_2=$"Turn the air conditioning on." Let $T^*$ denote the Thermostat's target temperature for the room. We assume that the thermostat implements the following function and that this is enough to maintain the target temperature of the room within reasonable bounds:

$\begin{equation}   f(T) =    \begin{cases}        a_1 & \text{if } T \leq T^* \text{  (Too cold or just right)} \       a_2 & \text{if } T > T^* \text{  (Too hot)}  \end{cases}\end{equation}$

We suppose that $f(T)$ is implemented on a simple one-layer hidden neural network, where the single input neuron corresponds to the room's current temperature, there are two neurons $h_1$ and $h_2$ in the hidden layer with ReLU activations, and the two output neurons $o_1$ and $o_2$ correspond to $a_1$ and $a_2$, respectively (see Figure below).

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/b9150fbb1cb969a18d6533a6a8fe3ea64d4e58ce137277bf.png)

Neural Network diagram of the Thermostat. (WARNING: Missing bias units and weights)

The hidden neuron values are given by: $h_1=\text{ReLU}(T^*-T)$ and $h_2=\text{ReLU}(T-T^*)$. We apply the identity to get the outputs, i.e., $o_1=h_1$ and $o_2=h_2$.

An argmax is applied to the outputs to select the corresponding action, i.e., if $o_1\geq o_2$, $a_1$ is selected; otherwise, $a_2$ is selected. One can check that this implements $f(T)$ as described above.

Observations of the Thermostat
------------------------------

The thermostat can be thought of as having a crude world model that consists of a single variable that tracks the temperature of the room, i.e., the input neuron. 

Internal Target Information
---------------------------

Recall that *Internal Target Information* *(ITI)* is information about an agent's target used to differentiate between actions that lead to the target outcome and actions that don’t.

In this example, the thermostat's target is to maintain the room at temperature $T^*$. We see that this information is explicitly stored in the bias terms in both hidden units.

Note that we can construct a space of neural networks that implement the same function $f(T)$, by multiplying the weights and biases related to the input to the hidden units by some non-zero number $\alpha$ and multiplying the weights between the hidden units and the output units by $1/\alpha$.

This observation highlights the problem with conceiving of ITI as being explicitly represented in a human-interpretable way. Perhaps instead, it is better to conceive of ITI as encoded in the function that maps from the world model of the thermostat (in this case, a single variable represented by the input neuron) to the outputs of the neural network (or to intermediate variables such as those in the hidden layer).

Observations Regarding the Thermostat’s Internal Target Information
-------------------------------------------------------------------

Quick observations:

*   ITI is causally upstream of the target outcome: if we scale both bias terms that are added to the hidden units, then we expect the resulting temperature of the room to change accordingly
*   ITI is naturally retargetable with respect to the world model: because it maps from the current temperature variable (input neuron) to the actions that lead to the target outcome, by postcomposing the current temperature variable with some linear function, the Thermostat can be retargeted. 
*   One could imagine a more expressive thermostat/NN that can have its target temperature set by some other input neuron (or by some more complicated process). In this case, the ITI would be contained in this variable.

Toy Model: Model-Based Planning (Maze-Solving) Agent
====================================================

The Model-Based Planning (Maze-Solving) Agent
---------------------------------------------

### The Task

The agent receives an input image of a maze and has to compute and output a plan/action sequence that will lead the mouse to the yellow star.

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/ba2bcfa3fe9ee90b1b7a1b2a249f5a12e78e26e65f7348a0.png)

The environment. The aim of the agent is to produce an action sequence that causes the mouse to reach the yellow star after seeing the image of the maze.

### The Pseudo-Algorithm

We briefly describe a Pseudo-Algorithm that the agent uses to solve the maze. The Figure below might be more illuminating.

We assume that the agent's algorithm used to select action sequences/plans is modular. The algorithm consists of several functions, including a world model for simulating the outcomes of plans, a value function for evaluating the value of a world state, and an argmax.

The agent receives an image of the maze and for each action sequence/plan in $\mathcal A^{\leq N}$, the agent uses its world model to simulate the outcome of the plan. For each outcome it uses the value function to assign a value to the outcome according to how good the state is, and then finally, an argmax function is used to select the plan that leads to the highest value state.

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/0ee2b7c5d93b2f0dfbf595864677d69f9e3b5e92125583b7.png)

WARNING: Value function/Evaluation function used interchangeably.

### The Neural Network-based Value Function

**WARNING:** This section is probably unnecessary. Feel free to ignore. I was going to write out the network explicitly but that seemed like it was too much effort. It wouldn't surprise me if the details are wrong/misleading, but I'm leaving it in just in case.

For our purposes, it isn't essential to consider how functions other than the value function are implemented. We ground the value function by assuming it's implemented by a neural network that we will describe shortly. The whole of the agent's architecture could be a neural network or some modular system that makes calls to a neural network that instantiates the value function.

Potentially, the most natural value function that encodes the idea that the agent's target is to get to the yellow star calculates the number of squares $M$ in the shortest path between the mouse and the yellow star and sets the value of that state as $10-\epsilon M$, where $\epsilon>0$ is sufficiently small.

We want to be explicit and write down the neural network that encodes the value function as we did in the thermostat case. Therefore, we choose a proxy value function that can be easily encoded in a neural network that also would result in the correct plan/action sequence being chosen.

We assume that the input to this value function is a sequence of variables that represents high-level and relevant information about a particular world state. In particular, we assume that the input to the value function/neural network is a sequence of 6 variables that correspond to the mouse/yellow star/red gem's x/y coordinates in the maze. We denote the  yellow star's x-coordinate as $ys_x$ and give the other variables similar naming conventions.

The value function $V:\mathbb Z^6 \rightarrow \mathbb R$ is given by:

$V(m_x, m_y, ys_x, ys_y, rg_x, rg_y)=-(|m_x-ys_x|+|m_y-ys_y|)$.

The highest value state is 0 and corresponds to a world state where the mouse is at the yellow star (the target). 

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/94bcfb5ef54d170ed34bc50c882f99a5190fe5abfc1c8e46.png)

Observations of the Agent's Internal Target Information
-------------------------------------------------------

*   ITI is not clearly represented in a single weight or activation but is contained in the weights and variables that make up the Evaluation Function.
*   The Target Outcome could be deduced from the Evaluation Function if the Overseer could identify the Evaluation Function, and search over inputs that maximize its output.
    *   For an Overseer to do this, it would need to identify the Evaluation Function subnetwork/circuit, be able to understand that the outputs of this subnetwork do indeed correspond to evaluations of world states, finally it would have to be able to intervene on the variables inputted to the Evaluation function. 
    *   To me, the hardest part of this seems to be detecting the corresponding structure in the network and deducing that it corresponds to an Evaluation function.
*   There is now a non-linear mapping from the world model variables to the value of the corresponding world state, which is then used to map to an action sequence that is finally mapped to individual actions that the agent might take. The ITI is used in the Evaluation function but is not represented explicitly in the weights, unlike in the case of the Thermostat.
*   Again, the ITI is causally upstream of the Target Outcome occurring in the environment.
*   The Agent can be retargeted by post-composing the world model variables (by changing the following weights in the corresponding way).
*   Furthermore, the Agent could be retargeted to go to the red gem by swapping around the weights corresponding to the Mouse position and the Red gem position in the first layer of the Evaluation function. This intervention doesn't screw up the Agent's world model; it only modifies what the Agent values.
*   One could train a probe whose domain is the world model variables/world state and whose codomain is the actual target outcome produced by the agent (technically, this would be the target outcome in the Overseer's world model). The probe would likely learn a compact representation of the Agent's target. In theory, a probe could be trained on all of the Agent's internal activations and would learn a similar compact representation without the Overseer needing prior knowledge of the Agent's World model, etc. This probe could then be studied to deduce the Agent's Target (although this remains tricky in practice).

Discussion
==========

What form does ITI take?
------------------------

The ITI is likely to be distributed across multiple parameters and activations but sufficiently localized that it can be used by a process that maps from world state variables to actions.

From these examples, it seems like ITI is embedded in the mapping (Action-Selection Process) from the Agent's world model to actions that lead to the target outcome.

Retargetable Cognition
----------------------

*   If the Agent's ITI is contained in some mapping (Action-Selection Process) from variables in its world model to actions, then in theory, this factorization of the Agent's internals could lead to some useful features:
    *   The Agent will be naturally retargetable by modifying the world model variables before they enter the mapping.
*   Space of Objectives 
    *   That being said, these Agents are not very sophisticated in terms of how diverse their objectives can be. 
    *   The Thermostat can pursue just one objective - keeping the room at a pre-specified target temperature. The Model-Based Planner (and the thermostat whose target temperature can be set) is slightly more general in the sense that its objective depends on the location of the cheese in the maze. Therefore, it seems natural that we can retarget the Agent's cognition towards reaching other places in the maze. Furthermore, we saw how we might be able to naturally retarget the Agent's cognition towards non-cheese objects.
    *   We could imagine a maze-solving agent that's capable of pursuing different objectives in the maze in different circumstances. The Agent may have a flexible Evaluation function whose weights are modified (via the mechanism described earlier) to pursue the cheese or the red gem depending on some variable outside of the Evaluation Function. It could be the case that this external variable also can be said to be ITI.

Detecting an Agent's Objective
------------------------------

*   Deducing Target Outcomes from ITI may require probes or interpretability of the action selection process.
    *   Probes could be used to map from the Agent's internals to the Target Outcome (in the Overseer's world model) if we assume the agent pursues aligned objectives on the probe's training dataset.
    *   One could then use interpretability on the probe to detect what information the probe is using to predict the outcome. The ITI would be a good candidate for this information.
    *   Potentially, one could set up a \[Mechanistic Anomaly Detection\] scheme where one could monitor the ITI and see whether it changes too drastically out-of-distribution.
    *   Presumably, the probe would learn a compact description of the Agent's Objective in terms of the Agent's world model (e.g., if the maze-solving agent represents the world in terms of the location of the cheese, mouse, and red gem, then the probe might learn some mapping from these variables to (cheese\_loc, mouse\_loc=cheese_loc, X), 
    *   Relying on probes has its problems as has been discussed in the ML literature.
    *   Also, this won't work if the agent is already deceptive because the prob will pick up on the instrumental objective, not the model's true objective. 
    *   That being said, if the Agent must use the same action-selection mechanism when it decides to pursue its terminal objective, we might detect this switch as stated in the MAD idea. 
    *   The probing method works if the same action-selection mechanism is used OOD and the structure of the ITI remains the same, but its content may change.
*   Interpreting the Agent's action-selection process
    *   If we can't rely on some safe dataset, we can't leverage the property of ITI that it causes the target outcome.
    *   We can only rely on deducing the Agent's action-selection process and interpreting that. 
    *   That would likely require advanced mechanistic interpretability.
    *   It also might require observing the agent pursue objectives in the environment like above, as presumably finding the action-selection mechanism would involve observing that it is used to select actions that lead to the target outcome.