Quick 2 minute Tutorial to understand LLM (RAG)s

Amber Ivanna Trujillo
3 min readApr 17, 2024

What are ๐—ฅ๐—ฒ๐˜๐—ฟ๐—ถ๐—ฒ๐˜ƒ๐—ฎ๐—น ๐—”๐˜‚๐—ด๐—บ๐—ฒ๐—ป๐˜๐—ฒ๐—ฑ ๐—š๐—ฒ๐—ป๐—ฒ๐—ฟ๐—ฎ๐˜๐—ถ๐—ผ๐—ป (๐—ฅ๐—”๐—š) ๐—ฆ๐˜†๐˜€๐˜๐—ฒ๐—บ๐˜€?

Here is an example of a simple RAG based Chatbot to query your Private Knowledge Base.

First step is to store the knowledge of your internal documents in a format that is suitable for querying. We do so by embedding it using an embedding model:

๐Ÿญ: Split text corpus of the entire knowledge base into chunks โ€” a chunk will represent a single piece of context available to be queried. Data of interest can be from multiple sources, e.g. Documentation in Confluence supplemented by PDF reports.

๐Ÿฎ: Use the Embedding Model to transform each of the chunks into a vector embedding.

๐Ÿฏ: Store all vector embeddings in a Vector Database.

๐Ÿฐ: Save text that represents each of the embeddings separately together with the pointer to the embedding (we will need this later).

Next we can start constructing the answer to a question/query of interest:

๐Ÿฑ: Embed a question/query you want to ask using the same Embedding Model that was used to embed the knowledge base itself.

๐Ÿฒ: Use the resulting Vector Embedding to run a query against the index in the Vector Database. Choose how many vectorsโ€ฆ

--

--

Amber Ivanna Trujillo

I am Executive Data Science Manager. Interested in Deep Learning, LLM, Startup, AI-Influencer, Technical stuff, Interviews and much more!!!