Binary encoding as a simple explicit construction for superposition
post by tailcalled · 2024-10-12T21:18:31.731Z · LW · GW · 0 commentsContents
No comments
Superposition is the possibility of storing more than features in an -dimensional vector, by letting the features be slightly correlated with each other. It turns out that one can store exponentially many features in a given vector. The ability to store that many features in a single vector space is sometimes explained using the Johnson–Lindenstrauss lemma, but the lemma seems counterintuitive, so I came up with an alternative approach that I found simpler:
Suppose you have a set with elements and you want to embed it in a -dimensional vector space. We label each element with integers such that . You can write each integer as a string of bits, . To improve symmetry, we translate a bit from being or to being or by taking . Join all the digits into a vector and normalize to get the embedding:
That is, we map each bit to a separate dimension, with a bit mapping to a positive value and a bit mapping to a negative value, and scale the embedding by to keep the embedding vector of unit length.
If we pick two random elements and of , then an elementary argument shows that their dot product is well-approximated as following a normal distribution .
In some ways this isn't quite as perfect as the Johnson-Lindenstrauss lemma since you could in principle be unlucky and get two elements that accidentally have a high similarity. After all, for a given element , there will be elements whose numbers merely differ from by a bitflip. However, it is straightforward to reduce the noise: just concatenate multiple embeddings based on different labels. If instead of using dimensions, you use dimensions, then you can pump down the noise to .
0 comments
Comments sorted by top scores.