<?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: Fouad Elhamra</title>
    <description>The latest articles on DEV Community by Fouad Elhamra (@fouad_elhamra_9d355787cd1).</description>
    <link>https://dev.to/fouad_elhamra_9d355787cd1</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%2F4028888%2F38f1b128-b4ec-4629-aa32-1467668a3682.jpeg</url>
      <title>DEV Community: Fouad Elhamra</title>
      <link>https://dev.to/fouad_elhamra_9d355787cd1</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/fouad_elhamra_9d355787cd1"/>
    <language>en</language>
    <item>
      <title>The Easiest Way to Understand Backpropagation A</title>
      <dc:creator>Fouad Elhamra</dc:creator>
      <pubDate>Wed, 05 Aug 2026 17:16:23 +0000</pubDate>
      <link>https://dev.to/fouad_elhamra_9d355787cd1/the-easiest-way-to-understand-backpropagation-a-1a3g</link>
      <guid>https://dev.to/fouad_elhamra_9d355787cd1/the-easiest-way-to-understand-backpropagation-a-1a3g</guid>
      <description>&lt;div class="ltag__link--embedded"&gt;
  &lt;div class="crayons-story "&gt;
  &lt;a href="https://dev.to/fouad_elhamra_9d355787cd1/the-easiest-way-to-understand-backpropagation-31hl" class="crayons-story__hidden-navigation-link"&gt;The Easiest Way to Understand Backpropagation&lt;/a&gt;


  &lt;div class="crayons-story__body crayons-story__body-full_post"&gt;
    &lt;div class="crayons-story__top"&gt;
      &lt;div class="crayons-story__meta"&gt;
        &lt;div class="crayons-story__author-pic"&gt;

          &lt;a href="/fouad_elhamra_9d355787cd1" class="crayons-avatar  crayons-avatar--l  "&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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4028888%2F38f1b128-b4ec-4629-aa32-1467668a3682.jpeg" alt="fouad_elhamra_9d355787cd1 profile" class="crayons-avatar__image" width="200" height="200"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
        &lt;div&gt;
          &lt;div&gt;
            &lt;a href="/fouad_elhamra_9d355787cd1" class="crayons-story__secondary fw-medium m:hidden"&gt;
              Fouad Elhamra
            &lt;/a&gt;
            &lt;div class="profile-preview-card relative mb-4 s:mb-0 fw-medium hidden m:inline-block"&gt;
              
                Fouad Elhamra
                
              
              &lt;div id="story-author-preview-content-4323622" class="profile-preview-card__content crayons-dropdown branded-7 p-4 pt-0"&gt;
                &lt;div class="gap-4 grid"&gt;
                  &lt;div class="-mt-4"&gt;
                    &lt;a href="/fouad_elhamra_9d355787cd1" class="flex"&gt;
                      &lt;span class="crayons-avatar crayons-avatar--xl mr-2 shrink-0"&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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4028888%2F38f1b128-b4ec-4629-aa32-1467668a3682.jpeg" class="crayons-avatar__image" alt="" width="200" height="200"&gt;
                      &lt;/span&gt;
                      &lt;span class="crayons-link crayons-subtitle-2 mt-5"&gt;Fouad Elhamra&lt;/span&gt;
                    &lt;/a&gt;
                  &lt;/div&gt;
                  &lt;div class="print-hidden"&gt;
                    
                      Follow
                    
                  &lt;/div&gt;
                  &lt;div class="author-preview-metadata-container"&gt;&lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;

          &lt;/div&gt;
          &lt;a href="https://dev.to/fouad_elhamra_9d355787cd1/the-easiest-way-to-understand-backpropagation-31hl" class="crayons-story__tertiary fs-xs"&gt;&lt;time&gt;Aug 5&lt;/time&gt;&lt;span class="time-ago-indicator-initial-placeholder"&gt;&lt;/span&gt;&lt;/a&gt;
        &lt;/div&gt;
      &lt;/div&gt;

    &lt;/div&gt;

    &lt;div class="crayons-story__indention"&gt;
      &lt;h2 class="crayons-story__title crayons-story__title-full_post"&gt;
        &lt;a href="https://dev.to/fouad_elhamra_9d355787cd1/the-easiest-way-to-understand-backpropagation-31hl" id="article-link-4323622"&gt;
          The Easiest Way to Understand Backpropagation
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;div class="crayons-story__tags"&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/ai"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;ai&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/machinelearning"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;machinelearning&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/deeplearning"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;deeplearning&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/datascience"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;datascience&lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="crayons-story__bottom"&gt;
        &lt;div class="crayons-story__details"&gt;
          &lt;a href="https://dev.to/fouad_elhamra_9d355787cd1/the-easiest-way-to-understand-backpropagation-31hl" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left"&gt;
            &lt;div class="multiple_reactions_aggregate"&gt;
              &lt;span class="multiple_reactions_icons_container"&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/sparkle-heart-5f9bee3767e18deb1bb725290cb151c25234768a0e9a2bd39370c382d02920cf.svg" width="24" height="24"&gt;
                  &lt;/span&gt;
              &lt;/span&gt;
              &lt;span class="aggregate_reactions_counter"&gt;1&lt;span class="hidden s:inline"&gt;&amp;nbsp;reaction&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/a&gt;
            &lt;a href="https://dev.to/fouad_elhamra_9d355787cd1/the-easiest-way-to-understand-backpropagation-31hl#comments" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left flex items-center"&gt;
              

              &lt;span class="hidden s:inline"&gt;Add&amp;nbsp;Comment&lt;/span&gt;
            &lt;/a&gt;
        &lt;/div&gt;
        &lt;div class="crayons-story__save"&gt;
          &lt;small class="crayons-story__tertiary fs-xs mr-2"&gt;
            2 min read
          &lt;/small&gt;
            
              &lt;span class="bm-initial crayons-icon c-btn__icon"&gt;
                

              &lt;/span&gt;
              &lt;span class="bm-success crayons-icon c-btn__icon"&gt;
                

              &lt;/span&gt;
            
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;/div&gt;


