RAG vs Fine Tuneing

 


Hello Learners,

Today we will have a little chat about RAG vs Fine Tuning.
I would like to start by giving credit to AI Jason for this awesome video, as he goes through his processes of customizing the Llama3 model for his use case. 

I will do my best to give you synopsis of my take away from that awesome and informative video. He goes through his whole RAG pipeline and the tools he uses to unify the data to make it easier to index and parse through, I would highly recommend watching it.
Lets dive in.



RAG.

It is short for Retrieval Augmented Generation.
The way this works is that you give the LLM access to your personal documents, or knowledge base, and when you ask it a questions, it would go there to find your answers.

A simple example:
You are working on a niche research project, and you have lots of documents to work from.
You need to find a specific piece of information, but you don’t know in which document its in.

With a RAG-ed system, you can ask your local model to find it, it will go through all those documents and retrieve it for you.
Its kind of a personalized Search Engine in a way, which is still pretty cool. Especially if your working with confidential and unique set of information.



Fine Tuning.

This one is also an option, but a bit more involved.
With Fine Tuning, you will be directly modifying the model.
This will involve finding datasets for your specific case.
Possibly re-training the model on your custom datasets.
Maybe even adjusting some of the model’s parameters.
This way, that model is now super hyper specific to what it is that you need it to do.



In short.

With RAG:
You are USING the model to help your cause.

With Fine Tuning:
You are MODIFYING the actual model to help your cause.



Which is better?

Well, that depends.
They both have their place in digital world. I see “Fine Tuning” applicable in places like research and science labs, and I see a “RAG” system in a more public atmosphere. If your a teacher, independent researcher, heck even a small company, I can see RAG being a better option, simply because it will take less time and energy to get you up and running.

Don’t get me wrong, a good RAG system can get complex, especially if your working with different kinds of data, so setting up a good RAG pipeline to unify the data (as AI Jason mentioned in his video) can help make your life easier.


See you in the next post learners.
Thanks for reading.
Ash Noor.
www.AshNoor.me