# Introducing Statistical Utility Mechanics: A Framework for Utility Maximizers

*This is independent alignment research. A decent grasp on stat mech is needed to understand this post fully, but I have recently written a stat mech sequence (up to part 3) which should do the trick to catch someone up to speed rapidly.*

### TL;DR

Statistical Utility Mechanics is a framework which draws on stat mech to model the actions of utility-maximizing agents. I introduce this framework here, and use it to demonstrate why the most naive possible alignment plan (by which of course I mean one not too far off the one that most AI companies are currently using) is doomed by scaling laws, and we should expect to see sudden increases in AI's potential for harm around when AI reaches roughly human level.

![A meme featuring Dr Doofenshmirtz, it reads "If I had a nickel for every time Statistical Mechanics proved we were all going to die, I'd have two nickels, which isn't a lot but it's weird that it happened twice.](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/741ecbee79d23a12b5a607a70c2352b13a1d06d0ff6c1528.png)

The framework consists of just three core rules

*   The world is a probability distribution over states
*   Each agent assigns a value to each state
*   Agents can affect the probability distribution over states with limited power

I'll go into more detail with these in this toy model:

Toy Example: Why AI Suddenly Becomes Dangerous
==============================================

The world is described by a multivariate normal distribution over states $\mathbf s \in \mathbb R^d$, centred on the origin. All variances are 1, so the distribution can be written as follows:

$P_0(\mathbf S =\mathbf  s) = \frac 1 {(2 \pi )^{d/2}}\exp(-\frac12 \mathbf s^2) \iff \mathbf S \sim \mathcal N(\mathbf 0, \mathrm I_d)$

This has the nice property of being totally spherically symmetrical. I will also write $P_0(\mathbf S = \mathbf s) \equiv p_0^\mathbf s$ for brevity in some cases.

Let us consider an AI agent $\mathrm A_X$, which has the simplest possible utility function: $x^\mathbf s = \mathbf v_X \cdot \mathbf s$ for some vector $\mathbf v_X$, and a "power level" $O_X \in \mathbb R$. Without loss of generality we will assume that $|\mathbf v_X|  = 1$ (the reason for this will be clear soon)

This AI will impact the world's probability distribution $P_0 \overset{\mathrm A_X}\to P_1$ according to two rules:

1.  $D_{KL}(P_1 \Vert P_0) \le O_X$
2.  Subject to rule 1, $\mathbb E(X) = \int P_1(\mathbf S = \mathbf s) x^\mathbf s \mathrm d\mathbf s$ is maximized

Normally stat mech tells us about entropy given expected values, but here we can flip it on its head to tell us about expected values given KL-divergence (see appendix for why we use KL-divergence here). This is $p_1^\mathbf s = p_0^\mathbf s \exp(b\mathbf v_X \cdot \mathbf s)$ for some constant $b$, and gives the distribution $P_1 \sim \mathcal N(b \mathbf v_X, \mathrm I_d)$ 

Using the formula for the KL-divergence of two multivariate gaussians, we get:

$D_{KL}(P_1 \Vert P_0) = \frac12 b^2(\mathbf v_X \cdot \mathbf v_X) = \frac12b^2$

$O_X = \frac12b^2 \therefore b = \sqrt{2O_X}$

$P_1 \sim \mathcal N(\sqrt{2O_X}\mathbf v_X,\mathrm I_d)$

$\mathbb E(X) = \sqrt{2 O_X}$

This framework naturally captures the fact that rescaling or adding a constant to our utility function does not change the behaviour of the agent. If $\mathbf |\mathbf v_X| \ne 1$, then we just get a different $b$ value and it all cancels out to the same answer.

The Alignment Process
---------------------

Let's describe a human utility function in the same way as the agent's: $y^\mathbf s = \mathbf v_Y \cdot \mathbf s$. We will also describe the "power" of humans in this system as $O_Y$. In this model, what matters is the cosine similarity between the two vectors, which can be expressed as $\tau=\cos(\theta_{XY}) = \mathbf v_X \cdot \mathbf v_Y$. For a $d$ dimensional space, and two totally randomly-chosen vectors, this is distributed like this:

$P_0(a;\tau = t) \propto (1-t^2)^a$ where $a = \frac{d-3}2$

We will work in terms of $a$ rather than $d$ to simplify the maths, and because we expect to have a very high-dimensional space, and mainly care about scaling laws, it doesn't really matter. We'll consider altering the value of $\tau$, again using the KL-divergence trick to measure how much we're impacting our distribution. Our system does not (really) have a good closed-form solution, especially for small values of $b$ and large values of $a$. We can approximate our whole system numerically though, and get the following results:

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

Note the log scale for both $a$, and the x-axis.

Here we've calculated $\mathbb E(\tau)$ as a function of $a$ and $b$, but plotted it against $O_\tau$, which we'll define as the divergence $D_{KL}(P_1(a,b; \tau=t) \Vert P_0(a; \tau=t))$. We can see that the higher the dimensionality of our space, the more we must optimize the AI's utility function to get $\mathbb E(\tau)$ above a certain critical value $\tau_c$. If we plot this required optimization against $\tau_c$:

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

We can also see that this relationship is linear for any $\tau_c$ threshold we might want to set. This is somewhat unsurprising, the each dimension is just another, mostly independent, dimension along which we must optimize $\mathbf v_X$. The question is, how might we optimize the AI's utility function, and what are the constraints on $O_{\tau}$?

Consider the following loop (basically trying to wrangle an AI into alignment by letting it loose and seeing what it does):

*   The AI observes the world.
*   The AI takes an action to optimize the world.
*   We observe the result of that action.
*   We take an action to optimize the AI's utility function

The expected amount of information we get about the AI's utility function from observing the result of each action is just the KL-divergence between the un-optimized world and the optimized world, in other words $O_X$! How much of this optimization is harmful? We can express it as  $O_{X\perp Y}$ :

$\sqrt{O_{X\perp Y}} = \sqrt{(1-\tau^2)}\sqrt{O_X}$

$\sqrt{O_{X \parallel Y}} = \sqrt{\tau^2}\sqrt{O_X}$ 

$O_X = O_{X\parallel Y} + O_{X\perp Y}$

(The reason for all the square roots is in Appendix 2)

Here is the plot of the following integral:

$\sqrt{O_{X \perp Y}} = \int\sqrt{1-\tau^2} \mathrm d\sqrt{O_\tau}$

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

This makes sense again: we have a linear relationship between the amount of harmful optimization the AI will do before we can wrangle it into alignment, and the size of the space of possible utility functions. Not good!

Now if the people trying to align the AI are not completely stupid (debatable) we might want to add a final point to this loop:

*   We take an action to rectify the result of the AI's action

If the AI is smarter than us, we would expect not to be able to fully rectify the result of the AI's decision. For simplicity, and without particular principle, we will make the choice of  $O_{X-Y} = \mathrm{plus}(O_{X\perp Y} - O_Y)$ where $\mathrm {plus}(x) = \cases{x, & $x \ge  0$ \ 0, & $x < 0$}$

We will also upper-bound $O_\tau = \max(O_X, O_Y)$, representing the assumption that we probably can't optimize the AI any more strongly than we can optimize against its effects on the world (since our limits on both are likely due to our ability to understand the AI's actions). We can then simplify our expressions to these relations in terms of $O_\tau$:

