<?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 Rohit Rahangdale on Medium]]></title>
        <description><![CDATA[Stories by Rohit Rahangdale on Medium]]></description>
        <link>https://medium.com/@rohitrahangdale4?source=rss-eca2b3bcd73d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*XXhkMA8qbM8XhO1Be06FFw.png</url>
            <title>Stories by Rohit Rahangdale on Medium</title>
            <link>https://medium.com/@rohitrahangdale4?source=rss-eca2b3bcd73d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 07:31:43 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rohitrahangdale4/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: A Simple Way to Understand RAG in AI]]></title>
            <link>https://medium.com/@rohitrahangdale4/a-simple-way-to-understand-rag-in-ai-1986fd04652a?source=rss-eca2b3bcd73d------2</link>
            <guid isPermaLink="false">https://medium.com/p/1986fd04652a</guid>
            <category><![CDATA[rag-architecture]]></category>
            <category><![CDATA[basics-of-rag]]></category>
            <category><![CDATA[retrieval-augmented-gen]]></category>
            <category><![CDATA[what-is-rag]]></category>
            <dc:creator><![CDATA[Rohit Rahangdale]]></dc:creator>
            <pubDate>Wed, 18 Mar 2026 05:31:26 GMT</pubDate>
            <atom:updated>2026-03-28T11:04:52.339Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0HGFDx2FSaflUt95OXHQrQ.png" /></figure><p>When I first started exploring AI tools, I noticed something interesting — they sound smart, but sometimes they <em>guess</em>. And when they guess wrong, it can be very confidently wrong. That’s when I came across a powerful concept called<strong> Retrieval-Augmented Generation (RAG).</strong></p><p>In simple words, RAG is like giving AI an <strong>open-book exam instead of a closed-book one</strong>.</p><p>Instead of relying only on what it has learned in the past, RAG allows AI to <strong>look up relevant information in real-time and then answer based on that</strong>. This makes the responses more accurate, reliable, and useful — especially in real-world applications.</p><h3>What is RAG?</h3><p>Let me explain this in a way we all understand.</p><p>Imagine:</p><ul><li>You are asked a difficult question in an exam</li><li>You don’t remember the exact answer</li><li>But you are allowed to open your notebook, find the answer, and then explain it in your own words</li></ul><p>That is exactly what RAG does.</p><h3>Breaking the Term:</h3><h3>1. Retrieval (The “Search” Part)</h3><p>This is the first step.</p><p>Here, the system:</p><ul><li>Searches for relevant information from a database, documents, or knowledge base</li><li>Picks the most useful pieces of data related to the question</li></ul><p>Think of it like:</p><blockquote>Googling something before answering a question.</blockquote><p>But instead of searching the entire internet, it searches <strong>a controlled and trusted data source</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JECDfs5LiO2yjRqqFhaNvw.png" /><figcaption>Internal Working of Retriever</figcaption></figure><h3>2. Augmented (The “Enhancement” Part)</h3><p>Now comes the smart part.</p><p>The retrieved information is:</p><ul><li>Added (or <em>augmented</em>) to the original question</li><li>Given as extra context to the AI model</li></ul><p>It’s like:</p><blockquote>You don’t just remember something — you refresh your memory with exact notes before answering.</blockquote><p>This step ensures the AI is not guessing — it is <strong>grounded in actual data</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G58EU_XpT6OyAceknqOWTw.png" /><figcaption>Context Augmentation</figcaption></figure><h3>3. Generation (The “Answer Creation” Part)</h3><p>Finally:</p><ul><li>The AI reads both the question + retrieved information</li><li>Then generates a human-like answer</li></ul><p>Think of it like:</p><blockquote>Reading from your notes and then explaining it in your own words.</blockquote><h3>Putting It All Together</h3><p>RAG = <strong>Search → Add Context → Generate Answer</strong></p><p>Or in one line:</p><blockquote>“Find the right information first, then speak.”</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-LEzoQPJlezgAtp1k_N0Cw.png" /><figcaption>RAG architecture</figcaption></figure><h3>Why RAG is Important (From My Perspective)</h3><p>I believe RAG solves one of the biggest problems in AI:</p><h4>Problem Without RAG:</h4><ul><li>AI relies only on training data</li><li>Can give outdated or incorrect answers</li><li>May hallucinate (make things up)</li></ul><h4>With RAG:</h4><ul><li>Answers are based on real, retrieved data</li><li>More accurate and trustworthy</li><li>Can work with <em>latest</em> or <em>custom</em> data</li></ul><p>That’s why RAG is widely used in:</p><ul><li>Chatbots for companies</li><li>Customer support systems</li><li>Document-based Q&amp;A systems</li><li>Personal AI assistants</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MGwRCcLUSYyGORak3RK77A.png" /><figcaption>Without RAG vs With RAG</figcaption></figure><h3>Real-Life Example</h3><p>Let’s say:</p><p>You ask:</p><blockquote>“What is the leave policy of my company?”</blockquote><h4>Without RAG:</h4><p>AI might give a general answer like:</p><blockquote>“Most companies offer 20–30 days of leave…”</blockquote><p>Which may be completely wrong for your company.</p><h4>With RAG:</h4><ul><li>It searches your company’s HR document</li><li>Retrieves exact leave policy</li><li>Then answers based on that</li></ul><p>Now the answer is:</p><ul><li>Accurate</li><li>Relevant</li><li>Personalized</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xZ9I4y6sf47ja_BYpUzsJw.png" /><figcaption>Example</figcaption></figure><h3>Limitations (Because Nothing is Perfect)</h3><p>Even though RAG is powerful, it has some challenges:</p><ul><li>Needs good-quality data</li><li>Retrieval step must be efficient</li><li>Can be slower than normal AI responses</li><li>Poor retrieval = poor answer</li></ul><p>So the system is only as good as the data it retrieves.</p><h3>Final Thoughts</h3><p>If I had to describe RAG in one sentence, I would say:</p><blockquote>“RAG makes AI less of a guesser and more of a researcher.”</blockquote><p>And honestly, that’s exactly what we need in today’s world — <br>AI that doesn’t just <em>sound smart</em>, but actually <em>is smart</em> because it uses real information.</p><blockquote>Thanks for reading this article till the end. I’ve kept everything simple on purpose so that you can clearly understand how RAG actually works, without getting confused by too many technical terms.</blockquote><blockquote>There’s definitely a lot more to RAG, especially if you go into the technical side — things like embeddings, vector databases, and how the whole system is built. But I didn’t want to overload this article with all that.</blockquote><blockquote>The goal here was just to help you <em>get the idea clearly</em>. Once that’s clear, learning the deeper concepts becomes much easier.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1986fd04652a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding the Transformer Model - From Zero to “Oh, That Makes Sense!”]]></title>
            <link>https://medium.com/@rohitrahangdale4/understanding-the-transformer-model-from-zero-to-oh-that-makes-sense-932bcba6e524?source=rss-eca2b3bcd73d------2</link>
            <guid isPermaLink="false">https://medium.com/p/932bcba6e524</guid>
            <dc:creator><![CDATA[Rohit Rahangdale]]></dc:creator>
            <pubDate>Tue, 10 Feb 2026 06:13:13 GMT</pubDate>
            <atom:updated>2026-02-11T11:05:13.352Z</atom:updated>
            <content:encoded><![CDATA[<p>When I first heard about <strong><em>Transformers</em></strong>, I thought they were something extremely complex and only meant for PhDs or research scientists. But once I broke it down step by step, I realized that a Transformer is actually a <strong>very well-organized combination of simple ideas</strong>.</p><p>In this article, I’ll explain the <strong>complete Transformer architecture from start to end</strong>, in a way that a beginner can follow — exactly how I understood it while learning.</p><h3>Why Do We Even Need Transformers?</h3><p>Before Transformers, most NLP models were based on <strong>RNNs and LSTMs</strong>. They worked, but they had some serious limitations:</p><ul><li>They processed words <strong>one by one</strong> (slow)</li><li>They struggled with <strong>long-range dependencies</strong></li><li>Parallelization was difficult</li></ul><p>Transformers solved these problems by introducing a powerful idea:</p><blockquote><strong><em>“Instead of processing words sequentially, let the model look at all words at once and decide what to focus on.”</em></strong></blockquote><p>This idea is called <strong>Attention</strong> — and it’s the heart of Transformers.</p><h3>High-Level View of a Transformer</h3><p>At a very high level, a Transformer has <strong>two main blocks</strong>:</p><ol><li><strong>Encoder</strong></li><li><strong>Decoder</strong></li></ol><ul><li>The <strong>Encoder</strong> reads and understands the input sentence</li><li>The <strong>Decoder</strong> generates the output sentence step by step</li></ul><p>📌 Example:</p><blockquote><em>Input: </em>“I am learning transformers”<em><br>Output: </em>“Je suis en train d’apprendre les transformers”</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oUgjQLbHNmegtaqn.png" /><figcaption><a href="https://www.oreilly.com/library/view/hands-on-natural-language/9781789139495/7d9f1317-d2e0-46ea-b8f0-28d7b42ecabf.xhtml">Source</a> — A simple Encoder–Decoder block diagram</figcaption></figure><h4>Step 1: Input Embedding — Turning Words into Numbers</h4><p>Computers don’t understand words — they understand numbers.</p><p>So the first thing we do is convert each word into a <strong>vector</strong> using an <strong>Embedding layer</strong>.</p><p>Example sentence:</p><pre>&quot;I love NLP&quot;</pre><p>Becomes:</p><pre>[0.21, -0.13, 0.87, ...]</pre><p>Each word is now a dense vector that captures some meaning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kP1fzhuneEhEEZ5lrQ8k6Q.png" /><figcaption>Words mapped to vectors</figcaption></figure><h4>Step 2: Positional Encoding — Adding Word Order</h4><p>Here’s an important catch.</p><p>Transformers process all words <strong>in parallel</strong>, so they don’t naturally know:</p><ul><li>Which word came first</li><li>Which word came last</li></ul><p>To fix this, we add <strong>Positional Encoding</strong> to embeddings.</p><blockquote><em>Final Input = Word Embedding + Positional Encoding</em></blockquote><p>This helps the model understand:</p><ul><li>“This word is before that word.”</li><li>“These words are close together.”</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SAUKKf5XpAtL3yXqOM56Ag.png" /></figure><h4>Step 3: Self-Attention — The Core Idea</h4><p>This is where the Transformer really becomes powerful.</p><h4>What is Self-Attention?</h4><p>Self-attention allows <strong>each word to look at every other word</strong> and decide:</p><blockquote><em>“How important is that word for understanding me?”</em></blockquote><p>Example:</p><blockquote><em>“The animal didn’t cross the street because </em><strong><em>it</em></strong><em> was tired.”</em></blockquote><p>Here, <strong>“it”</strong> refers to the <em>animal</em>, not the <em>street</em>.<br> Self-attention helps the model figure this out.</p><h4>Query, Key, and Value (Q, K, V)</h4><p>For each word embedding, we create three vectors:</p><ul><li><strong>Query (Q)</strong> — what I’m looking for</li><li><strong>Key (K)</strong> — what I have</li><li><strong>Value (V)</strong> — what I contribute</li></ul><p>Attention score is computed as:</p><pre>Attention(Q, K, V) = softmax(QKᵀ / √d) × V</pre><p>Don’t worry about the formula too much — conceptually:</p><ul><li>Compare Query with all Keys</li><li>Get importance scores</li><li>Use those scores to combine the values</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K2HPv2Q9PUTwgHsObCX3nw.png" /></figure><h4>Step 4: Multi-Head Attention — Looking from Multiple Angles</h4><p>Instead of doing attention <strong>once</strong>, Transformers do it <strong>multiple times in parallel</strong>.</p><p>Each attention head focuses on different aspects:</p><ul><li>One head may focus on grammar</li><li>Another on meaning</li><li>Another on long-range dependency</li></ul><p>All heads are then <strong>concatenated and combined</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dob9e3uGm7zHQSwIFsf4Dw.png" /><figcaption>Multi-head attention diagram showing parallel attention heads</figcaption></figure><h4>Step 5: Add &amp; Normalize — Stabilizing the Network</h4><p>After attention, we apply:</p><ol><li><strong>Residual Connection (Add) — </strong>Adds the original input back</li><li><strong>Layer Normalization — </strong>Normalizes everything</li></ol><p>Why?</p><ul><li>Helps gradients flow better</li><li>Makes training more stable</li><li>Prevents loss of original information</li></ul><p>This pattern repeats <strong>many times</strong> in the Transformer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F5dxGPNBNKdoe8tenvPvqw.png" /><figcaption>Layer Normalization with Residual Connection</figcaption></figure><h4>Step 6: Feed Forward Network — Non-Linearity</h4><p>After attention, each word goes through a <strong>fully connected feed-forward network</strong>:</p><pre>Linear → ReLU → Linear</pre><p>This is applied <strong>independently to each position</strong>, adding non-linearity and learning complex patterns.</p><h4>Encoder Stack — Putting It All Together</h4><p>Each <strong>Encoder layer</strong> consists of:</p><ol><li>Multi-Head Self Attention</li><li>Add &amp; Normalize</li><li>Feed Forward Network</li><li>Add &amp; Normalize</li></ol><p>And we stack <strong>multiple such layers</strong> (e.g., 6 or 12).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*88QWSj4cCKdZTPtIZgDATQ.png" /><figcaption><em>Stacked encoder layers visualization</em></figcaption></figure><h4>Decoder — Slightly More Advanced</h4><p>The Decoder is similar to the Encoder, but with two key differences:</p><p><strong>1. Masked Self-Attention</strong></p><ul><li>The decoder <strong>cannot see future words</strong></li><li>This ensures predictions happen left-to-right</li></ul><p><strong>2. Encoder–Decoder Attention</strong></p><ul><li>Decoder attends to encoder outputs</li><li>This helps align input and output sequences</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7wy_kEyLOexeSCluxFvPrw.png" /><figcaption>Encoder–Decoder Attention with Masked Self Attention</figcaption></figure><h4>Final Step: Output Layer &amp; Softmax</h4><p>The decoder output goes through:</p><ul><li>A <strong>Linear layer</strong></li><li>A <strong>Softmax layer</strong></li></ul><p>This converts vectors into <strong>probabilities over vocabulary</strong>.</p><p>The word with the highest probability is selected as the next token.</p><p>This continues until:</p><ul><li>&lt;END&gt; token is generated</li><li>Or the max length is reached</li></ul><h4>Why Transformers Are So Powerful</h4><p>From my understanding, Transformers work so well because:</p><ul><li>They handle <strong>long-term dependencies</strong> easily</li><li>They are <strong>fully parallelizable</strong></li><li>Attention lets them focus on <strong>what truly matters</strong></li><li>They scale beautifully with data and compute</li></ul><p>This is why models like <strong>BERT, GPT, T5, and ViT</strong> are all based on Transformers.</p><h3>Final Thoughts</h3><p>When I stopped seeing Transformers as a single complex equation and instead as a <strong>pipeline of simple steps</strong>, everything started clicking.</p><p>If you understand:</p><ul><li>Embeddings</li><li>Attention</li><li>Encoder–Decoder flow</li></ul><p>You already understand <strong>80% of Transformers</strong>.</p><p>The rest is just implementation details and practice</p><blockquote>Thanks for visiting my article — if this helped you, feel free to share it with someone who’s also trying to understand Transformers.</blockquote><p>— — — *** — — —</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=932bcba6e524" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>