<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Syed Muhammad Ali Raza</title>
    <description>The latest articles on DEV Community by Syed Muhammad Ali Raza (@syedmuhammadaliraza).</description>
    <link>https://dev.to/syedmuhammadaliraza</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F210677%2Fb1f0580c-cc32-459d-8078-0439930ee86b.png</url>
      <title>DEV Community: Syed Muhammad Ali Raza</title>
      <link>https://dev.to/syedmuhammadaliraza</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/syedmuhammadaliraza"/>
    <language>en</language>
    <item>
      <title>Fine-Tuning Explained (And When You Actually Need It Instead of RAG)</title>
      <dc:creator>Syed Muhammad Ali Raza</dc:creator>
      <pubDate>Wed, 29 Jul 2026 21:05:00 +0000</pubDate>
      <link>https://dev.to/syedmuhammadaliraza/fine-tuning-explained-and-when-you-actually-need-it-instead-of-rag-543f</link>
      <guid>https://dev.to/syedmuhammadaliraza/fine-tuning-explained-and-when-you-actually-need-it-instead-of-rag-543f</guid>
      <description>&lt;h1&gt;
  
  
  Fine-Tuning Explained (And When You Actually Need It Instead of RAG)
&lt;/h1&gt;

&lt;p&gt;After I wrote about RAG, a bunch of comments asked some version of the same question. "Okay but what if I want the model to actually behave differently, not just answer using my documents." Good question, and the honest answer is that's a different problem with a different tool. That tool is fine-tuning.&lt;/p&gt;

&lt;p&gt;I put off learning this properly for a long time because it sounded expensive and complicated, something only big companies with server farms do. Turns out a basic understanding of it is way more approachable than I expected, and knowing when NOT to use it is honestly the more valuable lesson. So let's get into it properly, real example first, then actual code.&lt;/p&gt;

&lt;h2&gt;
  
  
  A real life example to set the stage
&lt;/h2&gt;

&lt;p&gt;Think about training a new employee at a customer support job.&lt;/p&gt;

&lt;p&gt;If you hand them a manual and tell them "look things up in here whenever you're unsure," that's RAG. They still talk and think like themselves, they just consult reference material when they need specific facts. Their personality, tone, and general way of communicating hasn't changed at all, they've just got a good reference book next to them.&lt;/p&gt;

&lt;p&gt;Now imagine instead you actually trained that person for months, had them shadow senior staff, corrected their tone repeatedly, drilled them on your company's specific way of phrasing things until it became second nature. After that training, they don't need to look anything up for common situations, it's just baked into how they naturally respond now. That's fine-tuning. You're not handing the model a reference book, you're actually reshaping how it responds by showing it enough examples that the new behavior becomes part of it.&lt;/p&gt;

&lt;p&gt;Both approaches can get you a good employee. But they solve different problems. If your issue is "the person doesn't know our specific product details," a manual fixes that instantly and cheaply. If your issue is "the person's tone and style just isn't matching what we need no matter how much reference material we give them," training is what actually fixes that.&lt;/p&gt;

&lt;h2&gt;
  
  
  What fine-tuning actually is, technically
&lt;/h2&gt;

&lt;p&gt;An LLM, underneath everything, is a giant pile of numbers called parameters, sometimes billions of them, that got adjusted during training to make the model good at predicting text. Fine-tuning means taking a model that's already been trained once, and training it a bit further on a smaller, specific set of examples so its parameters shift slightly toward behaving the way you want in that specific area.&lt;/p&gt;

&lt;p&gt;You're not starting from scratch. You're not building a new model from nothing, that's what the original training already did and it costs an amount of money most of us will never personally spend. Fine-tuning is more like giving an already capable model some focused extra practice on exactly the kind of task or tone you care about.&lt;/p&gt;

&lt;h2&gt;
  
  
  When fine-tuning is genuinely the right call
&lt;/h2&gt;

&lt;p&gt;I used to think fine-tuning was just "the more advanced version of RAG," like a level up. That's wrong and it cost me some wasted time. They solve different kinds of problems.&lt;/p&gt;

&lt;p&gt;Fine-tuning makes sense when you need consistent style or tone across every single response, like a brand voice that has to be exactly right every time. It also helps with teaching the model a specific format or structure it doesn't naturally produce, or teaching it a narrow skill, like classifying support tickets into your company's exact categories, or writing code in a very specific internal style your team uses. It's also useful when you need the model to reliably follow a particular behavior pattern that's hard to fully explain in a prompt every single time.&lt;/p&gt;

&lt;p&gt;Fine-tuning does not make sense as the fix when your actual problem is that the model doesn't know specific facts or up to date information. That's what RAG solves, and it solves it far more cheaply and it updates instantly when your source data changes. A lot of people reach for fine-tuning to "teach the model our documentation" and end up frustrated, expensive, and still not getting current information reliably, when what they actually needed was retrieval the whole time.&lt;/p&gt;

&lt;p&gt;A decent rule of thumb I settled on, if the problem is about knowledge, reach for RAG first. If the problem is about behavior, tone, or format, fine-tuning is worth considering.&lt;/p&gt;

&lt;h2&gt;
  
  
  The data problem nobody warns you about
&lt;/h2&gt;

&lt;p&gt;Here's the part that actually matters more than the code, and I learned this the hard way. Fine-tuning is entirely dependent on the quality of your example data. Feed it fifty inconsistent, messy examples and you'll get a model that's inconsistently, messily different from before, not better.&lt;/p&gt;

&lt;p&gt;The examples need to actually represent the behavior you want, consistently, and there needs to be enough of them to establish a real pattern rather than a fluke. I've seen people try to fine-tune on twenty examples and wonder why nothing changed. The model needs enough repetition of the pattern to actually shift its behavior, not just see the idea once.&lt;/p&gt;

&lt;h2&gt;
  
  
  Let's actually do this with code
&lt;/h2&gt;

&lt;p&gt;I'll walk through two versions. First, using a hosted fine-tuning API, which is the easier route and what most people should start with. Then a quick look at what's happening if you were to do it yourself locally, so you understand what the hosted version is doing for you behind the scenes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Version one, using a hosted fine-tuning API
&lt;/h3&gt;

&lt;p&gt;Most major providers offer fine-tuning as an API service where you upload your examples and they handle the actual training infrastructure for you. The general shape looks like this, using OpenAI's fine-tuning setup as the example since it's widely used and well documented.&lt;/p&gt;

&lt;p&gt;First, you prepare your training data in a specific format, usually a JSONL file, which just means one JSON object per line, each one representing a single example conversation.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;

&lt;span class="n"&gt;training_examples&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;messages&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;role&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;system&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;content&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;You are a support assistant for a software company. Always respond in a friendly, concise tone and end with an offer to help further.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
            &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;role&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;user&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;content&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;My app keeps crashing on startup.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
            &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;role&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;assistant&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;content&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Sorry about that! Try clearing the app cache first, that fixes it most of the time. Let me know if it&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;s still crashing after that and we&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;ll dig deeper together.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;messages&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;role&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;system&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;content&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;You are a support assistant for a software company. Always respond in a friendly, concise tone and end with an offer to help further.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
            &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;role&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;user&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;content&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;How do I export my data?&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
            &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;role&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;assistant&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;content&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Easy, head to Settings then Export Data, pick CSV or JSON, and it&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;ll download right away. Want a hand finding where to import it afterward?&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="c1"&gt;# in a real project, you'd want at least fifty to a few hundred
&lt;/span&gt;    &lt;span class="c1"&gt;# examples like this, all consistently following the tone and
&lt;/span&gt;    &lt;span class="c1"&gt;# format you actually want
&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="c1"&gt;# write it out as JSONL, one example per line
&lt;/span&gt;&lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;training_data.jsonl&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;w&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;example&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;training_examples&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dumps&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;example&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once you have that file, you upload it and kick off the fine-tuning job.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;openai&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;OpenAI&lt;/span&gt;

&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;OpenAI&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;api_key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;your-api-key-here&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# upload the training file
&lt;/span&gt;&lt;span class="n"&gt;uploaded_file&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;files&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;training_data.jsonl&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;rb&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="n"&gt;purpose&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;fine-tune&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# start the fine-tuning job using that file
&lt;/span&gt;&lt;span class="n"&gt;job&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;fine_tuning&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;jobs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;training_file&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;uploaded_file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;gpt-4o-mini-2024-07-18&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;job&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# this runs in the background on their servers, could take
# anywhere from minutes to a couple hours depending on data size
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can check on it while it trains.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;fine_tuning&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;jobs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;retrieve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;job&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# will show something like "running" then eventually "succeeded"
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once it's done, you get back a custom model name, and from then on you just call it exactly like you'd call any other model.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;chat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;completions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;fine_tuned_model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;role&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;user&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;content&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;The app won&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;t let me log in.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;choices&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And that's genuinely the whole hosted workflow. Prepare consistent examples, upload them, start a job, wait, then use the resulting model name like normal.&lt;/p&gt;

&lt;h3&gt;
  
  
  Version two, a peek at what's happening underneath, using LoRA locally
&lt;/h3&gt;

&lt;p&gt;If you're curious what the hosted service is actually doing for you, or you want to fine-tune an open source model yourself instead of a closed one, this is roughly what it looks like using a technique called LoRA, which stands for Low Rank Adaptation. Instead of updating all of a model's billions of parameters, which would need a serious amount of computing power, LoRA only trains a small set of additional parameters that get layered on top of the original model. It's dramatically cheaper and faster while still getting you most of the benefit.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# this example uses the Hugging Face ecosystem, a common
# open source setup for this kind of thing
# pip install transformers peft datasets torch
&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;transformers&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;AutoModelForCausalLM&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;AutoTokenizer&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;peft&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;LoraConfig&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;get_peft_model&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;datasets&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Dataset&lt;/span&gt;

&lt;span class="n"&gt;model_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;meta-llama/Llama-3.2-1B&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;  &lt;span class="c1"&gt;# a small open model as an example
&lt;/span&gt;
&lt;span class="n"&gt;tokenizer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;AutoTokenizer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;from_pretrained&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;model_name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;AutoModelForCausalLM&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;from_pretrained&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;model_name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# LoRA config, this defines how much extra "adjustable" capacity
# we're adding on top of the frozen original model
&lt;/span&gt;&lt;span class="n"&gt;lora_config&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;LoraConfig&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;                 &lt;span class="c1"&gt;# rank, basically how much extra capacity to add
&lt;/span&gt;    &lt;span class="n"&gt;lora_alpha&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;target_modules&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;q_proj&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;v_proj&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;  &lt;span class="c1"&gt;# which parts of the model to adapt
&lt;/span&gt;    &lt;span class="n"&gt;lora_dropout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.05&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;task_type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;CAUSAL_LM&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;get_peft_model&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;lora_config&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# your training examples, formatted as plain text
&lt;/span&gt;&lt;span class="n"&gt;training_texts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;User: My app keeps crashing.&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;Assistant: Sorry about that! Try clearing the app cache first, that fixes it most of the time. Let me know if it&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;s still crashing after that and we&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;ll dig deeper together.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;User: How do I export my data?&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;Assistant: Easy, head to Settings then Export Data, pick CSV or JSON, and it&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;ll download right away. Want a hand finding where to import it afterward?&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="n"&gt;dataset&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Dataset&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;from_dict&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;text&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;training_texts&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;tokenize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;example&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;tokenizer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;example&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;text&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;truncation&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;padding&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;max_length&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;max_length&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;256&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;tokenized_dataset&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;dataset&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tokenize&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# from here you'd hand this off to a Trainer object and call .train()
# the important conceptual point is just this, the model's original
# weights stay frozen, only these small LoRA layers get updated,
# which is why this is so much cheaper than training everything
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I won't pretend that second example is copy paste ready for a beginner, actually running local fine-tuning involves GPU setup, dependency management, and enough moving parts to fill its own article. The point of showing it is just so the hosted API from version one stops feeling like a black box. Underneath, it's the same basic idea, feed it consistent examples, adjust a manageable number of parameters, get a model that's shifted toward your examples.&lt;/p&gt;

