7 ms·
It really surprises me that embeddings seem to be one of the least discussed parts of the LLM stack. Intuitively you would think that they would have enormous i
by zmmmmm 1y ago
It really surprises me that embeddings seem to be one of the least discussed parts of the LLM stack. Intuitively you would think that they would have enormous influence over the network's ability to infer semantic connections. But it doesn't seem that people talk about it too much.
- KasianFranks 1y agoAgreed. Vector embeddings along with which distance calculations you choose.
- gbacon 1y agoTend to avoid Euclidean distance.
- crystal_revenge 1y agoWhen the vectors are normalized to unit length cosine similarity and Euclidean distance are equivalent. This an optimization that many vector dbs use in retrieval since it is typically much faster to compute Euclidean distance rather than cosine.
- elite_barnacle 1y agoabsolutely. the first time i learned more deeply about embeddings i was like "whoa... at least a third of the magic of LLMs comes from embeddings". Understanding that words were already semantically arranged in such a useful pattern demystified LLMs a little bit for me. they're still wonderous, but it feels like the curtain has been rolled back a tiny bit for me
- ttul 1y agoThe weird thing about high-dimensional spaces is that most values are orthogonal to each other and most are also very far apart. It’s remarkable that you can still cluster concepts using dimension-reduction techniques when there are 50,000 dimensions to play with.
- gbacon 1y agoCosine similarity is your friend.
- nsingh2 1y agoCosine similarity is the dot product of vectors that have been normalized to lie on the unit sphere. Normalization doesn't alter orthogonality, nor does it change the fact that most high‑dimensional vectors are (nearly) orthogonal.
- samrus 1y agoMaybe cosine similarity isnt the sulver bullet, but going back to the point: why dont LLM embedding spaces suffer from the curse of dimensionality?
- namibj 1y agoThey do. It's just that for two vectors to be orthogonal it's the case as soon as they're orthogonal when projected down to any subspace; the latter means that if for example one coordinate is all they differ on, and it's inverse in that value between the two vectors, then these two vectors _are already orthogonal._ In d dimensions you can have d vectors that are mutually orthogonal. Interestingly this means that for sequence lengths up to d, you can have precise positional targeting attention. As soon as you go to longer sequences that's no longer universally possible.
- roadside_picnic 1y agoIt would be weird if the points in the embedding space where uniformly distributed but they're not. The entire role of the model in general is to project those results on to a subset of the larger space, that "makes sense" for the problem. Ultimately the projection becomes one in which the latent categories we're trying to predict (class, token, etc) become linearly separable.
- mbowcut2 1y agoThe problem with embeddings is that they're basically inscrutable to anything but the model itself. It's true that they must encode the semantic meaning of the input sequence, but the learning process compresses it to the point that only the model's learned decoder head knows what to do with it. Anthropic's developed interpretable internal features for Sonnet 3 [1], but from what I understand that requires somewhat expensive parallel training of a network whose sole purpose is attempt to disentangle LLM hidden layer activations. [1] https://transformer-circuits.pub/2024/scaling-monosemanticity/ https://transformer-circuits.pub/2024/scaling-monosemanticit...
- samrus 1y agoI mean thats true for all DL layers, but we talk about convolutions and stuff often enough. Embedding are relatively new but theres not alot of discussion as to how crazy they are, especially given that they are the real star of the LLM, with transformers being a close second imo
- TZubiri 1y agoCan't you decode the embeddings to tokens for debugging?
- freeone3000 1y agoYou can but this is lossy (as it drops context; it’s a dimensionality reduction from 512 or 1024 to a few bytes) and non-reconvertible.
- gbacon 1y agoI found decent results using multiclass spectral clustering to query embedding spaces. https://ieeexplore.ieee.org/document/10500152 https://ieeexplore.ieee.org/document/10500152 https://ieeexplore.ieee.org/document/10971523 https://ieeexplore.ieee.org/document/10971523
- visarga 1y agoYou can search the closest matching words or expressions in a dictionary. It is trivial to understand where an embedding points to.
- calibas 1y agoIt also seems odd to me. The embeddings are a kind of "Rosetta Stone" that allows a computer to quantify human language. They should be a really big deal! Though I can see why trying to comprehend a 1,000-dimensional vector space might be intimidating.
- stevenhuang 1y agoNot sure what you're on about. Embeddings have been talked about here at length since day 1 especially with RAG applications and vector dbs
- roadside_picnic 1y agoI had the same reaction to this comment. At least in my experience in this area, embeddings are heavily discussed and used. At this point, for most traditional NLP tasks involving a vector representation of a text, LLM embeddings are generally a good place to start.