Fine-tune For Better RAG

updated on 05 February 2024

To fine-tune or to conduct retrieval-augmented generation (RAG)? That is the question. Well, why not both? Instead of debating which method is better, we are going to be talking the paper "Unlocking the Power of Large Language Models In Search with Instruction Tuning." Welcome back to Silatus weekly, and lets start taking notes!

image-jc8mi

If you are a Silatus Scholar, you probably know what RAG and fine-tuning mean. But for those who skip class, here are the lectures on fine-tuning and RAG. On Linkedln, Facebook, and Reddit, there is a debate about whether RAG is better than fine-tuning or the other way around. Well, both methods have advantages and disadvantages. If companies want their models to acquire new skills, align with company values, or sound like Arnold Schwarzenegger, then fine-tuning is suitable. However, fine-tuning requires a lot of VRAM, which can cost hundreds to thousands of dollars. On the other side, RAG is ideal when companies want quick answers from their data bases. RAG acts is the pipeline between LLMs and external data. If you want to read more about RAG. You can check out our blog our latest TextReRank system. Although RAG is great for document augmentation, it's a fairly new concept. LLMs are not designed to answer document retrival questions. Well, it's look like that problem is being solved now!

image-pu5l6

The paper "INTERS: Unlocking the Power of Large Language Models in Search with Instruction Tuning" focuses on enhancing Large Language Models (LLMs) for search tasks using a novel dataset, INTERS. The researchers fine-tuned their open-sourced LLM on a variety of tasks that were used during the RAG Process. The models in the study used were, Falcon-REW-1B, Minima-2-3B, Mistral-7B, and LLaMA-2-7B. As for training, the researchers took advantage of the multiply gpus using Deepspeed, ZeRO stage 2. Furthermore, to save on VRAM the researchers implemented the GPU-Poor staple, FlashAttenion-2. The training deemed to be a success. The fine-tuned models out performed the model on RAG task.

image-nun7q
image-y05y9

In conclusion, the ongoing debate between fine-tuning and RAG highlights the different advantages and considerations associated with each method. Fine-tuning allows for model customization and skill acquisition, but it can be resource-intensive in terms of VRAM and cost. On the other hand, RAG offers quick access to information from external data sources, making it suitable for efficient document retrieval. However, as a relatively new concept, RAG still faces challenges in terms of optimizing language models for search tasks. The paper "INTERS: Unlocking the Power of Large Language Models in Search with Instruction Tuning" demonstrates the potential of enhancing LLMs for search tasks through fine-tuning, showcasing promising results. As research and development in this field continue, it is likely that both fine-tuning and RAG will evolve and find their respective roles in addressing different needs and requirements in the realm of AI-powered search and information retrieval.

Read more