&lt;h2&gt;
  
  
  Mistakes I made so you don't have to
&lt;/h2&gt;

&lt;p&gt;I fine-tuned on way too few examples the first time and got confused why nothing meaningfully changed. Consistency and volume both matter, a handful of examples isn't enough to establish a real pattern.&lt;/p&gt;

&lt;p&gt;I tried to fine-tune my way out of a knowledge problem, feeding the model our internal documentation as training examples hoping it would "learn our product." It kind of half worked and was way more expensive and slower to update than just building a small RAG setup would have been. Lesson learned the hard way, painfully.&lt;/p&gt;

&lt;p&gt;I didn't keep a solid evaluation set aside. I trained, tried a few examples, thought it looked good, and moved on, only to find out later it had gotten noticeably worse at some other unrelated task I hadn't tested. Always hold out some real test cases you didn't train on, and check the model against those before assuming a fine-tune actually helped.&lt;/p&gt;

&lt;h2&gt;
  
  
  The honest summary
&lt;/h2&gt;

&lt;p&gt;If you remember one thing from this, remember the employee example. A manual next to someone's desk fixes a knowledge gap instantly and cheaply, and that's RAG. Months of training reshapes how someone naturally behaves, and that's fine-tuning. Most problems people bring to fine-tuning are actually knowledge problems in disguise, and RAG would've solved them faster and cheaper. But for the real behavior and consistency problems, fine-tuning genuinely is the right tool, and now you've actually seen what's happening inside it instead of just hearing the word thrown around.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;If you try fine-tuning your own small model on something, I'd genuinely like to hear what you built it for, drop it in the comments.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>ai</category>
      <category>python</category>
      <category>rag</category>
    </item>
    <item>
      <title>RAG Explained Like You're Five (With Real Code You Can Actually Run)</title>
      <dc:creator>Syed Muhammad Ali Raza</dc:creator>
      <pubDate>Wed, 29 Jul 2026 03:15:00 +0000</pubDate>
      <link>https://dev.to/syedmuhammadaliraza/rag-explained-like-youre-five-with-real-code-you-can-actually-run-1050</link>
      <guid>https://dev.to/syedmuhammadaliraza/rag-explained-like-youre-five-with-real-code-you-can-actually-run-1050</guid>
      <description>&lt;h1&gt;
  
  
  RAG Explained Like You're Five (With Real Code You Can Actually Run)
&lt;/h1&gt;

&lt;p&gt;Okay so last time I wrote about RAG and a bunch of people messaged me saying "cool but I still don't get what's actually happening behind the scenes." Fair. I threw around words like embeddings and vector search without really slowing down to explain them properly. So this time I'm doing it differently.&lt;/p&gt;

&lt;p&gt;No jargon dump. Real life example first. Then a real, working, copy paste code example you can run on your own laptop today, even if you've never touched AI stuff before. By the end of this you should actually understand what's happening, not just be able to repeat the word "RAG" at a job interview.&lt;/p&gt;

&lt;p&gt;Grab a coffee, this one's long.&lt;/p&gt;

&lt;h2&gt;
  
  
  First, a real life example that has nothing to do with computers
&lt;/h2&gt;

&lt;p&gt;Imagine you're taking an exam. Two versions of the exam exist.&lt;/p&gt;

&lt;p&gt;In version one, it's closed book. You have to answer everything purely from memory. If you forgot something you studied three months ago, tough luck, you're guessing now. And when you guess, you don't say "I'm not sure." You just write something that sounds confident because that's what gets you marks in a normal exam.&lt;/p&gt;

&lt;p&gt;In version two, it's open book. You're allowed to bring your notes. When a question comes up, you flip to the right page, read the relevant paragraph, and write your answer based on what's actually written there.&lt;/p&gt;

&lt;p&gt;A regular LLM like plain ChatGPT answering your question is basically doing the closed book exam. It's answering from whatever it memorized during training, which happened at some point in the past and doesn't include your personal documents, your company's internal wiki, or anything private.&lt;/p&gt;

&lt;p&gt;RAG is what happens when you hand the model an open book exam instead. Before it answers, you go find the right page from your own documents and put it in front of the model. Then you ask the question. The model reads what's in front of it and answers based on that, instead of guessing from memory.&lt;/p&gt;

&lt;p&gt;That's genuinely the whole idea. RAG stands for Retrieval Augmented Generation, which is just a fancy way of saying "look stuff up, then generate an answer using what you looked up."&lt;/p&gt;

&lt;h2&gt;
  
  
  A second real life example, this time with a librarian
&lt;/h2&gt;

&lt;p&gt;Picture walking into a massive library and asking the librarian a question like "what does our company's return policy say about opened electronics."&lt;/p&gt;

&lt;p&gt;A librarian who just answers off the top of their head, without checking anything, might get it roughly right or might completely make it up based on what return policies usually look like at other stores. That's your plain LLM.&lt;/p&gt;

&lt;p&gt;A good librarian instead says "let me check" and walks over to the right shelf, pulls out the specific policy document, flips to the relevant page, reads that paragraph, and then answers you using what's actually written there. That "walking over to the shelf and finding the right page" part is retrieval. The "reading it and giving you an answer in plain English" part is generation. Put those two together and you get Retrieval Augmented Generation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why can't the model just memorize everything
&lt;/h2&gt;

&lt;p&gt;Good question, and it's the one that trips people up. A few reasons.&lt;/p&gt;

&lt;p&gt;The model was trained at some point in the past on a giant pile of public text from the internet. Anything private, like your own notes, your company's internal docs, your codebase, or anything created after training happened, it simply never saw. There's no way for it to know that stuff exists.&lt;/p&gt;

&lt;p&gt;Even if you tried to train the model on your own data specifically (this is called fine tuning), that process is slow, expensive, and annoying to redo every single time your documents change. If your company policy gets updated tomorrow, you don't want to retrain a whole model. You just want the system to pick up the new document.&lt;/p&gt;

&lt;p&gt;RAG sidesteps all of that. Your documents live wherever they normally live. When someone asks a question, you search those documents on the spot, grab the relevant bit, and hand it to the model fresh every single time. Update a document, and the very next question automatically benefits from the update. No retraining needed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Okay but how does the computer know which part of the document is "relevant"
&lt;/h2&gt;

&lt;p&gt;This is the part everyone glosses over, so let's actually slow down here because this is the heart of the whole system.&lt;/p&gt;

&lt;p&gt;Computers are bad at understanding meaning the way we do. If you search a document for the exact words "cancel my subscription" using basic search, and the document actually says "how to terminate your membership," a simple keyword search will completely miss it, even though to a human those two phrases obviously mean almost the same thing.&lt;/p&gt;

&lt;p&gt;To fix this, we use something called an embedding model. Its whole job is to take a piece of text and turn it into a list of numbers, something like [0.12, -0.87, 0.44, ... ] with maybe a few hundred or a thousand numbers in the list. This list of numbers is called a vector.&lt;/p&gt;

&lt;p&gt;Here's the important bit. The embedding model is trained in such a way that texts with similar meaning end up with similar lists of numbers, even if the actual words are totally different. So "cancel my subscription" and "terminate my membership" end up with vectors that are close to each other in this numerical space, while something totally unrelated like "recipe for banana bread" ends up far away.&lt;/p&gt;

&lt;p&gt;Once everything, both your documents and the user's question, gets converted into these number lists, finding "relevant" text becomes a math problem. You're just measuring which document vectors sit closest to the question's vector. That's it. That's the secret. It's not understanding in the human sense, it's just very clever math on numbers that happen to represent meaning.&lt;/p&gt;

&lt;h2&gt;
  
  
  The full pipeline, step by step, in plain English before we touch code
&lt;/h2&gt;

&lt;p&gt;Here's the order things actually happen in, and I'll walk through each piece with the librarian example still in your head.&lt;/p&gt;

&lt;p&gt;Step one, you take your documents and chop them into smaller pieces. This is called chunking. You wouldn't hand someone an entire 300 page manual to find one paragraph, you'd hand them the specific page. Same idea here.&lt;/p&gt;

&lt;p&gt;Step two, you run every chunk through the embedding model and get back a list of numbers for each one. You save all these number lists somewhere, this storage is usually called a vector store or vector database.&lt;/p&gt;

&lt;p&gt;Step three, this all happens once, ahead of time, before anyone even asks a question. Think of it as pre organizing the library shelves.&lt;/p&gt;

&lt;p&gt;Step four, when someone actually asks a question, you run their question through the same embedding model to get its number list.&lt;/p&gt;

&lt;p&gt;Step five, you compare the question's numbers against every chunk's numbers and pull out the closest matches. This comparison usually uses something called cosine similarity, which is just a mathematical way of measuring how similar two lists of numbers are, kind of like measuring the angle between two arrows.&lt;/p&gt;

&lt;p&gt;Step six, you take those closest matching chunks and paste them into a prompt along with the original question, then send that whole thing to the LLM.&lt;/p&gt;

&lt;p&gt;Step seven, the LLM reads the chunks you gave it and answers the question using that information, instead of guessing from memory.&lt;/p&gt;

&lt;p&gt;That's the entire system. Now let's actually build one.&lt;/p&gt;

&lt;h2&gt;
  
  
  Let's build a tiny working version, for real
&lt;/h2&gt;

&lt;p&gt;I'm going to keep the tools boring on purpose so you can actually follow what's happening instead of getting lost in library documentation. We'll use plain Python, a small free embedding model that runs locally on your own computer (no API key needed for this part), and basic math with numpy.&lt;/p&gt;

&lt;p&gt;First, install what we need.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;sentence-transformers numpy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;sentence-transformers&lt;/code&gt; library gives us a ready made embedding model we can use for free, and it downloads automatically the first time you run it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1, our tiny "documents"
&lt;/h3&gt;

&lt;p&gt;In a real system these would come from actual files, a database, or a website. To keep things simple and easy to follow, I'm just going to write them directly as text in the code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;documents&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Our return policy allows customers to return unopened electronics within 30 days for a full refund.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Opened electronics can only be exchanged for the same item if there is a manufacturing defect.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Software products and digital downloads are non refundable once purchased.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Shipping costs are non refundable, only the product price is refunded.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;To start a return, log into your account and click on Order History, then select Request Return.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2, chunking
&lt;/h3&gt;

&lt;p&gt;In this example each sentence is already a nice small chunk, so we don't need to split them further. In a real project, you'd usually break long documents into pieces of a few hundred words each, often with a bit of overlap between chunks so you don't accidentally cut a sentence in half at a chunk boundary. For our tiny example, each line above is already one clean chunk.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3, turning our documents into number lists (embeddings)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sentence_transformers&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;SentenceTransformer&lt;/span&gt;