$R_{XY} = O_X/O_Y$

$O_\tau = \max(1, R_{XY})\times O_Y$

$O_Y = O_\tau/\max(1, R_{XY})$

$O_X = \min(R_{XY},1 ) \times O_\tau$

$O_{X-Y} = \mathrm{plus}\Big((1-\tau) \times \min(R_{XY}, 1)   - \min(\frac 1{R_{XY}},1)\Big)\times O_\tau$

We will therefore calculate the integral:

$\sqrt{O_{X-Y}}=\int\sqrt{\mathrm{plus}\Big((1-\tau) \times \min(R_{XY}, 1) - \min(\frac1{R_{XY}}, 1)\Big)} \mathrm d\sqrt{O_\tau}$

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

Or we can plot it as a function of $R_{XY}$, with $a$ as a parameter:

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

We can note a few predictions from this system:

*   Total "harm" as measured by $O_{X-Y}$ during training is directly proportional to $a$
*   For $R_{XY} \le 1$, we experience zero total harm, but harm grows very rapidly around human level AI, and the larger the value of $a$, the faster it grows

AI Scaling
----------

The question is, how do our parameters $R_{XY}$ scale with AI "scale"? Let's assign AI scale the to variable $\xi$ (because xi is hard to draw and an AI's scale is hard to quantify) then we'll make the very conservative assumption that $R_{XY}$ scales with $\log(\xi)$, and $a$ scales with $\xi^k$ for some exponent $k$, probably $\le 1$. This gives us a plot looking something like the black line below:

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

If we expect $\xi$ to scale exponentially with time $T$, we expect $a$ to scale exponentially over time, and $R_{XY}$ to scale linearly. 

