
Why you should try RAG before Finetuning a LLM?
Last Updated on February 19, 2025 by Editorial Team
Author(s): Stefan Silver
Originally published on Towards AI.
This member-only story is on us. Upgrade to access all of Medium.
While many use cases that can be solved using LLMs like ChatGPT donβt need any extra information to be added, some require additional knowledge that the LLM has never seen before. In those cases you have to make a choice β do you use Finetuning to add that knowledge, or do you try using Retrieval Augmented Generation (RAG)?
In this article, I will make the case for why you should always try RAG before you try to embark on the Finetuning process.
Retrieval Augmented Generation or RAG for short is just a way for an LLM to extract pieces of information (called chunks, which can have various sizes) that are relevant to the prompt you wrote, out of a database or a link you give it access to. You can refer to the image below to see the exact process in which this happens.
Only pieces of information that are relevant to the question (prompt) you asked the LLM will be extracted. Anything else will be ignored.
This happens by using various algorithm that looks for semantic similarity between the words you wrote in… Read the full blog for free on Medium.
Join thousands of data leaders on the AI newsletter. Join over 80,000 subscribers and keep up to date with the latest developments in AI. From research to projects and ideas. If you are building an AI startup, an AI-related product, or a service, we invite you to consider becoming aΒ sponsor.
Published via Towards AI