&lt;span class="c1"&gt;# this loads a small, free embedding model onto your computer
&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;SentenceTransformer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;all-MiniLM-L6-v2&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# this turns every document into a list of numbers
&lt;/span&gt;&lt;span class="n"&gt;document_embeddings&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;encode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;documents&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;document_embeddings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shape&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# output looks something like: (5, 384)
# 5 documents, each turned into a list of 384 numbers
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you print &lt;code&gt;document_embeddings[0]&lt;/code&gt;, you'll literally see a long list of decimal numbers. That's the "meaning" of the first sentence, expressed as math instead of words.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4, turning the user's question into a number list too
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;question&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Can I get money back for a game I bought online?&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;span class="n"&gt;question_embedding&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;encode&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="n"&gt;question&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice the question doesn't use the words "refund" or "software" directly, it says "money back" and "game I bought online." A basic keyword search would probably miss the right document entirely. Let's see if our embedding based approach does better.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 5, finding the closest matching documents using math
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;numpy&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;cosine_similarity&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;linalg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;norm&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;linalg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;norm&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

&lt;span class="c1"&gt;# compare the question against every document
&lt;/span&gt;&lt;span class="n"&gt;similarities&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;doc_embedding&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;enumerate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;document_embeddings&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;cosine_similarity&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;question_embedding&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;doc_embedding&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;similarities&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;score&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;documents&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]))&lt;/span&gt;

