# Polysemanticity and Capacity in Neural Networks

Elhage et al at Anthropic recently published a paper, [Toy Models of Superposition](https://transformer-circuits.pub/2022/toy_model/index.html) (previous Alignment Forum discussion [here](https://www.alignmentforum.org/posts/CTh74TaWgvRiXnkS6/toy-models-of-superposition)) exploring the observation that in some cases, trained neural nets represent more features than they “have space for”--instead of choosing one feature per direction available in their embedding space, they choose more features than directions and then accept the cost of “interference”, where these features bleed over into each other. (See [the SoLU paper](https://transformer-circuits.pub/2022/solu/index.html#section-3-4) for more on the Anthropic interpretability team’s take on this.)

We (Kshitij Sachan, Adam Scherlis, Adam Jermyn, Joe Benton, Jacob Steinhardt, and I) recently uploaded an Arxiv paper, [Polysemanticity and Capacity in Neural Networks](https://arxiv.org/abs/2210.01892), building on that research. In this post, we’ll summarize the key idea of the paper.

We analyze this phenomenon by thinking about the model’s training as a constrained optimization process, where the model has a fixed total amount of capacity that can be allocated to different features, such that each feature can be ignored, purely represented (taking up one unit of capacity), or impurely represented (taking up some amount of capacity between zero and one units).  
 

![](https://lh5.googleusercontent.com/Zv_DkTQts5RWpMOYbxz1B8lOtb3XzTIEhgn1tysuHZLvnZ0LGr-C5-qLxMAEnTebBLPcN499h9F5-Ioy-cqKvgoubY7A-g3aGMqQVeQcrBI9z6f4jY2tIYPic5v-hNN-T9evshY3e7RXtvK5gqArBqWslX18g1DxsGhvoh-n9DJKo7x_tI2FzlHrBQ)

When the model purely represents a feature, that feature gets its own full dimension in embedding space, and so can be represented monosemantically; impurely represented features share space with other features, and so the dimensions they’re represented in are polysemantic.

For each feature, we can plot the marginal benefit of investing more capacity into representing that feature, as a function of how much it’s currently represented. Here we plot six cases, where one feature’s marginal benefit curve is represented in blue and the other in black.  
 

![](https://lh4.googleusercontent.com/6OSJ3v6YKNxDcd61N9OieucstStRFH0DtU0-Mvg5q32Oy70d0zPtiY2CnQ8wiIE3VFVf4D7knltkIEpIBMzrkWyHsoDlpRYVNBoK75PMUNEMIr_hCPIZDQpwNIhoV4OuUYnbtH3D7KMn-6syONLOmjzhL7bS2C3cBFwSlVZ-5ebP-5qfue_N54DM7w)

These graphs show a variety of different possible marginal benefit curves. In A and B, the marginal returns are increasing–the more you allocate capacity to a feature, the more strongly you want to allocate more capacity to it. In C, the marginal returns are constant (and in this graph they happen to be equal for the two features, but there’s no reason why constant marginal returns imply equal returns in general). And then in D, E, and F, there are diminishing marginal returns.

Now, we can make the observation that, like in any budget allocation problem, if capacities are allocated optimally, the marginal returns for allocating capacity to any feature *must be equal* (if the feature isn’t already maximally or minimally represented). Otherwise, we’d want to take capacity away from features with lower dL~i~/dC~i~ and give it to features with higher dL~i~/dC~i~ .

In the case where we have many features with diminishing marginal returns, capacity will in general be allocated like this:  
 

![](https://lh3.googleusercontent.com/A7qUljG32XeWOH5fxLv2RTEs0a-ghQZQguQeTSGEGeMY9BUzQQH-ibDVxbRsT9WDLmuMphdEFdjWrdAEGdaGPdEv-z8soUBO1kP2U4rtnq72BklLQ-ODYbGbQ7JIIYfJXWZZzc_2yd2-PnfovOFU90eUIdSiSfCOp7Ul_reMJnA78lqTUYUBYqshmg)

  
Here the circles represent the optimal capacity allocation for a particular total capacity.

This perspective suggests that polysemanticity will arise when there are diminishing marginal returns to capacity allocated to particular features (as well as in some other situations that we think are less representative of what goes on in networks).

In our paper, we do the following:

*   We describe a particularly analytically tractable model which exhibits polysemanticity. 
*   We analyze our model using the capacity framework, derive the above graphs, and replicate them numerically.
*   Elhage et al empirically observe that increasing the sparsity increases superposition. We analytically ground this observation by decomposing our toy model’s loss into two terms that directly correspond to the benefits and costs of superposition. As the input data becomes sparser, the kurtosis increases, and as the kurtosis increases the loss more heavily favors superposition.
*   We explain the phase transitions observed in our model, which look similar to the phase transitions observed in Elhage et al–the sharp lines are because the capacities eventually hit 0 or 1, and at low sparsity you never see features represented impurely because the marginal returns curves don’t have diminishing returns. We can use this understanding to analytically derive the phase diagram:

![](https://lh3.googleusercontent.com/Eg-SMyw-Q55pRWOPzm3qp_6kbVv0Co-Zt9I2diea9F30A4wZBP6Z55ncdhsieM_FuBpEKb7L2Kg9I8D_fUIR-qM6YWUx8L8vlrcrI09AppTrKgnS9vhoZbhqq32GjJw6nkMR9E5bhhwpR1VFFJK3-gmoR_WyaIdXYn9HNY3XRWfxAh8hV-zHb_Zj4Q)

*   Lastly, in Elhage et al’s toy model, features were often partitioned into small distinct subspaces; we explore this as a consequence of optimal allocation of capacity: we find a block-semi-orthogonal structure, with differing block sizes in different models.

How important or useful is this? We’re not sure. For Redwood this feels like more of a side-project than a core research project. Some thoughts on the value of this work:

*   We suspect that the capacity framework is getting at some important aspects of what’s going on in the training process for real neural networks, though probably the story in large models is probably substantially messier.
*   We think that our results are helpful additions to the story laid out in Elhage et al.
*   We think it’s nice to have some extremely simple examples where we understand polysemanticity very well. E.g. We’ve found it helpful to use our toy model as a testcase when developing interpretability techniques that should work in the presence of polysemantic neurons.