社内勉強会資料_StepByStep Build own RAG. .

NABLAS 437 views 12 slides Sep 09, 2024
Slide 1
Slide 1 of 12
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12

About This Presentation

LLMがより正確かつ関連性の高い回答を生成できるよう、独自にLLMにデータを組み込む「RAG system」を構築する方法について解説しています📝

デモはこちらから:
https://github.com/endrol/RagStudy

This explains how to construct the “RAG syst...


Slide Content

Build your own RAG system

What is RAG
Retrieval-Augmented Generation (RAG) solves specification problem by adding
your data to LLM
-LLM is powerful
-LLM + customize data
-Large file
-RAG *

Steps to build a RAG
Loading: text files, pdfs, website, database
Indexing: vector embeddings
Storing: Store metadata index
Querying: Matching query and answer
Evaluating: check the pipeline performance

Documents
There are many types of files could be fit in a RAG system
-Text files *
-Tables
-PDFs
-Website *

-MultiModels (image,
video, voice, etc) ->
MM Search


Step

Documents
Open-source community readers

Indexing and Storage
A rag will help to index data into a structure that’s easy to retrieve, usually vector
embeddings.
Embedding Model
-OpenAI
-Huggingface,
-etc

Step

Indexing and Storage
Once the embedding are created, we can store them for fast retrieval

Indexing and Storage
Graph Structure, GraphRAG
Basic element: triplet



Step NebulaGraph
Create KG and store


Graph structure
-Analyze for multiple points
-A->B->C
-Summarize concepts

Query & Retrieval
Query: eg Who is Paul Graham?

Embedding matching and Retrieval:
-Distance calculation
Retrieval response
-Source (Doc id: 10ea1490-dcc1-4d7c-b182-3e9f1e644d8e)
-Source (Doc id: cbde6734-d20e-4a25-b23e-1e2f2bbba7a1)
-
Step

Answer
After retrieving k source, LLM synthesize answer from sources

Evaluations
It’s important to have a evaluation metrics to see if RAG system works
-Response evaluation
-response match the query
-response match the retrieved context
-answer match the GroundTruth
-etc
-Retrieval evaluation
-whether the retrieved sources relevant to query
Steps (RAGAS)
1.generate testset




2.evaluate metrics

End
-Information Retrieval with a smart filter
-Easily build a customized system