&lt;span class="c1"&gt;# sort so the best matches come first
&lt;/span&gt;&lt;span class="n"&gt;similarities&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sort&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;lambda&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;reverse&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# grab the top 2 most relevant chunks
&lt;/span&gt;&lt;span class="n"&gt;top_matches&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;similarities&lt;/span&gt;&lt;span class="p"&gt;[:&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;score&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;top_matches&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;score&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;-&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When I run this, the top result is the sentence about software products and digital downloads being non refundable, even though the question never uses the word "software" or "refundable." That's the embedding model catching the meaning of "game bought online" and "money back," not just the literal words. This is genuinely the moment RAG clicked for me the first time I saw it work.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 6, building the prompt with the retrieved chunks
&lt;/h3&gt;

&lt;p&gt;Now we take those top matching chunks and hand them to the LLM along with clear instructions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;retrieved_text&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;score&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;top_matches&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;

&lt;span class="n"&gt;prompt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;
You are a helpful customer support assistant.
Only answer using the information given in the context below.
If the answer isn&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;t in the context, say you don&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;t know, do not guess.

Context:
&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;retrieved_text&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;

Question: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;question&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;
&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prompt&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That instruction telling it not to guess matters a lot more than it looks like at first glance. Without it, the model tends to blend its own general knowledge in with your retrieved context, and you lose the whole point of grounding the answer in your actual documents.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 7, sending it to an actual LLM
&lt;/h3&gt;

&lt;p&gt;This last part depends on which AI provider you're using, but the shape of it is always the same, you send the prompt, you get text back. Here's what it looks like using a typical API setup.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;anthropic&lt;/span&gt;

&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;anthropic&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Anthropic&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;api_key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;your-api-key-here&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;claude-sonnet-4-6&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;max_tokens&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;300&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;role&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;user&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;content&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;prompt&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And that's it. That's a full, real, working RAG pipeline from raw text documents all the way to a grounded answer. Everything above this line is the entire concept. Everything real world RAG systems add on top is just making these same seven steps faster, cheaper, and more accurate at a bigger scale.&lt;/p&gt;

&lt;h2&gt;
  
  
  What changes when you go from this toy example to a real project
&lt;/h2&gt;

&lt;p&gt;The core idea never changes, but a few things get more serious once you're dealing with thousands of documents instead of five sentences.&lt;/p&gt;

&lt;p&gt;Instead of storing embeddings in a plain Python list, you'd use an actual vector database like Chroma, Pinecone, or Weaviate, which are built to search through millions of these number lists quickly.&lt;/p&gt;

&lt;p&gt;Instead of writing your documents directly in the code, you'd load them from PDFs, websites, or a database, and you'd need a proper chunking strategy, usually a few hundred words per chunk with some overlap between chunks.&lt;/p&gt;

&lt;p&gt;You'd also want to handle the case where nothing relevant gets found at all, and make sure the model actually says "I don't know" instead of making something up, which is why that instruction in the prompt matters so much.&lt;/p&gt;

&lt;p&gt;And you'd probably want to periodically re run the embedding step whenever your source documents change, otherwise you end up answering questions using outdated information without any warning that something's wrong.&lt;/p&gt;

&lt;p&gt;None of that changes the underlying idea though. It's still just search, then answer using what you found. Everything else is refinement.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where you'll actually run into this in daily life
&lt;/h2&gt;

&lt;p&gt;Once you understand this, you start noticing it everywhere. That chatbot on a company's website that somehow knows details specific to your account and their exact policies, probably running some version of this. Tools that let you upload a PDF and "chat" with it, same idea, your PDF gets chunked and embedded, then your questions get matched against those chunks. Even code editors that can answer questions about your specific codebase are usually doing something similar, searching your actual files for relevant code before answering, instead of relying purely on what the model happened to learn during training.&lt;/p&gt;

&lt;p&gt;Once you see the pattern, these products stop feeling like unexplainable magic and start feeling like something you could genuinely build yourself over a weekend, because now you actually have.&lt;/p&gt;

&lt;h2&gt;
  
  
  A small challenge if you want to actually learn this properly
&lt;/h2&gt;

&lt;p&gt;Reading code is fine but it won't stick the way building something does. Try this, take ten notes or documents about anything you actually care about, your recipes, your class notes, your journal entries, whatever, and run them through the code above. Ask questions and watch what gets retrieved. Try asking things using totally different words than what's in your notes and see if it still finds the right chunk. Then try breaking it on purpose, ask something that isn't covered in your notes at all and see if your prompt instruction actually makes it say "I don't know" instead of guessing.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>rag</category>
      <category>python</category>
      <category>beginners</category>
    </item>
    <item>
      <title>I Built a "Chat With Your Docs" Tool and Finally Understood RAG</title>
      <dc:creator>Syed Muhammad Ali Raza</dc:creator>
      <pubDate>Tue, 28 Jul 2026 05:58:21 +0000</pubDate>
      <link>https://dev.to/syedmuhammadaliraza/i-built-a-chat-with-your-docs-tool-and-finally-understood-rag-54ke</link>
      <guid>https://dev.to/syedmuhammadaliraza/i-built-a-chat-with-your-docs-tool-and-finally-understood-rag-54ke</guid>
      <description>&lt;h1&gt;
  
  
  I Built a "Chat With Your Docs" Tool and Finally Understood RAG
&lt;/h1&gt;

&lt;p&gt;There's a specific kind of frustration that comes from asking an LLM a question about your own codebase, or your own company's internal docs, and watching it confidently make something up. Not because it's broken  because it genuinely has no way of knowing what's in a folder on your laptop, or a Notion page behind your company's login wall. It was trained on a giant snapshot of public text a while ago, and that's the entire universe it has access to unless you feed it something else.&lt;/p&gt;

&lt;p&gt;The first time I tried to fix this, my instinct was "fine tuning must be the answer  I'll just train it on my data." That turned out to be the wrong tool for the job, and expensive, and slow to iterate on. What I actually wanted has a name: RetrievalAugmented Generation, or RAG. And once I built a small version of it myself, the concept stopped feeling like a buzzword and started feeling almost embarrassingly simple.&lt;/p&gt;

&lt;p&gt;Here's what I learned building one, including the parts that tripped me up.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Idea, Stripped of Jargon
&lt;/h2&gt;

&lt;p&gt;RAG boils down to one sentence: before you ask the model a question, go find the relevant text yourself, and hand it to the model along with the question.&lt;/p&gt;

&lt;p&gt;That's the whole trick. Instead of hoping the model "knows" the answer from training, you do the lookup  search your documents, pull out the parts that seem relevant  and paste those chunks into the prompt. The model then answers based on what's sitting right in front of it, not what it vaguely remembers from training data that might be a year out of date or might not include your content at all.&lt;/p&gt;

&lt;p&gt;It's the AI equivalent of an openbook exam. You're not testing what the model memorized. You're handing it the book, open to the right page, and asking it to read and answer.&lt;/p&gt;

&lt;p&gt;The reason this works so well in practice is that LLMs are genuinely excellent at synthesizing and summarizing text that's directly in front of them  that's much closer to their core strength than recalling obscure facts from training. RAG plays to that strength instead of fighting it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Not Just Paste Everything Into the Prompt?
&lt;/h2&gt;

&lt;p&gt;My first "implementation" of RAG, before I knew what I was doing, was literally copypasting an entire document into the chat window before asking my question. That works fine for a fivepage PDF. It falls apart fast once you're dealing with hundreds of documents, a large codebase, or a knowledge base that doesn't fit in any context window no matter how generous.&lt;/p&gt;

&lt;p&gt;Even when things technically fit, there's a cost problem  you're paying (in tokens, in latency) to feed the model a bunch of irrelevant text alongside the two paragraphs that actually matter. So the real engineering problem RAG solves isn't "how do I give the model my data," it's "how do I automatically find and hand it only the small slice of my data that's actually relevant to this specific question."&lt;/p&gt;

&lt;p&gt;That's where the interesting part starts.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Pieces That Actually Make It Work
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Chunking
&lt;/h3&gt;

&lt;p&gt;You can't search a giant document as one blob effectively, so the first step is breaking it into smaller pieces  a paragraph, a few sentences, a section. I underestimated how much this step matters. Chunk too large, and you dilute the relevant bit with a bunch of noise. Chunk too small, and you lose context  a sentence pulled out of its surrounding paragraph can be almost meaningless on its own.&lt;/p&gt;

&lt;p&gt;I ended up landing on chunks of a few hundred words with a bit of overlap between consecutive chunks, so a sentence that happens to sit right at a chunk boundary doesn't get orphaned from its context. This isn't some universal magic number  it took a fair amount of trial and error looking at what actually got retrieved for real questions before it felt right.&lt;/p&gt;

&lt;h3&gt;
  
  
  Embeddings
&lt;/h3&gt;

&lt;p&gt;This was the part that felt like magic until I sat down and actually understood it. An embedding model takes a piece of text and converts it into a list of numbers  a vector  positioned in a highdimensional space such that texts with similar meaning end up close together in that space, and unrelated texts end up far apart.&lt;/p&gt;

&lt;p&gt;So "the cat sat on the mat" and "a feline rested on the rug"  very different words, similar meaning  would land near each other in this space. That's the property that makes semantic search possible: you're not matching keywords, you're matching meaning.&lt;/p&gt;

&lt;p&gt;You run every chunk of your documents through this embedding model once, ahead of time, and store the resulting vectors. When a user asks a question, you embed the question the same way, then look for the stored chunks whose vectors are closest to it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Vector Storage and Search
&lt;/h3&gt;

&lt;p&gt;Those embeddings need to live somewhere you can search efficiently. For a side project, something lightweight is genuinely enough  I started with a simple local vector store and only reached for something like Pinecone or a managed vector database once I actually had a scale problem, not before. A common mistake I see (and made myself) is reaching for heavy infrastructure before confirming the basic approach even works on a small scale.&lt;/p&gt;

&lt;p&gt;The search step itself is just "find the k chunks whose vectors are closest to the question's vector"  usually using cosine similarity. In practice, retrieving somewhere around three to eight chunks worked well for me; too few and you risk missing the answer, too many and you're back to diluting the prompt with noise.&lt;/p&gt;

&lt;h3&gt;
  
  
  Assembling the Prompt
&lt;/h3&gt;

&lt;p&gt;This is the step that's easy to gloss over but matters a lot. Once you have your retrieved chunks, you don't just dump them in  you construct a prompt that makes it explicit what the model should do with them. Something along the lines of:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;You are answering questions using only the context provided below.
If the answer isn't in the context, say you don't know  don't guess.

Context:
[retrieved chunk 1]
[retrieved chunk 2]
[retrieved chunk 3]

Question: {user's question}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That instruction to say "I don't know" rather than guess turned out to be one of the highest-leverage lines in the whole system. Without it, the model will happily blend its own background knowledge with your retrieved context, and you lose the whole point of grounding it in your actual data. With it, you get much more honest "the docs don't cover this" responses instead of confident nonsense.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where Mine Broke (And What That Taught Me)
&lt;/h2&gt;

&lt;p&gt;The first version I built worked shockingly well on obvious test questions and then fell over on real ones. A few lessons from debugging it:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Retrieval quality matters more than prompt cleverness.&lt;/strong&gt; I spent an embarrassing amount of time tweaking my prompt template before realizing the actual problem was upstream  the wrong chunks were being retrieved in the first place. No prompt engineering fixes bad retrieval. If the right information never makes it into the context, the model has no chance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Questions phrased differently than the source text can miss.&lt;/strong&gt; Semantic search is good, not psychic. A question asking "how do I cancel my plan" might not retrieve a doc chunk titled "Subscription Termination Process" as strongly as you'd hope, depending on the embedding model. This pushed me toward also trying a hybrid approach  combining semantic search with old-fashioned keyword search  which noticeably improved recall on edge cases.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stale data is a silent failure mode.&lt;/strong&gt; If your source documents change and you don't re-run the embedding step on the updated content, you'll keep serving confidently wrong answers based on outdated chunks, and nothing in the system will warn you. This is an unglamorous but very real operational concern once you're running one of these for real.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Evaluating "is this a good answer" is genuinely hard.&lt;/strong&gt; Unlike a typical software bug, there's no clean pass/fail. I ended up building a small set of test questions with known correct answers and periodically eyeballing whether changes to chunking or retrieval helped or hurt, which is a pretty manual process but better than flying blind.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where This Fits Into the Bigger Picture
&lt;/h2&gt;

&lt;p&gt;Once I understood RAG at this level, a lot of AI products I'd used casually suddenly made more sense. "Chat with your PDF" tools, internal company knowledge bots, customer support assistants that somehow know your specific order history  most of these aren't relying on some enormous finetuned model that magically knows everything. They're running some version of the retrievethengenerate loop described above, often with a fair amount of extra plumbing around chunking strategy, reranking, and prompt construction.&lt;/p&gt;

&lt;p&gt;It also reframed how I think about "does the model know X." The more useful question, most of the time, isn't whether the model was trained on something  it's whether you can retrieve the right information and hand it over at the moment it's needed. That shift in thinking has been more useful to me day to day than any specific prompting trick.&lt;/p&gt;

&lt;p&gt;If you're looking for a genuinely good weekend project to understand this stuff at a level deeper than reading about it, building a small RAG pipeline over your own notes or a folder of PDFs is a great one. It's small enough to finish in a weekend, and it touches almost every practical concept that shows up in production AI systems  embeddings, search, prompt construction, and the very real gap between "works on my test question" and "works reliably."&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>rag</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>What's Actually Going On Inside an LLM (And Why Your Prompts Keep Failing)</title>
      <dc:creator>Syed Muhammad Ali Raza</dc:creator>
      <pubDate>Mon, 27 Jul 2026 06:04:59 +0000</pubDate>
      <link>https://dev.to/syedmuhammadaliraza/whats-actually-going-on-inside-an-llm-and-why-your-prompts-keep-failing-1hbp</link>
      <guid>https://dev.to/syedmuhammadaliraza/whats-actually-going-on-inside-an-llm-and-why-your-prompts-keep-failing-1hbp</guid>
      <description>&lt;p&gt;A few months into using ChatGPT and Claude daily for work, I hit a wall. Some days the model felt like magic it would write exactly the function I needed, catch a bug I'd missed, explain a concept better than any textbook. Other days, the same tool would confidently give me garbage. Wrong API names. Made-up library functions. Code that looked right but silently did the wrong thing.&lt;/p&gt;

&lt;p&gt;For a while I chalked this up to "the AI being inconsistent." Eventually I realized the inconsistency was mostly on my end. I didn't actually understand what these models were doing under the hood, so I had no framework for knowing when to trust them, when to double-check them, or how to ask for what I actually wanted. Once I started treating prompting as an actual skill instead of "just typing a question," the quality of what I got back changed dramatically.&lt;/p&gt;

&lt;p&gt;This is the article I wish someone had handed me back then.&lt;/p&gt;

&lt;h2&gt;
  
  
  Forget "AI." Think "Autocomplete on Steroids."
&lt;/h2&gt;

&lt;p&gt;The most useful mental shift I made was dropping the sci-fi framing entirely. An LLM is not a mind. It's not reasoning about the world the way you or I do. At its core, it's a system trained on an enormous pile of text to do one job: given everything written so far, predict what token comes next.&lt;/p&gt;

&lt;p&gt;A token isn't quite a word — it's more like a chunk of a word. "Understanding" might get split into "under," "stand," and "ing," for example. The model doesn't see letters or meaning directly. It sees these chunks, converts them into number patterns, and repeatedly asks itself "given this pattern so far, what's statistically likely to come next?" It does this one token at a time, feeding its own output back in as it goes.&lt;/p&gt;

&lt;p&gt;That's genuinely it. There's no internal database being queried, no fact-checker running in the background, no persistent understanding of your codebase sitting there waiting. Everything the model "knows" is baked into billions of parameters shaped during training, and everything it produces is a very sophisticated guess based on patterns.&lt;/p&gt;

&lt;p&gt;Once that clicked for me, a lot of weird behavior stopped being mysterious. Of course it confidently invents a library function that doesn't exist somewhere in its training data, that pattern of "here's a plausible-sounding function name for this task" was common enough to reproduce. It's not lying. It doesn't know the difference between "real" and "plausible." Prompting well is largely about closing that gap.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Memory Problem Nobody Warns You About
&lt;/h2&gt;

&lt;p&gt;Here's something that tripped me up constantly early on: the model doesn't remember your last conversation unless the product you're using specifically layers memory on top (and even then, it's usually a summarized version, not the full transcript).&lt;/p&gt;

&lt;p&gt;Every single time you start a new chat, you're talking to a version of the model with zero knowledge of anything you've discussed before. It doesn't know your codebase, your company's conventions, your past preferences, or that you already told it three times not to use a particular library. You have to re-establish all of that context, every time, unless you're deliberately carrying it forward yourself.&lt;/p&gt;

&lt;p&gt;This also applies &lt;em&gt;within&lt;/em&gt; a single long conversation. There's a limit the "context window"  to how much text the model can actively hold in view at once. Modern models have gotten genuinely good at handling long contexts, but I've still noticed that details buried in the middle of a very long conversation get "forgotten" more easily than things stated near the beginning or end. If something is important, it's worth restating it rather than assuming the model still has it front of mind.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the Same Question Gets You Different Answers
&lt;/h2&gt;

&lt;p&gt;If you've ever asked an LLM the exact same question twice and gotten two different answers, that's not a bug. These models generate text probabilistically — at each step, there's a distribution of plausible next tokens, and the model samples from that distribution rather than always picking the single most likely one. This is actually intentional; picking the "safest" token every single time tends to produce dull, repetitive text.&lt;/p&gt;

&lt;p&gt;The practical takeaway: don't treat a single response as ground truth, especially for anything factual or high-stakes. If accuracy matters, ask again, ask it to double-check itself, or verify independently. I've caught real mistakes just by asking "are you sure about that?"  not because the model has some hidden self-awareness, but because the follow-up prompt gives it another shot at generating a better-calibrated answer.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Prompting Habits That Actually Moved the Needle for Me
&lt;/h2&gt;

&lt;p&gt;I went through the usual phase of collecting "magic prompt" lists from Twitter threads. Most of it was noise. What actually helped was much less exotic than I expected.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Writing the prompt like I'm briefing a smart contractor who's never seen my project.&lt;/strong&gt; Not a genius who can read my mind — a competent person who needs the actual context. What's the tech stack? What have I already tried? What does "good" look like here? The lazier my prompt, the lazier and more generic the output.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Giving examples instead of describing what I want in the abstract.&lt;/strong&gt; This one surprised me with how much of a difference it makes. If I want text reformatted a certain way, showing the model one or two input/output pairs almost always beats three paragraphs explaining the rules. It's the difference between describing a chair to someone versus just pointing at one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Asking for reasoning before the answer, on anything nontrivial.&lt;/strong&gt; For simple lookups this doesn't matter. But for debugging, architecture decisions, or anything involving multiple steps, explicitly asking the model to "think through this step by step before giving your final answer" noticeably reduces sloppy mistakes. It's forcing the model to lay out its own logic where it  and I  can spot errors, instead of jumping straight to a confident-sounding conclusion.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Telling it what NOT to do.&lt;/strong&gt; I underestimated this for a long time. "Don't use any external dependencies," "avoid marketing language," "don't just restate the question"  negative constraints cut out a huge amount of the generic filler these models default to.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Treating it as a back-and-forth, not a vending machine.&lt;/strong&gt; My first prompt is rarely my best one. I've stopped expecting a perfect answer on the first try and started treating the process more like pairing with someone: get a draft, point out specifically what's off, iterate. This alone probably improved my results more than any specific technique.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where This Gets Genuinely More Advanced
&lt;/h2&gt;

&lt;p&gt;Once basic prompting stops being the bottleneck, there's a whole layer of stuff worth knowing about, even if you're not building AI products yourself:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Retrieval-augmented generation (RAG)&lt;/strong&gt; is the fancy term for something intuitive: instead of relying on what the model memorized during training, you fetch relevant documents or data at request time and stuff them into the prompt. This is how a lot of "chat with your docs" tools work, and it's a big part of why some AI products feel much more accurate than raw ChatGPT  they're not relying purely on the model's internal knowledge.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tool use / function calling&lt;/strong&gt; lets a model call external code  hit an API, run a calculation, query a database  instead of just generating text and hoping it's right. This is a huge deal in practice because it moves things like arithmetic, live data lookups, and factual retrieval away from "the model's best guess" and toward "an actual deterministic system."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Agents&lt;/strong&gt; are essentially LLMs given a loop: take an action, observe the result, decide the next action, repeat, usually with some memory of what's happened so far. This is what's behind coding assistants that can browse a codebase, run tests, and fix their own mistakes rather than just producing a single response.&lt;/p&gt;

&lt;p&gt;I'd hold off on diving deep into any of these until basic prompting feels comfortable. It's a bit like learning to debug before you learn a framework the fundamentals compound.&lt;/p&gt;

&lt;h2&gt;
  
  
  The One Thing I'd Tell Past Me
&lt;/h2&gt;

&lt;p&gt;Stop treating the model like it either "knows" or "doesn't know" things, full stop. Treat it like a very well-read collaborator who's fast, tireless, occasionally brilliant, and prone to confidently bluffing when it's out of its depth  much like a smart intern who hasn't yet learned to say "I'm not sure." Once you internalize that, you stop being surprised by the failures and start getting a lot more consistent value out of the successes.&lt;/p&gt;

&lt;p&gt;If you're just starting to work with these tools seriously, don't expect to be good at this after one afternoon of playing with ChatGPT. It took me actively paying attention to what worked and what didn't over weeks of daily use before it clicked. But it does click and once it does, it's hard to go back to writing vague one-line prompts and hoping for the best.&lt;/p&gt;




</description>
      <category>ai</category>
      <category>llm</category>
      <category>promptengineering</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>How to Start a Career in AI/ML: A Complete Roadmap for Beginners</title>
      <dc:creator>Syed Muhammad Ali Raza</dc:creator>
      <pubDate>Fri, 24 Jul 2026 06:41:33 +0000</pubDate>
      <link>https://dev.to/syedmuhammadaliraza/how-to-start-a-career-in-aiml-a-complete-roadmap-for-beginners-7h4</link>
      <guid>https://dev.to/syedmuhammadaliraza/how-to-start-a-career-in-aiml-a-complete-roadmap-for-beginners-7h4</guid>
      <description>&lt;h1&gt;
  
  
  How to Start a Career in AI/ML: A Complete Roadmap for Beginners
&lt;/h1&gt;

&lt;p&gt;Artificial Intelligence and Machine Learning are no longer "future" skills  they're already reshaping how software is built, how businesses make decisions, and how products are designed. If you're a developer, student, or career-switcher wondering how to break into this field, the good news is: you don't need a PhD or a decade of math courses to get started. You need a clear path and consistent effort.&lt;/p&gt;

&lt;p&gt;This article lays out a practical, no-fluff roadmap to help you go from "complete beginner" to "job-ready AI/ML practitioner."&lt;/p&gt;

&lt;h2&gt;
  
  
  Why AI/ML Is Worth Learning Right Now
&lt;/h2&gt;

&lt;p&gt;Before diving into the "how," it's worth understanding the "why":&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Demand is exploding.&lt;/strong&gt; Companies across every industry  healthcare, finance, retail, logistics  are hiring for ML engineers, data scientists, and AI application developers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The barrier to entry is lower than ever.&lt;/strong&gt; Tools like scikit-learn, PyTorch, and high-level APIs (OpenAI, Anthropic, Hugging Face) let you build real things without writing algorithms from scratch.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It's not just for "math geniuses."&lt;/strong&gt; Applied AI/ML roles today lean heavily on engineering, problem-solving, and communication — not just theoretical math.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 1: Get Comfortable with the Fundamentals
&lt;/h2&gt;

&lt;p&gt;You don't need to master everything before you start building, but a working foundation will save you a lot of confusion later.&lt;/p&gt;

&lt;h3&gt;
  
  
  Math (the practical minimum)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Linear algebra&lt;/strong&gt;  vectors, matrices, dot products (used constantly in ML models)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Probability &amp;amp; statistics&lt;/strong&gt;  distributions, mean/variance, Bayes' theorem&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Calculus basics&lt;/strong&gt;  derivatives and gradients (enough to understand gradient descent)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You don't need to be a math expert. Aim for &lt;em&gt;intuitive understanding&lt;/em&gt;, not textbook mastery.&lt;/p&gt;

&lt;h3&gt;
  
  
  Programming
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Python&lt;/strong&gt; is the standard language for AI/ML. Learn it well before moving forward.&lt;/li&gt;
&lt;li&gt;Get comfortable with &lt;strong&gt;NumPy&lt;/strong&gt;, &lt;strong&gt;Pandas&lt;/strong&gt;, and &lt;strong&gt;Matplotlib&lt;/strong&gt;  the everyday toolkit for data manipulation and visualization.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Core ML Concepts
&lt;/h3&gt;

&lt;p&gt;Understand these before touching frameworks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Supervised vs. unsupervised vs. reinforcement learning&lt;/li&gt;
&lt;li&gt;Training, validation, and test sets&lt;/li&gt;
&lt;li&gt;Overfitting vs. underfitting&lt;/li&gt;
&lt;li&gt;Bias-variance tradeoff&lt;/li&gt;
&lt;li&gt;Common algorithms: linear/logistic regression, decision trees, k-means, k-NN&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 2: Learn the Tools of the Trade
&lt;/h2&gt;

&lt;p&gt;Once fundamentals click, move into hands-on tools:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;scikit-learn&lt;/strong&gt; the best starting point for classical ML (regression, classification, clustering)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TensorFlow or PyTorch&lt;/strong&gt;  for deep learning; PyTorch is currently the most popular in research and increasingly in industry&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Jupyter Notebooks&lt;/strong&gt; for experimenting and visualizing as you learn&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hugging Face&lt;/strong&gt;  for working with pretrained models (NLP, vision, and beyond)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Git/GitHub&lt;/strong&gt;  non-negotiable for any developer role; you'll use it to showcase projects&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 3: Build Real Projects (This Is Where Learning Sticks)
&lt;/h2&gt;

&lt;p&gt;Tutorials teach you syntax. Projects teach you how to think. Don't skip this step.&lt;/p&gt;

&lt;p&gt;Start simple and increase complexity over time:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Beginner:&lt;/strong&gt; Predict house prices with linear regression, classify iris flowers, build a spam detector&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Intermediate:&lt;/strong&gt; Image classifier with CNNs, sentiment analysis on tweets, a recommendation system&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Advanced:&lt;/strong&gt; Fine-tune a pretrained transformer model, build an end-to-end ML pipeline with deployment, create a small LLM-powered app using an API&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For each project:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Push the code to GitHub&lt;/li&gt;
&lt;li&gt;Write a clear README explaining the problem, approach, and results&lt;/li&gt;
&lt;li&gt;Reflect on what you learned and what you'd improve&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This portfolio becomes your proof of skill  often more valuable than a certificate.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Learn to Think Like an ML Engineer, Not Just a Modeler
&lt;/h2&gt;

&lt;p&gt;A common beginner trap is obsessing over model accuracy while ignoring everything else that matters in real-world AI/ML work:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Data quality&lt;/strong&gt;  garbage in, garbage out. Learn data cleaning and feature engineering deeply.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Evaluation metrics&lt;/strong&gt;  know when to use precision/recall vs. accuracy vs. F1-score, and why it matters.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deployment basics&lt;/strong&gt;  learn how models go from notebook to production (Flask/FastAPI, Docker, basic cloud deployment).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;MLOps awareness&lt;/strong&gt;  even a basic understanding of model monitoring, versioning, and retraining will set you apart.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 5: Specialize (Eventually)
&lt;/h2&gt;

&lt;p&gt;AI/ML is broad. Once you have the basics down, pick a direction that excites you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;NLP&lt;/strong&gt;  chatbots, language models, text analysis&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Computer Vision&lt;/strong&gt;  image/video recognition, object detection&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Recommender Systems&lt;/strong&gt;  personalization engines&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;MLOps/Infrastructure&lt;/strong&gt;  deploying and scaling ML systems&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Applied AI / LLM Engineering&lt;/strong&gt;  building products on top of foundation models (a fast-growing niche right now)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You don't need to pick immediately  explore first, specialize once something clicks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 6: Build Your Presence and Network
&lt;/h2&gt;

&lt;p&gt;Technical skill alone doesn't guarantee a job  visibility helps a lot.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Write about what you learn.&lt;/strong&gt; Explaining a concept (like you're doing by reading this!) solidifies your understanding and builds credibility. Platforms like dev.to are great for this.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Contribute to open source.&lt;/strong&gt; Even small contributions to ML libraries or projects show initiative.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Join communities.&lt;/strong&gt; Kaggle, Hugging Face forums, and AI-focused Discord/Slack groups are great for learning and networking.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Enter competitions.&lt;/strong&gt; Kaggle competitions are a fantastic way to test your skills against real problems and see how others approach them.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 7: Prepare for the Job Search
&lt;/h2&gt;

