[ad_1]
Tutorial for Generative AI beginners: let’s build a very simple RAG (Retrieval Augmented Generation) system locally, step-by-step
A Retrieval-Augmented Generation (RAG) system is like a smart assistant that helps you. Imagine you’re writing about a topic. You have some knowledge in your head (like a Generative AI), but you might not remember everything. So, you look up information in books or on the internet (this is the “retrieval” part). Once you’ve found the right information, you use it to help write your report in your own words (this is the “generation” part). So, a RAG system is a tool that combines its own knowledge (like your memory) with the ability to look up other sources of information (like your books or notes), to generate (write) a response or complete a task.
Usually, the complexity and demands of RAG systems necessitate the use of powerful computers or cloud services. In this tutorial, we are going to build a very very simple retrieval augmented generation system locally (i.e. without online services during the functioning phase), step-by-step, with state-of-the-art frameworks or tools. The procedure outlined here is fundamentally basic and significantly diverges from established industrial standards. The aim of this tutorial is not to build the ultimate RAG system, but rather to examine each component a little bit in detail to gain a deeper understanding of the underlying mechanics. This article is addressed to beginners of the GenAI world. Every piece of code shown here is also reported in the easyRAG GitHub repository.
Ready? Let’s go!
We use Anaconda in this tutorial. If you do not have it on your machine, please, download it from the official website and install it (just follow the installation script instructions).
Then, within a terminal session, we can start creating the environment with some packages we will use during the process
conda create -n easyrag -c nvidia -c conda-forge -v python==3.9 cuda-toolkit==12.4.0 jupyterlab==4.1.4 ipywidgets==8.1.2 wikipedia==1.4.0 mypy==1.8.0 accelerate==0.27.0…
Source link