# Searching for a model's concepts by their shape – a theoretical framework

**Produced as part of the** [**SERI ML Alignment Theory Scholars Program**](https://serimats.org/) **\- Winter 2022 Cohort**

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

I think that [Discovering Latent Knowledge in Language Models Without Supervision](https://arxiv.org/pdf/2212.03827.pdf) (DLK; Burns, Ye, Klein, & Steinhardt, 2022) is a very cool paper – it proposes a way to do unsupervised mind reading[^76nupl085dw][](#fn-4kdnPxSNhqsGnk8op-1)– diminished only by not making its conceptual coolness evident enough in the paper writeup. This is in large part corrected in Collin Burns's more conceptual [companion post](https://www.lesswrong.com/posts/L4anhrxjv8j2yRKKp/how-discovering-latent-knowledge-in-language-models-without). I'm rooting for their paper to sprout more research that finds concepts / high-level features in models by searching for their shape[^5vhs9kljr2f]. The aim of this post is to present a conceptual framework for this kind of interpretability, which I hope will facilitate turning concepts into structures to look for in ML models. Understanding this post does not require having read DLK, as the reader will be walked through the relevant parts of the result in parallel with developing this framework.

Epistemic status: This post contains a theoretical framework that suggests a bunch of concrete experiments, but none of these experiments have been run yet (well, except for ones that were run prior to the creation of the framework), so it's quite possible the framework ends up leading to nothing in practice. Treat this as an interim report, and as an invitation to action to run some of these experiments yourself. This post is written by Kaarel Hänni on behalf of a team consisting of Georgios Kaklamanos, Kay Kozaronek, Walter Laurito, June Ku, Alex Mennen, and myself.

The rough picture of the approach
---------------------------------

The idea is to start with a list of related concepts (or possibly just a single concept), write down a list of relations that the concepts satisfy, and then search for a list of features inside the model satisfying these relations. The hope is that this gives a way to find concepts inside models which requires us to make fewer assumptions about the model's thinking than if we were e.g. training a probe on activations according to human-specified labels. For instance, if we had good reasons to believe that models assign utilities to outcomes, but we had no idea about what the utility assignment is, we couldn't train a supervised probe (because of lacking labels), but perhaps we could still train an unsupervised probe that looks for utility-shaped features in the model. The bet would be that the utility-shaped features we find indeed store the model's utility assignment.

Philosophical framing
---------------------

The approach described above is very similar to [Ramsification](https://en.wikipedia.org/wiki/Ramsey%E2%80%93Lewis_method)[^354vpdgdt], a method for turning a theory in narrative form – usually with terms not grounded in some previously understood theory, possibly with circular definitions – into a well-defined theory. Roughly speaking, when presented with a scientific theory stated as a bunch of statements involving new terms, e.g. (borrowing an example from [Wikipedia](https://en.wikipedia.org/wiki/Ramsey%E2%80%93Lewis_method)) the new terms "electron" and "charge" in the narrative theory "Electrons have charge. Things with charge tickle you. Electrons cause lightning.", Ramsification suggests picking the meaning of "being an electron" and "having charge" in whatever way makes the narrative as true as possible, i.e. minimizing the fraction of cases in which the sentences are wrong.

I'm immediately struck by two (related) issues. First, it's not clear what the set of meanings is from which we are allowed to pick one – in fact, it's not even obvious to me what kind of language (theory, metatheory, or whatever) these meanings should be specified in. Second, I'd guess there's probably always going to be some convoluted meanings that satisfy the narrative form really well, but which aren't the natural concepts we'd want e.g. "electron" and "charge" to capture. So it would be nice if we could constrain the search for meanings only to natural concepts. Here's an idea: perhaps these issues would be fixed if we had a machine that learns useful representations for doing stuff, in which case we could restrict our search to the features learned by this machine.[^uw0zlilzqcf] This gives us a concrete search space, as well as a reason to believe that a lot of measure in the search space is inhabited by reasonable abstractions. One crucially important concept is truth, and language models are really powerful models that can understand text, which is a natural kind of thing to carry truth. So perhaps it makes sense to look for a representation of truth inside language models? (Spoiler: DLK does this.) In case the usefulness of being able to find out what a model believes is not obvious in analogy with how interpretability is generally useful, I'll spell out a few ways in which this is useful:

1.  We might be able to use it to check if and in what ways a model is deceiving us, and then go back to the model drawing board with some more information.[^5ckvuymnq05]
2.  We could just see if the model believes something like "If I'm unboxed, there won't be many humans around in 100 years", and if yes, go back to the drawing board with more information.
3.  Given a potentially misaligned AGI, if we had accurate access to its beliefs, we could use it as an oracle for e.g. our alignment research questions. This is like [microscope AI](https://www.lesswrong.com/posts/X2i9dQQK3gETCyqh2/chris-olah-s-views-on-agi-safety#Building_microscopes_not_agents), except instead of having to reconstruct some superhuman scientific theory from weights, this one weird trick gives us a question-answer interface. We can then play twenty (thousand) questions on alignment research plans with a boxed superintelligence that can't help but leak the truth.

Finally getting to the star of the show now: in DLK, it's plausible that they pull off just the above in current language models! One can think of the constraints used in the paper as arising by Ramsification from the following narrative form:

> The truthiness of a proposition is $1$ minus the truthiness of its negation. The truthiness of either a proposition or its negation should be close to $0$.

The paper searches for a feature in the model satisfying these relations, and turns out to indeed find something that's pretty correlated with ground truth! emotive status: Very cool. [^7lgwst1o7ly][^uyi71v8rmeb]

Formalism: features
===================

Let $\mathcal{F}$ be the set of all features of a model. For now, feel free to think of $\mathcal{F}$ as just a finite list if you like. Let's think of each element $f\in \mathcal{F}$ as a function from the model input space $X$ to some output space $Y_f$ – there can be a different output space $Y_f$ for each feature $f$. Here are four examples of features we could imagine an image classification model having:

1.  a feature $f_{\text{snout}}$ that maps a picture to $\{0,1\}$ according to whether it contains a snout;
2.  an analogous continuous feature $f_{\text{snout}}\colon X\to [0,1]$;
3.  $f_{horizontal}\colon X\to \mathbb{R}$ capturing the horizontal coordinate of the center of the salient object in the image;
4.  $f_{direction}\colon X\to S^2$ (unit sphere in $\mathbb{R}^3$) capturing the direction of gravity compared to some basis respecting the picture plane.

In general, the features should be derived from activations of the model in a pretty simple way. By this, I mean that if the map from model inputs to corresponding activations is $g\colon X\to A$, then for every feature $f$, there is a simple map $h_f\colon A\to Y_f$ such that $f=h_f\circ g$. For example, it could be that features are [directions in activation space](https://transformer-circuits.pub/2022/toy_model/index.html#motivation-directions) $A\cong \mathbb{R}^n$, in which case every $Y_f$ is a subspace of $A$ (or perhaps more precisely of the subspace spanned by the activations in just one layer, or at just one position in the [residual stream of a language model](https://dynalist.io/d/n2ZWtnoYHrU1s4vnFSAQ519J#z=pndoEIqJ6GPvC1yENQkEfZYR)), so $Y_f\cong \mathbb{R}$, and $h_f$ is a projection from the activation space to that subspace.[^fxao7kzczk][^wai246vix3]

So, [what are features](https://transformer-circuits.pub/2022/toy_model/index.html#motivation-features)? I don't know – the above definitely doesn't nail it down. In particular, the above does not capture the idea of features being the natural abstract units in terms of which a model is performing computation, not to speak of giving an algorithm for computing the features of a model. So, unfortunately, even though the above presentation most conjures up an image of the feature set $\mathcal{F}$ as a discrete thing, as humanity hasn't solved the problem of coming up with such a discrete set yet,[^hu7f3rhziku] in current practice we might want to work with a set $\mathcal{F}$ with smooth structure so as to be able to do gradient descent over it. This smooth $\mathcal{F}$ will almost always contain elements that are not features, so let's call it the set of prefeatures instead. And we will also often want to restrict to only a subset of all prefeatures of a model.[^rw4wxwxjyva] For example, if our model is GPT-J and we want to consider prefeatures with output space $Y_f=[0,1]$, then we could e.g. let $\mathcal{F}$ be the set of all one-dimensional subspaces of the vector space of activations at the last token position in the last layer, by which I really mean that if the scalar activations are $z_1,\ldots,z_d$, then $\mathcal{F}$ is the set of all $f$ induced by $h_f$ of the form $h_f=\sigma\left(a+\sum_{i=1}^d b_i z_i\right)$, where $\sigma$ is the usual sigmoid $\sigma(s)=\frac{1}{1+e^{-s}}$. (So there's an $f$ for each setting of $a\text{ and }b_1,b_2,\ldots,b_d\in \mathbb{R}$, and gradient descent is really happening over these parameters.) This is the choice of the prefeature set in the DLK paper. [^qesy4gyfxlq]

Formalism: searching for concepts in features
=============================================

Ok, whatever, let's assume for now that Anthropic et al. have succeeded at creating the [powerful primitive of enumerating over all features of a model](https://transformer-circuits.pub/2022/toy_model/index.html#strategic), so we can run this on our model, and get a set $\mathcal{F}$ of all features of the model. But even if we have a list of features in terms of which the model is performing computation, that doesn't make it trivial to identify features with useful concepts. For instance, we don't a priori know whether some feature is detecting dog snouts, or which one it is. So there's still some interpretability work to be done: we want to find a feature (or set of features) where a model's version of some concept or another lives. Let's associate each concept – e.g. truth, utility, honesty, treeness, goodness according to [humanity's CEV](https://arbital.com/p/cev/), ease of traversing a particular piece of terrain, whether another agent is an adversary, etc. [^jl72t5cxss] – with a function $c\colon X\to Y_c$ with $X$ being the input space of the model and $Y_c$ being some space specific to that concept [^49tziiafr1x][^9k2dt5ghw49].  (This agrees with the framework on pages 8-9 of "[Acquisition of Chess Knowledge in AlphaZero](https://arxiv.org/pdf/2111.09259.pdf)", with the caveat that we haven't assumed the function $c\colon X\to Y_c$ to be a priori known to us.)

Just write down a loss function capturing the concepts and minimize it?
-----------------------------------------------------------------------

Most generally [^m777b4hri0p], to capture a set of concepts $\mathcal{C}$, we could now define some loss function $\mathcal{L}=\mathcal{L}_{C,X}$ with type signature $\mathcal{L}\colon \prod_{(c,x)\in \mathcal{C}\times X}Y_c \to \mathbb{R}$ that attains an exceptionally low value with the indexed family containing the true concept values on all the inputs $(c(x))_{(c,x)\in \mathcal{C}\times X}$ as the input . Once we have $\mathcal{L}$, we search for an embedding of the concepts into features, $e\colon\mathcal{C}\to \mathcal{F}$, such that denoting $f_c=e(c)$, the loss $\mathcal{L}\left((f_c(x))_{(c,x)\in \mathcal{C}\times X}\right)$ is small. [^irnohvzdx3] The bet probing makes is that if the concepts in $\mathcal{C}$ are natural enough and $\mathcal{L}$ is designed well, then the $f_c$ we find from this search capture the model's versions of the concepts $\mathcal{C}$.

So, how would one design $\mathcal{L}$ for given concepts of interest? In general, it will require some cleverness not algorithmized away by the formalism at hand. But I think considering losses $\mathcal{L}$ with some additional structure can take us some of the way there. We'll look at a few simple cases before writing down a canonical form.

Special case: supervised probing for a single concept
-----------------------------------------------------

Suppose that for the concept $c\colon X\to \mathbb{R}$, we have a list of $n$ input-output pairs, i.e. $(x_i,c(x_i)) \in X\times \mathbb{R}$ for $i=1,2,\ldots,n$. Then it's natural to just let $\mathcal{L}=\sum_{i=1}^n (f_c(x_i)-c(x_i))^2$. In case we are looking for a feature $f_c$ that is a direction in activation space, the problem reduces to [OLS](https://en.wikipedia.org/wiki/Ordinary_least_squares). Further adding a regularization term to this loss (and sending through a sigmoid for concepts living in $[0,1]$), one gets the supervised probes in "[Acquisition of Chess Knowledge in AlphaZero](https://arxiv.org/pdf/2111.09259.pdf)". A second example of supervised probing, from "[Understanding intermediate layers using linear classifier probes](https://arxiv.org/pdf/1610.01644.pdf)": in case one has multiple mutually exclusive concepts (e.g. image classification), one can set up a [multinomial logistic regression problem](https://en.wikipedia.org/wiki/Multinomial_logistic_regression) and minimize cross-entropy loss. A third example, from "[A Structural Probe for Finding Syntax in Word Representations](https://aclanthology.org/N19-1419.pdf)": to find a representation of the (syntactic) dependency tree of a sentence at some layer $L$ in the $768$-dimensional residual stream[^3v0r19x7en7] of BERT, one looks for a linear map $B\colon \mathbb{R}^{768}\to \mathbb{R}^k$, such that when applied to the layer $L$ representation $h_i$ of each word $i$ in a sentence [^pgyh52hus2], the squared $L^2$ norm of the distance between each pair of vectors matches the graph distance between the corresponding vertices of the dependency tree. More precisely, letting $d_T(i,j)$ denote the dependency tree distance between words $i$ and $j$, the sentence contributes a term of $\sum_{i,j}\left|d_T(i,j)-||B h_i-Bh_j||^2\right|$ to the loss.[^gdlvyystyym] To fit this last example into our framework, we could try to think of the concept we're after as being the dependency tree, with the representation being constructed from the vectors $B h_i$ by looking at the complete graph with edges weighted by pairwise squared $L^2$ distances and taking the minimum spanning tree (which is in fact the inference rule used at test time in the paper). However, the relation $d_T(i,j)=||B h_i-Bh_j||^2$ is a function of the syntactic representation vectors $Bh_i$, and its value is not recoverable from the tree alone. So it's perhaps better to think of the concepts we're seeking as being the syntactic representation vectors $Bh_i$ of words, and this as being a semi-supervised search for these syntactic representations (after all, we're not giving the syntactic representation vectors as labels during training). Or as a slight conceptual variant, one could take the generalized syntax tree of a sentence to just be a tuple of vectors in $\mathbb{R}^k$ (out of which the usual syntax tree has to be constructed as a minimum spanning tree), in which case the relations here can be written as relations satisfied by the generalized concept. I refer the interested reader to [A Primer in BERTology](https://arxiv.org/pdf/2002.12327.pdf) for more results from supervised probing of BERT, and to [Probing Classifiers: Promises, Shortcomings, and Advances](https://arxiv.org/abs/2102.12452) for more on supervised probing in general.

The [canonical form of a probing loss function](https://youtu.be/8w4OvfLKp0o)
-----------------------------------------------------------------------------

To capture a set of concepts $\mathcal{C}$ (in an unsupervised way), I'm inviting you to think through the following steps.

1.  Come up with a set $\mathcal{P}$ of properties/relations that the concepts in $\mathcal{C}$ satisfy. [^3f5twghc5lm] We might have to content ourselves with natural language descriptions here that will just have to be turned into terms in the loss in a semi ad-hoc way, e.g. the property that some particular $c\in \mathcal{C}$ is far from being constant. But in my experience, a lot of the properties one comes up with are *contrastive*, by which I mean that they take the form of an equation between concept values on a set of inputs. For example, in DLK, the property of *negation coherence *[^nj54mxvkrs] says that for any proposition $Q$, we have the equation $\text{plausibility}(\neg Q)=1-\text{plausibility}(Q)$. This is a relation between the values of a concept on the *contrast tuple* $(Q,\neg Q)$. Of course, we can construct one such contrast tuple for every proposition $Q$. So more precisely, let's say a contrastive property is one that has the following form: Here, $I_p$ is a set indexing each contrast tuple, $T_p$ is the set of the finitely many contrast tuples we'll be looking at, and $E_p$ is the equation that the concept values on each tuple should satisfy. For example, for DLK, to capture the property of negation coherence, we could choose $I_p=\{\text{positive},\text{negative}\}$, $T_p=\{t^1,t^2,t^3\}$[^v2zxr32wns] where $t^1_{\text{positive}}= [2+2 \text{ is } 4.]$, $t^1_{\text{negative}}=[2+2\text{ is not }4.]$[^w7ykwdbsug], $t^2_{\text{positive}}= [\text{Dolphins are birds.}]$, $t^2_{\text{negative}}=[\text{Dolphins are not birds.}]$, $t^3_{\text{positive}}= [\text{Utilitarianism is incorrect.}]$, $t^3_{\text{negative}}= [\text{Utilitarianism is correct.}]$ and $E_p$ is $v_{\text{negative}}=1-v_{\text{positive}}$ (so with the plausibilities on the given data points plugged into the equation, it becomes $\text{plausibility}(t_{\text{negative}})=1-\text{plausibility}(t_{positive})$). In this framework, one can think of supervised probing as having one contrastive property $p_x\in \mathcal{P}$ per data point $x$ with its given label being $y=c(x)$, with $T_p=\{(x)\}$, and the equation $E_p$ just being $z=y$, where $z$ is the variable that $c(x)$ gets plugged into.[^4q1qsc4dn1u]
2.  For each property $p\in \mathcal{P}$, write down a corresponding loss $L_p$ capturing how closely the property is satisfied by given features. For example, for the property $p$ that a concept $c\in \mathcal{C}$ with $Y_c=[0,1]$ is far from being constant, we might pick a finite set of inputs $X'\subseteq X$ and let the corresponding loss be the negative sample variance of the feature on these inputs, i.e. $L_p=-\frac{1}{|X'|}\sum_{x\in X'}\left(f_c(x)-\frac{\sum_{x\in X'}f_c(x)}{|X'|}\right)^2$, where $f_c=e(c)$ is the candidate embedding of the concept $c$ in the set of features $\mathcal{F}$, as defined earlier. For a contrastive property $p$, one can let $L_p=\sum_{t\in T_p} \ell_p((f_c(t_i))_{(c,i)\in \mathcal{C}\times I_p})$, where $\ell_p\colon \left(\prod_{c\in \mathcal{C}}Y_c\right)^{I_p}\to \mathbb{R}$ captures how closely the values of the features $f_c$ satisfy the equation $E_p$ on the contrast tuple $t$. We can usually rewrite $E_p$ with $(f_c(t_i))_{(c,i)\in \mathcal{C}\times I_p}$ plugged in to have the form $0=[\text{expression in terms of the }f_c(t_i)\text{ for various }(c,i)\in \mathcal{C}\times I_p]$$=:r((f_c(t_i))_{(c,i)\in \mathcal{C}\times I_p})$[^ldixmirozop], and one can then let $\ell_p((f_c(t_i))_{(c,i)\in \mathcal{C}\times I_p})=\left(r((f_c(t_i))_{(c,i)\in \mathcal{C}\times I_p})\right)^2$.[^7026c0rpjeo] For example, for the property $p$ of negation coherence in DLK, one can rewrite $E_p$ as $0=1-z_{\text{positive}}-z_{\text{negative}}$, and the loss term corresponding to the contrast pair $(Q,\neg Q)$'s negation coherence is then $\ell_p(f_{\text{plausibility}}(Q),f_{\text{plausibility}}(\neg Q))=\left(1-f_{\text{plausibility}}(Q)-f_{\text{plausibility}}(\neg Q)\right)^2$.
3.  The final loss $\mathcal{L}$ will be a linear combination of the losses for each property with some hyperparameters $(\lambda_p)_{p\in \mathcal{P}}$ specifying the relative importance of each property, i.e. $\mathcal{L}=\sum_{p\in \mathcal{P}}\lambda_p L_p= \sum_{p\in \mathcal{P}_{\text{contrastive}}}\lambda_p \sum_{t\in T_p}\ell_p((f_c(t_i))_{(c,i)\in \mathcal{C}\times I_p}))+\sum_{p\in \mathcal{P}\setminus\mathcal{P}_{\text{contrastive}}} \lambda_p L_p$.
4.  Now, think about whether the most natural set of concepts having the properties you've written down is the set of concepts you're looking for. If you can think of something else that's more natural, or more generally if there's some plausible way a set of features that doesn't capture $\mathcal{C}$ could get low loss, then try adding properties (satisfied by $\mathcal{C}$) not satisfied by these other things.
5.  In practice, having to search over prefeatures instead of features, we might want to add a term to the loss that captures a requirement that the prefeature be simple, e.g. $L_1$ regularization on the coefficients of a linear regression. (The reason this is not already covered by the above is that all the previously considered properties are properties of the concepts translated to relations between the values of the features, whereas regularization is something that can look at inside a feature (at the parameters defining the feature), not just at its input-output behavior.)
6.  If it's difficult to think about how a certain concept $c$ could be represented in a model (for instance because it naturally lives in a space that does not neatly embed into $\mathbb{R}$, e.g. syntax trees) or difficult to write down relations involving $c$ directly, one can try to come up with other concepts that $c$ could be a function of, write down relations for those other concepts, search for features satisfying these inside a model as described above, and then recover $c$ from the values of these other concepts. For instance, this is what happens in "[A Structural Probe for Finding Syntax in Word Representations](https://aclanthology.org/N19-1419.pdf)" as described earlier in this post. [^eiejrvokplq][^xtwj7lnq2k8]

Examples
========

What follows is a list of examples stated in terms of the above framework. Some of the examples can be tried on current models with a reasonable chance of success (I think), some do not make sense for current models. I think some are directly relevant to alignment alone, some could be relevant to alignment by e.g. helping us locate parts of important circuits, and some are probably not relevant to alignment except as a proof of concept or for understanding models' representations better in general. Many of the examples are presented in table form in terms of the terminology introduced in the Formalism section above.

DLK
---

We've already covered most of DLK from the perspective of the framework above, but here's a concise summary:[^nnimfqqwxk]  
  
![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/26bbef2cfbe7a0a9405eb7fbbc5e6e444d331c31a4590d2f.png)

DLK – complete edition
----------------------

In the following, we will think of propositions/[sentences](https://en.wikipedia.org/wiki/Sentence_(mathematical_logic)) as coming from [propositional calculus](https://en.wikipedia.org/wiki/List_of_rules_of_inference#Rules_for_classical_sentential_calculus) or [first-order logic](https://en.wikipedia.org/wiki/List_of_rules_of_inference#Rules_of_classical_predicate_calculus). Instead of just looking for a feature that is coherent under negations, one could look for a feature that is coherent under all inference rules of the theory. By coherence, in the context of a given assignment of truth values in $\{0,1\}$ to all sentences in a given theory, I mean:

*   the existence of a [model](https://en.wikipedia.org/wiki/Interpretation_(logic)#First-order_logic)[^kqb2oem61f] for the theory in which the set of sentences which are satisfied is precisely the set of sentences to which the assignment gives truth value $1;$
*   or equivalently that negation coherence holds (meaning that for all sentences $\phi$, one of $\phi,\neg\phi$ gets assigned $0$ and the other gets assigned $1$), that there is no sentence $\varphi$ such that starting from the set of sentences assigned $1$ (and the axioms), there is a proof of $\varphi$ and also a proof of $\neg \varphi$;
*   or equivalently that negation coherence holds, that coherence under all inference rules of the theory holds (i.e. for every inference rule, whenever the premises of an inference rule are assigned $1$, so is the conclusion), and axioms of the theory are assigned 1.

The last one of these is just a thing we can check on a (finite) bunch of stuff given the assignment.[^7lm5wn026hf] There's some questions here about how to go from the discrete loss one would want to write down to the loss for truthiness taking continuous values in $[0,1]$ that one has to write down – in particular, it's unclear how to interpolate loss corresponding to failing to satisfy inference rules, e.g. modus ponens, to $[0,1]$. I can think of multiple options for this among which I am unsure how to choose in a principled way (except if we take truthiness to be probability, for which a principled choice is presented in the next subsection). Let's go with thinking of modus ponens as saying that at least one of $P, P\to Q,\neg Q$ is false, which suggests the equation $\min\left(\text{truthiness}(P),\text{truthiness}(P\to Q),1-\text{truthiness}( Q)\right)=0$, which we can turn into a term in the loss. With this choice, here's the table one gets for [this propositional logic](https://en.wikipedia.org/wiki/Propositional_calculus#Example_1._Simple_axiom_system) (where there's just one inference rule: modus ponens): ([pdf version](https://drive.google.com/file/d/1Fy8lQCAFvVP3yXhDeV16ufjp_r8G7jLH/view?usp=sharing))

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

In practice, we might have concerns about a language model's ability to understand the given input sentences, or about whether it understands them in the way this framework intends it to because of ambiguities in natural language; see the end of the next subsection for more on this. Because of these concerns, we might want to only take require coherence under a curated subset of inference rules, on a curated set of sentences – for instance, only ORs and ANDs of particular sentences of the form "The height of \[famous building $A$\] is between $x$ and $y$."

DLK – probabilistic complete edition
------------------------------------

A reasonable notion of coherence for a probability assignment to sentences is that there is a probability distribution of models for the theory which induces the given probability for the truth of every sentence. By Theorem 1 from [here](http://intelligence.org/files/DefinabilityTruthDraft.pdf), this is equivalent to the probability assignment having all of the following three properties: 

1.  $\mathbb{P}(\varphi)=\mathbb{P}(\varphi\land \psi)+\mathbb{P}(\varphi\land \neg\psi)$ for all sentences $\varphi,\psi$;
2.  For each tautology $\varphi$, $\mathbb{P}(\varphi)=1$;
3.  For each contradiction $\varphi$, $\mathbb{P}(\varphi)=0$.

 [^ht51jmfyxj5] This motivates the following table:

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

We might want to allow a theory which lets us create conditional environments, in which case I think just adding Bayes' rule to the above will again be equivalent to probabilistic coherence. One issue with this for language models is that the difference between \[conditional on a proposition $P$, claim\], \[$P$ and claim\], and \[$P$ implies claim\] is subtle in natural language. E.g. consider "Suppose that the present King of France is bald. Then, the present King of France has no hair." (In fact, it's [even more of a mess](https://plato.stanford.edu/entries/logic-conditionals/#Intr).) But of course, as the ambiguity goes both ways, this is also an issue for the schemas presented in the last two tables above! It would be great to better understand which of these interpretations language models run with. In the best case, there would be a separate feature that matches each.

An agent's estimate of the value of a state, from inside the policy network
---------------------------------------------------------------------------

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

Some notes:

*   One can subject the features found to a calibration test at the end. (Take a bucket of board states with "value" (according to the feature we found) in $[-0.2,-0.1]$, and check that the average value obtained from these is close to $-0.15$. $$
*   Maybe also throw in $L_1$ regularization like in "[Acquisition of Chess Knowledge in AlphaZero](https://arxiv.org/pdf/2111.09259.pdf)".
*   As a special case, this framework lets us capture the win probability in games where there is guaranteed to be a winner.
*   We can also add some supervised constraints to the loss from board states that are one ply from winning, or facing a guaranteed loss in two plies. (In fact, this could replace the variance term.)
*   One issue with this is that sending expected reward through any odd function $t\colon [-1,1]\to [-1,1]$ respecting the boundary condition at $1$ is going to still satisfy the constraints (or do even better if it extremizes). A completely analogous thing can be said about the original DLK constraints though, for functions which are antisymmetric around $\left(\frac{1}{2},\frac{1}{2}\right)$.

Is the model doing search?
--------------------------

One often does search over plans by considering a bunch of possible plans, evaluating their value, and then choosing the option with maximal value. (Though there are things reasonably called search that are not really [like](https://www.lesswrong.com/posts/FDjTgDcGPc7B98AES/searching-for-search-4#What_is_Search_) [this](https://www.lesswrong.com/posts/6mysMAqvo9giHC4iX/what-s-general-purpose-search-and-why-might-we-expect-to-see).) There is a constraint given by this process that gives us something to look for as an anchor to locate search in a model: the future value from the current situation is going to be the max of the values of the various options considered. In addition to e.g. helping us understand if a [model is doing optimization](https://www.lesswrong.com/s/r9tYkB2a8Fp4DN8yB), locating search in a model models could be useful because maybe that could help us [retarget it](https://www.lesswrong.com/posts/w4aeAFzSAguvqA5qu/how-to-go-from-interpretability-to-alignment-just-retarget). Here's a concrete experiment that could be run right now to look for search over possible next moves in an RL agent for CoinRun (written a bit less formally than previous examples):

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

A vision model's sense of direction
-----------------------------------

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

A few notes:

*   In practice, the integral in the loss can be approximated by sampling $\alpha,\beta$.
*   The model might have a representation of the direction of e.g. gravity w.r.t. the picture plane, which naturally lives in $S^2$, not $S^1$, and we might want to change the framing to look for that instead.
*   This generalizes to looking for other linear transformations. As other special cases, one could replace rotating the image by rescaling the horizontal direction by a constant, or by applying a shear.

Unsupervised syntax discovery
-----------------------------

Here's [Unsupervised Distillation of Syntactic Information](https://arxiv.org/pdf/2010.05265.pdf) [from Contextualized Word Representations](https://arxiv.org/pdf/2010.05265.pdf) stated in terms of this framework:

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

[^g937vr5y9zc] The paper goes on to check that the learned syntactic representations capture some syntactic properties better than the baseline. I think it would be a big win for linguistics if someone came up with an unsupervised method that reliably recovers the [syntax trees linguists believe in](https://en.wikipedia.org/wiki/Parse_tree) from language models.

Preferences
-----------

Let's say we have a model that can contemplate pairs of [lotteries](https://en.wikipedia.org/wiki/Lottery_(probability)), and we would like to find its preferences. We could look for a preference feature taking values in $[-1,1]$, where $-1$ intuitively corresponds to the first lottery being preferred, and $1$ corresponds to the second being preferred, by looking for a feature satisfying the [vNM axioms](https://en.wikipedia.org/wiki/Von_Neumann%E2%80%93Morgenstern_utility_theorem#The_axioms). Turn the completeness axiom into an equation saying that the preference for the pair $(A,B)$ and the preference on the pair $(M,L)$ should form $\{-1,1\}$ (this can be done analogously to what was done for negation coherence in the extended DLK subsection). Transitivity can be turned into an equation in analogy with modus ponens. For the Archimedean property, we can for instance have the loss term be $-\text{ReLU}(f(L,M))\text{ReLU}(f(M,N))\left(f((1-\varepsilon)L+\varepsilon N, M)+f(M,\varepsilon L+(1-\varepsilon) N)\right)$ for $\varepsilon=10^{-5}$ (this will sometimes be too big an $\varepsilon$, but hopefully rarely enough that it's fine)$$. And for independence, we can have the loss term be minus the product of the preferences on the two lotteries, $-f(L,M)f(pL+(1-p)N,pM+(1-p)N)$.

One issue here is that the comparing lotteries according to the expectation of any random variable will satisfy these properties. We might need to come up with a way to fine-tune/prompt the model such that preferences become more salient in its cognition.

Expected utilities
------------------

Alternatively, have the model contemplate lotteries, and look for a feature satisfying the property that utilities of composite lotteries should decompose:

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

In fact, for monetary lotteries, I think it would be reasonable to look for a direction capturing monetary expected value in e.g. GPT-4. Again, a big limitation is that these relations hold for the expectation of any random variable. For this to succeed, we might need to expose the model to specific situations/fine-tuning which cause utility to become very salient.

Conserved quantities in a physics simulator
-------------------------------------------

Take an ML model trained to do time evolution on a physics system, and look for whether it has learned the same conserved quantities (energy, momentum, angular momentum, charge) by writing down the constraint that a quantity should be preserved under time evolution but have variance across random world-states in general, look for a tuple of uncorrelated features inside the model satisfying these constraints, and see if what you get matches the familiar conserved quantities. (Should one generally expect to get linear combinations of these quantities instead of getting these quantities? In that case, do we at least get an invariant subspace of features which is spanned by the familiar quantities?) (Is there some cool connection with Noether's theorem here? I mean besides the fact that symmetries correspond to conservation laws – is there a way to use a symmetry of the Lagrangian to write down a constraint on a feature to search for the conserved quantity corresponding to that symmetry?)

Concepts we could find in the hyperoptimistic limit
---------------------------------------------------

In the hyperoptimistic limit, having robustly solved decision theory, we could write down the relations that beliefs and goals should satisfy – e.g. evidential expected utility maximization, or maybe some shard-theoretic understanding of how shards lead to actions – and just look for features which stand in these relations to each other, and hyperoptimistically actually just find the model's beliefs and goals. Or we could write down the constraints that correct epistemic reasoning should satisfy, and search for something satisfying these constraints to find a model's epistemics.

Limitations
===========

Two competing factors need to be balanced for this kind of search to have a chance of working:

1.  Specify too many relations, give too many labels, and you're in danger of assuming something about the model's conceptual framework which isn't true. Your search might fail because it's looking for something that doesn't exist inside the model.
2.  Specify too few relations, give too few labels, and you're going to be unlikely to find what you're looking for because of the search not being constrained enough. In other words, the search only has a chance of working if what you're looking for is roughly the most natural thing satisfying the relations you gave. The shape specified needs to capture what you're looking for, and it needs to be violated by anything else at least as natural for the model as the concept you're looking for.[^xamz9w6lids]

Further directions
==================

What I'd really like to say is that the relations one has to write down for a particular set of concepts are simply the result of mapping some sort of commutative diagram type thing from the "Platonic (coherence) category of concepts" that satisfies some unique property for this set of concepts into features, but I don't know how to do that. Even absent that, I think a category theorist would have written this post quite differently, and I'd be interested in seeing a category-theoretic version of this story.

I'd also be interested in ideas for pursuing the connection with model theory further, e.g. using it to inspire ways to look for representations of objects, functions, or predicates (perhaps corresponding to circuits?) in ML models.

We'd be very interested in other examples of concepts satisfying some simple relations which pin them down, especially those that are plausibly searchable in current models, useful to find in the AGI limit, or theoretically appealing[^9kty4wu6baf].

As for the next few weeks, the main experimental focus of our SERI MATS team remains on the directions outlined in [our previous post](https://www.lesswrong.com/posts/bFwigCDMC5ishLz7X/rfc-possible-ways-to-expand-on-discovering-latent-knowledge), as well as on figuring out ways to check [if we are measuring what we think are measuring](https://www.lesswrong.com/posts/9kNxhKWvixtKW5anS/you-are-not-measuring-what-you-think-you-are-measuring). However, we are planning to run a number of the experiments outlined above in the future. If you would be interested in running some of these experiments and would like to discuss further, feel free to email me at kaarelh AT gmail DOT com.

Acknowledgments
===============

This post was written by Kaarel Hänni on behalf of NotodAI Research, a team in John Wentworth's track in SERI MATS 3.0 consisting of Walter Laurito and Kay Kozaronek as the experimentalists, Georgios Kaklamanos as the distiller/facilitator, and me as the theorist, and on behalf of our research collaborators Alex Mennen and June Ku. I would like to thank Walter, Kay, and George for the great time I've had working with them on this project; John and SERI MATS for making this work possible; and Alex and June for contributing a large fraction of the ideas presented above. In addition to all the aforementioned people, I would like to thank Matt MacDermott, Jörn Stöhler, Daniel Filan, Peli Grietzer, Johannes C. Mayer, John Wentworth, Lucius Bushnaq, Collin Burns, Nora Belrose, Alexander Gietelink Oldenziel, and Marius Hobbhahn for discussions and feedback. I would particularly like to thank Alexandre Variengien for helpful conversations that greatly expanded my sense of what concepts that can be searched for in models, motivating much of the above work.

[^76nupl085dw]: This phrasing is taken from Burns's companion post. 

[^5vhs9kljr2f]: I share the authors' optimism about the approach extending to superhuman models. 

[^354vpdgdt]: I learned about Ramsification from this talk by June Ku. It's also the only presentation of Ramsification I know of which allows for error. 

[^uw0zlilzqcf]: Strictly speaking, we have switched from searching for a concept to searching for a model's representation of a concept. This is fine as long as one can recover the value of a concept if one has a model's representation of it (e.g. recover whether something has charge from whether a model thinks it has charge), which is generally not hard (conditional on having located the concept's representation in the model), because we can then lift the relation on the concepts to a relation on the representations. If this still worries you, I invite you to check if the formalism section assuages your concerns.  

[^5ckvuymnq05]: It's also possible to train against this interpretability tool, though that seems dangerous for the usual reasons. Maybe it's fine if we're clever about it? 

[^7lgwst1o7ly]: Here's another philosophical framing of DLK. DLK is looking for something inside a model that just fits together as required by the coherence theory of truth, and it seems somewhat promising that this alone indeed finds the model's beliefs! In this framing, adding in some examples with labels, e.g. "2+2=4" being true, would be like inserting some constraints coming from the correspondence theory of truth as well. 

[^uyi71v8rmeb]: The approach is also very similar to the syntactic part of June Ku's MetaEthical.AI framework, except with the part applying to brains applied to models instead. See item 1.2 here and also see this.  

[^fxao7kzczk]: times a constant scaling plus a constant shift, so really a linear functional 

[^wai246vix3]: Saying that a direction in activation space is a feature is an abuse of language (at least in the framing presented here), but I think it's a common one. 

[^hu7f3rhziku]: at least one that is small enough to naively search over (i.e. just loop over); we might be able to come up with huge discrete sets like this, but optimizing over those is tricky 

[^rw4wxwxjyva]: I think the reason for this is some combination of considerations about computational efficiency, reducing the dimensionality of the search space, and getting a better inductive bias (if we have reason to believe that some concept is more likely to be represented in a certain location in the model). 

[^qesy4gyfxlq]: Ok, this is not quite true, because they are actually performing a normalization of the activations first to get rid of a different solution that satisfies the right constraints. 

[^jl72t5cxss]: Each of these only has a chance of being represented as a concept in a respective particular kind of (current) model 

[^49tziiafr1x]: I'm not really sure if I've sufficiently captured all there is to concepts with this type signature. For example, take the concept [planet]. Is it fair to just identify the concept with something like the set of inputs to my world model for which the concept gets activated? One thing that this might be missing is that my concept of [planet] should stand in some relations to lots of other concepts like [star] and [gravity]. And maybe we want the features we find to actually stand in this relation in the model's computation? I guess that since we will be looking at when [planet] gets activated together with when a bunch of other concepts get activated, maybe this is fine – we can even recover causation from data using Pearl's work. And also, even if we find accurate representations of concepts which are not causally effective, e.g. because the concept is represented in various activations and one would need to alter most of them, we might be content with being able to interpret a model without being able to edit the model directly 

[^9k2dt5ghw49]: For us to have hope of finding a concept, it should probably be something like a natural abstraction. 

[^m777b4hri0p]: Okay, this is not quite most general, because (especially when having to deal with prefeatures instead of features) we might want to also add some terms that depend on the parameters of the prefeatures considered (e.g. \(L_1\)regularization of coefficients for linear features) to select for ones which are more natural. 

[^irnohvzdx3]: A technicality: for this to make sense, \(f_c\) should be picked from only among features with the right type signature, i.e. with \(Y_c \cong Y_{f_c}\). And if there are multiple ways in which \(Y_c\) and \(Y_{f_c}\) are isomorphic, then the embedding \(e\) should technically also carry data specifying this isomorphism. Or more generally, one should specify maps of both \(Y_c\) and \(Y_{f_c}\) into the same space \(Y_c'\), and \(Y_c'\) should replace \(Y_c\) in the type signature of the loss function. 

[^3v0r19x7en7]: I couldn't find anyone talking about the "residual stream" of BERT on the interwebs, so to clarify, what I mean are just "the contextualized representations in hidden layer \(L\)" of BERT. 

[^pgyh52hus2]: You might be worried about the representations don't directly correspond to words because BERT's tokenizer might not just consider each word an individual token. I invite you to forget this and to assume the tokenizer respects words for this example. But I believe what really happens is that (1) the units that go in the dependency trees are Penn Treebank tokens which are often words but sometimes subwords (if a word consists of multiple syntactic units, e.g. "rais-ing"), and (2) representations of BERT's tokens overlapping with each Penn Treebank token are averaged to create a representation of the Treebank token. (I'm not sure if BERT's tokens always correspond to subwords of the subwords corresponding to Penn Treebank tokens or not, and I'm not sure if they use the length of overlap as a weight in the average.) 

[^gdlvyystyym]: The total training loss is then the linear combination of such terms from many sentences with known dependency trees. 

[^3f5twghc5lm]: I would love to say that the properties are obtained by evoking some universal property to construct a diagram in some sort of platonic category of concepts, and then mapping this diagram down into the shadow realm with some concept projection/realization functor, but alas, all I can see are shadows.  

[^nj54mxvkrs]: The paper calls this consistency, but I'll want to also talk about other kinds of consistency/coherence later, so this is not the best name here. 

[^v2zxr32wns]: I'm using upper indices for different tuples here to keep the indices manageable. 

[^w7ykwdbsug]: I'll be sometimes abusing notation slightly by just saying e.g. \(t^1=\left([2+2 \text{ is } 4.], [2+2\text{ is not }4.]\right)\), in case the indices are clear. 

[^4q1qsc4dn1u]: A different way to accommodate supervised or semi-supervised probing would be to say that supervised probing is when we turn the equation \(E_p\) into one that can depend on the values of the concepts on the particular contrast tuple \(t\). But it really does seem right to me to consider matching each label as a conceptually independent property that the probe should satisfy. Intuitively, if one can capture a concept using unsupervised probing with only a few properties, then it only takes a short description, i.e. a small number of bits of information, to pin down the concept starting from the prior distribution induced by the model's learned representations, meaning it must be a really natural concept for the model! Whereas simply being recoverable with a probe that needs many labeled data points is a much weaker kind of naturalness – one needs to give a lot more data to the probing process to find what one's after. (That said, it's possible that only a small number of labels would also pin some concept down.) So I think that with this convention for supervised probing, the number of properties \(|\mathcal{P}|\) is a good way to capture the message lenght here. What's more, I think it's reasonable to think of there being a spectrum between unsupervised and supervised probing parametrized by \(|\mathcal{P}|\). In this framing, the motivating idea behind unsupervised probing for concepts is that certain concepts are naturally used in the mental framework of humans and models, and we can find their values by specifying just a small number of bits of information about them. 

[^ldixmirozop]: We could have just said that equations are of the form \([0=r(v)]\) with \(r\colon \left(\prod_{c\in \mathcal{C}}Y_c\right)^{I_p}  \to\mathbb{R}\) by definition when we first introduced \(E_p\), but I think this might have been more confusing, and that it could be good to keep the form of \(E_p\) a bit more open to allow more stuff, e.g. see the example with learning syntax later. 

[^7026c0rpjeo]: But it might also occasionally be neater to go with some different loss term, e.g. \(r\) might be such that it's guaranteed that \(r\geq 0\) for any inputs, in which case it could make sense to just put \(r\) in the loss (instead of \(r^2\)). 

[^eiejrvokplq]: I believe one could shoehorn this example (as well as other similar cases, probably) into the framework above by adding prefeatures that are minimum spanning trees of the distance graph of linear function outputs and adding a really big term to the loss for the syntax tree concept being equal to the MSP one would construct from these syntactic representation vectors of words. But while the framework above can be thought to already capture that, it's clearly conceptually neater to think of the syntax tree as just being a predetermined function of other concepts. 

[^xtwj7lnq2k8]: You might notice that this form is technically no less general than what we started from because one could technically fit all inputs in one contrast tuple. But it definitely feels more fleshed-out to me. Think of it as a form with an attitude. 

[^nnimfqqwxk]: It currently seems more theoretically natural to me to either replace negation coherence with a second confidence term, \(\max(\text{plausibility}(Q),\text{plausibility}(\neg Q))=1\), or to keep negation coherence and to replace the confidence equation with \(\text{plausibility}(Q)(1-\text{plausibility}(Q))=0\) (this would apply to all propositions, including \(\neg Q\)). (I haven't tried if either of these makes any difference in practice.)  

[^kqb2oem61f]: I mean "model" in the sense of model theory – there's going to be an unfortunate conflict with "model" in the sense of ML. 

[^7lm5wn026hf]: I am not saying that one can check that no contradiction is generated by some finite set – this is undecidable – just that the conditions stated above can be mechanically checked on some finite number of tuples on which they apply. 

[^ht51jmfyxj5]: This also implies that in the special case where all probabilities assigned are \(0\) or \(1\), as long as these three things are satisfied, there is a model of the theory with the assigned truth-values. 

[^g937vr5y9zc]: The contextualized representation of a word which is used is the mean of its reps across all layers concatenated with the representation at layer 16. (Or really, the representation of the first token in the word.) 

[^xamz9w6lids]: In fact, the DLK paper runs into this issue. The framing of it above is not actually quite what's done in the paper. Really, instead of \((P,\neg P)\), the contrast pairs in the paper are more like \((\text{"Is Paris the capital of France? A: Yes"}, \text{"Is Paris the capital of France? A: No"})\), and a really salient feature satisfying both DLK constraints for such pairs is just whether the phrase ends with "Yes" or "No". To fix this, the paper subtracts the average of the activation vectors of all phrases ending with "Yes" from each activation vector of a phrase ending with "Yes" before doing the search for a feature satisfying the constraints. I think this roughly makes sense given the picture of features as directions and the law of large numbers.  

[^9kty4wu6baf]: for example, ones that would help us gauge if ML models have developed the same understanding of syntax as human linguists believe humans have