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