<?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 Varsha Deheriya on Medium]]></title>
        <description><![CDATA[Stories by Varsha Deheriya on Medium]]></description>
        <link>https://medium.com/@varshadeheriya0418?source=rss-338206a0ea0f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*7z6E1x-NwssL__Hd</url>
            <title>Stories by Varsha Deheriya on Medium</title>
            <link>https://medium.com/@varshadeheriya0418?source=rss-338206a0ea0f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 17:05:52 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@varshadeheriya0418/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[PageIndex vs Vector Databases: Choosing the Right Approach for Modern AI Systems]]></title>
            <link>https://medium.com/@varshadeheriya0418/pageindex-vs-vector-databases-choosing-the-right-approach-for-modern-ai-systems-85d261543f8d?source=rss-338206a0ea0f------2</link>
            <guid isPermaLink="false">https://medium.com/p/85d261543f8d</guid>
            <dc:creator><![CDATA[Varsha Deheriya]]></dc:creator>
            <pubDate>Mon, 06 Apr 2026 05:31:01 GMT</pubDate>
            <atom:updated>2026-04-06T05:31:01.334Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZYQ9IOFn_Oqjr3YqnzgUvw.png" /><figcaption>PageIndex vs Vector Databases</figcaption></figure><p>Vector databases have become a foundational component in many AI applications. With the rise of embeddings and semantic search, they introduced a powerful way to retrieve information based on meaning rather than exact keywords.</p><p>This shift enabled more natural interactions with data, especially in use cases like conversational interfaces, document search, and recommendation systems. However, as systems scale and move closer to production realities, it becomes clear that vector search is not always the most efficient or appropriate solution.</p><p>At the same time, approaches like PageIndex and even vector-less methods are gaining attention, not as replacements, but as practical alternatives depending on the problem.</p><h3>Understanding the Trade-offs</h3><p>Vector databases excel at capturing semantic relationships, but they come with overhead. High memory usage, infrastructure cost, and approximate results are common characteristics. These trade-offs are acceptable when semantic understanding is essential, but unnecessary when the problem is more structured or precise.</p><p>PageIndex addresses a different concern. Instead of focusing purely on similarity search, it optimizes how data is stored and accessed. By dividing data into smaller pages and loading only what is needed at query time, it improves scalability and reduces memory pressure.</p><p>Vector-less methods, on the other hand, rely on traditional techniques such as keyword search, filtering, or structured queries. While often overlooked, they remain highly effective for many well-defined use cases.</p><h3>When to Use Vector Databases</h3><p>Vector databases are most effective when the goal is to understand intent rather than match exact words.</p><p>They are a strong fit when working with unstructured data such as documents, conversations, or knowledge bases, where users may phrase the same idea in multiple ways. In such cases, semantic similarity helps bridge the gap between different expressions of the same concept.</p><p>They are also useful when dealing with exploratory queries, where the input is vague, incomplete, or conversational in nature. Here, approximate matching is not a limitation but a feature.</p><h3>When to Use PageIndex</h3><p>PageIndex becomes relevant when scale and efficiency start to dominate the conversation.</p><p>For large datasets that cannot be fully loaded into memory, paging allows systems to remain responsive without requiring excessive infrastructure. It is particularly useful in scenarios where data is naturally partitioned or can be grouped logically, enabling selective access rather than full scans.</p><p>This approach is well-suited for systems that need to balance performance with cost, especially when operating at scale.</p><h3>When to Use Vector-less Methods</h3><p>Vector-less methods are often the simplest and most effective choice when precision matters.</p><p>If the data is structured and queries are explicit, traditional approaches such as keyword search or structured query filtering provide faster and more accurate results. There is no ambiguity to resolve, and introducing embeddings in such cases can add unnecessary complexity.</p><p>They are especially effective for exact lookups, rule-based filtering, and scenarios where correctness is more important than interpretation.</p><h3>A Practical Perspective</h3><p>Not every problem benefits from semantic search, and not every system requires complex indexing strategies. The choice between vector databases, PageIndex, and vector-less methods depends on the nature of the data, the type of queries, and the constraints of the system.</p><p>Vector databases are powerful when meaning is ambiguous. PageIndex is valuable when scale becomes a constraint. Vector-less methods are optimal when the problem is already well-defined.</p><p>Understanding these distinctions leads to better system design decisions ones that prioritize clarity, efficiency, and practical performance over unnecessary complexity.</p><p>Happy Learning :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=85d261543f8d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Vector Database Response Formats Impact LLM Cost, Speed, and Accuracy]]></title>
            <link>https://medium.com/@varshadeheriya0418/how-vector-database-response-formats-impact-llm-cost-speed-and-accuracy-1a1c57e6bcf6?source=rss-338206a0ea0f------2</link>
            <guid isPermaLink="false">https://medium.com/p/1a1c57e6bcf6</guid>
            <dc:creator><![CDATA[Varsha Deheriya]]></dc:creator>
            <pubDate>Fri, 26 Dec 2025 05:32:48 GMT</pubDate>
            <atom:updated>2025-12-26T05:32:48.784Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k5f1lEow5dKJF5LP3L6Y_Q.jpeg" /></figure><p>When we build AI applications with vector databases and large language models, most of our energy goes into embeddings, prompts, and model selection.</p><p>But there is a quieter decision that often gets overlooked and it directly affects <strong>cost, speed, and answer quality.</strong></p><p><strong>How your vector database sends its results to the LLM.</strong></p><p>Most teams default to JSON because it is familiar and safe. That works but it is not always the smartest choice, especially in production RAG systems.</p><p>In this blog, I will walk through <strong>JSON, TOON, VML, and YAML</strong>, explain how each one impacts <strong>LLM cost, latency, and accuracy</strong>, and share when you should and should not use them.</p><p><strong>What Does a Vector Database Actually Return?</strong></p><p>When you query a vector database, it usually returns relevant text chunks, similarity scores, and some metadata like source or page number.</p><p>In simple terms, here is the text most relevant to your question, and where it came from.</p><p>Before this information reaches the LLM, it must be <strong>formatted</strong> and that formatting decision matters more than most people realize.</p><p><strong>Why Response Format Matters</strong></p><p>LLMs don’t read data the way humans do. They process <strong>tokens</strong>.</p><p>That leads to three practical consequences:</p><ul><li>More tokens → higher cost and slower responses</li><li>Poor structure → confusion and hallucinations</li></ul><p>So response format is not just a technical detail. It is a <strong>design choice</strong> that affects real world performance.</p><p><strong>JSON (JavaScript Object Notation): Familiar, Reliable, but Heavy</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*eXDp2BVmr6L-ZmTI0AOPxw.png" /><figcaption>Example of JSON format</figcaption></figure><p><strong>Cost : </strong>JSON repeats field names across every chunk. As results grow, token usage grows quickly.</p><p><strong>Speed : </strong>More tokens mean more text for the model to process, which slows responses.</p><p><strong>Accuracy : </strong>JSON is clear, but it adds noise. The LLM sees many keys that don not help it reason.</p><p><strong>When to use JSON</strong></p><ul><li>Backend APIs</li><li>Database storage</li><li>Logging and auditing</li><li>Structured LLM outputs</li></ul><p><strong>When not to use JSON</strong></p><ul><li>Large VecDB responses inside prompts</li><li>Cost sensitive retrieval pipelines</li></ul><p><strong>TOON (Token-Oriented Object Notation): Compact and Built for LLMs</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/619/1*Dg4reIwD1zc4jzUKLOQlMA.png" /><figcaption>Example of TOON format</figcaption></figure><p>TOON focuses on reducing token usage while keeping structure predictable.</p><p><strong>Cost : </strong>Short keys and minimal syntax significantly reduce token count.</p><p><strong>Speed : </strong>Fewer tokens mean faster inference.</p><p><strong>Accuracy : </strong>The model spends less attention on formatting and more on meaning.</p><p><strong>When to use TOON</strong></p><ul><li>VecDB → LLM communication</li><li>High-traffic chatbots</li><li>Production RAG systems</li></ul><p><strong>When not to use TOON</strong></p><ul><li>Human-readable logs</li><li>Systems that require standard formats</li><li>deep or complex response format</li></ul><p><strong>VML (Vector Markup Language): More Structure, Safer Reasoning</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/727/1*uEo9vUasiHx0WOLsry6Tlg.png" /><figcaption>Example of VML format</figcaption></figure><p>VML adds strong boundaries between documents and metadata.</p><p><strong>Cost : </strong>Extra tags increase token usage compared to TOON.</p><p><strong>Speed : </strong>More structure means slightly slower responses.</p><p><strong>Accuracy : </strong>Clear boundaries reduce document mixing and hallucinations.</p><p><strong>When to use VML</strong></p><ul><li>Finance and compliance systems</li><li>Legal document analysis</li><li>Multi-document reasoning</li></ul><p><strong>When not to use VML</strong></p><ul><li>Simple Q&amp;A bots</li><li>High-volume, low-cost systems</li></ul><p><strong>YAML (Yet Another Markup Language): Human-Friendly but Fragile</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/1*heXQ0NURp8BDjwm2Xpgy6A.png" /><figcaption>Example of YAML format</figcaption></figure><p><strong>Cost : </strong>Slightly better than JSON, but still not optimal.</p><p><strong>Speed &amp; Accuracy : </strong>Indentation sensitivity often breaks when generated by LLMs.</p><p><strong>When to use YAML</strong></p><ul><li>Prompt templates</li><li>Configuration files</li></ul><p><strong>When not to use YAML</strong></p><ul><li>VecDB responses</li><li>Generated LLM inputs</li></ul><p><strong>A practical rule that works most of time</strong></p><ul><li><strong>Storage &amp; APIs</strong> → JSON</li><li><strong>VecDB &amp; LLM</strong> → TOON</li><li><strong>Sensitive reasoning</strong> → VML</li><li><strong>Configs &amp; prompts</strong> → YAML</li></ul><p><strong>Final Thoughts</strong></p><p>If your AI system feels expensive, slow, or unreliable, don’t blame the model right away.</p><p>Sometimes the real issue is simpler,</p><p><strong>The format you chose is working against you.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1a1c57e6bcf6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[LLM vs LAM vs LCM vs LMM vs SLM: A Clear Guide to Choosing the Right AI Model for the Job]]></title>
            <link>https://medium.com/@varshadeheriya0418/llm-vs-lam-vs-lcm-vs-lmm-vs-slm-a-clear-guide-to-choosing-the-right-ai-model-for-the-job-446f66f46e22?source=rss-338206a0ea0f------2</link>
            <guid isPermaLink="false">https://medium.com/p/446f66f46e22</guid>
            <dc:creator><![CDATA[Varsha Deheriya]]></dc:creator>
            <pubDate>Tue, 29 Jul 2025 05:41:36 GMT</pubDate>
            <atom:updated>2025-08-01T02:25:35.035Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/918/1*VnJ7gZvBpQnLAhQVuadlSA.jpeg" /></figure><p><strong>LLM vs LAM vs LCM vs LMM vs SLM: A Clear Guide to Choosing the Right AI Model for the Job</strong></p><p><strong>1. LLM — Large Language Model</strong></p><p><strong>What is it:</strong><br> LLMs are foundational models trained on massive corpora of text data. They learn language patterns, semantics, syntax, and even basic reasoning to generate human-like responses.</p><p><strong>Examples:</strong></p><p>You want to build a chatbot that answers user queries like:<br> → Use LLM to generate a natural-sounding answer</p><p>Models: GPT-4, LLaMA-3, Claude, Mistral</p><p><strong>Key Traits:</strong></p><ul><li>Trained on billions/trillions of tokens</li><li>Excellent at zero-shot and few-shot tasks</li><li>Form the <em>core</em> of most Generative AI systems</li></ul><p><strong>Use When:</strong><br> You need <strong>natural language understanding or generation</strong> in a generic use case.</p><p><strong>Use Cases:</strong></p><ul><li>Chatbots &amp; virtual assistants</li><li>Text summarization</li><li>Email &amp; report generation</li><li>Code generation (e.g., GitHub Copilot)</li></ul><p><strong>2. LAM — Large Action Model</strong></p><p><strong>What is it:</strong><br> LAMs represent a <strong>layer on top of LLMs</strong>, where the model behaves like an <strong>agent</strong>. It can reason, use tools, plan tasks, access APIs, and retain memory.</p><p><strong>Think of it as:</strong><br> LLM + Planning + Tool Use + Memory</p><p><strong>Examples:</strong></p><p>You want a travel assistant that: Searches for flights, Books hotels via API, Sends the summary via email</p><p>→ Use LAM to build a <strong>smart, tool-using travel agent</strong>.</p><p>Frameworks: LangChain Agents, CrewAI, OpenAI Function Calling, LangGraph</p><p><strong>Use When:</strong><br> You need the model to perform <strong>multi-step tasks</strong> or call tools dynamically.</p><p><strong>Use Cases:</strong></p><ul><li>Autonomous agents</li><li>Document processors</li><li>Multi-tool orchestration</li><li>Smart task automation</li></ul><p><strong>3. LCM — Large Context Model</strong></p><p><strong>What is it:</strong><br> LCM refers to <strong>LLMs with extended context window</strong> capability — meaning they can take in <em>much larger</em> input lengths (often 100K–1M+ tokens). This is useful for tasks requiring full-document or multi-document reasoning.</p><p><strong>Examples:</strong></p><p>You want to summarize this 100-page legal contract and highlight risk clauses.<br> → Use LCM to handle and understand the full document in one go.</p><p>Model: Claude 2/3 (100K+ tokens), Gemini 1.5 Pro (1M tokens), GPT-4 Turbo (128K tokens)</p><p><strong>Use When:</strong><br> You need the model to process <strong>long documents or keep memory over long interactions</strong>.</p><p><strong>Use Cases:</strong></p><ul><li>Legal/compliance document analysis</li><li>Book summarization</li><li>Complex multi-turn chat memory</li><li>RAG (Retrieval-Augmented Generation)</li></ul><p><strong>Important:</strong><br> LCMs are typically built from or fine-tuned versions of LLMs but are optimized for <strong>context length</strong> rather than just model size or parameter count.</p><p><strong>4. LMM — Large Multimodal Model</strong></p><p><strong>What is it:</strong><br> LMMs are capable of understanding and generating across <strong>multiple modalities</strong>, such as <strong>text, images, audio, video</strong>, and even sensory data.</p><p><strong>Examples:</strong></p><p>You upload a chart or screenshot and ask want to ask question like What is the trend in this graph?<br> → Use LMM to analyze and respond based on <strong>visual input</strong>.</p><p>Model: GPT-4o, Gemini 1.5, Claude 3 Opus, LLaVA</p><p><strong>Use When:</strong><br> You want the model to <strong>see, hear, and read</strong> — not just type.</p><p><strong>Use Cases:</strong></p><ul><li>Visual question answering</li><li>Document parsing (scanned PDFs, receipts)</li><li>Image captioning</li><li>Video summarization</li></ul><p><strong>Significance:</strong><br> Multimodality is key for general intelligence systems — especially those interacting with the physical world.</p><p><strong>5. SLM — Small Language Model</strong></p><p><strong>What is it:</strong><br> SLMs are compact models (typically under 1B parameters), built for <strong>on-device inference</strong>, <strong>cost efficiency</strong>, and <strong>speed</strong>. They’re either trained from scratch or distilled from LLMs.</p><p><strong>Examples:</strong></p><p>You want a grammar correction tool that works <strong>offline</strong> on a phone.<br> → Use an SLM that fits and runs locally.</p><p>Model: Phi-3 Mini (1.8B), Tiny Llama, Mistral 7B, Gemma 2B</p><p><strong>Use When:</strong><br> You need <strong>fast, private, or cost-efficient</strong> AI at the edge.</p><p><strong>Use Cases:</strong></p><ul><li>Mobile apps</li><li>Embedded systems</li><li>Privacy-first environments</li><li>Real-time chatbots on-device</li></ul><p><strong>Advantages:</strong></p><ul><li>Fast inference</li><li>Low compute footprint</li><li>Ideal for edge/IoT environments</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=446f66f46e22" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MCP vs FastAPI: Clearing the Confusion Once and For All]]></title>
            <link>https://medium.com/@varshadeheriya0418/mcp-vs-fastapi-clearing-the-confusion-once-and-for-all-6cfcf1d706cf?source=rss-338206a0ea0f------2</link>
            <guid isPermaLink="false">https://medium.com/p/6cfcf1d706cf</guid>
            <dc:creator><![CDATA[Varsha Deheriya]]></dc:creator>
            <pubDate>Fri, 27 Jun 2025 05:31:53 GMT</pubDate>
            <atom:updated>2025-06-27T05:31:53.490Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>What is MCP (Model Context Protocol)?</strong></p><p><strong>MCP (Model Context Protocol)</strong> is a <strong>structured messaging protocol</strong> designed for large language model (LLM) ecosystems, especially those involving <strong>agentic systems</strong>, <strong>graph-based workflows</strong>, or <strong>multi-step reasoning chains</strong>. MCP is not a transport layer like HTTP, nor is it an execution engine like FastAPI. It is a <strong>formal schema and process for preserving context and intent</strong> throughout complex model-driven applications.</p><p><strong>Why MCP?</strong></p><p>Traditional LLM applications use plain-text prompts and responses, but that becomes brittle when you introduce:</p><ul><li>Multiple agents</li><li>Tool usage (e.g., calculators, search APIs)</li><li>Memory injection</li><li>Function calling</li><li>State management across turns</li></ul><p>MCP addresses this by providing <strong>a standardized protocol</strong> for message exchange that maintains full context, type safety, and interoperability between components.</p><p><strong>Core Components of MCP</strong></p><p><strong>1. MCP Client</strong></p><p>The <strong>MCP Client</strong> is the component that <strong>initiates the request</strong>. It could be a user-facing agent, a calling node in a LangGraph pipeline, or an application layer (like a chatbot or frontend service).</p><p><strong>Key Responsibilities:</strong></p><ul><li>Constructing a message in MCP format (with fields like type, content, metadata, tool_call, etc.)</li><li>Sending that message to the MCP Server</li><li>Parsing the structured response back into usable data</li></ul><p>The client doesn’t need to know the inner workings of the model. It just needs to follow the <strong>contract</strong> defined by MCP.</p><p><strong>2. MCP Server</strong></p><p>The <strong>MCP Server</strong> is the <strong>model handler</strong> — a server-side entity that receives structured MCP messages, routes them to the appropriate model or tool, and returns a properly formatted response.</p><p><strong>Think of it as:</strong></p><ul><li>An LLM gateway with understanding of the MCP format</li><li>The “brain” that evaluates the message content, possibly makes tool calls, generates responses, and returns structured data</li></ul><p>In some cases, the MCP server might interface with:</p><ul><li>A language model like GPT-4 or Claude</li><li>A tool registry (e.g., search, calculator)</li><li>Memory backends</li></ul><p>The server also <strong>tracks context</strong>, ensuring the protocol can carry memory or agent state forward into subsequent turns.</p><p><strong>3. MCP Host</strong></p><p>The <strong>MCP Host</strong> is the <strong>orchestration layer</strong> — a runtime that coordinates between multiple MCP clients and servers. You can think of this as the <strong>environment in which agents run</strong>, tools are loaded, and messages are routed.</p><p><strong>Responsibilities:</strong></p><ul><li>Managing the lifecycle of an MCP conversation or workflow</li><li>Routing messages correctly between client/server roles</li><li>Enforcing protocol-level rules (e.g., type checking, timeout policies)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/1*xhmgY5GfM5CkBV-6cZRX1Q.png" /><figcaption>Agent orchestration before and after MCP</figcaption></figure><p><strong>What is FastAPI?</strong></p><p><strong>FastAPI</strong> is a modern Python web framework designed for building <strong>REST APIs</strong> with <strong>asynchronous support</strong>, <strong>type hints</strong>, and <strong>automatic docs</strong> using OpenAPI and Swagger.</p><p><strong>Purpose:</strong></p><p>FastAPI is built for exposing backend logic ML models, data services, LLMs as web services. It’s used to <strong>deploy</strong> models, manage inputs/outputs, and serve endpoints to frontend apps or other systems.</p><p><strong>Key Features:</strong></p><ul><li>Async I/O powered by Starlette</li><li>Pydantic for request/response validation</li><li>Auto-generated Swagger UI</li><li>Lightning-fast performance (hence “Fast”)</li></ul><p><strong>Typical Use Case:</strong></p><ul><li>Hosting a fine-tuned LLM or RAG system on a server.</li><li>Creating APIs for frontend apps to access inference engines.</li><li>Integrating with mobile apps or third-party systems.</li></ul><p><strong>So Why Are People Confused?</strong></p><ol><li><strong>Both deal with models</strong>: MCP messages often encapsulate model inputs/outputs, so newcomers assume it’s somehow a serving framework.</li><li><strong>Both are used in LLM pipelines</strong>: You might use FastAPI to expose a LangGraph-powered agent system that uses MCP under the hood — making it look like they’re the same layer.</li></ol><p>But here’s the real-world analogy:</p><p><strong>FastAPI is the highway</strong>, letting you transport requests and responses between systems.<br> <strong>MCP is the instruction format</strong> your self-driving car uses to navigate and make decisions on that highway.</p><p><strong>So When to Use What?</strong></p><p><strong>Use MCP when:</strong></p><ul><li>You’re orchestrating <strong>multi-agent</strong> systems with memory, tools, or reasoning.</li><li>You’re building with <strong>LangGraph</strong>, <strong>CrewAI</strong>, or any <strong>agentic LLM framework</strong>.</li><li>You need <strong>structured, type-safe messages</strong> between agents or nodes.</li><li>Your system lives <strong>inside the LLM stack</strong>, not exposed to the outside world.</li></ul><p>Think of MCP as the <strong>internal brain language</strong> your AI system speaks to itself.</p><p><strong>Use FastAPI when:</strong></p><ul><li>You want to <strong>expose your model or AI service to the world</strong> via HTTP.</li><li>You’re deploying a <strong>REST API</strong> for inference, generation, or prediction.</li><li>You need to connect to <strong>frontend apps, mobile clients, or external systems</strong>.</li><li>You care about <strong>speed, validation, and Swagger docs out of the box</strong>.</li></ul><p>Think of FastAPI as the <strong>public-facing door</strong> that your AI system opens to the outside world.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6cfcf1d706cf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Optimization and Optimizers]]></title>
            <link>https://medium.com/@varshadeheriya0418/optimization-and-optimizers-1df8738fe0d7?source=rss-338206a0ea0f------2</link>
            <guid isPermaLink="false">https://medium.com/p/1df8738fe0d7</guid>
            <dc:creator><![CDATA[Varsha Deheriya]]></dc:creator>
            <pubDate>Tue, 09 May 2023 18:20:41 GMT</pubDate>
            <atom:updated>2023-05-10T05:09:51.157Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Optimization</strong></p><p>The process of creating or identifying the ideal equation that lowers the loss terms and boosts efficiency is referred to as optimization. We can describe optimization theory in terms of machine learning as the process of improving the accuracy and reducing the loss or error of a model.</p><p>Using optimizers, we will improve the loss function. Our most well-liked optimizers are,</p><ol><li>Gradient Descent</li><li>Stochastic Gradient Descent</li><li>Mini Batch Stochastic Gradient Descent</li></ol><p>Prior to understanding optimizers, it is necessary to have a basic understanding of terms like maxima, and minima.</p><p><strong>Minima and Maxima</strong></p><p>The extreme values of a function are its maxima and minima, where the maxima are the largest and the minima are the smallest. Despite having several maxima and minima, there will only be one global minima and one global maxima. The remainder are local minima and maxima.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/515/1*2nr__dyUr1RXWfSO216rjA.jpeg" /></figure><p><strong>1. Gradient Descent</strong></p><p>Gradient Descent is an optimising technique that can locate the best answers to a variety of problems. Gradient Descent aims to iteratively minimize the objective convex function f(x). The total number of observations for each iteration is referred to as the gradient descent</p><p>Steps to implement Gradient Descent</p><p>(a) Randomly initialize values.</p><p>(b) Update values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/653/1*mOrqXxYvZb0IS4k-zMH-6A.png" /></figure><p>(c) Repeat until Convergence</p><p><strong>Learning rate:</strong></p><p>To attain the minimum point, it is a Hyperparameter that must be properly chosen. Each repetition requires a change. If we maintained it constant, though, we would run into an oscillation issue where the jumping would occur at the same points.</p><p>For a single update, we must apply Gradient Descent across all of the points. The updating function will need a lot of processing power for a larger number of data points since we need to apply it to all of the data points and we will run out of memory ram, but it converges quickly and has lower error than other updating functions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*hsWt1ojVBBbNEij0aXlXkw.png" /></figure><p><strong>2. Stochastic Gradient Descent</strong></p><p>The Stochastic Gradient Descent algorithm replaces the Gradient Descent algorithm due to its drawback.For each training example in the dataset, stochastic gradient descent (SGD) modifies the parameters for each training sample one at a time. SGD may become faster than gradient descent as a result, depending on the problem. In gradient descent, all points are taken into account while computing the loss and derivative, whereas in stochastic gradient descent, only one point is used to calculate the loss function’s derivative at random.</p><p><strong>3. Mini Batch Stochastic Gradient Descent</strong></p><p>The training dataset is split up into manageable groups (mini-batches), and each is updated separately. This will result in a balance between the robustness of stochastic gradient descent and the effectiveness of gradient descent. make this the most widely utilized optimization in deep learning and machine learning.</p><p>Smaller values reduce training noise while allowing the learning process to converge more quickly. Larger values cause a learning process to gradually converge to an exact estimation of the error gradient.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*NuWp74xbokdDd6ZkkF7cUg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1df8738fe0d7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>