&lt;p&gt;When you're ready to apply:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Tailor your resume&lt;/strong&gt; to highlight projects, not just courses.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Practice explaining your projects&lt;/strong&gt; clearly interviewers care as much about your thought process as your results.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Study common interview topics&lt;/strong&gt;: ML fundamentals, coding (data structures/algorithms), SQL, and case studies ("how would you approach building X system?").&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Consider internships or freelance work&lt;/strong&gt; if full-time roles feel out of reach initially — real-world experience, even small, compounds quickly.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  A Realistic Timeline
&lt;/h2&gt;

&lt;p&gt;Everyone's pace differs, but a reasonable roadmap looks like:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Phase&lt;/th&gt;
&lt;th&gt;Focus&lt;/th&gt;
&lt;th&gt;Duration&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Foundations&lt;/td&gt;
&lt;td&gt;Python, math basics, core ML concepts&lt;/td&gt;
&lt;td&gt;2–3 months&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Tools &amp;amp; Projects&lt;/td&gt;
&lt;td&gt;scikit-learn, PyTorch/TensorFlow, portfolio projects&lt;/td&gt;
&lt;td&gt;3–4 months&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Specialization&lt;/td&gt;
&lt;td&gt;Deep dive into a chosen niche&lt;/td&gt;
&lt;td&gt;2–3 months&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Job Prep&lt;/td&gt;
&lt;td&gt;Networking, interviews, applications&lt;/td&gt;
&lt;td&gt;Ongoing&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Total: roughly 6–12 months of consistent effort to become job-ready, depending on your starting point and time commitment.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Breaking into AI/ML isn't about consuming endless courses  it's about building, iterating, and sharing what you learn along the way. Focus on fundamentals, get your hands dirty with real projects, and don't wait until you "know everything" to start applying or writing about your journey.&lt;/p&gt;

&lt;p&gt;The field moves fast, but that also means there's room for newcomers who are willing to learn in public and keep building. Start today  your future self (and your GitHub contribution graph) will thank you.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;If you found this useful, feel free to follow &lt;a class="mentioned-user" href="https://dev.to/syedmuhammadaliraza"&gt;@syedmuhammadaliraza&lt;/a&gt; for more beginner-friendly content on AI/ML, software engineering, and career growth in tech.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>machinelearning</category>
      <category>beginners</category>
      <category>career</category>
    </item>
    <item>
      <title>Multi Language Support in Your React &amp; Next JS App</title>
      <dc:creator>Syed Muhammad Ali Raza</dc:creator>
      <pubDate>Fri, 17 Jul 2026 06:00:53 +0000</pubDate>
      <link>https://dev.to/syedmuhammadaliraza/multi-language-support-in-your-react-next-js-app-od7</link>
      <guid>https://dev.to/syedmuhammadaliraza/multi-language-support-in-your-react-next-js-app-od7</guid>
      <description>&lt;h1&gt;
  
  
  How to Add Multi Language Support to Your React App Using react i18next
&lt;/h1&gt;

&lt;p&gt;As a frontend developer there comes a time when your React app needs to speak than one language. Whether you are building for an audience or planning ahead internationalization is a must have.&lt;/p&gt;

&lt;p&gt;In this guide I will walk you through setting up react i18next. The popular internationalization library for React with over 6.3 million weekly downloads.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Is Internationalization. Why Do You Need It?
&lt;/h2&gt;

&lt;p&gt;Internationalization means designing your app so it can support languages without rewriting code. Think of it as laying the foundation. Localization is what comes after. Actually translating the content.&lt;/p&gt;

&lt;p&gt;With react i18next you can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Move all user facing text into JSON translation files&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Switch languages dynamically without page reloads&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Handle plurals, variables and even HTML inside translations&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Load the translations your user needs&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Step 1: Installation
&lt;/h2&gt;