![A graph showing harm from scaling of constant a levelling off, whereas harm in a scenario where a is related to scale by a power law increases exponentially](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/c27f06dcc14aabdc52329c2bca7e84f24a7cc0ea5ec7e59d.png)

What Ilya Saw

Or if we use a logarithmic $y$-axis, to get a better look at just how fast it is growing:

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

X axis has been rescaled to remove the zeroes

I conjecture that this consists of three phases: 

*   A "lag" phase in which $O_X \ll O_Y$, so no harm is possible (the world is currently in this phase)
*   A "catch-up" phase in which the $O_X \approx O_Y$, so we see double-scaling (due to overcoming the $\mathrm{plus}$ function more and more as $R_{XY}$ increases)
*   An "exponential" phase, in which $O_X \gg O_Y$, so we "only" see exponential scaling, or perhaps scaling as (which is still very fast)

Conclusions
===========

This model tells us to expect super-exponential scaling of AI harms around human level. It also tells us that the higher the dimensionality of the possible utility-function space, the more quickly these harms will grow.

Some things this model does not include, a mixture of things which would make alignment easier or harder:

*   The ability for the aligners to "sandbox" the AI, limiting its domain during alignment, or do offline-RL-ish-stuff on it
*   Clever tricks to "repeat" the AI's actions in some way to get more than $O_X$ information out of each of the AI's actions
*   The ability for the AI to become more powerful over time during deployment (i.e. $O_X$ increases over time while the AI is being altered)
*   The ability for the AI to understand that it is being optimized, and act strategically or deceptively
*   A "sharp left turn" in which AI gains new capabilities (e.g. can optimize in more dimensions)
*   "Real" goodharting, in which eventually even highly correlated optimization targets diverge due to constraints.
*   Extra "fragility" terms outside of $\tau$. I tried to simulate this by transforming the distribution to a narrower one, but polynomially-scaling $\tau$ had the same effect as increasing $a$, so perhaps it is best to think of $a$ as just being a general "fragility constant"

I'm going to keep working on SUM, and hopefully get even more interesting results. I think SUM has the potential to be a fertile ground for both formal proofs and more informal models (like this one) surrounding alignment.

For a recap, here are the foundational principles:

*   The world has states $s \in \mathcal S$, which can be any set
*   We define a probability distribution $P_0(S = s) = p^s_0$
*   Agents $\mathrm A_X$ assign real values to each element $x^s \in \mathbb R$
*   An agent can influence that probability distribution with power $O_X$
*   This means the action $P_i \overset {\mathrm A_X} \to P_{i+1}$ is subject to $D_{KL}(P_{i+1}\Vert P_i) \le O_X$
*   The optimal action for a myopic agent is $p_{i+1}^s \propto p_i^s e^{bx^s}$ for $b \in \mathbb R^+$

Major Caveat
------------

*   Arguably the sudden threshold is somewhat artificial. I did add a threshold function to my measure for harm, which induced a threshold in harm. I do think the threshold is well-motivated though.
*   It's somewhat unclear whether $O_X$ is the most natural measure of an AI's power
*   Technically this should all be done with lots of causal models and severed correlations, which I have omitted here. I think the results ought to still hold there, but I haven't crunched all the numbers so I'm working in shorthand.

Appendices
==========

Appendix 1: The Entropy to KL-Divergence Trick
----------------------------------------------

The world in SUM is conceptualized as a set of states $s \in \mathcal S$. To each of these we assign an initial probability $p^s_0$, according to all the normal rules of probability distributions. We define the total entropy $H = \underset{s \in \mathcal S} \sum p^s(h_0^s - \ln p^s)$ where $h_0^s$ is the "intrinsic entropy" of each state, a trick from stat mech when our "states" are not truly fundamental.

We then perform a second trick by defining $h_0^s = \ln p^s_0$. This has two effects: $H_0 = 0$ by definition, and more subtly $P_0(S)$ becomes the maximum-entropy probability distribution.

This combination gives us a definition of $H$ which reduces to the KL-divergence.

$H = \underset{s \in \mathcal S} \sum p^s(\ln p_0^s - \ln p^s) = -D_{KL}(P \Vert P_0)$

Appendix 2: KL-Divergence is not a Metric
-----------------------------------------

So KL-divergence is actually a generalization of squared distance, not distance. This is why I do my integrals with respect to $\mathrm d\sqrt{O}$. This still might not be the most appropriate way to do things, but I've found that the qualitative results are the same if I do them with respect to $\mathrm dO$ or $\mathrm d\sqrt O$.