top of page
  • Photo du rédacteurRanya Khemiri

I set up a RAG pipeline to help with a school assignment

How to make studying more fun

Exam season is upon us, and every minute counts. One of my most challenging courses this semester is a research-oriented Telecommunication course that requires lots of reading and analysis of different research papers. As the final project of this course, I chose to tackle the role of AI and Blockchain technologies in 5G-based vehicular ad hoc networks (VANETs). As the task of analyzing papers is tedious and takes a lot of time, I thought to myself, why not leverage LLMs to assist in analyzing the documents?

 

My first intution was to upload the PDF documents in ChatGPT-4, and ask questions. However, the fact that GPT-4 as it comes isn't tailored to my specific use-case and the 5G context, pushed me to seek something customizable, Using ChatGPT, I found the answers lacking precision and the model sometimes not providing the correct answers.


 

What is Retrieval-Augmented Generation ?

Retrieval-Augmented Generation, also known as RAG, is a technique used in NLP. It combines a retrieval system, with a language generation model. The retrieval system fetches relevant documents or information based on a user query, and the generation model then uses this information to create a context-aware and informed response. This approach enhances the model's ability to provide accurate and contextually relevant answers.

 

LlamaIndex article

Only 2 days ago, LlamaIndex came out with "RAGs", an app that allows you to quickly use GPT-4 on your own data using a RAG agent builder. Using AI to build AI is a genius idea, and it's even better when you see how easy and effective it is.




 

Solution

The first step was to clone the github repository and setup the necessary OpenAI credentials (API key to access GPT-4).



After this step, you simply need to run the app and a window will pop on your browser with the AI-powered RAG Agent builder!

The RAGs bot should be tailored to your specific task (summurization, text completition, etc) :



For my case, I wanted it to help me quickly identify key concepts in my research paper, so I gave it the task and the local path to the paper :



What's happening under the hood is that the RAGs builder creates a GPT-4-backed RAG agent with specific document retrieval settings, tailored to the user-requested prompt. Multiple parameters can be modified, such as Top-K retrieval and Chunk size variables. The following is the configuration of the RAG Pipeline, literally created for you in seconds by the RAG bot :



And voilà! You now have your agent ready to use your own data and provide answers :



After playing around with it, I found that it definetly is more accurate and helpful than Chat GPT. As an example, if you look closely between the answers provided by my GPT-4-powered RAG agent and the Chat GPT website, you can notice that Chat GPT is slightly more vague, whilst my RAGs application is more straight to the point and accurate :



I also noticed that upon turning on the summarization feature, I got a paragraph in return instead of bullet points, which you generally have to specifically ask Chat GPT for if needed. Otherwise, Chat GPT will usually generate bullet points as an answer to questions like this. So I guess it made my life a little bit easier after all!




 

Limitation


The only downside to the proposed solution is that it is limited to one document at a time, so it's not very efficiant for my needs. In my next project, I will try to implement a smiliar solution using Amazon Kendra for index retrieval and LangChain, and compare the performance and quality of the answers.





657 vues0 commentaire
bottom of page