&lt;p&gt;First install the core packages. You need both i18next. React i18next.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
npm &lt;span class="nb"&gt;install &lt;/span&gt;react-i18next i18next &lt;span class="nt"&gt;--save&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You need both because i18next does the lifting. Managing languages, pluralization, formatting. React i18next gives you React tools like the useTranslation hook and Trans component.&lt;/p&gt;

&lt;p&gt;For production apps you will likely want two packages:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
npm &lt;span class="nb"&gt;install &lt;/span&gt;i18next-http-backend i18next-browser-languagedetector &lt;span class="nt"&gt;--save&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;i18next-http-backend: Loads translation JSON files from your public folder&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;i18next-browser-languagedetector: Automatically detects the users preferred language from browser settings, cookies or localStorage&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Step 2: Set Up the Configuration
&lt;/h2&gt;

&lt;p&gt;Create a file called i18n.js in your src folder.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;i18n&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;i18next&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;initReactI18next&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react-i18next&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Backend&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;i18next-http-backend&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;LanguageDetector&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;i18next-browser-languagedetector&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;i18n&lt;/span&gt;

&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;Backend&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;LanguageDetector&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;initReactI18next&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;init&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;

&lt;span class="na"&gt;fallbackLng&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;en&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="na"&gt;debug&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

&lt;span class="na"&gt;interpolation&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

&lt;span class="na"&gt;escapeValue&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;i18n&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The escapeValue is set to false because React already handles XSS protection.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 3: Connect to Your React App
&lt;/h2&gt;

&lt;p&gt;Import the i18n configuration in your entry file before rendering your app.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;createRoot&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react-dom/client&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./i18n&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./App&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;root&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;createRoot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;root&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

&lt;span class="nx"&gt;root&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;render&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;App&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Step 4: Create Your Translation Files
&lt;/h2&gt;

&lt;p&gt;By default i18next looks for translation files in public/locales/[language]/translation.json.&lt;/p&gt;

&lt;p&gt;Create this folder structure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
public/

locales/

en/

translation.json

fr/

translation.json

es/

translation.json

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;translation file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="nl"&gt;"welcome"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Welcome to my app"&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="nl"&gt;"greeting"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Hello, {{name}}!"&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="nl"&gt;"itemCount"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"You have {{count}} item"&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="nl"&gt;"itemCount_plural"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"You have {{count}} items"&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;translation file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="nl"&gt;"welcome"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Bienvenue sur mon app"&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="nl"&gt;"greeting"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Bonjour, {{name}} !"&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="nl"&gt;"itemCount"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Vous avez {{count}} article"&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="nl"&gt;"itemCount_plural"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Vous avez {{count}} articles"&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Keep your JSON keys consistent across all languages. Use. Group related strings into namespaces.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 5: Use Translations in Your Components
&lt;/h2&gt;

&lt;h3&gt;
  
  
  The useTranslation Hook
&lt;/h3&gt;

&lt;p&gt;The way to translate in functional components:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useTranslation&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react-i18next&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;WelcomeMessage&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;t&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useTranslation&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;

&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;

&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;t&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;welcome&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;

&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;t&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;greeting&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Alex&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;

&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;t&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;itemCount&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;count&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;

&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;

&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;WelcomeMessage&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When the language changes, everything re-renders automatically. No page reload needed.&lt;/p&gt;

&lt;h3&gt;
  
  
  Handling Plurals
&lt;/h3&gt;

&lt;p&gt;i18next follows CLDR rules so it handles complex pluralization across languages. Just define _ keys in your JSON:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="nl"&gt;"message"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"{{count}} item"&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="nl"&gt;"message_plural"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"{{count}} items"&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;t&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useTranslation&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="nf"&gt;t&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;message&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;count&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="nf"&gt;t&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;message&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;count&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="nf"&gt;t&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;message&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;count&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  The Trans Component for HTML and JSX
&lt;/h3&gt;

&lt;p&gt;When your translation includes links, bold text or React components use the Trans component instead of concatenating strings.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Trans&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react-i18next&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Message&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

&lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;

&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Trans&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;

Hello &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;strong&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;world&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;strong&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; check out our &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;a&lt;/span&gt; &lt;span class="na"&gt;href&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"/docs"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;docs&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;.

&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Trans&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;

&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In your translation file use numbered tags to match the JSX structure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="nl"&gt;"Hello &amp;lt;1&amp;gt;world&amp;lt;/1&amp;gt; check out our &amp;lt;3&amp;gt;docs&amp;lt;/3&amp;gt;."&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Bonjour &amp;lt;1&amp;gt;le monde&amp;lt;/1&amp;gt;, consultez notre &amp;lt;3&amp;gt;documentation&amp;lt;/3&amp;gt;."&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Trans component maps &amp;lt;1&amp;gt; to the child element &amp;lt;2&amp;gt; to the second and so on.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 6: Add a Language Switcher
&lt;/h2&gt;

&lt;p&gt;Let users change languages on the fly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useTranslation&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react-i18next&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;LanguageSwitcher&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;i18n&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useTranslation&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;changeLanguage&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;lang&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

&lt;span class="nx"&gt;i18n&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;changeLanguage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;lang&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;

&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;

&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="na"&gt;onClick&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;changeLanguage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;en&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;English&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;

&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="na"&gt;onClick&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;changeLanguage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;fr&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Français&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;

&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="na"&gt;onClick&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;changeLanguage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;es)}&amp;gt;Español&amp;lt;/button&amp;gt;

&amp;lt;/div&amp;gt;

);

}

export default LanguageSwitcher;

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When you call i18n.changeLanguage() i18next loads the translation file and triggers a re-render of all components using useTranslation.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 7: Organize with Namespaces
&lt;/h2&gt;

&lt;p&gt;As your app grows putting everything in one translation.json becomes messy. Namespaces let you split translations by feature.&lt;/p&gt;

&lt;p&gt;Folder structure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
/locales/en/

common.json

dashboard.json

profile.json

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;
&lt;span class="c1"&gt;// Load only what you need&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;t&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useTranslation&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;dashboard&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;//. Load multiple&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;t&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useTranslation&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;dashboard&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;common&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using namespaces improves performance by loading only the translations needed for the current view.&lt;/p&gt;




&lt;h2&gt;
  
  
  Project Structure Recap
&lt;/h2&gt;

&lt;p&gt;Here's what a organized internationalization setup looks like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
src/

├── i18n.js          # i18next configuration

├── index.js         # Import i18n.js here

├── components/

│   ├── Welcome.jsx

│   └── LanguageSwitcher.jsx

└── App.jsx

public/

└── locales/

├── en/

│   ├── translation.json

│   └── dashboard.json

└── fr/

├── translation.json

└── dashboard.json

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






</description>
      <category>react</category>
      <category>nextjs</category>
      <category>webdev</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>React Interview Prep: 50+ Problems Every Frontend Dev Should Know</title>
      <dc:creator>Syed Muhammad Ali Raza</dc:creator>
      <pubDate>Fri, 31 Oct 2025 09:48:49 +0000</pubDate>
      <link>https://dev.to/syedmuhammadaliraza/react-interview-prep-50-problems-every-frontend-dev-should-know-4je9</link>
      <guid>https://dev.to/syedmuhammadaliraza/react-interview-prep-50-problems-every-frontend-dev-should-know-4je9</guid>
      <description>&lt;p&gt;If I’m testing your React knowledge in a Frontend interview, I’m definitely going to ask 1–2 questions out of these 50+ problems (collected over my 12+ years of exp.)&lt;/p&gt;

&lt;p&gt;These cover everything :&lt;br&gt;
→ Component design and reusability&lt;br&gt;
→ State management and hooks&lt;br&gt;
→ Handling user interactions and events&lt;br&gt;
→ Accessibility and ARIA roles&lt;br&gt;
→ Optimizing rendering and performance&lt;br&gt;
→ Working with external data and APIs&lt;/p&gt;

&lt;p&gt;➥UI/Component Building&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Memory Game&lt;/li&gt;
&lt;li&gt;Image Carousel&lt;/li&gt;
&lt;li&gt;Image Carousel II (smooth transitions)&lt;/li&gt;
&lt;li&gt;Digital Clock&lt;/li&gt;
&lt;li&gt;Analog Clock&lt;/li&gt;
&lt;li&gt;Whack-A-Mole&lt;/li&gt;
&lt;li&gt;Tic-tac-toe&lt;/li&gt;
&lt;li&gt;Tic-tac-toe II (N x N, variable win condition)&lt;/li&gt;
&lt;li&gt;Connect Four&lt;/li&gt;
&lt;li&gt;Modal Dialog&lt;/li&gt;
&lt;li&gt;Modal Dialog II (ARIA roles, semi-accessible)&lt;/li&gt;
&lt;li&gt;Modal Dialog III (common close methods, moderately accessible)&lt;/li&gt;
&lt;li&gt;Accordion II (accessible, ARIA support)&lt;/li&gt;
&lt;li&gt;Accordion III (full keyboard support, ARIA)&lt;/li&gt;
&lt;li&gt;Tabs&lt;/li&gt;
&lt;li&gt;Tabs II (semi-accessible)&lt;/li&gt;
&lt;li&gt;Tabs III (keyboard/ARIA spec)&lt;/li&gt;
&lt;li&gt;Star Rating&lt;/li&gt;
&lt;li&gt;Like Button&lt;/li&gt;
&lt;li&gt;Progress Bars III (multiple concurrent, pause/resume)&lt;/li&gt;
&lt;li&gt;Progress Bars II (sequential fill, one at a time)&lt;/li&gt;
&lt;li&gt;Grid Lights&lt;/li&gt;
&lt;li&gt;Traffic Light&lt;/li&gt;
&lt;li&gt;Data Table&lt;/li&gt;
&lt;li&gt;Data Table II (sorting)&lt;/li&gt;
&lt;li&gt;Data Table III (pagination, sorting)&lt;/li&gt;
&lt;li&gt;Data Table IV (pagination, sorting, filtering)&lt;/li&gt;
&lt;li&gt;Nested Checkboxes (parent-child selection logic)&lt;/li&gt;
&lt;li&gt;File Explorer&lt;/li&gt;
&lt;li&gt;File Explorer II (ARIA roles, semi-accessible)&lt;/li&gt;
&lt;li&gt;File Explorer III (flat DOM)&lt;/li&gt;
&lt;li&gt;Table of Contents (HTML parsing, tree)&lt;/li&gt;
&lt;li&gt;Selectable Cells (drag-select grid)&lt;/li&gt;
&lt;li&gt;Auth Code Input (6-digit entry)&lt;/li&gt;
&lt;li&gt;Modal Dialog IV (fully accessible, keyboard support)&lt;/li&gt;
&lt;li&gt;Undoable Counter (undo/redo)&lt;/li&gt;
&lt;li&gt;Pixel Art (drawing grid)&lt;/li&gt;
&lt;li&gt;Todo List&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;➥Logic/Algorithmic &amp;amp; Data Handling&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Birth Year Histogram (API + plotting)&lt;/li&gt;
&lt;li&gt;Job Board (API data + rendering)&lt;/li&gt;
&lt;li&gt;Transfer List&lt;/li&gt;
&lt;li&gt;Transfer List II (bulk select, add, transfer)&lt;/li&gt;
&lt;li&gt;Users Database (CRUD)&lt;/li&gt;
&lt;li&gt;Dice Roller&lt;/li&gt;
&lt;li&gt;Backbone Model (custom object store)&lt;/li&gt;
&lt;li&gt;Data Selection (filtering)&lt;/li&gt;
&lt;li&gt;getElementsByTagNameHierarchy (DOM queries)&lt;/li&gt;
&lt;li&gt;Curry III (JS currying logic)&lt;/li&gt;
&lt;li&gt;Classnames II (join/dedupe classnames)&lt;/li&gt;
&lt;li&gt;Heap (implement data structure)&lt;/li&gt;
&lt;li&gt;Heap Operations&lt;/li&gt;
&lt;li&gt;End of Array Reachable (jump game)&lt;/li&gt;
&lt;li&gt;Find the Longest Palindromic Substring&lt;/li&gt;
&lt;li&gt;Find Words in Grid&lt;/li&gt;
&lt;li&gt;Find Word in Grid (existence check)&lt;/li&gt;
&lt;li&gt;Shortest Substring Containing Characters&lt;/li&gt;
&lt;li&gt;Disjoint Intervals (remove overlaps)&lt;/li&gt;
&lt;li&gt;Minimum Meeting Rooms Needed&lt;/li&gt;
&lt;li&gt;Graph Clone (deep copy graph)&lt;/li&gt;
&lt;li&gt;Binary Tree Serialization and Deserialization&lt;/li&gt;
&lt;li&gt;Binary Tree Maximum Total Path&lt;/li&gt;
&lt;li&gt;Binary Tree Rebuilding from Preorder/Inorder&lt;/li&gt;
&lt;li&gt;Graph Count Connected Components&lt;/li&gt;
&lt;li&gt;Number Stream Median&lt;/li&gt;
&lt;li&gt;Linked Lists Combine K Sorted&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;➥Custom Hooks&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;useDebounce&lt;/li&gt;
&lt;li&gt;useEventListener&lt;/li&gt;
&lt;li&gt;useHover&lt;/li&gt;
&lt;li&gt;useInterval&lt;/li&gt;
&lt;li&gt;useKeyPress&lt;/li&gt;
&lt;li&gt;useMap&lt;/li&gt;
&lt;li&gt;useObject&lt;/li&gt;
&lt;li&gt;useSet&lt;/li&gt;
&lt;li&gt;useStep&lt;/li&gt;
&lt;li&gt;useThrottle&lt;/li&gt;
&lt;li&gt;useTimeout&lt;/li&gt;
&lt;li&gt;useWindowSize&lt;/li&gt;
&lt;li&gt;useIdle&lt;/li&gt;
&lt;li&gt;useInputControl&lt;/li&gt;
&lt;li&gt;useMediaQuery&lt;/li&gt;
&lt;li&gt;useMediatedState&lt;/li&gt;
&lt;li&gt;useQuery&lt;/li&gt;
&lt;li&gt;useArray&lt;/li&gt;
&lt;li&gt;useBreakpoint&lt;/li&gt;
&lt;li&gt;useClickOutside&lt;/li&gt;
&lt;li&gt;useCountdown&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you can build, debug, and explain at least half of these, you’re already ahead of 90% of candidates.&lt;/p&gt;

