RAG vs Fine-tuning: Pipelines, Tradeoffs, and a Case Study on Agriculture
Authors: Aman Gupta, Anup Shirgaonkar, Angels de Luis Balaguer, Bruno Silva, Daniel Holstein, Dawei Li, Jennifer Marsman, Leonardo O. Nunes, Mahsa Rouzbahman, Morris Sharp, Nick Mecklenburg, Rafael Padilha, Ranveer Chandra, Renato Luiz de Freitas Cunha, Roberto de M. Estevão Filho, Ryan Tsang, Sara Malvar, Swati Sharma, Todd Hendry, Vijay Aski, Vijetha Vijayendran, Vinamra Benara
AI-generated Key Points
- The paper explores two approaches for incorporating proprietary and domain-specific data into applications of Large Language Models (LLMs): Retrieval-Augmented Generation (RAG) and Fine-Tuning.
- RAG involves augmenting the prompt with external data, while Fine-Tuning incorporates additional knowledge directly into the model.
- The authors propose a pipeline that combines fine-tuning and RAG techniques for multiple popular LLMs, including Llama2-13B, GPT-3.5, and GPT-4.
- The pipeline consists of stages such as extracting information from PDFs, generating questions and answers, using them for fine-tuning, and leveraging GPT-4 to evaluate the results.
- Metrics are introduced to assess the performance of different stages in the RAG and fine-tuning pipeline.
- An in-depth study on an agricultural dataset demonstrates how these techniques can be applied to provide location-specific insights to farmers.
- Results show that the proposed dataset generation pipeline effectively captures geographic-specific knowledge.
- Using both RAG and fine-tuning together leads to increased accuracy compared to using either approach alone.
- A specific experiment shows that the fine-tuned model leverages information from various geographies to answer specific questions more accurately.
- The research showcases how systems built using LLMs can incorporate industry-specific knowledge across critical dimensions.
- The findings open up possibilities for further applications of LLMs in other industrial domains where AI has not seen much penetration yet.
Abstract: There are two common ways in which developers are incorporating proprietary and domain-specific data when building applications of Large Language Models (LLMs): Retrieval-Augmented Generation (RAG) and Fine-Tuning. RAG augments the prompt with the external data, while fine-Tuning incorporates the additional knowledge into the model itself. However, the pros and cons of both approaches are not well understood. In this paper, we propose a pipeline for fine-tuning and RAG, and present the tradeoffs of both for multiple popular LLMs, including Llama2-13B, GPT-3.5, and GPT-4. Our pipeline consists of multiple stages, including extracting information from PDFs, generating questions and answers, using them for fine-tuning, and leveraging GPT-4 for evaluating the results. We propose metrics to assess the performance of different stages of the RAG and fine-Tuning pipeline. We conduct an in-depth study on an agricultural dataset. Agriculture as an industry has not seen much penetration of AI, and we study a potentially disruptive application - what if we could provide location-specific insights to a farmer? Our results show the effectiveness of our dataset generation pipeline in capturing geographic-specific knowledge, and the quantitative and qualitative benefits of RAG and fine-tuning. We see an accuracy increase of over 6 p.p. when fine-tuning the model and this is cumulative with RAG, which increases accuracy by 5 p.p. further. In one particular experiment, we also demonstrate that the fine-tuned model leverages information from across geographies to answer specific questions, increasing answer similarity from 47% to 72%. Overall, the results point to how systems built using LLMs can be adapted to respond and incorporate knowledge across a dimension that is critical for a specific industry, paving the way for further applications of LLMs in other industrial domains.
Tools for this paper
Ask questions about this paper to our AI assistant
You can also chat with multiple papers at once here.
⚠The license of the paper does not allow us to build upon its content and the AI assistant only knows about the paper metadata rather than the full article.
The previous summary was created more than a year ago and can be re-run (if necessary) by clicking on the Run button below.
⚠The license of this specific paper does not allow us to build upon its content and the summarizing tools will be run using the paper metadata rather than the full article. However, it still does a good job, and you can also try our tools on papers with more open licenses.
Similar papers summarized with our AI tools
Navigate through even more similar papers through a
tree representationLook for similar papers (in beta version)
By clicking on the button above, our algorithm compares the title and abstract of this paper with all the papers of the same arXiv category that we have summarized, and finds the closest ones. You can rerun it from time to time: the results improve as our database grows.
Disclaimer: The AI-based summarization tool and virtual assistant provided on this website may not always provide accurate and complete summaries or responses. We encourage you to carefully review and evaluate the generated content to ensure its quality and relevance to your needs.