I do not think that word means what *I* think it means.
For a deep dive, I highly recommend Vicki Boykis's free materials:
Thank you for the additional resource!
Also - despite the fact that language model embedding [1] are currently the hot rage, good old embedding models are more than good enough for most tasks.
With just a bit of tuning, they're generally as good at many sentence embedding tasks [2], and with good libraries [3] you're getting something like 400k sentence/sec on laptop CPU versus ~4k-15k sentences/sec on a v100 for LM embeddings.
When you should use language model embeddings:
- Multilingual tasks. While some embedding models are multilingual aligned (eg. MUSE [4]), you still need to route the sentence to the correct embedding model file (you need something like langdetect). It's also cumbersome, with one 400mb file per language.
For LM embedding models, many are multilingual aligned right away.
- Tasks that are very context specific or require fine-tuning. For instance, if you're making a RAG system for medical documents, the embedding space is best when it creates larger deviations for the difference between seemingly-related medical words.
This means models with more embedding dimensions, and heavily favors LM models over classic embedding models.
1. sbert.net
2. https://collaborate.princeton.edu/en/publications/a-simple-b...
> Tasks that are very context specific or require fine-tuning. For instance, if you're making a RAG system for medical documents, the embedding space is best when it creates larger deviations for the difference between seemingly-related medical words.
(sorry I'm very new to ML stuff :))
Foundational models (GPT-4, Llama 3 etc) effectively compress “some” human knowledge into its neural network weights so that it can generate outputs from inputs.
However, obviously it can’t compress ALL human knowledge for obvious time and cost reasons, but also on the basis that not all knowledge is publicly available (it’s either personal information such as your medical records or otherwise proprietary).
So we build Retrieval Augmented Gen AI, where we retrieve additional knowledge that the model wouldn’t know about to help answer the query.
We found early on the LLMs are very effective at in-context learning (look at 1-shot, few-shot learning) and so if you can include the right reference material and/or private information, the foundational models can demonstrate that they’ve “learnt” something and answer far more effectively.
The challenge is how do you the right content to pass to the foundational model? One very effective way is to use vector search, which basically means:
Pass your query to an embedding model, get a vector back. Then use that vector to perform a cosine-similarity search on all of the private data you have, that you’ve previously also generated an embedding vector for.
The closest vectors are likely to be the most similar (and relevant) if the embedding model is able to generate very different vectors for sources that superficially, seemingly related topics but are actually very very different.
A good embedding model returns very different vectors for “University” and “Universe” but similar for “University” and “College”
You can think of the word embedding as a weighted average of embeddings of words which co-occur with the initial word.
So it's a bit of a blurry meaning.
Is "bark" related to a dog? Or to a tree?
Well, a bit of both, really. The embedding doesn't care about the context of the word - once it's been trained.
So if you search for related documents based on word embeddings of your query - it can happen that you miss the mark. The embeddings simply don't encode the semantics you need.
In fact, this can happen even with contextual embeddings, when you look for something specific or in a specialized domain. With word embeddings it's just much more apparent.
The Illustrated Word2vec - https://news.ycombinator.com/item?id=19498356 - March 2019 (37 comments)