How to use Instruct Embeddings Correctly
ππ»ββοΈHey there folks,
I π noticed that a lot of people are liking and hyping instruct embeddings, but what's the point , and how to use them correctly?
The Story So Far
Basically you can have a text and embed it, then query it in a RAG application... but you'll never really know what kind of question a user will ask , what topic it will be or what type of question it is (multihop , contrary, validation, etc.)
What's more is you can make a RAG app where folks upload their documents but you'll never know what type of document it is. For example : is it a medical research paper , a mlmathematics paper, or a news article, a wikipedia page, or a legal text in a foreign language
so what do you do?
well, normally you use the same embeddings model regardless of the content of the document or the type of question.
this is psychotic
if you're using a single text , you might as well use a specialized embedding, and train your audience to only ask relevant questions. But you cant always do that !
What You DONT Want To Be Doing in RAG
when you make a RAG application , what you're really trying to do is create the most appropriate embeddings for each document.
- you dont want to use the same embeddings for law and for engineering
- you dont want to use the same embeddings for questions about math or news questions
- you dont want to use the same embeddings for questions to confirm , deny , or multihop about a topic
that's because you want the best results , so if you're looking at diverse data or have a public facing application, you have to capture this diversity somehow.
The Problem With Public Facing Applications
When you make a public facing document loader or RAG application , you'll face several common issues :
- it's impossible to predict what kind of text the user will upload.
- it's impossible to predict what kind of question the user will ask.
- a single specialized embedding model can't capture all this diversity.
What You DO WANT To Be Doing in RAG
When you're making a public-facing RAG application you'll naturally want to :
- Capture all the diversity of all the types of questions people are asking
- Capture all the diversity of all the types of documents and text are asking about with specialized embeddings
By doing this , you increase performance and usability based on context