<?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 karthik sathish on Medium]]></title>
        <description><![CDATA[Stories by karthik sathish on Medium]]></description>
        <link>https://medium.com/@karthiksathishjnv?source=rss-4b41f3b4e348------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*qSWeI2ZZyQdE1mml</url>
            <title>Stories by karthik sathish on Medium</title>
            <link>https://medium.com/@karthiksathishjnv?source=rss-4b41f3b4e348------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 17:16:31 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@karthiksathishjnv/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[why is ATTENTION all you need?]]></title>
            <link>https://medium.com/@karthiksathishjnv/why-is-attention-all-you-need-80de00356286?source=rss-4b41f3b4e348------2</link>
            <guid isPermaLink="false">https://medium.com/p/80de00356286</guid>
            <category><![CDATA[attention-mechanism]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[karthik sathish]]></dc:creator>
            <pubDate>Tue, 23 Jun 2026 17:28:22 GMT</pubDate>
            <atom:updated>2026-06-23T18:23:44.816Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aJ-idEyxF6Gorgfdn3Xrew.png" /></figure><p>Attention was introduced way back in 2014. But, it’s fullest potential was explored in the paper <em>Attention Is All You Need — </em>2017.</p><p>In this article we are gonna discuss about Attention, and then on look into various modifications of the initial version of attention proposed in the transformer architecture (MHA), like MQA, GQA (used by Llama models), MLA (unlike the one we see in Politics, this MLA is useful ).</p><p>A good way to get the most out of this article is to keep on questioning each particular section and try to figure out the answer by yourself. If not, feel free to google/GPT it.</p><p>The Transformer block made use of the self-attention mechanism to understand the context of the input sentence and this allowed the ability to parallelize the training phase. I know the term “self- attention” and “parallelize” might be bit confusing at this point. Cools. I will try to keep it as detailed as possible.</p><p>Let’s say you ask a question to an LLM : “How are you ?”. The previous architecture before transformer like RNNs, LSTMs, would process each of this tokens SEQUENTIALLY, meaning : it would first process the term “How” and compute a hidden state : “h1” and use it as an input to compute the a second hidden stage “h2” and so on…</p><blockquote>h1=f(“How”,h0) → h2=f(“are”,h1) → h3=f(“you”,h2) → h4=f(“?”,h3)</blockquote><p>Notice, the hidden state h4 is only computed after h3 and so on.. This takes too much time and isn’t an efficient method. The self attention mechanism allows to compute the context aware representation for all the tokens at once.</p><pre>h_{How} = f(How, are, you, ?)<br>h_{are} = f(How, are, you, ?)<br>h_{you} = f(How, are, you, ?)<br>h_{?} = f(How, are, you, ?)</pre><p>Good. Now we know that in transformers, context are computed in parallel, let’s see how the it is computed or what does the word “attention” even mean in the first place!!</p><p><em>Bengaluru is a beautiful city. It has the best weather in the country.</em></p><p>In the above sentence, we easily understood that the term “It” refers to Bengaluru. Now, how to make the models understand this? The answer is attention. Attention allows the model to understand the relationship of a given word with the other words in the input, making the model to understand the context.</p><p><strong>Compute Attention <br></strong>Attention is basically a score calculated by using these three parameters: Query (Q): What am I looking for? Key (K): I can provide you <strong><em>this</em></strong> Value (V): The actual content of <strong><em>this</em></strong></p><p>For the above sentence here is the intuition: “It” generates a Query (Q): Who does “It” refer to? “Bengaluru” has a Key (K): I am a city/entity. The Q and K are compared to produce an attention score. If the score is high, the Value (V) from “Bengaluru” is used to enrich the representation of “It”.</p><pre>Q, K, and V are vectors computed using learned matrices W_Q, W_K, and W_V.<br><br>Q = XW_Q, K = XW_K, V = XW_V<br><br>These matrices are learned during the training phase of the language model.</pre><p>Now, let’s compute the attention score for our above example:</p><p><strong>Attention Score Computation for “It”</strong></p><pre>Query Vector for &quot;It&quot;<br><br>Let the query vector for the token &quot;It&quot; be:<br><br>```<br>Q_h6<br>```<br><br>---<br><br>### Attention Scores<br><br>Attention scores are computed as:<br><br>```<br>Score_i = Q_h6 · K_hi<br>```<br><br>| Token     | Computation | Score |<br>| --------- | ----------- | ----- |<br>| Bengaluru | Q_h6 · K_h1 | 8     |<br>| is        | Q_h6 · K_h2 | 1     |<br>| a         | Q_h6 · K_h3 | 0     |<br>| beautiful | Q_h6 · K_h4 | 2     |<br>| city      | Q_h6 · K_h5 | 5     |<br>| It        | Q_h6 · K_h6 | 1     |<br><br>```<br>Scores = [8, 1, 0, 2, 5, 1]<br>```<br><br>---<br><br>### Applying Softmax<br><br>#### Raw Attention Scores<br><br>| Token     | Score |<br>| --------- | ----- |<br>| Bengaluru | 8     |<br>| is        | 1     |<br>| a         | 0     |<br>| beautiful | 2     |<br>| city      | 5     |<br>| It        | 1     |<br><br>#### After Softmax<br><br>| Token     | Weight |<br>| --------- | ------ |<br>| Bengaluru | 0.94   |<br>| is        | 0.001  |<br>| a         | 0.0004 |<br>| beautiful | 0.002  |<br>| city      | 0.047  |<br>| It        | 0.001  |<br><br>---<br><br>### Computing Context-Aware Representation<br><br>```<br>Context_It =<br>0.94 * V_h1 +<br>0.001 * V_h2 +<br>0.0004 * V_h3 +<br>0.002 * V_h4 +<br>0.047 * V_h5 +<br>0.001 * V_h6<br>```<br><br>Since Bengaluru has the highest weight, V_h1 contributes the most.<br>The representation of &quot;It&quot; is updated to capture that it refers to Bengaluru.<br></pre><p>I get it.</p><p>You might be wondering what is the subscript “h” denoting here. The above calculations just happened in a single head h. There will be multiple such heads in practice, each focusing on different patterns. One head might focus on learning the semantic relationship, other on grammar and so on..</p><p>As mentioned above, the Q,K and V are calculated using trained matrices. Each head h, has it’s own set of these matrix or in other words, Q,K and V is generated in head 1 is different from the ones that are generated in head 2.</p><p>But the best part is we can optimize it and based on this optimization there are various types of attention researchers came up through over a period of time.</p><p><strong>Multi-Head Attention</strong> :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TUNtfYy52miWcDE4psFfFw.png" /></figure><p>The one we discussed above is nothing but MHA. Each head has it’s own set of Wq,Wk, and Wv. The representation learnt will be most efficient but storing of K and V ( called as <a href="https://huggingface.co/blog/not-lain/kv-caching">KV Cache</a>) during inference is a big problem here. Consider there are 8 heads and each has it’s own set of this matrices, which means you need to store 8K and 8V vectors !!</p><p>Models that used MHA: Transformer, BERT, GPT-2, GPT-3.</p><p>Most of the new LLM’s in today’s world don’t prefer using it due its memory inefficiency.</p><p><strong>Multi-Query Attention</strong> :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jUewkbe9xevHBN0Bf8A_1Q.png" /></figure><p>This is an optimization which improves the storage of KV Cache. Instead of having a separate KV head for each Q, it owns a single KV head for all the Q heads. Now, you might be wondering, there would be a lack of information/context right? You are right in assuming so, but there is a small adjustment. Remember what K and V refers to?</p><pre>Key  (K):   I can provide you this information  <br>Value (V):  The actual content of this information</pre><p>So, this architecture let’s Query Q (which is different for different heads) to attend for the same KV across the heads (which tells <em>here is what you can take from me</em>).</p><p>Models that used MQA: PaLM, Falcon.</p><p><em>Fun Fact : PaLM was an LLM developed by Google. They then dropped it off and shifted their focus towards building Gemini Family of models!!</em></p><p><strong>Grouped-Query Attention</strong> :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z0hToiBo4a3MJl9aDQggCg.png" /></figure><p>MHA ensured that the quality of representation is high and MQA was developed to reduce the memory problem.</p><p>But the problem with the MQA is the assumption of using the same set of KV across heads. Sharing the KV reduced the quality of response a bit. Therefore, researchers came up with an optimized approach which balanced both the memory and quality problem i.e GQA.</p><p>A set of Q heads (grouped query) attends to a specific KV head solving all the problems we saw above!!</p><p>Models that use GQA: Llama, Mistral (not sure about <a href="https://x.com/arthurmensch/status/2066456715650793956">Le Gros Chaton</a>😅).</p><p><strong>Multi-Head Latent Attention</strong> :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wwWr23KIAZ2dAtQZ-KaVbQ.png" /></figure><p>This is an architectural masterpiece designed by DeepSeek. In all the previous versions of attention, we actually stored the K and V tensors right? DeepSeek researchers realized that it can be further optimized by storing a lower-dimensional vector of the same.</p><pre>% KV Compression<br><br>c_t^{KV} = W^{DKV} h_t<br><br>% KV Reconstruction<br><br>k_t = W^{UK} c_t^{KV}<br><br>v_t = W^{UV} c_t^{KV}<br><br>Only the compressed latent vector $c_t^{KV}$ is stored in the KV cache.</pre><p>Think of it something like this: You have a big data, compress it, store it. during attention computation — -&gt; get the stored data, decompress back, get the k and v by multiplying with respective trained matrices.</p><p>Models that use MLA : DeepSeek, GLM.</p><p><em>For context, GLM-5.2 beat the Claude Opus-4.8(the existing SOTA) in the Design Arena Benchmark by 29 points!! (stats as of 20 Jun, 2026)</em></p><p>If you have reached this far, give yourself a pat on the back!! <br>Hope you got to learn something new. This was my small effort of expressing my thoughts and knowledge on <strong>Attention</strong>. Thanks for the read. Expect more blogs in the coming days!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=80de00356286" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Direct Policy Optimization — A Post Training Technique for Modern LLMs]]></title>
            <link>https://medium.com/@karthiksathishjnv/direct-policy-optimization-a-post-training-technique-for-modern-llms-5d689e632aee?source=rss-4b41f3b4e348------2</link>
            <guid isPermaLink="false">https://medium.com/p/5d689e632aee</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[post-training]]></category>
            <category><![CDATA[genai]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[karthik sathish]]></dc:creator>
            <pubDate>Sat, 23 May 2026 18:26:12 GMT</pubDate>
            <atom:updated>2026-05-23T18:26:12.177Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sgP2irRITAxWwy3cpRKXWw.png" /></figure><p>ChatGPT is the place where we usually end up when our professor allots us an assignment. By default, it uses the latest model (GPT-5.5 as of now). If it’s a hard problem, you may shift to a reasoning model such as o3. The reasoning models are so good that they eventually end up solving or giving an answer close to the actual answer.</p><p>Ever wondered how such models are created? How is it different from the base models like GPT 5.5 ? The answer lies in the step called <strong>post-training process</strong>. There are various post training process like RLHF with PPO, DPO, GRPO and so on. RLHF was used in the initial phase of LLM era. I have written a detailed blog for RLHF <a href="https://x.com/karmakarthik/status/2030766560160473537">here</a>. This article focuses on a clear and in-depth understanding of DPO.</p><p>Let me help you understand what a post training process might usually look like, or in other words why is it even needed in the first place.. So, to begin with, we have a pre-trained model (also called foundational model) say (GPT-3) which is trained on numerous corps of text available on the internet.Massive amount of computation goes on for building the pre-trained model.</p><p>Now we have a model which gives us a response for a given prompt. But but but…., is it what a human wants or is it in a human readable format yet? No matter how much compute or investment we put into building a model, at the end of the day, it must serve a purpose right? How do we ensure that the model is producing a response which is not hurting human sentiments? In order to tackle this, we come up with a post training operation on the foundational model which we built earlier.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LecnOV20dCZMtjAvTGSc0g.png" /></figure><p>RLHF is a post training process which involves both human as well a reinforcement learning model. DPO skips the need for a RL model and <strong>directly</strong> <strong>optimises</strong> the foundational model so as to meet human standards (don’t worry if it feels complex at this stage, detailed explanation is given in the next few passages).</p><p><strong>Workflow of DPO</strong></p><p><strong>1. Reference Model : </strong>Start with a SFT model (a base model which is been trained to answer a question instead of just predicting next token — also called Supervised Fine Tuned Model -SFT). This SFT model will be referred as a reference model (<strong>π ref</strong>) in the subsequent section. The weights of the reference model will not change in the entire training process.</p><p>2. <strong>Creation of Dataset:</strong> For a given prompt, with the help of a human mark the responses generated by the reference model as good and bad. Create numerous such entries so that it can be used to train the policy model to create a response which a human usually expects.</p><p>3. <strong>Policy</strong> : Take another copy of the reference model and this model will be termed as policy model (<strong>πθ</strong>). The end goal is to adjust the weights of <strong>πθ</strong>,<strong> </strong>so that it produces human preferred response.</p><p><em>Training the Policy Model:</em></p><p>i) As a first step, calculate the probability of policy model producing the winning response<strong> πθ(Yw/X) </strong>as well as the losing response <strong>πθ(Yₗ/X). </strong>Similarly, calculate the probability for reference model too <strong>π ref (Yw/X) </strong>and<strong> π ref (Yₗ/X).<br> </strong>ii) Take the differences of the logs and wrap it inside a sigmoid function so that the loss in the the range 0 to 1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*8uTSPNBv8SLRWYn1l5qRdw.png" /></figure><p>iii) Compute the gradient and update the weights of the policy model so as to minimize the above loss.</p><p><strong>Beauty of Math</strong></p><p><em>Please ignore this section if you are not interested in knowning how we ended up with the above loss function.</em></p><p>In this section, we will derive the loss function for DPO using the objective function of RLHF:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/1*1k5YivY9zI-HuDR8YomVJQ.png" /></figure><p>The above objective function of RLHF aims to maximize the reward such that the new model is not too distinct from the reference model, with β controlling this tradeoff.</p><p>An analytical solution for this is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/1*2FQUPnfcI6G1Q4b54Fze5Q.png" /></figure><p>where,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/1*jVMG5_oBctEknh6nN4w9OA.png" /></figure><p>Calculating Z(x) is very computationally very very expensive job. This is where the beauty of math comes into picture.</p><p>Rearranging π(y/x) we get (equation A):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*jM29jIsZfOmVOqJ9OUqiPQ.png" /></figure><p>Ultimately we want the model to prefer the winning response over the loosing one (equation B):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/1*fXB0VqWW8Qott-7pSrk9zg.png" /></figure><p>from equations A and B we get the equation C:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/866/1*oUMVsbBqZHUVNxnmedF39A.png" /></figure><p>The best part is we have entirely eliminated the need for computing Z !!! Now we have the preference probability expressed completely in terms of the policy πθ and no reward model needed. Hence the loss will be negative log likelihood of preference probability:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/1*_ZT7GazN7EFh16z2ugrrMw.png" /></figure><p>A detailed summary of the whole architecture is summarised in the below image</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ye9XaEn1tHlJLitkiNgvcg.png" /></figure><p>That said, I have covered most of the aspects of DPO in this article. Thanks for the read. Will write a blog on GRPO soon!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5d689e632aee" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Semantic Entropy Decoded]]></title>
            <link>https://medium.com/@karthiksathishjnv/semantic-entropy-decoded-f1eee935145f?source=rss-4b41f3b4e348------2</link>
            <guid isPermaLink="false">https://medium.com/p/f1eee935145f</guid>
            <category><![CDATA[ai-engineering]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[llm-hallucinations]]></category>
            <dc:creator><![CDATA[karthik sathish]]></dc:creator>
            <pubDate>Fri, 27 Mar 2026 06:40:47 GMT</pubDate>
            <atom:updated>2026-03-27T06:40:47.287Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*3yD7eYNRKoXBY_pyxaQ2FQ.png" /></figure><p>When asked a question regarding the relationship between the two main characters of the film Dhurnadhar, the LLM may respond :</p><p>“Hamza Ali Mazari is the son-in-law of Jameel” or <br>“Jameel is the father-in-law of Hamza Ali Mazari”</p><p>&gt;As an AI Engineer, your goal is to determine whether the LLM is hallucinating or not.</p><p>&gt;An easiest way to check this is by asking it to generate multiple responses for the same prompt and check if all the responses give you the same info.</p><p>&gt;In the above example, even though they are written differently, they both mean the same thing i.e they exactly say how these two individuals are related to each other.</p><p>&gt;While checking for Hallucinations, we shouldn’t consider the 2nd response to be irrelevant just because it has different set of wordings (“son-in-law”, “father-in-law”)</p><p>&gt;This is were Semantic Entropy comes into picture. It checks the meaning of the entire sentence instead of the traditional methods .The key idea is: if the responses have low entropy, the model isn’t hallucinating and vice versa.</p><p>&gt;Let’s implement this by dry running over an example: <br>Question : What is the Captial City of India? <br>Answers : <br> 1. Delhi <br> 2. The capital of India is Delhi <br> 3. New York <br> 4. India’s capital is Delhi <br> 5. New York is in America</p><p>&gt;Now use a semantic search tool to check the similarity between these responses in order to cluster it further. <br>&gt;A Natural Language Inference model, which is built on top of transformer architecture, is used for this purpose. <br>&gt;Estimate the probability: Count how many samples fall into each cluster and divide by total samples:</p><p><em>p(Delhi) = 3/5 = 0.6 <br>p(New York) = 2/5 = 0.4</em></p><p>&gt;Apply Shannon entropy formula</p><p>Now treat these meaning clusters like discrete outcomes and plug into the standard entropy formula:</p><p><em>H = − Σ p(c) · log₂ p(c)</em></p><p>In our example it is:</p><p><em>H = − [ 0.6 × log₂(0.6) + 0.4 × log₂(0.4) ] <br>H = − [ 0.6 × (−0.737) + 0.4 × (−1.322) ] <br>H = − [ −0.442 + (−0.529) ] <br>H ≈ 0.97 bits</em></p><p>Interpret these scores: <br>&gt;If all the responses are same, H would be zero(min),meaning no hallucination. <br>&gt;Whereas, if all the responses where different, H would be 2.32(max), meaning heavy hallucination <br>&gt;Now looking at the current model’s entropy score, you can conclude that the model is slightly hallucinating in nature.</p><p>Follow for more such technical blog posts regarding AI, ML and DL 😁</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f1eee935145f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Reinforcement Learning from Human Feedback]]></title>
            <link>https://medium.com/@karthiksathishjnv/understanding-reinforcement-learning-from-human-feedback-b86df186facc?source=rss-4b41f3b4e348------2</link>
            <guid isPermaLink="false">https://medium.com/p/b86df186facc</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[reinforcement-learning]]></category>
            <category><![CDATA[chatgpt]]></category>
            <dc:creator><![CDATA[karthik sathish]]></dc:creator>
            <pubDate>Sun, 08 Mar 2026 22:29:49 GMT</pubDate>
            <atom:updated>2026-03-08T22:29:49.518Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Reinforcement Learning from Human Feedback (RLHF in detail for beginners)</strong></h3><p>I have a friend who earns in US dollars, just by answering some basic questions. I went to his room and tried to figure out what he actually does. This was our conversation:</p><p>Me: “What raa Sudeep, too much Money you are printing”. <br>Sudeep: “No machha, I am just helping LLMs by evaluating their response”.</p><p>I literally stood there and stared at him for a while. Is he serious? It was always GPT who helped me and was never the other way .</p><p>Jokes apart, what he did there was a part of RLHF technique, a post training method. In this article, I will help you learn the entire pipeline of the RLHF technique. This is a beginner friendly Article to help you understand what RLHF actually is, study it’s components which includes what my friend was doing above, with more insights on the pipeline.</p><p><strong>Prerequisites: Read English</strong> (which I believe you can).</p><p>Consider an LLM, ChatGPT for example. You must be aware of the fact that it takes enormous amount of data(text) and compute to build the BASE model, in this case GPT-5.4 (the latest) . But what you are chatting with, is not the Base model itself, rather a model which was formed after performing a series of steps. These “series of steps” are what we call <strong>Post Training</strong>.</p><p>There are various ways of doing post training, and most common among them is <strong>RLHF — </strong>Reinforcement Learning from Human Feedback<strong> </strong>. As the name says, a human feedback will be used to improve the responses of the Base Model.</p><p>Now let’s deep dive into it’s components:<br>1. Create a Supervised Fine-Tuned (SFT) Model: Start with collecting data. The data should have 2 columns: Prompt and Human Response to that Prompt.</p><p>For example : Prompt (X): “what is RLHF?” <br>Human Response (Y): “RLHF is a post training technique”.</p><p>Once you are done collecting data, start training by calculating log loss or what we call Cross Entropy Loss and Back propagation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8gWFBk52WmQmK4NPQWdbpw.png" /><figcaption>Note: Loss is not computed for prompt tokens (t starts with p+1). The reason being, we don’t want the LLM to learn how to predict the prompt tokens.</figcaption></figure><p>After training on every batch, this will update the weights of the base model to form a model whose response matches with a typical human answers.</p><p>Damn!! You just created a SFT model.</p><p><strong>2. Create a reward model:</strong> For a given prompt, use the SFT model to generate multiple responses. We know that the model can generate a response but the model still doesn’t know which particular answer is better out of these multiple responses right? This is where a human feedback comes into picture. A human(just like my friend Sudeep), will rate these responses for a given prompt and create a preference order.</p><p>For example : Prompt : “I just obtained my driving licence. Help me write a post on LinkedIn”. <br>Response A : “It may seem like a small milestone, but for me it feels special — especially remembering how nervous I was during my first few lessons. From stalling the car to finally driving smoothly through traffic, the journey taught me patience, focus, and confidence.” <br>Response B : “Beyond being a routine milestone, the experience has been a meaningful learning journey. It reinforced the importance of discipline, situational awareness, and staying calm under pressure — lessons that extend well beyond the road”.</p><p>Sudeep, chooses Response A over B. Similarly he will rate many such responses for n different prompts. Now, you have a rich dataset(D2) that consists of n prompts , m responses for each prompt (m is set as 2 in the above example for simplicity) and a preferred response for each of these prompts. What if a model is asked a different prompt in the future? Will it still be able to generate a response which is highly preferred by a human?</p><p>Not yet. So, you train a reward model, which takes a prompt and responses as an input and predicts a “score” for each response. This is similar to the usual prediction we did in machine learning, where we aim to make a model that can predict the score for an unseen data by training it on a dataset (D2).</p><pre>RM scores Response A  →  6.3   (Sudeep&#39;s choice)<br>RM scores Response B  →  2.1   (Sudeep rejected)</pre><p>After the training, we will have a model that can rate the response. Good.</p><p><strong>3. Update SFT model weights </strong>: At this point, we have two models;</p><pre>             (prompt)<br>Model 1 (SFT) -------&gt; Response<br>                      (prompt, response)<br>Model 2 (Reward Model) -----------------&gt; Score</pre><p>Now, our goal is to update the SFT model’s weights so that it generates a response which a human prefers. This weight updation is done by using a concept called as PPO — Proximal Policy Optimization.</p><p>For each response generated by the SFT, use the reward model to score it. The higher the score, higher the chances that the response is liked by a human. Therefore update the weights of SFT, so that the resulting reward score is higher. <br>But wait……</p><p>This creates a problem called as Reward hacking i.e the resulting response may not be informative (even though it’s reward score is higher). For eg : Prompt : “Who is Newton?” <br>Response(if we just used reward score without any constraint) : “Newton is a great amazing talented fantastic person”</p><p>The reason it happens is because, the current approach is trying to exploit the weakness of the reward model instead of actually improving the response quality. <br>Note: In the example above, the response generated sounds verbose yet not meaningful.</p><p>Hence, we need to ensure that the resulting change in the response is not huge compared to it’s original response. In other words, while modeling the optimization function, we need to ensure that response has higher reward score and is not extremely different from the original response.</p><pre>Final Reward(r_t) = Reward Score  -  β × KL(SFT model || current model)</pre><p>Reward Score says “keep it as good as possible”. KL Score says “don’t change much from the original response” and β controls the tradeoff between these two. <br>Note: While calculating KL, we use the initial SFT model also called frozen model and not the one we keep updating in every batch.</p><p>The Final Reward(r_t) is used to calculate L_clip, which in return is used to calculate the L_total (derivations ignored to reduce the complexity of the article). <br>Now, backpropagate to minimize L_total to get the final, stable weights for the SFT model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u7YPmc9X6yM5ojYQ9_dWDQ.png" /><figcaption>RLHF Pipeline</figcaption></figure><p>That’s it!!! If you have reached here, then you have understood the whole pipeline of RLHF.</p><p>I hope I did my best to explain all the concepts involved in this architecture. New blogs on PPO(with maths), DPO, GRPO are on the way. Follow me for more such interesting content. Until then, keep backpropagating to update your knowledge weights!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b86df186facc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My Google Summer of Code 2025 Experience]]></title>
            <link>https://medium.com/@karthiksathishjnv/my-google-summer-of-code-2025-experience-92c1ae9626be?source=rss-4b41f3b4e348------2</link>
            <guid isPermaLink="false">https://medium.com/p/92c1ae9626be</guid>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[google]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[google-summer-of-code]]></category>
            <dc:creator><![CDATA[karthik sathish]]></dc:creator>
            <pubDate>Mon, 22 Sep 2025 17:57:34 GMT</pubDate>
            <atom:updated>2025-09-22T17:57:34.473Z</atom:updated>
            <content:encoded><![CDATA[<p>Back in my first year, like every other computer science enthusiast, I used to admire my seniors who were part of GSoC. I used to hear stories of people dedicating hours choosing the right organization, picking a good project, writing a good proposal and the list goes on…. Fast forward, after a good effort, I was able to clear GSoC in the org Alaska and successfully complete it in my summer break in 3rd year. This blog mainly deals with my entire journey and preparation for the same.</p><p>For someone who is hearing about this program for the first time, GSoC is an annual program organized by Google to encourage open-source contributions among college students and working professionals. In my case, I contributed to the project Bio Block, a platform to buy and sell patient health data in a decentralized way by leveraging blockchain architecture.</p><p><strong>The Start</strong></p><p>This was during January 2025. While scrolling X (former Twitter, I use it for academic purposes 😄), I saw a random tweet by <a href="https://x.com/ayushsh48128093?ref_src=twsrc%5Etfw%7Ctwcamp%5Etweetembed%7Ctwterm%5E1881627836932648960%7Ctwgr%5Ec9f8d097f6d2076f863f60b0252fe0197ddea17f%7Ctwcon%5Es1_&amp;ref_url=https%3A%2F%2Fayush-sharma410.github.io%2FAyush_Portfilio.github.io%2F">Ayush Sharma</a>, who was a GSoC 2024 mentee, regarding his experience. This motivated me to apply for the same this summer. I began with understanding the journey from <a href="https://www.youtube.com/@harkirat1">Harkirat Singh</a>, (a YouTuber and our distinguished alumnus).</p><p>This is a rough timeline of GSoC: <br><strong>Phase 1. </strong>Mentoring organizations (like Alaska) first submit their application to Google (starts from late January).<br><strong>Phase 2.</strong> Google shortlists organizations for that year’s program (will be done by Feb end).<br><strong>Phase 3. </strong>Student applies for a Mentoring organization by submitting their proposal for a project in Google’s portal. The usual deadline for this is end of April.<br><strong>Phase 4. </strong>Org shortlists 1 proposal per each project and sends it to Google, who publishes the result by early weeks of May.<br><strong>Phase 5.</strong> Mentees begin their coding journey from June 1 and ends it by August (for a standard 12-week project).</p><p><em>Org Shortlist Period</em></p><p>One way to stand out from the crowd in Phase 3 (proposal submission),is to start early. Since this is a very competitive program (5% acceptance rate), aspirants start as early as the previous GSoC ends i.e during September. Before writing a proposal for an org, one must spend a good amount of time shortlisting organizations where they wish to contribute this summer, if he/she gets selected. Your previous contributions to an org shows your dedication and effort.</p><p>Note: When I say <strong>contributions,</strong> I mean solving issues listed in the Github repository of an org (ex: <a href="https://github.com/uaanchorage">https://github.com/uaanchorage</a>).</p><p>Once you pick an org, visit their Ideas page where there would be multiple project Ideas for the upcoming GSoC. For example this is the ideas page for Alaska: <a href="https://github.com/uaanchorage/GSoC">https://github.com/uaanchorage/GSoC</a></p><p>Since I was late than other contributors, I chose orgs where there were relatively new projects, where I had a good area of expertise. After a thorough research and interaction with previous GSoC mentees over Linkedin, I finally chose Alaska as an organization and decided to contribute to the project Bio-Block as I had a previous experience with blockchain.</p><p><em>Proposal Submitting Period</em></p><p>I started contributing my ideas in the <a href="https://github.com/bio-block/healthy/discussions/1#discussioncomment-12013295">discussion</a> page of the project. I received good feedback from the org admin regarding my proposed architecture for the project. In the month of March, I started writing my proposal and spent nearly 15–20 days to complete it. The proposal carries the highest weight in your application. I ensured to put my thoughts as clear as possible. Orgs have a specific proposal template which one should follow while writing.</p><p>An aspirant mentions his/her area of expertise and write their solution for the problem which they would like to solve if selected. You are also asked to write the timeline of your proposed solution.You can view my <a href="https://docs.google.com/document/d/1H7zp62qOH00BrA_yJRG1HdI-zBGlthJn-GqZJLToUkk">proposal</a> which landed me this opportunity. This would give you a clear understanding.</p><p>I wrote a 22 page proposal where I included my previous contributions to the org along with all the major details listed above. Once I finished writing the proposal, I asked the mentors of the Bio-Block project to review it before submitting it in the Google’s portal. They corrected some mistakes and asked me to make the required changes.</p><p>You will have the chance to edit your proposal in the portal before the deadline. So, I would recommend you to submit the proposal soon after finishing it.</p><p><strong>The Result Day</strong></p><p>On May 8 2025 11:46 PM IST, I received my results. At that moment,all the work which I did for the past few months made sense.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lRwurvIwJr-YkFAMCnvurA.png" /></figure><p>Once you are shortlisted, you will have 12 weeks to complete your project. You can extend it, if you feel you may require more time than what you initially estimated.</p><p><strong>Benefits</strong></p><p>Apart from the skills you get to learn during GSoC, it comes with a good stipend. The stipend depends on your project length. For more details, you can visit this <a href="https://developers.google.com/open-source/gsoc/help/student-stipends#:~:text=There%20is%20a%20minimum%20(3000,(1650%20USD)%20stipend%20amount."><strong>page</strong></a><strong>. </strong>Additionally, once you successfully complete the project, a GSoC tag will be automatically attached to your application whenever you apply for a full-time role in Google.</p><p><strong>A tip from my end</strong></p><p>In the age of AI, we tend to rely mostly on AI written content and code. From my personal experience, I would recommend you to gain knowledge from these tools and then apply your skills on top of them. Most of the proposals today are written almost entirely using AI and often lack the technical depth that’s required. Simply copy pasting content from AI generated tools is a huge NO. A good mentor evaluating your proposal will not mind your minor spelling/grammar mistakes rather focus more on your understanding of the proposed solution and the effort it took to reach there. <br>Start writing your proposal yourself. It’s a fun journey in itself (just like this blog😜).</p><p><strong>Conclusion</strong></p><p>In my personal experience, getting shortlisted is the most difficult task. But once you do, the journey feels easier. So, if you are targeting for upcoming GSoC, don’t settle down for small setbacks during the application period. Keep working hard!!</p><p>Even if you don’t get shortlisted, no worries at all. In the long run you have learnt something new. Happy coding!!!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=92c1ae9626be" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Brain Network Paper Summary in Simple Words]]></title>
            <link>https://medium.com/@karthiksathishjnv/brain-network-paper-summary-in-simple-words-1a1732338f1d?source=rss-4b41f3b4e348------2</link>
            <guid isPermaLink="false">https://medium.com/p/1a1732338f1d</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[neuroscience]]></category>
            <dc:creator><![CDATA[karthik sathish]]></dc:creator>
            <pubDate>Mon, 14 Apr 2025 04:09:56 GMT</pubDate>
            <atom:updated>2025-04-14T04:09:56.807Z</atom:updated>
            <content:encoded><![CDATA[<p>Namaste friends! Today I want to tell you about this big brain paper I read. It is talking about how to connect animal brain studies with human brain studies in better way. Very interesting topic, no?</p><p>So these scientists are saying we must use “network models” to study brain. What is meaning of network models? Simple — instead of looking at small parts of brain separately, we look at how all parts connect together, like a social network but for brain areas! Just like how we understand a family by seeing relationships between all members, not just by studying each person alone.</p><p>See, the problem is like this only — scientists study mice and monkey brains to learn about human brain problems, but comparing them is difficult. It’s like trying to understand Mumbai traffic by studying Jaipur traffic — same basic idea but different scale! These network models help solve this problem.</p><h3>Types of Brain Networks</h3><p>The paper talks about three types of network things:</p><ul><li>Graph theory: This counts how many connections each brain part has. Like counting how many friends each person has in a group. Some brain parts are very popular with many connections!</li><li>Network control: This shows how brain structure affects brain working. Like how road system controls where cars can go.</li><li>Neural networks: This uses computer to predict brain patterns. Very smart technology, but different from our actual brain networks!</li></ul><p>The good thing is that now we have new machines that can see whole brain activity in animals with very good detail. Earlier we could only see small parts! It’s like going from old black-and-white TV to new 4K television — so much more detail we can see now!</p><h3>Brain Development Studies</h3><p>For brain development, they found that in monkeys, the front parts of visual system develop first, then back parts. Just like building a house — foundation first, then walls!</p><p>They also found that baby brain connections are affected by diet — certain nutrients are very important for proper brain network formation. This is why doctors are always telling pregnant ladies to eat good food, no?</p><p>In small worm called C. elegans (very tiny creature with only 302 neurons!), they watched whole nervous system develop and saw that connections become more organized in groups (modules) as the worm grows up. Some neuron cells that make many early connections are more likely to make new connections later also — like popular children who keep making new friends!</p><h3>Drug Effects on Brain</h3><p>For drug studies, they found that in rats who take nicotine, the connection between two brain parts called “insular-frontal cortex” tells how addicted they will become. Same thing happens in humans who smoke cigarettes!</p><p>The most interesting thing is they could show that weak connection between “cingulate” and “striatum” brain regions is result of nicotine addiction, not the cause. This means these brain changes happen after you become addicted, not before! Very important for understanding addiction cycle.</p><p>They also discovered something surprising about dopamine (happy chemical in brain) — when they increased OR decreased dopamine, both actions reduced brain connectivity. This means brain needs just right amount of dopamine — not too much, not too little. Like salt in cooking — correct amount is necessary!</p><h3>Mental Health Findings</h3><p>For depression, they discovered that it’s not just one brain part having problem, but the whole network of connections is different. In mice, they could predict which ones would become depressed after stress by looking at their brain networks.</p><p>A fish study (zebrafish) found special brain part called “habenula” helps with handling stress. When this part works properly, the fish (and maybe humans too!) can better handle difficult situations.</p><p>The scientists are now saying we should stop thinking about mental problems as separate boxes (like depression OR anxiety) and instead look at symptom networks that go across different conditions. This is big change in psychiatry thinking! Some people might have similar brain network problems but different symptoms.</p><h3>Brain Disease Spread</h3><p>For brain diseases like Alzheimer’s, they showed how bad proteins spread through brain following connection paths, like how virus spreads through contact network. This helps predict which brain parts will become sick next.</p><p>They did clever experiment where they injected small amount of bad tau protein (which causes problems in Alzheimer’s) into one spot in mouse brain, then watched how it spread. The spreading followed brain connections, especially in backward direction (from receiving end to sending end of neurons).</p><p>They also found that special brain cells called “microglia” (brain’s cleaning staff) can affect how quickly tau protein travels between brain regions. One gene called TREM2 makes tau build up less in one spot but spread more to other areas — like sweeping dust under different carpets!</p><p>When they used network models from these animal studies and applied to human brain scans, they could predict pattern of brain shrinkage in human patients! This shows these network models really work across species.</p><h3>Why This Research is Important</h3><p>These network approaches are like building bridge between tiny cell studies and whole brain understanding. Without this bridge, we are just collecting facts without seeing big picture!</p><p>In India, we have saying “can’t see forest for the trees” — means focusing too much on small details and missing bigger pattern. Network science helps see both trees AND forest together.</p><p>For doctors treating brain diseases, this research is giving new ways to find which brain connections to fix. Instead of just giving medicine that affects whole brain (causing many side effects), future treatments might target specific network connections or cell types.</p><h3>Future Directions</h3><p>For future, the scientists are saying we should make models that connect different types of brain data — from single cells to whole brain scans. This is like having translators who can convert between different languages.</p><p>They want to make multi-layer networks — imagine stack of transparent papers, each showing different aspect of brain (cells, connections, activity patterns). By looking through all papers together, we get complete picture!</p><p>Another exciting thing they mention is using artificial intelligence (graph neural networks) to help translate findings between species. The computer can learn which mouse brain parts correspond to which human brain parts, even when they look different.</p><p>They also say network models could help design better brain stimulation treatments. These treatments use small electrical pulses to help in depression, Parkinson’s disease, and other conditions. Network models can tell doctors exactly where to stimulate for best results!</p><h3>Final Thoughts</h3><p>Overall, I am thinking this network approach is like building a bridge between animal studies and human studies. Very clever idea, isn’t it? Maybe this will help doctors find better treatments for serious brain problems.</p><p>The paper shows how mathematics and biology can work together to solve health problems. Sometimes in science, the tool (network modeling) is as important as the microscope or scanner!</p><p>I am remembering what my old professor used to say — “in biology, connection is everything.” This network approach is proving how right he was! From genes to cells to brain regions to behavior — everything is connected.</p><p>What you people think about this research? Interesting, na? Do you think these network ideas will help your family members with brain problems?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1a1732338f1d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bring In A Change By Chaining…..]]></title>
            <link>https://medium.com/@karthiksathishjnv/bring-in-a-change-by-chaining-f86bf80adc71?source=rss-4b41f3b4e348------2</link>
            <guid isPermaLink="false">https://medium.com/p/f86bf80adc71</guid>
            <category><![CDATA[blockchain-technology]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[web-3-point-0]]></category>
            <category><![CDATA[blockchain-development]]></category>
            <dc:creator><![CDATA[karthik sathish]]></dc:creator>
            <pubDate>Tue, 03 Oct 2023 12:28:18 GMT</pubDate>
            <atom:updated>2023-12-05T06:01:57.405Z</atom:updated>
            <content:encoded><![CDATA[<p>Ever since I joined my college, I was wondering about this hot topic (which used to be the part of our gossip in school days). And a big Yes, if you are guessing it right. It’s Blockchain !!!!!!!</p><p>I started collecting information from various resources and these are some of my insights regarding blockchain, which might help you in giving a clearcut idea of what actually it is.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/1*tmiA8b76znqJROiLKCUZdw.png" /></figure><p>In today’s digital age, blockchain technology has emerged as one of the most transformative innovations, disrupting traditional industries and revolutionizing the way we conduct transactions, share information, and secure our data. At its core, blockchain is a decentralized and distributed ledger technology that has the potential to change the way we interact with the world.</p><blockquote><strong>Understanding Blockchain</strong></blockquote><p>At its simplest, a blockchain is a chain of blocks, where each block contains a record of transactions. What makes it unique is the way it stores and secures these records. Instead of a central authority like a bank or government, blockchain relies on a decentralized network of computers (nodes) to validate and record transactions. This distributed nature of blockchain ensures transparency and security.</p><blockquote><strong>How Does Blockchain Work?</strong></blockquote><p><strong>Decentralization</strong>: First things first, blockchain operates on a decentralized network, meaning no single entity has control over the entire system. This decentralization contributes to greater security and trust in the network.</p><p><strong>Cryptographic Security</strong>: Transactions on the blockchain are secured using advanced cryptographic techniques, making it nearly impossible for unauthorized parties to alter or hack the data.</p><p><strong>Consensus Mechanisms:</strong> Blockchain networks rely on consensus mechanisms, such as Proof of Work (PoW) or Proof of Stake (PoS), to validate transactions and add them to the chain. This consensus ensures that all nodes agree on the state of the ledger.</p><p><strong>Immutability:</strong> Once a transaction is added to a block and confirmed by the network, it becomes practically irreversible, adding an element of immutability to the ledger.</p><blockquote><strong>Applications of Blockchain</strong></blockquote><p>Blockchain technology has found applications in various industries:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/567/1*nEGu2Bl5yLLTfDUhJGawbg.png" /></figure><p><strong>Cryptocurrencies:</strong> Yes , you are on track. Bitcoin, the first cryptocurrency, operates on a blockchain, allowing for secure and transparent peer-to-peer transactions without the need for intermediaries.</p><p><strong>Supply Chain Management:</strong> Blockchain is used to trace the origin and journey of products, ensuring authenticity and quality. This is particularly valuable in the food and pharmaceutical industries.</p><p><strong>Smart Contracts:</strong> Smart contracts are self-executing agreements with the terms directly written into code. They automatically execute and enforce contracts when predetermined conditions are met.</p><p><strong>Voting Systems:</strong> Blockchain can be used to create secure and tamper-proof voting systems, ensuring fair and transparent elections.</p><p><strong>Healthcare: </strong>Patient records can be securely stored on a blockchain, allowing authorized healthcare providers access to crucial medical information while maintaining patient privacy.</p><p><strong>Real Estate: </strong>Blockchain simplifies property transactions by eliminating the need for intermediaries and ensuring the legitimacy of titles and deeds.</p><p><strong>Cross-border Payments: </strong>Blockchain enables faster, cheaper, and more transparent cross-border payments and remittances.</p><p><em>Ohhh!!! Lot of theory right? To cheer you up, let me tell you a small secret. Despite of the fact that blockchain has a huge application in real world, the founder of blockchain still remains a mystery!!!!!!! People know the person by name - SATOSHI NAKAMOTO</em></p><blockquote><strong>Challenges and Concerns</strong></blockquote><p>While the potential of blockchain is vast, it also faces several challenges and concerns:</p><p><strong>Scalability:</strong> The process of validating transactions and adding them to the blockchain can be slow and resource-intensive, especially for larger networks like Bitcoin.</p><p><strong>Regulation:</strong> The evolving regulatory landscape presents challenges for blockchain technology, as governments grapple with how to oversee and tax blockchain-based transactions.</p><p><strong>Energy Consumption: </strong>Proof of Work (PoW) blockchains, like Bitcoin, require significant energy to validate transactions, leading to environmental concerns.</p><p><strong>Privacy: </strong>While blockchain transactions are secure, concerns around privacy persist. Striking a balance between transparency and privacy is an ongoing challenge.</p><p><strong>Interoperability: </strong>As multiple blockchains coexist, interoperability between them becomes crucial for a seamless exchange of assets and information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I9nMYhWYW5e10gm932dTXA.png" /></figure><blockquote><strong>The Future of Blockchain</strong></blockquote><p>Despite these challenges, the future of blockchain technology looks promising. As scalability and energy efficiency solutions are developed, blockchain will continue to evolve and disrupt industries. It has the potential to create more secure, efficient, and transparent systems, from financial services to supply chain management.</p><h3><strong>In Conclusion</strong></h3><p>Blockchain technology is more than just a buzzword; it’s a fundamental shift in how we manage and share information. With its decentralized, secure, and transparent nature, blockchain holds the promise to transform industries and redefine how we interact with the digital world. While challenges exist, innovation and adoption continue to drive this technology forward, ensuring that its impact will be felt for years to come. Whether you’re a technology enthusiast or a business professional, understanding blockchain is increasingly essential in today’s world.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f86bf80adc71" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[NEURAL NETWORKS]]></title>
            <link>https://medium.com/@karthiksathishjnv/neural-networks-2ad43fe2f234?source=rss-4b41f3b4e348------2</link>
            <guid isPermaLink="false">https://medium.com/p/2ad43fe2f234</guid>
            <category><![CDATA[neural-networks]]></category>
            <category><![CDATA[network]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[artificial-neural-network]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[karthik sathish]]></dc:creator>
            <pubDate>Mon, 03 Apr 2023 14:40:28 GMT</pubDate>
            <atom:updated>2023-04-03T14:40:28.879Z</atom:updated>
            <content:encoded><![CDATA[<p>Ever wondered how does ChatGPT work? Ever thought of what makes it produce a human-like language? Well, the answer to all this fascinating questions just lies in a two-word process!!!</p><p>Yes, you are right, it’s <strong>neural network.</strong></p><p>Just go through the small conversation below:</p><p>“Maa, what is this stuff? Isn’t it brown in color? Is it a chocolate? Can I taste it?” asks Sakshi, a 2-year old child, curiously to her mother Uma ,pointing a heap of clay in the garden. The mother, who is busy in her own work, replies calmly-“No child, neither it’s a chocolate nor it’s meant for eating. Come here! Have some food”. Feeling hard to digest the words of her mother, poor Sakshi starts to move in the direction of the heap, to taste the mysterious clay .Fortunately, her mother sees this act and rushes towards her child. Standing in front of the child and staring at her eyes, she says angrily “Didn’t I just refuse you from eating this thing? If you repeat this again, I will call the devil and order him to take you. Did you understand ?”. “Okay Maa” answers cute little Sakshi, her eyes filled with tears. From then on, Sakshi never tried to taste the clay and didn’t even have a glance at the heap!!!!!</p><p>This is just a small conversation between a mother and her child, wherein some sort of information is being shared to the child ,who is unaware of the difference between eatables and non-eatables. Basically, the mother is <strong>training </strong>the child to bring in the <strong>desired</strong> <strong>outcome(</strong>i.e<strong> </strong>not to eat the clay<strong>).</strong></p><p>Similarly <em>neural network</em> is an algorithm used to train the Artificial Intelligence to bring desired outputs, just as in the case of ChatGPT and several other AI based technologies like robots, self-driven cars and so on.</p><p>Now, let us look at the vast application of neural network in the field of Artificial Intelligence. But wait!! Without even understanding it’s working mechanism, there is no use in knowing it’s application. So, better we understand it’s working first.</p><p><strong>HOW DO NEURAL NETWORKS WORK?</strong></p><p>A neural network is an algorithm which works more or less similar to the neurons in our brain. In fact, it is a model inspired by the working of the human brain!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/1*23mesIcLtKQyGd_0W3wusA.png" /><figcaption><strong>Fig-1 BIOLOGICAL NEURON</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/826/1*NkfjVQTBb9ZC7wOt98rgHQ.png" /><figcaption><strong>Fig-2 ARTIFICIAL NEURON</strong></figcaption></figure><p>Observe that both the biological neuron and the artificial neuron(also called as perceptron) has similar basic structure i.e INPUT — — — — →PROCESS(MODULATION) — — — — →OUTPUT.</p><p>There are two types of perceptron:</p><ol><li><strong>Single layer perceptron</strong>: It is a basic model of perceptron, which consists of an input layer and an output layer with no other layers in between. For example the above figure (fig-2) is a single layer perceptron.</li><li><strong>Multi layer perceptron:(Single layer perceptron+ hidden layers)</strong> It consists some hidden layer in between the input layer and output layer. The below picture represents a multi-layer perceptron:</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*ESXFzA1hU_SVpZVj.png" /><figcaption><strong>Fig-3 Multi-layer perceptron with 2 hidden layers</strong></figcaption></figure><p>Looking at the figure above(fig-3), you might have started asking yourself: What on earth are those blue squares, circles of various color doing here???</p><p>Well, those are called as <strong>nodes</strong>.</p><p>Now, let us dive deep into the network!!! <em>chill</em></p><p>Think of a general case of a network having <strong>t</strong> layers. Each layer is made up of several nodes. Let <strong>p∈[1,t-1], </strong>where p<strong> </strong>is an integer and<strong> n</strong> be the total number of nodes in <strong>p </strong>th layer.</p><p>Consider the four steps given below:</p><p>1.Each node in <strong>p</strong> th layer has a variable(<em>input</em>) <em>x</em>ᵢ (0&lt;<em>x</em>ᵢ&lt;1) ,where i denotes the<strong> i </strong>th node of the <strong>p</strong> th layer, which stores the input information.</p><p>2.Each node of<strong> p+1 </strong>th layer is linked with the nodes of it’s pre<em>ceding (</em><strong><em>p</em></strong><em> th)layer </em>and vice-versa.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/406/1*0lbxdj3n6RSlXoxuRuekeA.png" /><figcaption><strong>Fig-4 Nodes of the input layer is been linked with j th node of the second layer.</strong></figcaption></figure><p>3.Each link or connection is assigned a weight <em>w</em>ᵢⱼ .Larger weights signify that particular variables(<em>inputs</em>) are of greater importance to the decision or outcome.</p><p><em>The value of a node(xᵢ) of </em><strong><em>p</em></strong><em> th layer is called as </em><strong><em>input</em></strong><em> whereas, the value of a node (yⱼ) of </em><strong><em>p+1 </em></strong><em>th layer is called </em><strong><em>output</em></strong><em>. The value of a node represents the amount of information it contains.</em></p><p>4.The <em>output(</em>yⱼ<em>) </em>at<em> </em><strong>p+1</strong> th layer are determined by the connections from the <em>inputs </em>in<em> </em><strong>p </strong>th layer (<em>sounds natural right?</em>).Calculations involved are discussed later.</p><p>For <strong>p =</strong> 1, the <em>inputs</em> are determined by the input information like image of cat, sound of ultrasonic sound and so on.</p><p>When once, all these four steps are completed, <strong>p</strong> gets incremented by one and again, these steps are repeated.</p><p><strong>NOTE: All those outputs before the incrementation of p, now becomes inputs when p is increased by one.</strong></p><p>This continues from <strong>p = 1 </strong>to <strong>p = t-1 </strong>. We will get the final output, when these steps are completed for<strong> p = t-1.</strong></p><p>Oopphh! Too bored of reading all this theory stuff. Isn’t it ? Lets involve some math for a while; calculations involved in step 4 are as given below :</p><p>All inputs(xᵢ) are multiplied by their respective weights(wᵢ) and then summed:</p><p>→<strong>k = Σwᵢⱼxᵢ+b = w₁ⱼx₁ + w₂ⱼx₂+ w₃ⱼ x₃ +……….. wₙⱼxₙ + b</strong>, where <strong>b </strong>stands for bias. We will discuss more about bias a bit later.</p><p>Since the value of wᵢ is not restricted to be between any two numbers, the value of k may be anything between -∞ to +∞ .But <strong>yⱼ∈(0,1), </strong>as output becomes input in the next iteration and we know that input<strong> </strong>should belong to the region <strong>(0,1).</strong>So we need a function, by using which we can generate the <em>output</em> that lies between 0 and 1.</p><p>Such a function is called <strong>activation function</strong></p><p>→ <strong>yⱼ=</strong>f(k)<strong>∈(0,1)</strong>;where f is the activation function.</p><p>Well, there are many types of activation function, but for the time being let us use the sigmoid function:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/355/1*fAPc8eS2Myc4TTqaj55q9A.png" /><figcaption><strong>S(x) is a sigmoid function</strong></figcaption></figure><p>Not all the nodes of<strong> p+1 </strong>th layer gets activated or will start to store information. If and only if the output exceeds a given <strong>threshold</strong>, it “fires” (or activates) the node, passing data to the next layer in the network. For example, in the below graph, for all those value of z(in our case, it is k) which is greater than 0,the node is been activated, which means 0 is the threshold .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*8fuElN8Ild3b7GvD" /></figure><p>Now comes the award winning question!!!</p><p>How to set the threshold, some number other than zero?</p><p>This is where bias comes into picture. In simple words, bias can be defined as the constant which is added to the product of inputs and weights. It is used to offset the result. It helps the models to shift the activation function towards the positive or negative side in the same way as we add constant c to the equation y=mx to move the straight line up and down by c units.</p><p>NOTE: If threshold is r, then bias b = -r;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/1*sRdprY8QC2i8cdWuV_twfw.png" /><figcaption><strong>Graph of sigmoid function for different value of bias.</strong></figcaption></figure><p>From the above graph, it can be concluded that the bias is required for shifting the origin of the curve to the left or right.</p><p>The same process repeats until the output layer, where we get the final<em> output</em>. We would be delighted to get the desired output, but what if the final <em>output </em>turns out to be an undesired one!!! Don’t you think all these process and algorithms we had done so far, was good for nothing?</p><p>Cool! To resolve this issue, neural network has adopted a methodology called as <strong>BACK PROPAGATION. </strong>Here, is a basic understanding of back propagation:</p><p>Do you remember the conversation between the mother and her child that we saw in the beginning of this blog? Some of the key events were:</p><ol><li>The mother orders her child not to eat the clay- <strong>order</strong></li><li>But, the child does not follow the order -<strong>not followed</strong></li><li>The mother is furious this time and scolds her child- <strong>order+ scolding</strong></li><li>The child follows her mother’s order- <strong>followed</strong></li></ol><p>Let us sum up this way:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*ckp32BbWvL4elvA_hZn5_g.png" /></figure><p>Observe that in trial 1, i.e the mother didn’t get the desired output( desired output was to <strong>follow</strong> the command), so she focused more on the input in second trial i.e she gave higher <em>importance to the input </em>this time. Wait! — <em>importance to the input — -</em>it seems like you have gone through this term in the blog right? Think of it… Remember…..Don’t give up….. Yessss!!!</p><p>It is the <em>weight</em> which indicates the importance of the input. Therefore, the key takeaway message is: making a change in weights, will change the output. Increase or decrease in weights, in order to bring in a desired output, with the help of previous output is called as<strong> back-propagation.</strong></p><p>Do check out the math involved in back-propagation, by browsing the link below:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FtUoUdOdTkRw%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DtUoUdOdTkRw&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FtUoUdOdTkRw%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/032788992701ad09f62c8f640d48c356/href">https://medium.com/media/032788992701ad09f62c8f640d48c356/href</a></iframe><p>Since we have gone through the working of neural network, now we are in a position to look at the various application of neural network.</p><p><strong>APPLICATION OF NEURAL NETWORK</strong></p><p>Neural networks can be applied to a broad range of problems and can assess many different types of input, including images, videos, files, databases, and more. They also do not require explicit programming to interpret the content of those inputs.</p><p>Because of the generalized approach to problem solving that neural networks offer, there is virtually no limit to the areas that this technique can be applied. Some common applications of neural networks today, include image/pattern recognition, self driving vehicle trajectory prediction, facial recognition, data mining, email spam filtering, medical diagnosis, and cancer research. There are many more ways that neural nets are used today, and adoption is increasing rapidly.</p><p><strong>CONCLUSION</strong></p><ol><li>Today, we gained some knowledge on neural network; the heart of deep learning, mainly the working part.</li></ol><p><strong>WORDS OF THE AUTHOR</strong></p><p>Hey, thanks for spending your precious time in reading this article. I am pretty sure that, you are now in a position to explain your friends, peers about the working of neural network. In order, to get similar updates and master in the field of deep learning I would recommend you to follow DSG’s and VLG’s medium page. I have attached the link for the page below:</p><ul><li><a href="https://medium.com/data-science-group-iitr/why-dsg-why-not-something-else-6d428baedc78">Why DSG. Why not something else.</a></li><li><a href="https://medium.com/@vlgiitr18">VLG IITR - Medium</a></li></ul><p><strong>References</strong></p><ul><li><a href="https://www.turing.com/kb/necessity-of-bias-in-neural-networks">Importance of Neural Network Bias and How to Add It</a></li><li><a href="https://www.javatpoint.com/artificial-neural-network">Artificial Neural Network Tutorial - Javatpoint</a></li><li><a href="https://www.analyticsvidhya.com/blog/2021/03/basics-of-neural-network/">Neural Network | Introduction to Neural Network | Neural Network for DL</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2ad43fe2f234" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>