<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Tharusha Ranasinghe on Medium]]></title>
        <description><![CDATA[Stories by Tharusha Ranasinghe on Medium]]></description>
        <link>https://medium.com/@tharushapradeepani123?source=rss-e9ff941fd1d9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*2mbfERLB9p6bf80H</url>
            <title>Stories by Tharusha Ranasinghe on Medium</title>
            <link>https://medium.com/@tharushapradeepani123?source=rss-e9ff941fd1d9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 05:35:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tharushapradeepani123/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[RAG Explained Simply: How AI Assistants Actually Know What You Ask Them]]></title>
            <link>https://medium.com/@tharushapradeepani123/rag-explained-simply-how-ai-assistants-actually-know-what-you-ask-them-de30dcc7f18e?source=rss-e9ff941fd1d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/de30dcc7f18e</guid>
            <category><![CDATA[rag-architecture]]></category>
            <dc:creator><![CDATA[Tharusha Ranasinghe]]></dc:creator>
            <pubDate>Sun, 26 Jul 2026 03:47:11 GMT</pubDate>
            <atom:updated>2026-07-26T03:47:11.770Z</atom:updated>
            <content:encoded><![CDATA[<h3>1. My Journey Learning RAG</h3><p>The first time I heard the term <strong>“RAG,”</strong> I pretended I understood it. I didn’t.</p><p>I ignored it until I built a chatbot that confidently gave wrong answers and made up information.</p><p>That’s when I started learning RAG — not as an AI buzzword, but as a real solution I needed to build.</p><p>Once I understood the basics, it completely changed how I think about AI applications: it’s not about making the model know everything, but about giving it the right information at the right time.</p><p>This is the simple explanation I wish I had when I started.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XXfkL9kqLiBPT_Oj_--55Q.png" /></figure><h3>2. Why Do We Need RAG?</h3><p>LLMs (Large Language Models) are impressive, but they have real limits:</p><ul><li><strong>Hallucination</strong> — confident answers that are simply wrong</li><li><strong>Outdated knowledge</strong> — frozen at their training cutoff</li><li><strong>No access to private data</strong> — never seen your company’s documents</li><li><strong>Limited context</strong> — you can’t paste an entire knowledge base into one prompt</li></ul><p>Here’s the example that made it click for me: imagine asking an AI <em>“What is our company’s leave policy?”</em> It’s never read your handbook, so it either admits it doesn’t know or guesses confidently and gets it wrong.</p><p>You could paste the whole handbook into every prompt, but that’s slow and falls apart once your documents grow. That gap between what a model <em>knows</em> and what you <em>need it to know</em> is exactly what RAG solves.</p><h3>3. What Is RAG, Really?</h3><p>RAG stands for <strong>Retrieval-Augmented Generation</strong>. The name explains itself once you break it apart:</p><ul><li><strong>Retrieval</strong> — find relevant information from an external source</li><li><strong>Augmented</strong> — add that information into the LLM’s prompt</li><li><strong>Generation</strong> — the LLM writes the final answer using that added context</li></ul><p>Think of it like an open-book exam instead of a memory test. The model isn’t relying purely on what it memorized, it gets to “look things up” first.</p><h3>4. RAG vs Fine-tuning</h3><p>A question that confused me just as much: <em>“Why not just fine-tune the model on your data?”</em></p><p><strong>Fine-tuning</strong> retrains the model’s weights on your data. <strong>RAG</strong> leaves the model untouched and feeds it knowledge at query time instead.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fkbZNfnPrgyxcmkbRetPkw.png" /></figure><p>They’re not mutually exclusive — some systems use both. But for private or fast-changing data, RAG is usually the faster place to start.</p><h3>5. How RAG Architecture Works</h3><p>Here’s the full pipeline that finally made it click for me:</p><p><strong>Documents → Chunking → Embeddings → Vector Database → Retrieval → LLM Response</strong></p><p><strong>Documents.</strong> RAG can pull knowledge from PDFs, websites, or internal docs — anything text-based becomes searchable.</p><p><strong>Chunking.</strong> A document is split into smaller pieces called chunks (think: paragraph-sized sections instead of one giant PDF). Too big, and search gets fuzzy; too small, and you lose context.</p><p><strong>Embeddings.</strong> Each chunk becomes a list of numbers — a vector — where similar <em>meanings</em> produce similar numbers, even with different wording. This is why searching “vacation days” can still match a document that says “annual leave.”</p><p><strong>Vector Database.</strong> These vectors are stored in a database (FAISS, ChromaDB, Pinecone) built for fast similarity search — instead of scanning every document, it jumps straight to the closest matches.</p><p><strong>Retrieval + Generation.</strong> A question becomes an embedding → gets matched against the vector database → the closest chunks are retrieved → added to the prompt → sent to the LLM, which generates an answer grounded in real text.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UGvIQjz6DhsoWrjn5gzaig.png" /></figure><h3>6. Real-World Example: Chatting With Company Documents</h3><p>Say an employee asks: <strong>“What is the company’s leave policy?”</strong></p><ol><li>The question is sent to the system.</li><li>The system searches the company’s document knowledge base.</li><li>The relevant policy section is retrieved.</li><li>The LLM reads that section and generates a clear answer.</li></ol><p>No guessing — just the model reading the actual source and summarizing it.</p><h3>7. Building a Simple RAG Application</h3><p>A beginner-friendly stack:</p><ul><li><strong>LLM:</strong> OpenAI models / Llama / Mistral</li><li><strong>Embedding Models:</strong> OpenAI Embeddings / BGE / Sentence Transformers</li><li><strong>Vector Database:</strong> FAISS / ChromaDB / Pinecone</li><li><strong>Framework:</strong> LangChain / LlamaIndex</li><li><strong>Backend:</strong> Python + FastAPI</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t81vo4gF9VTwuQMl6zWypA.png" /></figure><h3>8. Challenges I Learned While Understanding RAG</h3><p>What I learned while building and understanding RAG:</p><ul><li><strong>Good chunking affects retrieval quality</strong> — too large or too small, and search suffers</li><li><strong>Poor retrieval creates poor answers</strong>, no matter how good the LLM is</li><li><strong>Embedding quality matters</strong> — not all embedding models capture meaning equally well</li><li><strong>More context isn’t always better</strong> — it raises cost and latency</li><li><strong>RAG doesn’t fully remove hallucination</strong> — it reduces it by grounding answers in real text, but the model can still misread what it retrieved</li></ul><p>The quality of an AI app depends as much on how information is retrieved as on the model generating the answer.</p><h3>9. Conclusion</h3><p>Learning RAG changed how I think about AI systems. I used to assume a bigger, smarter model automatically meant a better product.</p><p>Now I know it’s just as much about giving the model the right knowledge at the right time.</p><p>RAG is the bridge between what a model <em>knows</em> and what it <em>needs to know</em> to be useful. If you’re just starting out, don’t be intimidated by the diagrams full of arrows and boxes — break it into retrieval, chunking, embeddings, and generation, and it becomes surprisingly approachable.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=de30dcc7f18e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>