<?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 Shriji Agarwal on Medium]]></title>
        <description><![CDATA[Stories by Shriji Agarwal on Medium]]></description>
        <link>https://medium.com/@shriji205?source=rss-1c5f0aebe1f6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*CYSb8Wpag7PF75-4ik9DQQ.png</url>
            <title>Stories by Shriji Agarwal on Medium</title>
            <link>https://medium.com/@shriji205?source=rss-1c5f0aebe1f6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 13:19:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shriji205/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[Architecture of Node.js]]></title>
            <link>https://medium.com/@shriji205/architecture-of-node-js-1024f8c926c3?source=rss-1c5f0aebe1f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/1024f8c926c3</guid>
            <category><![CDATA[asynchronous]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Shriji Agarwal]]></dc:creator>
            <pubDate>Sat, 18 Jul 2026 14:17:38 GMT</pubDate>
            <atom:updated>2026-07-18T14:17:38.460Z</atom:updated>
            <content:encoded><![CDATA[<p>Here is your complete, comprehensive set of notes on Node.js architecture with the new details seamlessly integrated into the flow:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X9SVjAqnws_ecJGs1giq2A.png" /></figure><h3>Architecture of Node.js: How It Works Internally</h3><p>The entire execution flow starts with the client, who makes a request to a server. This request is first stored in the <strong>Event Queue</strong>.</p><p>Behind the scenes, Node.js uses two core building blocks to handle these requests:</p><ol><li><strong>Google V8 Engine:</strong> Translates and runs your JavaScript code.</li><li><strong>Libuv (C++ Library):</strong> A specialized library that provides and manages the <strong>Event Loop</strong>, the <strong>Thread Pool</strong>, and all asynchronous background operations.</li></ol><h3>The Event Loop and the Event Queue</h3><p>Next, the request goes to the <strong>Event Loop</strong>. The Event Loop runs on a single thread (the main thread) and constantly watches the Event Queue. It picks up incoming requests one by one and determines what kind of operation it is handling: a blocking operation (sync) or a non-blocking operation (async).</p><h3>Blocking Operations (Sync) and the Thread Pool</h3><p>When the Event Loop encounters a blocking operation, it offloads the task to the <strong>Thread Pool</strong> so the main thread doesn’t freeze.</p><ul><li><strong>The Thread Pool:</strong> This is a collection of worker threads managed by Libuv. It is primarily used for heavy, local computational tasks like File System (fs) operations, hashing, or cryptography.</li><li><strong>The Worker Allocation:</strong> The request is assigned to an available thread. Once the work is done, the thread passes the result along and returns to the pool.</li><li><strong>The Limitation:</strong> By default, the Thread Pool only has 4 threads available. While this can be configured, it is ultimately limited by the machine’s physical CPU cores.</li></ul><h3>Non-Blocking Operations (Async) and the OS Kernel</h3><p>For non-blocking operations — specifically <strong>Network Requests</strong> (like handling incoming HTTP traffic or fetching data from an external API) — Node.js does not use the limited Thread Pool at all.</p><p>Instead, it delegates the task directly to the underlying <strong>OS Kernel</strong>. Modern operating systems are highly efficient at managing multiple network connections at the kernel level. This smart separation allows Node.js to handle thousands of concurrent network connections effortlessly without exhausting its threads.</p><h3>The Major Difference &amp; The Callback Queue</h3><p>The core difference between the two tracks comes down to execution flow and timing:</p><ul><li><strong>Blocking operations</strong> halt the execution of any subsequent JavaScript code until the result is completely returned from the thread pool.</li><li><strong>Non-blocking operations</strong> allow the main thread to keep compiling and executing further code immediately while the task runs quietly in the background.</li></ul><p>When an asynchronous task (whether handled by a worker thread or the OS Kernel) finishes its job, it doesn’t immediately interrupt what the main thread is doing. Instead, its corresponding <strong>Callback Function</strong> is placed into the <strong>Callback Queue</strong>.</p><p>The Event Loop continuously monitors the main execution thread. The absolute moment the main thread becomes completely empty and finishes executing the initial script, the Event Loop pulls the callback function from the Callback Queue and executes it, delivering the final answer to the application.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1024f8c926c3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Full-Stack Learner’s Journal: Mastering Node.js]]></title>
            <link>https://medium.com/@shriji205/the-full-stack-learners-journal-mastering-node-js-e028470fe69d?source=rss-1c5f0aebe1f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/e028470fe69d</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[full-stack]]></category>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Shriji Agarwal]]></dc:creator>
            <pubDate>Sat, 18 Jul 2026 12:06:49 GMT</pubDate>
            <atom:updated>2026-07-18T12:45:29.825Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>What is Node.js?</strong></p><p>Originally, JavaScript was designed to run only inside a web browser. To change this, a developer named Ryan Dahl took Google Chrome’s V8 JavaScript engine and combined it with C++ to create Node.js. This environment allows developers to run JavaScript on the server side. To execute a file, you simply type node filename.js in your terminal.</p><p><strong>NPM and Browser Limitations</strong></p><p>Node Package Manager (npm) comes pre-installed with Node.js and is used to manage third-party packages. When you run npm init in your terminal, it initializes a new project and generates a package.json file to keep track of your dependencies.</p><p><em>Note: Because Node.js runs on a server and not in a browser, browser-specific features like the DOM and </em><em>window.alert() will not work.</em></p><p><strong>Modular Programming</strong></p><p>Node.js relies heavily on modular programming — the practice of breaking a large codebase down into smaller, reusable files (modules) to make development easier. While Node has many built-in modules, you will often create your own.</p><p><strong>Exporting and Importing</strong></p><p>By default, functions you write inside a file (like math.js) are private. To use them in another file, you must export them using module.exports or exports. If you have more than one function, you can group them into a single object and export them all at once.</p><p>To use that module in your main file (like index.js), you import it using the require() function. It is important to include ./ (e.g., require(&#39;./math&#39;)) so Node.js knows to look for the file in your current directory. If you leave out the ./, Node will search for an installed npm package instead.</p><h4>File Handling and Creation</h4><p>File handling means doing operations on a file, like creating or reading it. All of these things cannot be done in normal JavaScript but in Node.js, we have a special fs module to read, write, delete, and append files..</p><h4>Creating Files</h4><p>To create a file we use fs.writeFileSync(&quot;./filename.txt&quot;, &quot;hello world&quot;). For async, we use fs.writeFile(&quot;./filename.txt&quot;, &quot;hello world async&quot;, (err)=&gt;{}).For backend development, we should have clarity between blocking and non-blocking functions, also called sync and async.</p><h4>Reading Files</h4><p>Now, to read a file, we use the function const result = fs.readFileSync(&quot;./filename.txt&quot;, &quot;utf-8&quot;) to show all the data from the file in the terminal. Sync functions return the result directly, but async functions do not return a result; they always expect a callback.</p><h4>Appending and Log Files</h4><p>To append a file, we use fs.appendFileSync(&quot;./text.txt&quot;, &quot;something to do or append, you can put dates&quot;). This does not overwrite the file; it just appends the data. We can use this to make a log file where we can store the IP address of a person, what they have searched, and other details like the date and time.</p><h4>Additional File Operations</h4><p>There are also functions like fs.statSync. We have many functions like this in the module.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e028470fe69d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Where RAG Fails: Understand the Limitations]]></title>
            <link>https://medium.com/@shriji205/why-vectorless-rag-is-the-future-of-document-q-a-893a3cd63958?source=rss-1c5f0aebe1f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/893a3cd63958</guid>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[rags]]></category>
            <dc:creator><![CDATA[Shriji Agarwal]]></dc:creator>
            <pubDate>Sun, 12 Jul 2026 09:23:57 GMT</pubDate>
            <atom:updated>2026-07-17T17:18:46.709Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mmHRjo6kwyCXIMyPSYtliQ.png" /></figure><p>Large Language Models (LLMs) are trained by big companies. We can’t train the data ourselves. Each LLM has a last training time called the <strong>knowledge cutoff</strong>. This is the date and time up to which the LLMs are trained. Even in the worst-case scenario, this cutoff could be 12 hours ago.</p><p>Okay, now let’s say we want to give our own data to the LLMs so we can do a Q&amp;A.</p><h3>The Problem with Large PDFs</h3><p>If your PDF is large — like more than 150 pages — you can’t just give it all to the AI. If you try, you may face a few problems:</p><ul><li><strong>The context window may exceed:</strong> The AI simply cannot process that much text at once.</li><li><strong>It might be very costly:</strong> Processing huge amounts of text gets expensive.</li><li><strong>Generic answers:</strong> The AI will lose focus, and the answers will not be focused.</li><li><strong>Hallucination:</strong> The AI might get confused and start making things up.</li></ul><p>Therefore, we use <strong>RAG (Retrieval-Augmented Generation)</strong>.</p><h3>What is Traditional RAG?</h3><p>Basically, RAG is giving the AI additional data on which it is not trained, and asking Q&amp;A on that.</p><p><strong>Common Scenarios Where RAG Works Well</strong></p><p>RAG isn’t just for reading large PDFs. It shines in many real-world scenarios where quick access to specific information is critical. For example, companies use RAG for internal wikis so employees can instantly find HR policies or technical docs. It is also heavily used in customer support chatbots that need to search through thousands of product manuals, or by legal and medical professionals to quickly pull exact clauses from massive databases.</p><p>In RAG, we have two main parts: the <strong>indexing</strong> part and the <strong>query</strong> part. Let’s go with the indexing part first.</p><p>In indexing, the PDF is first converted into smaller pieces called <strong>chunks</strong>. We have options for chunking:</p><ul><li>Paragraph by paragraph</li><li>Page by page</li><li>Setting a fixed context window (for example, a size of 500 words)</li></ul><p><strong>The Query Part</strong></p><p>Now, what happens on the query side? When a user asks a question, that question is also converted into a format the computer understands (a vector). The system searches through our indexed chunks to find the ones that are most similar to the user’s question. It takes those matching chunks, attaches them to the user’s original prompt as context, and gives it all to the LLM. The LLM then reads this specific context and generates a precise answer.</p><p><strong>The Flaw in Traditional RAG</strong> Traditional RAG works on <em>similarity</em>, but it has two big issues:</p><ol><li><strong>Broken Context:</strong> If we use a fixed size (like 500 words), it is possible that half of your content is in one context window and the other half goes into the other window. In this case, the connection between the chunks is lost.</li><li><strong>Bad Queries:</strong> It could be possible that the user’s query does not match with the chunks in the document. If the query is not good, we might not get the correct answer.</li><li><strong>Hallucinations Even With RAG:</strong> While RAG was built to fix AI confusion, hallucinations can still happen <em>even with</em> RAG. This usually occurs when the retrieval step fails. If the system pulls the wrong chunk, or if the pulled chunk doesn’t have enough surrounding context, the LLM is left guessing. It will confidently try to connect the dots using that bad or incomplete data, resulting in an answer that sounds correct but is completely made up.</li><li><strong>Keeping Knowledge Bases Up to Date:</strong> Data is rarely static. One big challenge with RAG is keeping your knowledge base up to date. If your original PDF or company data gets a new version, you can’t just leave the old data sitting in the database. You have to design your system to track changes, delete old chunks, and re-index the updated documents. Otherwise, your AI will confidently give users outdated information.</li></ol><h3>The Solution: Vectorless RAG</h3><p>To fix these problems, we come to <strong>Vectorless RAG</strong>.</p><p>Instead of just relying on semantic data and matching similar words, Vectorless RAG uses a <strong>reasoning model</strong>. Here is how it works:</p><ul><li>It builds a <strong>hierarchical Table of Contents (ToC) tree</strong> of the document.</li><li>Traditional RAG works on similarity, but Vectorless RAG works on <strong>reasoning</strong>.</li><li>In this model, we don’t have any fixed chunk size or window size.</li></ul><p>Because it doesn’t just blindly cut documents into fixed chunks, the AI actually understands the structure of the data. It reasons through the Table of Contents to find the exact right information, giving you focused and correct answers every time.</p><h3>When RAG is Not the Right Solution</h3><p>Finally, RAG is not a magic bullet for everything. If your document is very small (like a 2-page report), building a whole RAG pipeline is overkill — just paste it directly into the AI’s prompt! Also, RAG only helps with <em>knowledge</em>. If you want the AI to learn a specific writing style, adapt to your brand’s tone of voice, or learn entirely new behaviors, RAG won’t help. For that, you need to fine-tune the model itself.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=893a3cd63958" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Generative AI: How LLMs Work Behind the Scenes]]></title>
            <link>https://medium.com/@shriji205/understanding-generative-ai-how-llms-work-behind-the-scenes-a88f6bda21a7?source=rss-1c5f0aebe1f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/a88f6bda21a7</guid>
            <category><![CDATA[chatbots]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[genrative-ai]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Shriji Agarwal]]></dc:creator>
            <pubDate>Wed, 01 Jul 2026 09:15:22 GMT</pubDate>
            <atom:updated>2026-07-01T09:42:41.837Z</atom:updated>
            <content:encoded><![CDATA[<p>Generative AI is changing the way we interact with technology. Millions of people use AI tools every day, but very few know what actually happens behind the scenes. In this blog, I’ll explain some of the core concepts of LLMs in a simple and beginner-friendly way.</p><p>LLM (Large Language Model) is an AI model trained on massive amounts of text to understand and generate human language. It solves tasks such as question answering, content writing, translation, summarization, and coding. Popular examples include GPT, Claude, Gemini, Llama, and DeepSeek. Today, LLMs power chatbots, virtual assistants, search engines, coding tools, customer support, and many other everyday AI applications.</p><p>I like to think of Generative AI as having two major parts: Application Development and AI Engineering. Imagine a restaurant. The dining area, chairs, menu, and customer experience represent application development because that’s what customers interact with. The kitchen, where the actual cooking happens, represents AI engineering. Similarly, applications like ChatGPT are the products users interact with, while the LLM working behind them is the real engine.</p><p>One thing I found interesting is the naming. ChatGPT and OpenAI are simple names that immediately give people an idea that they are related to Artificial Intelligence. On the other hand, if someone from a non-technical background hears a name like Claude, they may not immediately recognize that it is an AI model.</p><p>Now let’s understand how an LLM works.</p><p>The first stage is pre-training. During this phase, the model learns from a massive amount of data, including books, websites, research papers, and programming code. This is where the Pre-trained part of GPT (Generative Pre-trained Transformer) comes from.</p><p>When we send a prompt to an LLM, the first step is tokenization. Since computers cannot understand human language directly and can only process numbers, the input text is first broken down into smaller units called tokens. Every LLM has its own vocabulary, which is the collection of tokens it recognizes. Depending on the tokenizer, a single word may even be split into multiple tokens before being processed by the model.</p><p>Next comes token embedding, where every token is converted into a mathematical vector. Tokens with similar meanings are placed close to each other in a vector space, allowing the model to understand relationships between words rather than treating them as plain text.</p><p>After that, positional embedding is added. This tells the model the position of every token in the sentence. This is important because sentences like “Dog bites man” and “Man bites dog” contain almost the same words but have completely different meanings. Position helps the model understand this difference.</p><p>The token embedding and positional embedding are combined to form the input embedding, which is then passed into the Transformer.</p><p>The breakthrough behind modern LLMs came from the 2017 research paper <strong>“Attention Is All You Need” </strong>written by researchers at <strong>Google</strong>.Before this paper, AI models such as RNNs processed text one word at a time, making it difficult to capture long-range relationships and limiting parallel processing. The paper introduced the Transformer architecture, whose core innovation was self-attention a mechanism that allows every token to interact with other relevant tokens in a sentence to better understand context. This made training significantly faster and more efficient, and today the Transformer serves as the foundation for models like GPT, BERT, Claude, Gemini, and many other modern AI systems.</p><p>The attention scores are then converted into probabilities using Softmax, helping the model decide how much attention each token deserves. The Transformer also uses multi-head attention, where multiple attention mechanisms work in parallel to capture different types of relationships, and a feed-forward network, which further refines the information. These Transformer layers are repeated many times, sometimes dozens or even hundreds of times in larger models.</p><p>Finally, the model predicts a probability distribution over its entire vocabulary, selects the most appropriate next token, appends it to the sentence, and repeats this process until the complete response is generated.</p><p>Learning how an LLM works made me realize that AI is not magic. It is an incredible combination of mathematics, probability, neural networks, and engineering. The more I learn about it, the more fascinated I become, and this is just the beginning of the world of Artificial Intelligence.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nunqwjSv8B-FzGed9bbfqA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a88f6bda21a7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>