How to feed your AI
Wait⌠how do you actually feed knowledge into RAG?đ¤
RAG??
Well, if you missed the last post it was about Retrieval Augmented Generation (RAG) and me complaining about a doctorate program in Gen AI. đ
I'm also learning and taking classes more than ever before, because that's how you stay relevant in a fast-changing world!
Alright, so last time I said RAG is like giving your AI an open-book exam. But hereâs the catch: if your âbookâ is a messy 400-page PDF, your AI is going to get lost flipping through it.
So the trick is: donât give the AI the whole book.
You slice it down into bite-sized pieces through some processes I will lay out below.
⸝
Step 1: Chunking đ
Instead of throwing giant documents at your AI, you break them down into chunks â usually a few paragraphs each.
Think of it like ripping chapters out of a book so your friend can quickly pull just the right page.
⸝
Step 2: Vectorizing đ˘
Now, hereâs the slightly nerdy part:
Each chunk gets turned into a vector, which is basically a long list of numbers that capture its meaning. And there is a lot of mind-bending cosine stuff and math here (or maybe it was just mind-bending for me!) Why all this math?
Why?
Because numbers are way easier for computers to compare than raw text.
So when you ask, âWhatâs the refund policy?â â the AI doesnât search keywords, it searches meanings.
⸝
Step 3: Retrieval đŻ
When you ask a question, the system finds the top few chunks that are most relevant. The fancy term is "top K".
Then it hands those to the AI along with your question, and boom â the AI gives you a personalized, accurate answer!
Remember those chunks we spoke about?
In the next post, Iâll talk about where you store all these chunks. But before we get there, whatâs the most chaotic document youâd love to see an AI instantly organize for you?
And let me know if you like this AI series OR if you'd rather we focus on other themes.
Let me know. I read every response.
Regards
John
P.S: Want to know about our programs, here is a good starting point.
Responses