<?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 Prerna Aggarwal on Medium]]></title>
        <description><![CDATA[Stories by Prerna Aggarwal on Medium]]></description>
        <link>https://medium.com/@prernaaggarwal?source=rss-701c0debde90------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*om196A2Sehliau51</url>
            <title>Stories by Prerna Aggarwal on Medium</title>
            <link>https://medium.com/@prernaaggarwal?source=rss-701c0debde90------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 11:12:23 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@prernaaggarwal/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[The security of Generative AI: Why Your LLM Needs Guardrails]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@prernaaggarwal/the-security-of-generative-ai-why-your-llm-needs-guardrails-229ac90e7178?source=rss-701c0debde90------2"><img src="https://cdn-images-1.medium.com/max/1588/1*W3XeVaEVAXLjpJWjO7LHSg.png" width="1588"></a></p><p class="medium-feed-snippet">Power without control is dangerous. Here is how to keep your AI applications securely on the tracks.</p><p class="medium-feed-link"><a href="https://medium.com/@prernaaggarwal/the-security-of-generative-ai-why-your-llm-needs-guardrails-229ac90e7178?source=rss-701c0debde90------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@prernaaggarwal/the-security-of-generative-ai-why-your-llm-needs-guardrails-229ac90e7178?source=rss-701c0debde90------2</link>
            <guid isPermaLink="false">https://medium.com/p/229ac90e7178</guid>
            <category><![CDATA[generative-ai-solution]]></category>
            <category><![CDATA[llm-guardrails]]></category>
            <dc:creator><![CDATA[Prerna Aggarwal]]></dc:creator>
            <pubDate>Tue, 02 Jun 2026 11:01:41 GMT</pubDate>
            <atom:updated>2026-06-02T11:01:41.751Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[The Career Gap Penalty: Why Are Companies Still Afraid to Hire Returning Mothers?]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-snippet">I recently updated my Naukri profile to reflect my latest upskilling in Generative AI, AI guardrails, and other cutting-edge technologies&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@prernaaggarwal/the-career-gap-penalty-why-are-companies-still-afraid-to-hire-returning-mothers-a2998909ef20?source=rss-701c0debde90------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@prernaaggarwal/the-career-gap-penalty-why-are-companies-still-afraid-to-hire-returning-mothers-a2998909ef20?source=rss-701c0debde90------2</link>
            <guid isPermaLink="false">https://medium.com/p/a2998909ef20</guid>
            <dc:creator><![CDATA[Prerna Aggarwal]]></dc:creator>
            <pubDate>Tue, 26 May 2026 08:02:15 GMT</pubDate>
            <atom:updated>2026-05-26T08:02:15.782Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Stop Using Basic AI: The Beginner’s Guide to LLM Fine-Tuning]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-snippet">How to take an AI from a &#x201C;jack-of-all-trades&#x201D; to a specialized expert (without overcomplicating it).</p><p class="medium-feed-link"><a href="https://medium.com/@prernaaggarwal/stop-using-basic-ai-the-beginners-guide-to-llm-fine-tuning-140f573add8b?source=rss-701c0debde90------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@prernaaggarwal/stop-using-basic-ai-the-beginners-guide-to-llm-fine-tuning-140f573add8b?source=rss-701c0debde90------2</link>
            <guid isPermaLink="false">https://medium.com/p/140f573add8b</guid>
            <category><![CDATA[llm-fine-tuning-explained]]></category>
            <category><![CDATA[how-to-fine-tune-an-llm]]></category>
            <dc:creator><![CDATA[Prerna Aggarwal]]></dc:creator>
            <pubDate>Tue, 17 Mar 2026 07:47:18 GMT</pubDate>
            <atom:updated>2026-03-17T07:47:18.686Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[My Experience with Google ADK: Building Real-World AI Agents #adkhackathon]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@prernaaggarwal/my-experience-with-google-adk-building-real-world-ai-agents-adkhackathon-e693441676cc?source=rss-701c0debde90------2"><img src="https://cdn-images-1.medium.com/max/600/1*JD-nNddoacIrZ-7txb3c2Q.png" width="600"></a></p><p class="medium-feed-snippet">Recently, I had the opportunity to participate in the Google ADK Hackathon, where the challenge was to build a real-life multi-agent&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@prernaaggarwal/my-experience-with-google-adk-building-real-world-ai-agents-adkhackathon-e693441676cc?source=rss-701c0debde90------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@prernaaggarwal/my-experience-with-google-adk-building-real-world-ai-agents-adkhackathon-e693441676cc?source=rss-701c0debde90------2</link>
            <guid isPermaLink="false">https://medium.com/p/e693441676cc</guid>
            <dc:creator><![CDATA[Prerna Aggarwal]]></dc:creator>
            <pubDate>Mon, 23 Jun 2025 11:15:17 GMT</pubDate>
            <atom:updated>2025-06-23T11:15:17.154Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Knowledge Distillation in LLM]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@prernaaggarwal/knowledge-distillation-in-llm-dfc54b34a6be?source=rss-701c0debde90------2"><img src="https://cdn-images-1.medium.com/max/1665/1*5P4BVrKFa_PC0vS2VVQZnA.png" width="1665"></a></p><p class="medium-feed-snippet">Knowledge distillation is a model compression technique where a smaller &#x201C;student&#x201D; model learns to replicate the behavior of a larger&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@prernaaggarwal/knowledge-distillation-in-llm-dfc54b34a6be?source=rss-701c0debde90------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@prernaaggarwal/knowledge-distillation-in-llm-dfc54b34a6be?source=rss-701c0debde90------2</link>
            <guid isPermaLink="false">https://medium.com/p/dfc54b34a6be</guid>
            <category><![CDATA[knowledge-distillation]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[fine-tuning-llm]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Prerna Aggarwal]]></dc:creator>
            <pubDate>Sun, 08 Jun 2025 12:52:53 GMT</pubDate>
            <atom:updated>2025-06-08T17:58:31.544Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Quantization Techniques for Fine-Tuning Large Language Models (LLMs)]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@prernaaggarwal/quantization-techniques-for-fine-tuning-large-language-models-llms-a16f4e123aa9?source=rss-701c0debde90------2"><img src="https://cdn-images-1.medium.com/max/600/1*H60USVcACQ6vM0KnsItApg.png" width="600"></a></p><p class="medium-feed-snippet">Introduction</p><p class="medium-feed-link"><a href="https://medium.com/@prernaaggarwal/quantization-techniques-for-fine-tuning-large-language-models-llms-a16f4e123aa9?source=rss-701c0debde90------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@prernaaggarwal/quantization-techniques-for-fine-tuning-large-language-models-llms-a16f4e123aa9?source=rss-701c0debde90------2</link>
            <guid isPermaLink="false">https://medium.com/p/a16f4e123aa9</guid>
            <dc:creator><![CDATA[Prerna Aggarwal]]></dc:creator>
            <pubDate>Wed, 14 May 2025 12:45:55 GMT</pubDate>
            <atom:updated>2025-05-14T12:45:55.365Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Avoid CUDA OOM Errors: How to Estimate RAM Requirements for Fine-Tuning Pre-trained Models]]></title>
            <link>https://medium.com/@prernaaggarwal/avoid-cuda-oom-errors-how-to-estimate-ram-requirements-for-fine-tuning-pre-trained-models-c0b88e13d8ff?source=rss-701c0debde90------2</link>
            <guid isPermaLink="false">https://medium.com/p/c0b88e13d8ff</guid>
            <dc:creator><![CDATA[Prerna Aggarwal]]></dc:creator>
            <pubDate>Mon, 12 May 2025 10:16:57 GMT</pubDate>
            <atom:updated>2025-05-12T10:16:57.263Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nTUPPErhdNPRRG1fE_Y37Q.png" /></figure><p>Fine-tuning a pre-trained model can be an exciting yet frustrating experience — especially for beginners. I recently fine-tuned a pre-trained transformer model using an open-source dataset from Hugging Face, and I ran into a common (and painful) issue: <strong>CUDA Out Of Memory (OOM) errors</strong>.</p><p>At the time, I struggled to find beginner-friendly resources that explained how to avoid these memory-related crashes or how to estimate the RAM required for training and inference. So in this blog post, I’ll walk you through <strong>how to determine the RAM size required by a pre-trained model</strong> before you even begin fine-tuning.</p><h3>💡 Why Estimating RAM Matters</h3><p>Before choosing any model to fine-tune, it’s crucial to understand the resources at your disposal — especially <strong>available GPU RAM</strong> and <strong>disk space</strong>. Not all models are created equal; some can be handled easily on a standard GPU, while others demand top-tier hardware or cloud-based solutions.</p><h3>🔍 Key Factors That Influence RAM Requirements</h3><h3>🔹 1. Number of Parameters</h3><p>This is the most important factor in determining how “heavy” a model is.</p><ul><li>A model with a <strong>few million parameters</strong> is considered <strong>small</strong>.</li><li>A model with <strong>billions of parameters</strong> (e.g., LLaMA 2–7B or GPT-3) is <strong>large</strong> and requires significantly more resources.</li></ul><h3>🔹 2. Memory Footprint</h3><p>Several things affect the memory used during training:</p><ul><li>Model size (number of parameters)</li><li>Batch size</li><li>Sequence length</li><li>Optimizer states</li><li>Precision (FP16 vs FP32)</li></ul><p>If your model needs more GPU memory than your system provides, you’re likely to hit OOM errors.</p><p><strong>Workarounds include:</strong></p><ul><li>Mixed-precision training (using FP16)</li><li>Gradient accumulation</li><li>Parameter-efficient fine-tuning (PEFT) methods like LoRA</li></ul><h3>🔹 3. Computational Requirements</h3><p>“Heavier” models don’t just consume more memory — they also require more <strong>time</strong> and <strong>compute power</strong> to train. For example, a large model might require multiple high-end GPUs or TPUs to train within a reasonable timeframe.</p><h3>📏 How to Estimate RAM Requirements</h3><p>Before running your training script, you can estimate how much RAM a model will consume using this simple formula:</p><p><strong>RAM (in GB) ≈ (Number of Parameters × Bytes per parameter × 3) / 1e9</strong></p><p><strong><em>Number of Parameters</em></strong><em>:</em></p><p>number of model parameters → check the model card (7B, 13B, 65B, etc.)</p><p><strong><em>Bytes per parameter:</em></strong></p><ul><li>4 for FP32 (float32)</li><li>2 for FP16 (half-precision)</li></ul><p><strong><em>The factor of 3 accounts for</em></strong></p><ul><li>Model weights</li><li>Gradients</li><li>Optimizer states</li></ul><h3>✅ Example: LLaMA 1.3B in FP32</h3><p>= (1.3e9 × 4 × 3) / 1e9</p><p>= 15.6 GB</p><p>So, you’d need around <strong>16 GB of GPU RAM</strong> just to fine-tune this model using FP32.</p><h3>✅ Example: Same model in FP16</h3><p>= (1.3e9 × 2 × 3) / 1e9</p><p>= 7.8 GB</p><p>FP16 cuts the requirement in half — this is why mixed-precision training is so popular.</p><p><strong>Script for RAM Size estimation</strong></p><p>The following script can be used for RAM size estimation for any model with or without using PEFT techniques</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yZ9YkGei5VhReYBf" /></figure><pre>Script for RAM Size estimation:<br>from transformers import AutoModelForCausalLM<br>import torch<br><br><br>def estimate_ram(model_name, precision=&quot;fp16&quot;, method=&quot;full&quot;):<br>    # Load model config only (no weights)<br>    model = AutoModelForCausalLM.from_pretrained(model_name, trust_remote_code=True,token=&quot;&lt;Your Huggingface access token&gt;&quot;)<br><br><br>    # Count parameters<br>    total_params = sum(p.numel() for p in model.parameters())<br>    total_params_in_billions = total_params / 1e9<br><br><br>    # Precision size<br>    if precision == &quot;fp32&quot;:<br>        bytes_per_param = 4<br>    elif precision in [&quot;fp16&quot;, &quot;bfloat16&quot;]:<br>        bytes_per_param = 2<br>    elif precision == &quot;int8&quot;:<br>        bytes_per_param = 1<br>    elif precision in [&quot;int4&quot;, &quot;4bit&quot;]:<br>        bytes_per_param = 0.5<br>    else:<br>        raise ValueError(&quot;Unsupported precision&quot;)<br><br><br>    # Compute multiplier<br>    if method == &quot;full&quot;:<br>        multiplier = 2.5  # weights + gradients + optimizer states<br>    elif method.lower() in [&quot;lora&quot;, &quot;qlora&quot;]:<br>        multiplier = 1.1  # mostly adapter weights + optimizer states<br>    else:<br>        raise ValueError(&quot;Unsupported method&quot;)<br><br><br>    # Calculate estimated RAM (in GB)<br>    estimated_ram_bytes = total_params * bytes_per_param * multiplier<br>    estimated_ram_gb = estimated_ram_bytes / (1024 ** 3)<br><br><br>    print(f&quot;Model: {model_name}&quot;)<br>    print(f&quot;Total Parameters: {total_params_in_billions:.2f}B&quot;)<br>    print(f&quot;Precision: {precision}&quot;)<br>    print(f&quot;Method: {method}&quot;)<br>    print(f&quot;Estimated RAM required: {estimated_ram_gb:.2f} GB\n&quot;)<br><br><br># Example models<br>estimate_ram(&quot;Prerna234/lora-llama-orca-merged&quot;, precision=&quot;fp16&quot;, method=&quot;full&quot;)<br>estimate_ram(&quot;Prerna234/lora-llama-orca-merged&quot;, precision=&quot;4bit&quot;, method=&quot;qlora&quot;)<br>estimate_ram(&quot;Prerna234/lora-llama-orca-merged&quot;, precision=&quot;fp8&quot;, method=&quot;full&quot;)<br>estimate_ram(&quot;Prerna234/lora-llama-orca-merged&quot;, precision=&quot;4bit&quot;, method=&quot;lora&quot;)<br></pre><h3>🛡 Tips to Prevent OOM Errors</h3><p>Here are a few practical strategies to help reduce memory usage:</p><ul><li>✅ Use <strong>torch.float16</strong> or <strong>bfloat16</strong> for mixed-precision training</li><li>✅ Apply <strong>gradient accumulation</strong> to simulate larger batch sizes without consuming more memory</li><li>✅ Use <strong>PEFT methods</strong> like LoRA or QLoRA to fine-tune only parts of the model</li><li>✅ Reduce <strong>batch size</strong> and <strong>sequence length</strong></li><li>✅ Consider <strong>model quantization</strong> for inference</li></ul><h3>🧠 In Summary</h3><ul><li>Estimating memory needs is crucial before training any model.</li><li>Use the number of parameters and parameter size to calculate estimated RAM usage.</li><li>Techniques like mixed precision and PEFT can help reduce the load on your GPU.</li></ul><p>Always monitor your available system RAM or GPU VRAM — tools like nvidia-smi or Colab’s resource monitor can help.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0b88e13d8ff" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>