</description>
      <category>react</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Frontend Challenge - Halloween Edition</title>
      <dc:creator>Syed Muhammad Ali Raza</dc:creator>
      <pubDate>Fri, 31 Oct 2025 06:55:40 +0000</pubDate>
      <link>https://dev.to/syedmuhammadaliraza/frontend-challenge-halloween-edition-1m74</link>
      <guid>https://dev.to/syedmuhammadaliraza/frontend-challenge-halloween-edition-1m74</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for &lt;a href="https://dev.to/challenges/frontend-2025-10-15"&gt;Frontend Challenge - Halloween Edition, Perfect Landing&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;I built the Spooky Heritage Museum landing page—an interactive experience that takes visitors through Halloween’s history. The page includes:&lt;br&gt;
Animated Hero Section: Full-screen intro with a glowing moon, twinkling stars, floating ghosts, and bats flying across. Typography uses the "Creepster" font.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Interactive Timeline: A vertical timeline showing Halloween’s evolution from ancient Celtic Samhain to modern trick-or-treating. Timeline items animate into view on scroll and alternate left/right.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Exhibit Showcase: Four featured exhibits with hover lift/glow effects. Clicking opens modal dialogs (replacing alerts).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Events Section: Calendar-style event cards for upcoming activities like  midnight ghost tours and pumpkin carving workshops.&lt;br&gt;
Reservation System: A validated form with real-time email, date, and guest limit checks, plus clear error messages.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The design uses a purple-to-orange gradient with dark backgrounds that make orange accents pop, plus yellow highlights for a warm, candlelit feel.&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;Demo Link&lt;br&gt;
&lt;a href="https://github.com/Syed-Muhammad-Ali-Raza/Halloween-Landing-Challenge-" rel="noopener noreferrer"&gt;https://github.com/Syed-Muhammad-Ali-Raza/Halloween-Landing-Challenge-&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwutuqwdztpnqskaprybs.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwutuqwdztpnqskaprybs.PNG" alt=" " width="800" height="385"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqmrzewvryfns0hqq9rmm.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqmrzewvryfns0hqq9rmm.PNG" alt=" " width="800" height="385"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fahht2kwsrma00niw01sx.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fahht2kwsrma00niw01sx.PNG" alt=" " width="800" height="383"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2kbhqyd2jorhg2b1407i.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2kbhqyd2jorhg2b1407i.PNG" alt=" " width="800" height="386"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Journey
&lt;/h2&gt;

&lt;h4&gt;
  
  
  The Concept
&lt;/h4&gt;

&lt;p&gt;I started with the museum theme because museums are about discovery, and Halloween has a rich, often untold history. I wanted storytelling and education, not just scares.&lt;/p&gt;

&lt;h4&gt;
  
  
  Challenges &amp;amp; Solutions
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Smooth animations&lt;/strong&gt;: The floating ghosts and bats needed randomness. I varied animation durations and delays per element and used transforms for organic arcs instead of straight lines.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Timeline layout&lt;/strong&gt;: Alternating left/right on desktop, stacking on mobile took careful positioning. CSS Grid and Flexbox handled it, but getting margins right required multiple iterations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Form validation&lt;/strong&gt;: HTML5 validation wasn’t enough. I added real-time validation with inline error messages, ARIA attributes, and visual states (green for valid, red for errors). The date picker sets today as the minimum automatically.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  What I'm Proud Of
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Accessibility&lt;/strong&gt;: Skip links, ARIA labels, keyboard navigation, focus indicators, and prefers-reduced-motion support.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mobile menu&lt;/strong&gt;: Hamburger-to-X transition with staggered menu item animations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Modals&lt;/strong&gt;: Replaced alerts with accessible modals that fade in, trap focus, and close on Escape or outside click.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Performance&lt;/strong&gt;: Vanilla JavaScript with IntersectionObserver for scroll animations—fast and smooth.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Tech Stack
&lt;/h4&gt;

&lt;p&gt;Pure HTML, CSS, and vanilla JavaScript—no build process. CSS Custom Properties make theme tweaks easy, and Grid/Flexbox handle layouts. backdrop-filter adds frosted glass effects with graceful degradation.&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>frontendchallenge</category>
      <category>webdev</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Frontend Challenge - Halloween Edition</title>
      <dc:creator>Syed Muhammad Ali Raza</dc:creator>
      <pubDate>Fri, 31 Oct 2025 06:08:03 +0000</pubDate>
      <link>https://dev.to/syedmuhammadaliraza/frontend-challenge-halloween-edition-4f79</link>
      <guid>https://dev.to/syedmuhammadaliraza/frontend-challenge-halloween-edition-4f79</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for &lt;a href="https://dev.to/challenges/frontend-2025-10-15"&gt;Frontend Challenge - Halloween Edition, CSS Art&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Inspiration
&lt;/h2&gt;

&lt;p&gt;Classic Halloween imagery inspired this scene:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Haunted Victorian houses with flickering candlelit windows&lt;/li&gt;
&lt;li&gt;Jack-o-lanterns with glowing faces&lt;/li&gt;
&lt;li&gt;Bats in the night sky&lt;/li&gt;
&lt;li&gt;Floating ghosts&lt;/li&gt;
&lt;li&gt;Graveyards with tombstones&lt;/li&gt;
&lt;li&gt;Moonlit nights&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://codepen.io/Syed-Muhammad-Ali-Raza/pen/YPwOMbP" rel="noopener noreferrer"&gt;https://codepen.io/Syed-Muhammad-Ali-Raza/pen/YPwOMbP&lt;/a&gt;&lt;br&gt;
For complete code you can check out this Github repo &lt;br&gt;
&lt;a href="https://github.com/Syed-Muhammad-Ali-Raza/Halloween-Challenge" rel="noopener noreferrer"&gt;https://github.com/Syed-Muhammad-Ali-Raza/Halloween-Challenge&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Journey
&lt;/h2&gt;

&lt;p&gt;Started with a layout plan, then built elements from back to front:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;sky &lt;/li&gt;
&lt;li&gt;house
&lt;/li&gt;
&lt;li&gt;pumpkin&lt;/li&gt;
&lt;li&gt;ghost &lt;/li&gt;
&lt;li&gt;bats&lt;/li&gt;
&lt;li&gt;tombstones&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Using &lt;strong&gt;clip-path&lt;/strong&gt; for complex shapes (pumpkin face features)&lt;br&gt;
Layering gradients and radial gradients for lighting&lt;br&gt;
Coordinating multiple animations with different delays&lt;br&gt;
and durations  Pseudo-elements (::before, ::after) &lt;br&gt;
for details Transform and animation keyframes for movement&lt;/p&gt;

</description>
      <category>frontendchallenge</category>
      <category>devchallenge</category>
      <category>css</category>
    </item>
    <item>
      <title>GitHub repos that will make you a 10x software engineer:
1 Vision agent
 https://lnkd.in/e-ZHJTqc

2 System design
 https://lnkd.in/e7SUQ3ei

3 Public APIs
 https://lnkd.in/epWSyzqs

