# Toward Statistical Mechanics Of Interfaces Under Selection Pressure

Imagine using an ML-like training process to design two simple electronic components, in series. The parameters $\theta^1$ control the function performed by the first component, and the parameters $\theta^2$ control the function performed by the second component. The whole thing is trained so that the end-to-end behavior is that of a digital identity function: voltages close to logical 1 are sent close to logical 1, voltages close to logical 0 are sent close to logical 0.

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

Background: Signal Buffering
----------------------------

We’re imagining electronic components here because, for those with some electronics background, I want to summon to mind something like this:

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

This electronic component is called a signal buffer. Logically, it’s an identity function: it maps 0 to 0 and 1 to 1. But crucially, it maps a *wider* range of logical-0 voltages to a *narrower* (and lower) range of logical-0 voltages, and correspondingly for logical-1. So if noise in the circuit upstream might make a logical-1 voltage a little too low or a logical-0 voltage a little too high, the buffer cleans that up, pushing the voltages closer to their ideal values.

This is a generalizable point about interfaces in scalable systems: for robustness and scalability, components need to accept less-precise inputs and give more-precise outputs.

That’s the background mental picture I want to invoke. But now, I want to combine it with an ML-like mental picture of training a system to match particular input/output behavior.

Back To The Original Picture: Introducing Interfaces
----------------------------------------------------

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

$\theta^1$ chooses the function performed by the first component, $\theta^2$ chooses the function performed by the second component; the colored curves show some possible functions for the two components. The whole system is trained to have a particular end-to-end behavior.

Here’s a conceptual story.

There are three interfaces - “APIs”, we’ll call them. The first ($API^1$) is at the input of the whole system, the second ($API^2$) between the two components, and the last ($API^3$) is at the output of the whole system. At each of those APIs, there’s a set of “acceptable” voltages for each logical input *to the full system* (i.e. 0 or 1).

The APIs constrain the behavior of each component - e.g. component 1 is constrained by $API^1$ (which specifies its inputs) and $API^2$ (which specifies its outputs).

Let's put some math on that, with some examples.

A set of APIs might look like:

*   $API^1: (0 \mapsto [0V, 1.2V], 1 \mapsto [3.5V, 5.0V])$ \- i.e. the full system accepts either a voltage between 0 and 1.2 volts (representing logical 0), or a voltage between 3.5 and 5.0 volts (representing logical 1). No particular behavior is guaranteed for other voltages.
*   $API^2: (0 \mapsto [0V, 0.5V] \cup [4.6V, 5.0V], 1 \mapsto [2.6V, 3.8V])$ \- i.e. in the middle the system uses extreme voltages (either above 4.6 or below 0.5 volts) to represent logical 0, and middling voltages to represent logical 1. Weird, but allowed.
*   $API^3: (0 \mapsto [0V, 0.5V], 1 \mapsto [2.8V, 5.0V])$ \- i.e. a narrower range of low voltages but wider range of high voltages, compared to the input. This might not be the most useful circuit behavior, but it’s an allowed circuit behavior.

(For simplicity, we’ll assume all voltages are between 0V and 5V). In order for the system to satisfy those particular APIs:

*   Component 1 must map every value in $API^1(0)$ to a value in $API^2(0)$, and every value in $API^1(1)$ to a value in $API^2(1)$ \- i.e. any value less than 1.2V must be mapped either below 0.5V or above 4.6V, while any value above 3.5V must be mapped between 2.6 and 3.8V.
*   Component 2 must likewise map every value in $API^2(0)$ to a value in $API^3(0)$, and every value in $API^2(1)$ to a value in $API^3(1)$.

Using $f^i$ for component $i$ and writing it out mathematically: the components satisfy a set of APIs if and only if

$\forall b \in {0, 1}, x \in API^i(b): f^i(x, \theta^i) \in API^{i+1}(b)$

That’s a set of constraints on $\theta^i$, for each component $i$.

The Stat Mech Part
------------------

So the APIs put constraints on the components. Furthermore, subject to those constraints, the different components *decouple*: component 1 can use any parameters $\theta^1$ internally so long as it satisfies the API set (specifically $API^1$ and $API^2$), and component 2 can use any parameters $\theta^2$ internally so long as it satisfied the API set (specifically $API^2$ and $API^3$).

Last big piece: putting on our stat mech/[singular learning theory](https://www.lesswrong.com/w/singular-learning-theory) hats, we educatedly-guess that the training process will probably end up with an API set which can be realized by many different parameter-values. A near-maximal number of parameter values, probably.

The decoupling now becomes very handy. Let’s use the notation $H(\Theta|<constraints>)$ \- you can think of it as the log number of parameter values compatible with the constraints, or as entropy or relative entropy of parameters given constraints (if we want to weight parameter values by some prior distribution, rather than uniformly). Because of the decoupling, we can write H as

$H(\Theta|API) =$

$H(\Theta^1 | \forall b \in {0, 1}, x \in API^1(b): f^1(x, \theta^1) \in API^2(b))$

$+ H(\Theta^2 | \forall b \in {0, 1}, x \in API^2(b): f^2(x, \theta^2) \in API^3(b))$

So there’s one term which depends only on component 1 and the two APIs adjacent to component 1, and another term which depends only on component 2 and the two APIs adjacent to component 2.

Our stat-mech-ish prediction is then that the training process will end up with a set of APIs for which $H(\Theta|API)$ is (approximately) maximal.

Why Is This Interesting?
------------------------

What we like about this mental model is that it bridges the gap between stat mech/singular learning theory flavored intuitions (i.e. training finds structure compatible with the most parameters, subject to constraints) and internal structures in the net (i.e. internal interfaces). This feels to us like exactly the gap which needs to be crossed in order for stat mech flavored tools to start saying big things about interpretability.