</description>
    </item>
    <item>
      <title>The Easiest Way to Understand Backpropagation</title>
      <dc:creator>Fouad Elhamra</dc:creator>
      <pubDate>Wed, 05 Aug 2026 14:41:07 +0000</pubDate>
      <link>https://dev.to/fouad_elhamra_9d355787cd1/the-easiest-way-to-understand-backpropagation-31hl</link>
      <guid>https://dev.to/fouad_elhamra_9d355787cd1/the-easiest-way-to-understand-backpropagation-31hl</guid>
      <description>&lt;p&gt;When I first learned deep learning, I thought there was only one way to train a neural network: compute the gradient and update the weights.&lt;/p&gt;

&lt;p&gt;Then I discovered there are actually &lt;strong&gt;three different ways&lt;/strong&gt; to do it.&lt;/p&gt;

&lt;p&gt;Let's understand them with a simple example.&lt;/p&gt;

&lt;p&gt;Imagine you have a dataset with &lt;strong&gt;10,000 images&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Your goal is to minimize the loss function by updating the model's weights.&lt;/p&gt;

&lt;h2&gt;
  
  
  Batch Gradient Descent
&lt;/h2&gt;

&lt;p&gt;Batch Gradient Descent processes the &lt;strong&gt;entire dataset&lt;/strong&gt; before making a single update.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;10,000 samples -&amp;gt; Compute total loss -&amp;gt; Compute gradients -&amp;gt; Update weights
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Advantages
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Stable gradient&lt;/li&gt;
&lt;li&gt;Smooth convergence&lt;/li&gt;
&lt;li&gt;Accurate update direction&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Disadvantages
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Slow for large datasets&lt;/li&gt;
&lt;li&gt;Requires lots of memory&lt;/li&gt;
&lt;li&gt;One update only after processing every sample&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Think of it like reading an entire book before writing a summary.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Stochastic Gradient Descent (SGD)
&lt;/h2&gt;

&lt;p&gt;Instead of waiting for all 10,000 samples, SGD updates the weights &lt;strong&gt;after every single sample&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Sample 1 → Update
Sample 2 → Update
Sample 3 → Update
...
Sample 10,000 → Update
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now the model learns much faster.&lt;/p&gt;

&lt;p&gt;The downside?&lt;/p&gt;

&lt;p&gt;Each sample may point in a slightly different direction, causing the optimization path to bounce around.&lt;/p&gt;

&lt;p&gt;Imagine hiking toward the bottom of a valley while someone changes your direction every few seconds.&lt;/p&gt;

&lt;p&gt;This creates the famous &lt;strong&gt;zigzag optimization path&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Advantages
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Very fast updates&lt;/li&gt;
&lt;li&gt;Low memory usage&lt;/li&gt;
&lt;li&gt;Can escape some local minima&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Disadvantages
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Noisy gradients&lt;/li&gt;
&lt;li&gt;Unstable convergence&lt;/li&gt;
&lt;li&gt;Loss fluctuates a lot&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  3. Mini-Batch Gradient Descent
&lt;/h2&gt;

&lt;p&gt;Mini-batch combines the best parts of both approaches.&lt;/p&gt;

&lt;p&gt;Instead of using one sample or the entire dataset, we split the data into small batches.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;10,000 samples

Batch 1 = 128 samples → Update
Batch 2 = 128 samples → Update
Batch 3 = 128 samples → Update
...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now every update is based on enough data to reduce noise, but not so much that training becomes slow.&lt;/p&gt;

&lt;p&gt;This is why frameworks like &lt;strong&gt;PyTorch&lt;/strong&gt; and &lt;strong&gt;TensorFlow&lt;/strong&gt; use mini-batches by default.&lt;/p&gt;

&lt;h3&gt;
  
  
  Advantages
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Faster than Batch GD&lt;/li&gt;
&lt;li&gt;More stable than SGD&lt;/li&gt;
&lt;li&gt;Efficient GPU utilization&lt;/li&gt;
&lt;li&gt;Standard choice for deep learning&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Comparison
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Method&lt;/th&gt;
&lt;th&gt;Update Frequency&lt;/th&gt;
&lt;th&gt;Speed&lt;/th&gt;
&lt;th&gt;Stability&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Batch Gradient Descent&lt;/td&gt;
&lt;td&gt;After the entire dataset&lt;/td&gt;
&lt;td&gt;Slow&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Stochastic Gradient Descent&lt;/td&gt;
&lt;td&gt;After every sample&lt;/td&gt;
&lt;td&gt;Fast&lt;/td&gt;
&lt;td&gt;Low&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Mini-Batch Gradient Descent&lt;/td&gt;
&lt;td&gt;After every small batch&lt;/td&gt;
&lt;td&gt;Fast&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




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

&lt;p&gt;If you're training modern neural networks, &lt;strong&gt;Mini-Batch Gradient Descent is usually the best choice&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;It balances speed, memory usage, and convergence, making it the default optimization strategy in most deep learning libraries.&lt;/p&gt;

&lt;p&gt;Understanding these three optimization strategies helped me understand &lt;em&gt;why&lt;/em&gt; neural networks train the way they do—not just &lt;em&gt;how&lt;/em&gt; they train.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>machinelearning</category>
      <category>deeplearning</category>
      <category>datascience</category>
    </item>
  </channel>
</rss>