4 Tech interview handbook
 https://lnkd.in/e7EjsJNF</title>
      <dc:creator>Syed Muhammad Ali Raza</dc:creator>
      <pubDate>Thu, 23 Oct 2025 13:38:04 +0000</pubDate>
      <link>https://dev.to/syedmuhammadaliraza/github-repos-that-will-make-you-a-10x-software-engineer-1-vision-agent--3hkh</link>
      <guid>https://dev.to/syedmuhammadaliraza/github-repos-that-will-make-you-a-10x-software-engineer-1-vision-agent--3hkh</guid>
      <description>&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__content"&gt;
        &lt;div class="c-embed__cover"&gt;
          &lt;a href="https://lnkd.in/e-ZHJTqc" class="c-link align-middle" rel="noopener noreferrer"&gt;
            &lt;img alt="" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstatic.licdn.com%2Fscds%2Fcommon%2Fu%2Fimages%2Flogos%2Ffavicons%2Fv1%2Ffavicon.ico" height="64" class="m-0" width="64"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="c-embed__body"&gt;
        &lt;h2 class="fs-xl lh-tight"&gt;
          &lt;a href="https://lnkd.in/e-ZHJTqc" rel="noopener noreferrer" class="c-link"&gt;
            LinkedIn
          &lt;/a&gt;
        &lt;/h2&gt;
          &lt;p class="truncate-at-3"&gt;
            This link will take you to a page that’s not on LinkedIn
          &lt;/p&gt;
        &lt;div class="color-secondary fs-s flex items-center"&gt;
            &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstatic.licdn.com%2Faero-v1%2Fsc%2Fh%2Fal2o9zrvru7aqj8e1x2rzsrca" width="64" height="64"&gt;
          lnkd.in
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;
&lt;br&gt;
&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__content"&gt;
        &lt;div class="c-embed__cover"&gt;
          &lt;a href="https://lnkd.in/e7SUQ3ei" class="c-link align-middle" rel="noopener noreferrer"&gt;
            &lt;img alt="" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstatic.licdn.com%2Fscds%2Fcommon%2Fu%2Fimages%2Flogos%2Ffavicons%2Fv1%2Ffavicon.ico" height="64" class="m-0" width="64"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="c-embed__body"&gt;
        &lt;h2 class="fs-xl lh-tight"&gt;
          &lt;a href="https://lnkd.in/e7SUQ3ei" rel="noopener noreferrer" class="c-link"&gt;
            LinkedIn
          &lt;/a&gt;
        &lt;/h2&gt;
          &lt;p class="truncate-at-3"&gt;
            This link will take you to a page that’s not on LinkedIn
          &lt;/p&gt;
        &lt;div class="color-secondary fs-s flex items-center"&gt;
            &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstatic.licdn.com%2Faero-v1%2Fsc%2Fh%2Fal2o9zrvru7aqj8e1x2rzsrca" width="64" height="64"&gt;
          lnkd.in
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;
&lt;br&gt;
&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__content"&gt;
        &lt;div class="c-embed__cover"&gt;
          &lt;a href="https://lnkd.in/epWSyzqs" class="c-link align-middle" rel="noopener noreferrer"&gt;
            &lt;img alt="" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstatic.licdn.com%2Fscds%2Fcommon%2Fu%2Fimages%2Flogos%2Ffavicons%2Fv1%2Ffavicon.ico" height="64" class="m-0" width="64"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="c-embed__body"&gt;
        &lt;h2 class="fs-xl lh-tight"&gt;
          &lt;a href="https://lnkd.in/epWSyzqs" rel="noopener noreferrer" class="c-link"&gt;
            LinkedIn
          &lt;/a&gt;
        &lt;/h2&gt;
          &lt;p class="truncate-at-3"&gt;
            This link will take you to a page that’s not on LinkedIn
          &lt;/p&gt;
        &lt;div class="color-secondary fs-s flex items-center"&gt;
            &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstatic.licdn.com%2Faero-v1%2Fsc%2Fh%2Fal2o9zrvru7aqj8e1x2rzsrca" width="64" height="64"&gt;
          lnkd.in
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;
&lt;br&gt;
&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__content"&gt;
        &lt;div class="c-embed__cover"&gt;
          &lt;a href="https://lnkd.in/e7EjsJNF" class="c-link align-middle" rel="noopener noreferrer"&gt;
            &lt;img alt="" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstatic.licdn.com%2Fscds%2Fcommon%2Fu%2Fimages%2Flogos%2Ffavicons%2Fv1%2Ffavicon.ico" height="64" class="m-0" width="64"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="c-embed__body"&gt;
        &lt;h2 class="fs-xl lh-tight"&gt;
          &lt;a href="https://lnkd.in/e7EjsJNF" rel="noopener noreferrer" class="c-link"&gt;
            LinkedIn
          &lt;/a&gt;
        &lt;/h2&gt;
          &lt;p class="truncate-at-3"&gt;
            This link will take you to a page that’s not on LinkedIn
          &lt;/p&gt;
        &lt;div class="color-secondary fs-s flex items-center"&gt;
            &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstatic.licdn.com%2Faero-v1%2Fsc%2Fh%2Fal2o9zrvru7aqj8e1x2rzsrca" width="64" height="64"&gt;
          lnkd.in
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


</description>
    </item>
    <item>
      <title>JavaScript feels tricky until you master its language. Once you truly understand these core words, the rest becomes 10x easier. Strong concepts = Clean code = Confident developer. What was the one JavaScript term that finally clicked for you?</title>
      <dc:creator>Syed Muhammad Ali Raza</dc:creator>
      <pubDate>Thu, 18 Sep 2025 13:08:33 +0000</pubDate>
      <link>https://dev.to/syedmuhammadaliraza/javascript-feels-tricky-until-you-master-its-language-once-you-truly-understand-these-core-words-374k</link>
      <guid>https://dev.to/syedmuhammadaliraza/javascript-feels-tricky-until-you-master-its-language-once-you-truly-understand-these-core-words-374k</guid>
      <description></description>
    </item>
    <item>
      <title>Frontend Developer Roadmap for Junior &amp; Senior Developer's</title>
      <dc:creator>Syed Muhammad Ali Raza</dc:creator>
      <pubDate>Mon, 16 Dec 2024 17:04:29 +0000</pubDate>
      <link>https://dev.to/syedmuhammadaliraza/frontend-developer-roadmap-for-junior-senior-developers-hei</link>
      <guid>https://dev.to/syedmuhammadaliraza/frontend-developer-roadmap-for-junior-senior-developers-hei</guid>
      <description>&lt;h2&gt;
  
  
  ♣ Frontend Developer Roadmap For Junior Developers:
&lt;/h2&gt;

&lt;p&gt;🧩 Phase 1: Foundations of Frontend Development  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;HTML, CSS, JavaScript  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Semantic HTML
&lt;/li&gt;
&lt;li&gt;Modern CSS (Flexbox, Grid, Variables)
&lt;/li&gt;
&lt;li&gt;JavaScript ES6+ features (let/const, classes, async/await)
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;DOM Manipulation  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Event handling and propagation
&lt;/li&gt;
&lt;li&gt;Working with the DOM API
&lt;/li&gt;
&lt;li&gt;Basic performance considerations
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Version Control  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Git basics (branching, merging, pull requests)
&lt;/li&gt;
&lt;li&gt;Working with GitHub/GitLab/Bitbucket
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🧩 Phase 2: UI Development and Design  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;CSS Frameworks &amp;amp; Preprocessors  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;TailwindCSS, Bootstrap, SASS/SCSS
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Responsive Design  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Media queries
&lt;/li&gt;
&lt;li&gt;Mobile-first vs Desktop-first design
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Component-Based Architecture  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Introduction to React, Vue, or Angular
&lt;/li&gt;
&lt;li&gt;Building reusable components
&lt;/li&gt;
&lt;li&gt;State and props management
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🧩 Phase 3: Data Fetching and APIs  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;HTTP Basics  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;REST APIs, GraphQL basics
&lt;/li&gt;
&lt;li&gt;Fetch API and Axios for API requests
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;State Management  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Local state (useState, Vue's &lt;code&gt;data&lt;/code&gt;)
&lt;/li&gt;
&lt;li&gt;Context API for global state
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Error Handling  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Basic error handling and retries
&lt;/li&gt;
&lt;li&gt;Loading and error states in the UI
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🧩Phase 4: Performance Optimization  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Web Performance Metrics  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Core Web Vitals (LCP, FID, CLS)
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Asset Optimization  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Image compression and lazy loading
&lt;/li&gt;
&lt;li&gt;Minification of CSS/JS
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Rendering Basics  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Client-Side Rendering (CSR)
&lt;/li&gt;
&lt;li&gt;Understanding rendering lifecycle in React/Vue
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🧩Phase 5: Security Basics  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Common Vulnerabilities  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;XSS (Cross-Site Scripting)
&lt;/li&gt;
&lt;li&gt;CSRF (Cross-Site Request Forgery)
&lt;/li&gt;
&lt;li&gt;CORS (Cross-Origin Resource Sharing)
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Best Practices  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Secure cookies and basic HTTP headers
&lt;/li&gt;
&lt;li&gt;Sanitizing user input
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🧩Phase 6: Testing and Debugging  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Debugging Tools  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Chrome DevTools basics
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Unit Testing  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Introduction to Jest, Mocha, or Jasmine
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Basic Monitoring  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Browser console logs
&lt;/li&gt;
&lt;li&gt;Simple crash/error reports
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🧩 Phase 7: Build Tools and Deployment  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Tooling  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;NPM/Yarn package managers
&lt;/li&gt;
&lt;li&gt;Introduction to bundlers like Webpack, Vite, or Parcel
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Deployment  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Hosting with Vercel, Netlify, or GitHub Pages
&lt;/li&gt;
&lt;li&gt;CI/CD basics
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Junior Engineers: Focus on mastering the basics, frameworks, and deployments. Build confidence in delivering small to medium features.  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Senior Engineers: Dive deep into architecture, testing, performance optimization, and scalability while mentoring others.  &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🔥 Roadmap For Senior Frontend Engineers
&lt;/h2&gt;

&lt;p&gt;🧩 Phase 1: Advanced JavaScript and Frameworks  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Deep Dive into JavaScript  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Closures, hoisting, event loop, and prototypes
&lt;/li&gt;
&lt;li&gt;Performance optimization (Debouncing, Throttling)
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Advanced Framework Knowledge  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;React: Advanced hooks, memoization, error boundaries
&lt;/li&gt;
&lt;li&gt;Vue: Vuex/Pinia state management
&lt;/li&gt;
&lt;li&gt;Angular: Dependency Injection and RxJS
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Server-Side Rendering (SSR)  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Next.js for React
&lt;/li&gt;
&lt;li&gt;Nuxt.js for Vue
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🧩 Phase 2: Architecture and State Management  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;State Management at Scale  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Redux, Zustand, Recoil (React)
&lt;/li&gt;
&lt;li&gt;Pinia/Vuex (Vue)
&lt;/li&gt;
&lt;li&gt;Understanding global vs local state
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Component Architecture  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Container vs Presentational components
&lt;/li&gt;
&lt;li&gt;Design Systems and reusable libraries
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;API Handling  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;GraphQL basics and Apollo Client
&lt;/li&gt;
&lt;li&gt;Error boundaries, retries, and fallbacks
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🧩 Phase 3: Performance Optimization  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Core Web Vitals  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;LCP, FID, CLS
&lt;/li&gt;
&lt;li&gt;Code splitting and lazy loading
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Optimization Techniques  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Bundle analysis and tree shaking
&lt;/li&gt;
&lt;li&gt;Server-Side Rendering and pre-rendering
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Advanced Rendering Concepts  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Virtual DOM, reconciliation
&lt;/li&gt;
&lt;li&gt;Concurrent rendering in React
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🧩Phase 4: Testing and Debugging  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Advanced Testing  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Unit testing: Jest, Mocha
&lt;/li&gt;
&lt;li&gt;Integration testing with React Testing Library or Cypress
&lt;/li&gt;
&lt;li&gt;Snapshot testing
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Error Monitoring and Debugging  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Tools: Sentry, LogRocket, or Datadog
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🧩 Phase 5: Security and Best Practices  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Web Security  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;XSS, CSRF, CORS
&lt;/li&gt;
&lt;li&gt;Content Security Policies (CSP)
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Secure Cookies and Storage  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;HttpOnly, Secure flags
&lt;/li&gt;
&lt;li&gt;Handling tokens (JWTs) safely
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🧩Phase 6: Advanced Tooling and CI/CD  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Tooling  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Webpack, Rollup, or Vite for advanced bundling
&lt;/li&gt;
&lt;li&gt;ESLint, Prettier for code consistency
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;CI/CD  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Integrate pipelines for automated builds and deployments
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Code Review and Collaboration  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;PR best practices and design discussions
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🧩Phase 7: Scalability and Architecture  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Micro-Frontend Architecture  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Breaking apps into smaller parts for maintainability
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Monorepos  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Managing large-scale codebases with tools like Turborepo or Nx
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Progressive Web Apps (PWA)  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Service workers, offline caching
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>javascript</category>
      <category>roadmap</category>
    </item>
  </channel>
</rss>
