<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Publishing DTD v1.4 20241031//EN" "JATS-journalpublishing1-4.dtd">
<article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" article-type="research-article" dtd-version="1.4" xml:lang="en">
  <front>
    <journal-meta>
      <journal-id journal-id-type="publisher-id">jcc</journal-id>
      <journal-title-group>
        <journal-title>Journal of Computer and Communications</journal-title>
      </journal-title-group>
      <issn pub-type="epub">2327-5227</issn>
      <issn pub-type="ppub">2327-5219</issn>
      <publisher>
        <publisher-name>Scientific Research Publishing</publisher-name>
      </publisher>
    </journal-meta>
    <article-meta>
      <article-id pub-id-type="doi">10.4236/jcc.2025.1311009</article-id>
      <article-id pub-id-type="publisher-id">jcc-147496</article-id>
      <article-categories>
        <subj-group>
          <subject>Article</subject>
        </subj-group>
        <subj-group>
          <subject>Computer Science</subject>
          <subject>Communications</subject>
        </subj-group>
      </article-categories>
      <title-group>
        <article-title>Vanishing Gradients in an Artificial Deep Neural Network: The Impact of Activation Functions and Optimization Techniques</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <name name-style="western">
            <surname>Ntambwe</surname>
            <given-names>Baron</given-names>
          </name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
      </contrib-group>
      <aff id="aff1"><label>1</label> Department of Computer Science, University of East London, London, UK </aff>
      <author-notes>
        <fn fn-type="conflict" id="fn-conflict">
          <p>The authors declare no conflicts of interest regarding the publication of this paper.</p>
        </fn>
      </author-notes>
      <pub-date pub-type="epub">
        <day>05</day>
        <month>11</month>
        <year>2025</year>
      </pub-date>
      <pub-date pub-type="collection">
        <month>11</month>
        <year>2025</year>
      </pub-date>
      <volume>13</volume>
      <issue>11</issue>
      <fpage>128</fpage>
      <lpage>162</lpage>
      <history>
        <date date-type="received">
          <day>27</day>
          <month>08</month>
          <year>2025</year>
        </date>
        <date date-type="accepted">
          <day>22</day>
          <month>11</month>
          <year>2025</year>
        </date>
        <date date-type="published">
          <day>25</day>
          <month>11</month>
          <year>2025</year>
        </date>
      </history>
      <permissions>
        <copyright-statement>© 2025 by the authors and Scientific Research Publishing Inc.</copyright-statement>
        <copyright-year>2025</copyright-year>
        <license license-type="open-access">
          <license-p> This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license ( <ext-link ext-link-type="uri" xlink:href="https://creativecommons.org/licenses/by/4.0/">https://creativecommons.org/licenses/by/4.0/</ext-link> ). </license-p>
        </license>
      </permissions>
      <self-uri content-type="doi" xlink:href="https://doi.org/10.4236/jcc.2025.1311009">https://doi.org/10.4236/jcc.2025.1311009</self-uri>
      <abstract>
        <p>Artificial deep neural networks (ADNNs) have become a cornerstone of modern machine learning, but they are not immune to challenges. One of the most significant problems plaguing ADNNs is the vanishing gradient problem, which hinders their ability to learn and generalize. Activation functions and optimization techniques play a crucial role in mitigating or aggravating this issue. This study compares how two activation functions (Sigmoid, ReLU) and two optimizers (SGD, Adam) affect the vanishing-gradient phenomenon in a 12-layer neural network trained on MNIST. Gradient-norm ratios, mean gradients, loss, and accuracy are tracked across 10 epochs for each of four activation-optimizer combinations. Results indicate that ReLU with Adam maintains the most stable gradient flow and achieves the highest accuracy, whereas both Sigmoid and SGD combinations exhibit severe vanishing or exploding gradients. The author concludes that activation-optimizer synergy is critical and recommends ReLU with Adam for deep networks.</p>
      </abstract>
      <kwd-group kwd-group-type="author-generated" xml:lang="en">
        <kwd>Vanishing Gradient</kwd>
        <kwd>Sigmoid</kwd>
        <kwd>Optimization</kwd>
        <kwd>ADNN</kwd>
        <kwd>ReLU</kwd>
        <kwd>SGD</kwd>
        <kwd>ADAM</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec1">
      <title>1. Introduction</title>
      <p>The vanishing gradient problem remains a significant challenge in training deep artificial neural networks, often leading to slow convergence and suboptimal performance, especially in very deep architectures. Activation functions and optimization techniques play a critical role in influencing how gradients are propagated during backpropagation. While sigmoid and ReLU are widely used activation functions, they differ significantly in how they handle gradient flow. Similarly, stochastic gradient descent (SGD) and Adam are popular optimization algorithms that affect how gradients are updated and can interact differently with activation functions in deep networks. </p>
      <p>Despite extensive use, there is limited empirical evidence comparing the combined effects of these activation functions and optimization techniques on the vanishing gradient problem. Most existing studies evaluate these components in isolation, leaving a gap in understanding their interaction and collective impact on training deep networks. </p>
      <p>Even though it is widely acknowledged that ReLU helps mitigate the vanishing gradient problem compared to sigmoid, there remains a notable lack of systematic, controlled experiments directly comparing ReLU and sigmoid under identical architectures, initializations, and training protocols [<xref ref-type="bibr" rid="B1">1</xref>]. Reviews such as [<xref ref-type="bibr" rid="B2">2</xref>] remark on “limited empirical and theoretical evidence for Sigmoid’s competitors.” They explicitly state that comparisons lack theoretical rigor and empirical depth across activation functions. Although this survey evaluates multiple activation functions including sigmoid and ReLU, it primarily offers a descriptive comparison, not controlled evaluations isolating activation choices. Empirical results often differ in architectures, datasets, or settings—hindering direct conclusions about activation-specific effects. Furthermore, smaller-scale studies like [<xref ref-type="bibr" rid="B3">3</xref>] are also constrained to specific datasets like MNIST and limited depth, with no systematic control of architecture and optimizer across conditions to isolate activation effects in deeper or diverse tasks. </p>
      <p>This research seeks to address this gap by quantitatively analyzing how the choice of activation function (sigmoid vs. ReLU) and optimization algorithm (SGD vs. Adam) affects the magnitude and flow of gradients in a controlled architecture and optimization of deep neural networks. By systematically measuring gradient behavior, convergence rates, and performance outcomes, the study aims to provide practical insights into mitigating vanishing gradients through architectural and algorithmic choices.</p>
    </sec>
    <sec id="sec2">
      <title>2. Research Questions</title>
      <p>This study aims to investigate the impact of two widely used activation functions (Sigmoid and ReLU) and two popular optimization techniques (Stochastic Gradient Descent (SGD) and Adam) on the vanishing gradient problem in DNNs. Therefore, as a result of the experiment, we will attempt to answer the following five questions at the end of this research project: </p>
      <p>1. How does the choice of activation function (Sigmoid vs. ReLU) affect the occurrence and severity of vanishing gradients in deep artificial neural networks?</p>
      <p>2. What are the impacts of optimization algorithms (SGD vs. Adam) on gradient flow and the mitigation of vanishing gradients during training? </p>
      <p>3. What is the interaction effect between activation functions (Sigmoid and ReLU) and optimization techniques (SGD vs. Adam) that influences the vanishing gradient problem in deep neural networks? </p>
      <p>4. How do different combinations of activation functions and optimization algorithms affect training convergence speed and final model performance (e.g., accuracy, loss)? </p>
      <p>5. Which combination of activation function and optimization algorithm is most effective in minimizing vanishing gradients in deep network architectures?</p>
    </sec>
    <sec id="sec3">
      <title>3. Foundational Knowledge</title>
      <sec id="sec3dot1">
        <title>3.1. Previous Work</title>
        <p>3.1.1. Causes of the Vanishing Gradient Problem</p>
        <p>The vanishing gradient problem remains a fundamental challenge in training deep neural networks, particularly when using activation functions that cause gradients to diminish exponentially as they are propagated backward through layers. This issue has significant implications for the learning capacity of deep models and is heavily influenced by both the activation function and the optimization algorithm used. </p>
        <p>Early neural networks predominantly used the sigmoid activation function due to its smooth, differentiable curve, mapping inputs to an output between 0 and 1. However, it was soon discovered that the sigmoid function suffers from saturation in both positive and negative regions of its domain, resulting in gradients that tend toward zero as illustrated in <xref ref-type="fig" rid="fig1">Figure 1</xref>, and making it difficult for weights in early layers to update effectively [<xref ref-type="bibr" rid="B4">4</xref>]. This phenomenon is now well-known as the vanishing gradient problem. The gradient of the sigmoid function becomes very small for large input values, thereby impeding effective learning in deep networks [<xref ref-type="bibr" rid="B5">5</xref>].</p>
        <fig id="fig1">
          <label>Figure 1</label>
          <graphic xlink:href="https://html.scirp.org/file/1733300-rId13.jpeg?20251210040034" />
        </fig>
        <p><bold>Figure 1.</bold> Vanishing gradient.</p>
        <p>During backpropagation, the gradients of the loss function with respect to the weights are calculated using the chain rule. When the gradients flow backward through the network, the derivatives of the activation functions are multiplied together. If the activation functions are sigmoid or tanh, the small derivatives can cause the gradients to vanish. <xref ref-type="fig" rid="fig2">Figure 2</xref> illustrates this phenomenon.</p>
        <fig id="fig2">
          <label>Figure 2</label>
          <graphic xlink:href="https://html.scirp.org/file/1733300-rId14.jpeg?20251210040034" />
        </fig>
        <p><bold>Figure 2.</bold> Vanishing gradient—activation function derivative.</p>
        <p>Suppose we have a neural network with multiple layers using sigmoid activation functions. The derivative of the sigmoid function is typically small, around 0.25. If we have 5 layers, the gradient of the loss function with respect to the weights in the first layer would be multiplied by (0.25)^5, resulting in a very small value. This can cause the weights in the earlier layers to be updated very slowly, leading to the vanishing gradient problem.</p>
        <p>To address this issue, Rectified Linear Units (ReLU) were introduced and quickly became the default activation function in modern deep learning due to their simplicity and effectiveness in mitigating vanishing gradients [<xref ref-type="bibr" rid="B6">6</xref>]. The ReLU function is defined as f(x) = max(0, x), which allows gradients to remain large and active for positive input values. While ReLU introduces its own challenge—the “dying ReLU” problem where neurons can become inactive—it generally maintains gradient flow better than sigmoid in deep architectures.</p>
        <p>Simultaneously, advances in optimization algorithms have also played a role in addressing vanishing gradients. The Adam optimizer, introduced by [<xref ref-type="bibr" rid="B5">5</xref>], combines the advantages of RMSProp and momentum by using adaptive learning rates for each parameter, which improves convergence speed and stability, especially in the presence of sparse or noisy gradients. Although Adam was not designed explicitly to counter vanishing gradients, its adaptive nature often results in better performance in deep networks where vanishing or exploding gradients are present.</p>
        <p>Despite these developments, there is a notable research gap in systematic studies that compare the impact of ReLU and sigmoid activation functions under identical experimental conditions, particularly in combination with different optimizers such as SGD and Adam. Reviews by [<xref ref-type="bibr" rid="B2">2</xref>][<xref ref-type="bibr" rid="B7">7</xref>] highlight that while ReLU’s advantages are empirically supported, most comparisons between activation functions and optimization strategies lack rigorous control over confounding factors such as network depth, initialization, and batch normalization. These limitations make it difficult to isolate the precise contribution of activation and optimization choices to the vanishing gradient problem.</p>
        <p>Furthermore, theoretical work by [<xref ref-type="bibr" rid="B8">8</xref>] shows that sigmoid networks can maintain gradient flow if initialized using orthogonal methods, suggesting that the choice of activation function may not be solely responsible for vanishing gradients. However, this finding has not been extensively validated in practical, large-scale models using modern optimizers like Adam.</p>
        <p>In conclusion, while ReLU and Adam have become standard components of modern neural networks, the interaction between activation functions and optimizers—and their joint impact on the vanishing gradient problem—remains insufficiently explored. A more comprehensive, controlled evaluation is necessary to understand these effects and to provide evidence-based guidelines for model design in deep learning.</p>
        <p>3.1.2. Mitigating the Vanishing Gradient Problem</p>
        <p><bold>1. Use of Non-Saturating Activation Functions</bold></p>
        <p>Several techniques have been proposed to address the vanishing gradient problem. One of the earliest and most effective techniques involves replacing saturating functions like sigmoid and tanh with non-saturating alternatives, such as the Rectified Linear Unit (ReLU). Unlike sigmoid, whose gradients vanish for large positive or negative inputs, ReLU maintains a constant gradient of 1 for positive values, thus allowing gradients to propagate more effectively in deep architectures [<xref ref-type="bibr" rid="B1">1</xref>]. Variants like Leaky ReLU and ELU further address the issue of dying neurons while maintaining non-saturation characteristics [<xref ref-type="bibr" rid="B9">9</xref>].</p>
        <p><bold>2. Proper Weight Initialization</bold></p>
        <p>Weight initialization plays a crucial role in controlling the magnitude of gradients during training. Techniques such as Xavier initialization [<xref ref-type="bibr" rid="B10">10</xref>] and He initialization [<xref ref-type="bibr" rid="B11">11</xref>] are designed to maintain the variance of activations and gradients across layers. These methods set initial weights based on the number of input and/or output units in each layer, which prevents early layer gradients from vanishing or exploding.</p>
        <p><bold>3. Batch Normalization</bold></p>
        <p>Batch normalization, introduced by Ioffe and Szegedy [<xref ref-type="bibr" rid="B12">12</xref>], normalizes the inputs of each layer to have zero mean and unit variance. This helps to stabilize the distribution of activations throughout training, reducing internal covariate shift and allowing for faster convergence. Batch normalization has been shown to maintain more consistent gradient flow, thus alleviating the vanishing gradient problem even when using activation functions like sigmoid or tanh.</p>
        <p><bold>4. Residual Connections (Skip Connections)</bold></p>
        <p>The introduction of residual networks (ResNets) [<xref ref-type="bibr" rid="B13">13</xref>] marked a significant breakthrough in deep learning. Residual connections allow gradients to bypass several layers by directly adding the input of a layer to its output. This ensures that gradients can flow back more easily, even through very deep networks, effectively mitigating vanishing gradients and enabling the training of networks with hundreds of layers.</p>
        <p><bold>5. Gradient Clipping and Normalization Techniques</bold></p>
        <p>While more common in recurrent neural networks (RNNs), gradient clipping is also used to stabilize training in deep feedforward networks. By limiting the maximum gradient magnitude, this technique can prevent exploding gradients, which often co-occur with vanishing ones [<xref ref-type="bibr" rid="B14">14</xref>]. Additionally, layer normalization and weight normalization have been explored as alternatives to batch normalization, offering similar gradient-stabilizing effects, especially in recurrent architectures.</p>
        <p><bold>6. Adaptive Optimization Algorithms</bold></p>
        <p>Optimizers such as Adam and RMSProp adjust learning rates dynamically for each parameter, often helping maintain effective updates even when gradients are small [<xref ref-type="bibr" rid="B6">6</xref>]. Although not designed to directly solve vanishing gradients, their adaptive mechanisms improve training stability and convergence in deep models that might otherwise struggle with poor gradient flow.</p>
      </sec>
      <sec id="sec3dot2">
        <title>3.2. Sigmoid vs. ReLU Activation Functions</title>
        <p>Sigmoid and ReLU are two widely used activation functions in deep learning models. Therefore, in the course of this research, we will focus solely on them. We will keep the scope of this comparative section within the boundaries of these two activation functions while emphasizing performance and the vanishing gradient problem, which are critical aspects in training deep neural networks. <xref ref-type="fig" rid="fig3">Figure 3</xref> below provides their mathematical representation.</p>
        <fig id="fig3">
          <label>Figure 3</label>
          <graphic xlink:href="https://html.scirp.org/file/1733300-rId15.jpeg?20251210040036" />
        </fig>
        <p><bold>Figure 3.</bold> Sigmoid vs. ReLU activation functions.</p>
        <p>Several scholarly studies have compared the performance of sigmoid versus ReLU activation functions in DANNs under different contexts. However, most of them converged to the supremacy of ReLU over sigmoid. For example, in a study conducted by Xu using a deep neural network trained on the MNIST dataset, it was proven that ReLU performed better than sigmoid [<xref ref-type="bibr" rid="B15">15</xref>]. In another experiment, it was discovered that ReLU outperformed sigmoid in a neural network trained on a natural language processing task [<xref ref-type="bibr" rid="B16">16</xref>].</p>
        <p>In the sigmoid function, as the input becomes very positive or very negative, the output saturates near 1 or 0, respectively. This causes the gradient (derivative) to be very small and contributes to the vanishing gradient problem. This slows down or stalls learning in deep networks, especially for earlier layers. </p>
        <p>ReLU, on the other hand, has a gradient of 1 for <italic>x</italic> &gt; 0, causing it to avoid vanishing gradients for positive inputs. However, it can suffer from the “dying ReLU” problem: if many neurons output <italic>x</italic> ≤ 0, they produce 0 gradients (this can be mitigated using Leaky ReLU or PReLU).</p>
        <p>As many researchers suggest, ReLU is generally a better choice than sigmoid for deep learning models due to its ability to avoid vanishing gradients and its computational efficiency. However, sigmoid can still be useful in certain applications, such as binary classification problems. The choice of activation function ultimately depends on the specific problem and the characteristics of the data.</p>
      </sec>
      <sec id="sec3dot3">
        <title>3.3. SGD vs. Adam Optimization</title>
        <p>While both Adam and Stochastic Gradient Descent (SGD) are foundational optimization algorithms in deep learning, their effectiveness in mitigating the vanishing gradient problem differs in practice. </p>
        <p>SGD updates weights using stochastic samples, which introduces noise and may help escape flat regions of the loss surface; however, it is often sensitive to vanishing gradients, particularly when used with saturating activation functions like sigmoid or tanh [<xref ref-type="bibr" rid="B5">5</xref>]. Unless carefully tuned with momentum or learning rate schedules, SGD alone struggles to propagate gradients effectively in very deep networks.</p>
        <p>In contrast, Adam uses adaptive learning rates and momentum estimates, allowing it to maintain relatively strong parameter updates even when gradients are small. This makes Adam more robust in networks affected by vanishing gradients, especially in the early stages of training. Additionally, empirical studies show that Adam often converges faster and with greater stability compared to SGD in complex or deep architectures [<xref ref-type="bibr" rid="B17">17</xref>]. However, while Adam mitigates the effects of vanishing gradients better in many cases, it can lead to poorer generalization compared to SGD in some tasks [<xref ref-type="bibr" rid="B18">18</xref>]. </p>
        <p>Thus, Adam provides more reliable optimization in the presence of weak gradients, whereas SGD may offer better long-term performance when combined with appropriate regularization and architectural choices.</p>
      </sec>
    </sec>
    <sec id="sec4">
      <title>4. Methodology</title>
      <p>This study adopts a quantitative research approach, utilizing an experimental design to compare the effects of sigmoid and ReLU activation functions on vanishing gradients in deep artificial neural networks. </p>
      <p>To compare the effects of sigmoid and ReLU activation functions on vanishing gradients with regard to different optimization techniques using a quantitative research approach and experimental design, we will follow a structured methodology grounded in empirical data collection and statistical analysis. </p>
      <p>Using a quantitative research approach and experimental design allows for a rigorous, repeatable, and statistically valid comparison of sigmoid vs. ReLU activation functions with respect to the SGD and Adam optimizers in the context of vanishing gradients. This methodology has the potential to yield concrete evidence to support or refute theoretical expectations, providing valuable insights into neural network training dynamics.</p>
      <sec id="sec4dot1">
        <title>4.1. Research Problem and Hypothesis</title>
        <p>4.1.1. Research Problem</p>
        <p>Vanishing gradients hinder the training of deep neural networks. This study aims to quantitatively compare the extent to which sigmoid and ReLU activation functions, with respect to Stochastic Gradient Descent (SGD) and Adam optimization techniques, contribute to or mitigate vanishing gradients.</p>
        <p>4.1.2. Hypotheses</p>
        <p>H₀ (Null Hypothesis): There is no significant difference in the magnitude of gradients when using sigmoid vs. ReLU activation functions. H₁ (Alternative Hypothesis): ReLU leads to significantly fewer vanishing gradients compared to sigmoid.</p>
      </sec>
      <sec id="sec4dot2">
        <title>4.2. Quantitative Research Approach</title>
        <p>The quantitative research approach emphasizes numerical data, statistical inference, and objective measurement. In this study, we will apply it as follows.</p>
        <p>4.2.1. Data Collection</p>
        <p>Run multiple training sessions of deep neural networks using different activation functions (sigmoid and ReLU) combined with different optimization techniques (SGD and Adam).Collect numerical gradient values (e.g., the mean absolute value of gradients per layer per epoch).Track training loss, accuracy, and convergence time.</p>
        <p>4.2.2. Variables</p>
        <p>Independent Variable: Type of activation function (sigmoid or ReLU). Dependent Variables: Magnitude of gradients, convergence speed, training loss, and final model accuracy.Control Variables: Network architecture, optimizer, learning rate, batch size, and dataset used.</p>
      </sec>
      <sec id="sec4dot3">
        <title>4.3. Experimental Design</title>
        <p>For this experimental design, we will focus on ensuring the control and repeatability of the experiments. Therefore, we will use the following framework.</p>
        <p>4.3.1. Network Architecture</p>
        <p>For this experiment, we will use a deep feedforward or convolutional neural network for images. The network will have 128 input neurons, 5 layers, a Sigmoid or ReLU activation function for the hidden layers, a SoftMax activation for the output layer, and SGD (Stochastic Gradient Descent) or Adam as the optimizer. All hyperparameters and initial conditions (except the activation function) are kept constant. </p>
        <p>The proposed Artificial Neural Network (ANN) architecture in <xref ref-type="fig" rid="fig4">Figure 4</xref> comprises 128 input neurons, five hidden layers using sigmoid activation functions, and a SoftMax-activated output layer, and is well-suited for investigating the vanishing gradient problem in the context of different activation and optimization strategies. Deep networks with multiple hidden layers are particularly susceptible to vanishing gradients, especially when using sigmoid activations. This makes the architecture ideal for empirically observing the limitations imposed by vanishing gradients on weight updates and convergence.</p>
        <fig id="fig4">
          <label>Figure 4</label>
          <graphic xlink:href="https://html.scirp.org/file/1733300-rId16.jpeg?20251210040045" />
        </fig>
        <p><bold>Figure 4.</bold> Neural network architecture.</p>
        <p>The use of five hidden layers provides sufficient depth to expose these issues, as deeper architectures increase the likelihood of gradients shrinking during backpropagation [<xref ref-type="bibr" rid="B10">10</xref>]. Incorporating 128 input neurons allows the model to handle moderately complex input features, making it suitable for experimentation across various datasets while maintaining computational feasibility. Additionally, using Softmax activation in the output layer aligns with standard multi-class classification practices, enabling the use of cross-entropy loss, which is sensitive to small gradients and thus accentuates vanishing gradient effects [<xref ref-type="bibr" rid="B19">19</xref>]. </p>
        <p>Finally, running this architecture under both SGD and Adam optimizers enables a direct comparison of how different optimization techniques influence training stability and gradient propagation, making this setup both theoretically grounded and experimentally informative.</p>
        <p><bold>1. Implementation</bold></p>
        <p>For this research project, we have decided to implement the entire Artificial Neural Network (ANN) from scratch instead of using existing frameworks such as TensorFlow, PyTorch, or Keras. This decision was motivated by the need to have granular and low-level control over the learning process so that we could collect gradient data with more precision at each layer and epoch. As proposed in <xref ref-type="fig" rid="fig5">Figure 5</xref>, the components of this implementation are structured to facilitate the flow of data and transformations through various computational layers. The architecture begins with the main module, which orchestrates the remaining components of the architecture.</p>
        <fig id="fig5">
          <label>Figure 5</label>
          <graphic xlink:href="https://html.scirp.org/file/1733300-rId17.jpeg?20251210040045" />
        </fig>
        <p><bold>Figure 5.</bold> Neural network architecture: components diagram.</p>
        <p>4.3.2. Between-Subjects Design</p>
        <p>We will create four groups of neural networks.</p>
        <p><bold>1. Group 1 uses sigmoid activation with an SGD optimizer</bold></p>
        <p>Here are the characteristics as detailed in <bold>Table 1</bold>: </p>
        <p>128 input neurons; 5 hidden layers + 1 input layer + 6 activation layers; Sigmoid activation functions for hidden layers; SoftMax activation for the output layer; SGD (Stochastic Gradient Descent) is the optimization algorithm.</p>
        <p><bold>Table 1.</bold> Group 1 neural network architecture—sigmoid and SGD.</p>
        <table-wrap id="tbl1">
          <label>Table 1</label>
          <table>
            <tbody>
              <tr>
                <td>Layer</td>
                <td>Layer Type</td>
                <td>Number of Neurons</td>
                <td>Activation Function</td>
                <td>Optimizer</td>
              </tr>
              <tr>
                <td>Input Layer</td>
                <td>Input</td>
                <td>128</td>
                <td>-</td>
                <td>-</td>
              </tr>
              <tr>
                <td>Hidden Layer 1</td>
                <td>Dense (Fully Connected)</td>
                <td>128</td>
                <td>Sigmoid</td>
                <td>SGD</td>
              </tr>
              <tr>
                <td>Hidden Layer 2</td>
                <td>Dense</td>
                <td>128</td>
                <td>Sigmoid</td>
                <td>SGD</td>
              </tr>
              <tr>
                <td>Hidden Layer 3</td>
                <td>Dense</td>
                <td>64</td>
                <td>Sigmoid</td>
                <td>SGD</td>
              </tr>
              <tr>
                <td>Hidden Layer 4</td>
                <td>Dense</td>
                <td>32</td>
                <td>Sigmoid</td>
                <td>SGD</td>
              </tr>
              <tr>
                <td>Hidden Layer 5</td>
                <td>Dense</td>
                <td>16</td>
                <td>Sigmoid</td>
                <td>SGD</td>
              </tr>
              <tr>
                <td>Output Layer</td>
                <td>Dense</td>
                <td>10</td>
                <td>SoftMax</td>
                <td>SGD</td>
              </tr>
            </tbody>
          </table>
        </table-wrap>
        <p><bold>2. Group 2 uses sigmoid activation with an Adam optimizer</bold></p>
        <p>Here are the characteristics as detailed in <bold>Table 2</bold>: </p>
        <p>128 input neurons; 5 hidden layers + 1 input layer + 6 activation layers; Sigmoid activation functions for hidden layers; SoftMax activation for the output layer; Adam as the optimization algorithm.</p>
        <p><bold>Table 2.</bold> Group 2 neural network architecture—sigmoid and Adam.</p>
        <table-wrap id="tbl2">
          <label>Table 2</label>
          <table>
            <tbody>
              <tr>
                <td>Layer</td>
                <td>Layer Type</td>
                <td>Number of Neurons</td>
                <td>Activation Function</td>
                <td>Optimizer</td>
              </tr>
              <tr>
                <td>Input Layer</td>
                <td>Input</td>
                <td>128</td>
                <td>-</td>
                <td>-</td>
              </tr>
              <tr>
                <td>Hidden Layer 1</td>
                <td>Dense (Fully Connected)</td>
                <td>128</td>
                <td>Sigmoid</td>
                <td>Adam</td>
              </tr>
              <tr>
                <td>Hidden Layer 2</td>
                <td>Dense</td>
                <td>128</td>
                <td>Sigmoid</td>
                <td>Adam</td>
              </tr>
              <tr>
                <td>Hidden Layer 3</td>
                <td>Dense</td>
                <td>64</td>
                <td>Sigmoid</td>
                <td>Adam</td>
              </tr>
              <tr>
                <td>Hidden Layer 4</td>
                <td>Dense</td>
                <td>32</td>
                <td>Sigmoid</td>
                <td>Adam</td>
              </tr>
              <tr>
                <td>Hidden Layer 5</td>
                <td>Dense</td>
                <td>16</td>
                <td>Sigmoid</td>
                <td>Adam</td>
              </tr>
              <tr>
                <td>Output Layer</td>
                <td>Dense</td>
                <td>10</td>
                <td>SoftMax</td>
                <td>Adam</td>
              </tr>
            </tbody>
          </table>
        </table-wrap>
        <p><bold>3. Group 3 uses ReLU activation with an SGD optimizer</bold></p>
        <p>Here are the characteristics as detailed in <bold>Table 3</bold>: </p>
        <p>128 input neurons;5 hidden layers + 1 input layer + 6 activation layers;ReLU activation functions for hidden layers;SoftMax activation for the output layer;SGD (Stochastic Gradient Descent) is the optimization algorithm.</p>
        <p><bold>Table 3.</bold> Group 3 neural network architecture—ReLU and SGD.</p>
        <table-wrap id="tbl3">
          <label>Table 3</label>
          <table>
            <tbody>
              <tr>
                <td>Layer</td>
                <td>Layer Type</td>
                <td>Number of Neurons</td>
                <td>Activation Function</td>
                <td>Optimizer</td>
              </tr>
              <tr>
                <td>Input Layer</td>
                <td>Input</td>
                <td>128</td>
                <td>-</td>
                <td>-</td>
              </tr>
              <tr>
                <td>Hidden Layer 1</td>
                <td>Dense (Fully Connected)</td>
                <td>128</td>
                <td>ReLU</td>
                <td>SGD</td>
              </tr>
              <tr>
                <td>Hidden Layer 2</td>
                <td>Dense</td>
                <td>128</td>
                <td>ReLU</td>
                <td>SGD</td>
              </tr>
              <tr>
                <td>Hidden Layer 3</td>
                <td>Dense</td>
                <td>64</td>
                <td>ReLU</td>
                <td>SGD</td>
              </tr>
              <tr>
                <td>Hidden Layer 4</td>
                <td>Dense</td>
                <td>32</td>
                <td>ReLU</td>
                <td>SGD</td>
              </tr>
              <tr>
                <td>Hidden Layer 5</td>
                <td>Dense</td>
                <td>16</td>
                <td>ReLU</td>
                <td>SGD</td>
              </tr>
              <tr>
                <td>Output Layer</td>
                <td>Dense</td>
                <td>10</td>
                <td>SoftMax</td>
                <td>SGD</td>
              </tr>
            </tbody>
          </table>
        </table-wrap>
        <p><bold>4. Group 4 uses ReLU activation with the Adam optimizer</bold></p>
        <p>Here are the characteristics as detailed in <bold>Table 4</bold>: </p>
        <p>128 input neurons; 5 hidden layers + 1 input layer + 6 activation layers; ReLU activation functions for hidden layers; SoftMax activation for the output layer; Adam as the optimization algorithm.</p>
        <p><bold>Table 4.</bold> Group 4 neural network architecture—ReLU and Adam.</p>
        <table-wrap id="tbl4">
          <label>Table 4</label>
          <table>
            <tbody>
              <tr>
                <td>Layer</td>
                <td>Layer Type</td>
                <td>Number of Neurons</td>
                <td>Activation Function</td>
                <td>Optimizer</td>
              </tr>
              <tr>
                <td>Input Layer</td>
                <td>Input</td>
                <td>128</td>
                <td>-</td>
                <td>-</td>
              </tr>
              <tr>
                <td>Hidden Layer 1</td>
                <td>Dense (Fully Connected)</td>
                <td>128</td>
                <td>ReLU</td>
                <td>Adam</td>
              </tr>
              <tr>
                <td>Hidden Layer 2</td>
                <td>Dense</td>
                <td>128</td>
                <td>ReLU</td>
                <td>Adam</td>
              </tr>
              <tr>
                <td>Hidden Layer 3</td>
                <td>Dense</td>
                <td>64</td>
                <td>ReLU</td>
                <td>Adam</td>
              </tr>
              <tr>
                <td>Hidden Layer 4</td>
                <td>Dense</td>
                <td>32</td>
                <td>ReLU</td>
                <td>Adam</td>
              </tr>
              <tr>
                <td>Hidden Layer 5</td>
                <td>Dense</td>
                <td>16</td>
                <td>ReLU</td>
                <td>Adam</td>
              </tr>
              <tr>
                <td>Output Layer</td>
                <td>Dense</td>
                <td>10</td>
                <td>SoftMax</td>
                <td>Adam</td>
              </tr>
            </tbody>
          </table>
        </table-wrap>
        <p>4.3.3. Hyper-Parameters</p>
        <p>Each group of neural networks is trained multiple times with different random seeds for statistical robustness. The above uses a progressively decreasing architecture, which is common in classification tasks. Dropout and Batch Normalization are also used between layers as regularization is needed. <bold>Table 5</bold> provides a complete list of hyperparameters.</p>
        <p><bold>Table 5.</bold> Training hyperparameters.</p>
        <table-wrap id="tbl5">
          <label>Table 5</label>
          <table>
            <tbody>
              <tr>
                <td>Hyper-Parameter</td>
                <td>Value</td>
              </tr>
              <tr>
                <td>Initial Adam learning rate</td>
                <td>0.001</td>
              </tr>
              <tr>
                <td>Initial SDG learning rate</td>
                <td>1</td>
              </tr>
              <tr>
                <td>Initial Momentum</td>
                <td>0</td>
              </tr>
              <tr>
                <td>Weight initialization scheme</td>
                <td>Random</td>
              </tr>
              <tr>
                <td>Batch size</td>
                <td>128</td>
              </tr>
              <tr>
                <td>Epochs</td>
                <td>10</td>
              </tr>
              <tr>
                <td>Optimizer Decay</td>
                <td>1e-3</td>
              </tr>
              <tr>
                <td>Epsilon</td>
                <td>1e-7</td>
              </tr>
              <tr>
                <td>beta_1</td>
                <td>0.9</td>
              </tr>
              <tr>
                <td>beta_2</td>
                <td>0.999</td>
              </tr>
              <tr>
                <td>Initial weight_regularizer_l1</td>
                <td>0</td>
              </tr>
              <tr>
                <td>Initial weight_regularizer_l2</td>
                <td>0</td>
              </tr>
              <tr>
                <td>Initial bias_regularizer_l2</td>
                <td>0</td>
              </tr>
            </tbody>
          </table>
        </table-wrap>
        <p>To give a clear idea of how this architecture was implemented in Python, <xref ref-type="fig" rid="fig6">Figure 6</xref> and <xref ref-type="fig" rid="fig7">Figure 7</xref> provide the code snippets of the dependencies as well as the body of the main module of the deep neural network.</p>
        <fig id="fig6">
          <label>Figure 6</label>
          <graphic xlink:href="https://html.scirp.org/file/1733300-rId18.jpeg?20251210040047" />
        </fig>
        <p><bold>Figure 6.</bold> Python code of the neural network: dependency modules.</p>
        <fig id="fig7">
          <label>Figure 7</label>
          <graphic xlink:href="https://html.scirp.org/file/1733300-rId19.jpeg?20251210040047" />
        </fig>
        <p><bold>Figure 7.</bold> Python code of the neural network: main module.</p>
        <p>4.3.4. Dataset</p>
        <p>For this experiment, we have opted to use the MNIST dataset. MNIST is an ideal benchmark for experimentation on our research topic due to its simplicity, balanced structure, and wide adoption in deep learning research. Comprising 70,000 grayscale images (60,000 for training and 10,000 for testing), each of 28 × 28 pixels and labeled from 0 to 9, MNIST presents a low-dimensional yet sufficiently complex classification task that allows for effective observation of learning behavior in neural networks [<xref ref-type="bibr" rid="B20">20</xref>]. Its moderate input size (784 features per image) aligns well with the proposed ANN architecture featuring 128 input neurons and multiple hidden layers. Importantly, MNIST’s structure makes it easier to isolate and observe the effects of architectural and optimization choices—such as the use of sigmoid vs. ReLU and SGD vs. Adam—on issues like vanishing gradients. </p>
        <p>Even though MNIST does not require 12 layers to achieve &gt;99% accuracy, using such a network can be justified as our goal is research and testing deep architectures. It also serves as a stepping stone for more complex datasets (e.g., Fashion-MNIST, CIFAR-10) where deeper networks are beneficial. </p>
        <p>Additionally, this dataset is well-understood, computationally lightweight, and does not introduce confounding domain-specific complexity, making it a practical and scientifically valid choice for foundational experimentation [<xref ref-type="bibr" rid="B19">19</xref>]. The widespread use of MNIST in past research also facilitates reproducibility and comparison with existing studies addressing gradient flow and neural optimization behavior. </p>
        <p>Thus, while a 12-layer fully connected network would be overkill for MNIST, it can be justified for experimentation, studying deep network behavior, or testing regularization and optimization techniques. With proper precautions, overparameterization can even aid generalization rather than hurt it. </p>
        <p>Metrics to Measure the Vanishing Gradient </p>
        <p>Mean or median of gradients for each layer during training. Frequency of near-zero gradients (e.g., &lt; 1e−3 (0.001) or gradients &lt; 1e−5). Gradient norm ratios between layers.</p>
        <p>4.3.5. Data Collection</p>
        <p>For this experiment, we will collect gradient data from each layer through different epochs. Each hidden layer of the architecture is made of: </p>
        <p>128 inputs; 128 neurons; 128 sets of weights (one set for each neuron); 128 weights per set (one weight for each input); 128 gradients (each gradient belongs to a single neuron); 128 partial derivatives per gradient (each partial derivative belongs to a single weight); 7 layers (1 input, 5 hidden, and 1 output). </p>
        <p>This gives us a total of 16,384 partial derivatives to be generated per hidden layer.</p>
        <p>Data size: 45 GB per experiment. </p>
        <p>Rows per layer: 3,676,960.</p>
      </sec>
      <sec id="sec4dot4">
        <title>4.4. Statistical Analysis</title>
        <p>For this study, we will use descriptive statistics to measure the gradient norm ratios between layers as well as the mean of gradient values per layer.</p>
        <p>4.4.1. Gradient Norm</p>
        <p>The gradient norm is a quantitative measure of the overall magnitude of the gradients in a neural network during training. It reflects how strongly the loss function responds to changes in the model parameters and is commonly expressed as the L_2 norm of the gradient vector, <inline-formula><mml:math><mml:mrow><mml:msub><mml:mrow><mml:mrow><mml:mo> ‖ </mml:mo><mml:mrow><mml:msub><mml:mo> ∇ </mml:mo><mml:mi> θ </mml:mi></mml:msub><mml:mi> ℒ </mml:mi></mml:mrow><mml:mo> ‖ </mml:mo></mml:mrow></mml:mrow><mml:mn> 2 </mml:mn></mml:msub></mml:mrow></mml:math></inline-formula> . Monitoring the gradient norm provides critical insight into training dynamics, helping to identify issues such as vanishing or exploding gradients, which can hinder convergence or destabilize learning [<xref ref-type="bibr" rid="B4">4</xref>][<xref ref-type="bibr" rid="B14">14</xref>]. Large gradient norms indicate that parameter updates are excessively large, potentially causing divergence, while very small norms suggest weak learning signals and slow progress. Thus, the gradient norm serves as a foundational diagnostic tool in deep learning optimization, revealing how efficiently information and learning signals propagate through the network. </p>
        <p><bold>1. Gradient Norm Formula Equation</bold></p>
        <p>A concise equation for the gradient norm of a gradient vector 𝒢 is:</p>
        <disp-formula id="FD1">
          <label>(1)</label>
          <mml:math>
            <mml:mrow>
              <mml:msub>
                <mml:mrow>
                  <mml:mrow>
                    <mml:mo>‖</mml:mo>
                    <mml:mi>g</mml:mi>
                    <mml:mo>‖</mml:mo>
                  </mml:mrow>
                </mml:mrow>
                <mml:mi>p</mml:mi>
              </mml:msub>
              <mml:mo>=</mml:mo>
              <mml:msup>
                <mml:mrow>
                  <mml:mrow>
                    <mml:mo>(</mml:mo>
                    <mml:mrow>
                      <mml:mstyle displaystyle="true">
                        <mml:msub>
                          <mml:mo>∑</mml:mo>
                          <mml:mi>i</mml:mi>
                        </mml:msub>
                        <mml:mrow>
                          <mml:msup>
                            <mml:mrow>
                              <mml:mrow>
                                <mml:mo>|</mml:mo>
                                <mml:mrow>
                                  <mml:msub>
                                    <mml:mi>g</mml:mi>
                                    <mml:mi>i</mml:mi>
                                  </mml:msub>
                                </mml:mrow>
                                <mml:mo>|</mml:mo>
                              </mml:mrow>
                            </mml:mrow>
                            <mml:mi>p</mml:mi>
                          </mml:msup>
                        </mml:mrow>
                      </mml:mstyle>
                    </mml:mrow>
                    <mml:mo>)</mml:mo>
                  </mml:mrow>
                </mml:mrow>
                <mml:mrow>
                  <mml:mrow>
                    <mml:mn>1</mml:mn>
                    <mml:mo>/</mml:mo>
                    <mml:mi>p</mml:mi>
                  </mml:mrow>
                </mml:mrow>
              </mml:msup>
            </mml:mrow>
          </mml:math>
        </disp-formula>
        <p>Here, <inline-formula><mml:math><mml:mrow><mml:msub><mml:mi> g </mml:mi><mml:mi> i </mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> are the components of the gradient vector, and <italic>p</italic> specifies the norm type. </p>
        <p>In our case, we will use the common case (L2 norm), with <italic>p</italic> = 2, which gives:</p>
        <disp-formula id="FD2">
          <label>(2)</label>
          <mml:math>
            <mml:mrow>
              <mml:msub>
                <mml:mrow>
                  <mml:mrow>
                    <mml:mo>‖</mml:mo>
                    <mml:mi>g</mml:mi>
                    <mml:mo>‖</mml:mo>
                  </mml:mrow>
                </mml:mrow>
                <mml:mn>2</mml:mn>
              </mml:msub>
              <mml:mo>=</mml:mo>
              <mml:msqrt>
                <mml:mrow>
                  <mml:mstyle displaystyle="true">
                    <mml:msub>
                      <mml:mo>∑</mml:mo>
                      <mml:mi>i</mml:mi>
                    </mml:msub>
                    <mml:mrow>
                      <mml:msubsup>
                        <mml:mi>g</mml:mi>
                        <mml:mi>i</mml:mi>
                        <mml:mn>2</mml:mn>
                      </mml:msubsup>
                    </mml:mrow>
                  </mml:mstyle>
                </mml:mrow>
              </mml:msqrt>
            </mml:mrow>
          </mml:math>
        </disp-formula>
        <p><bold>2. Pseudo Code</bold></p>
        <p>1. Square each element of the gradient vector. </p>
        <p>2. Sum all the squared values. </p>
        <p>3. Calculate the square toot of the sum. </p>
        <p>For this study, we use the average gradient norm instead of the per-step gradient norm to have a stable, long-term view of training dynamics rather than a snapshot from a single batch or step. This also helps with visualization as the average aggregation will reduce the number of items in the dataset while maintaining the statistical significance.</p>
        <p><bold>3. Average Gradient Norm Formal Equation</bold></p>
        <disp-formula id="FD3">
          <label>(3)</label>
          <mml:math>
            <mml:mrow>
              <mml:mi>A</mml:mi>
              <mml:mi>v</mml:mi>
              <mml:mi>g</mml:mi>
              <mml:mi>G</mml:mi>
              <mml:mi>r</mml:mi>
              <mml:mi>a</mml:mi>
              <mml:mi>d</mml:mi>
              <mml:mi>N</mml:mi>
              <mml:mi>o</mml:mi>
              <mml:mi>r</mml:mi>
              <mml:msub>
                <mml:mi>m</mml:mi>
                <mml:mi>l</mml:mi>
              </mml:msub>
              <mml:mo>=</mml:mo>
              <mml:mfrac>
                <mml:mn>1</mml:mn>
                <mml:mi>T</mml:mi>
              </mml:mfrac>
              <mml:mstyle displaystyle="true">
                <mml:msubsup>
                  <mml:mo>∑</mml:mo>
                  <mml:mrow>
                    <mml:mi>t</mml:mi>
                    <mml:mo>=</mml:mo>
                    <mml:mn>1</mml:mn>
                  </mml:mrow>
                  <mml:mi>T</mml:mi>
                </mml:msubsup>
                <mml:mrow>
                  <mml:msub>
                    <mml:mrow>
                      <mml:mrow>
                        <mml:mo>‖</mml:mo>
                        <mml:mrow>
                          <mml:msub>
                            <mml:mo>∇</mml:mo>
                            <mml:mrow>
                              <mml:msub>
                                <mml:mi>θ</mml:mi>
                                <mml:mi>l</mml:mi>
                              </mml:msub>
                            </mml:mrow>
                          </mml:msub>
                          <mml:msup>
                            <mml:mi>ℒ</mml:mi>
                            <mml:mrow>
                              <mml:mrow>
                                <mml:mo>(</mml:mo>
                                <mml:mi>t</mml:mi>
                                <mml:mo>)</mml:mo>
                              </mml:mrow>
                            </mml:mrow>
                          </mml:msup>
                        </mml:mrow>
                        <mml:mo>‖</mml:mo>
                      </mml:mrow>
                    </mml:mrow>
                    <mml:mi>p</mml:mi>
                  </mml:msub>
                </mml:mrow>
              </mml:mstyle>
            </mml:mrow>
          </mml:math>
        </disp-formula>
        <p>where: </p>
        <p>1. <inline-formula><mml:math display="inline"><mml:mi> l </mml:mi></mml:math></inline-formula> = layer index;</p>
        <p>2. <inline-formula><mml:math display="inline"><mml:mi> T </mml:mi></mml:math></inline-formula> = total number of training steps or batches;</p>
        <p>3. <inline-formula><mml:math><mml:mrow><mml:msub><mml:mi> θ </mml:mi><mml:mi> l </mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> = parameters of layer <inline-formula><mml:math display="inline"><mml:mi> l </mml:mi></mml:math></inline-formula> ;</p>
        <p>4. <inline-formula><mml:math><mml:mrow><mml:msub><mml:mo> ∇ </mml:mo><mml:mrow><mml:msub><mml:mi> θ </mml:mi><mml:mi> l </mml:mi></mml:msub></mml:mrow></mml:msub><mml:msup><mml:mi> ℒ </mml:mi><mml:mrow><mml:mrow><mml:mo> ( </mml:mo><mml:mi> t </mml:mi><mml:mo> ) </mml:mo></mml:mrow></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula> = gradient of the loss at step <italic>t</italic> with respect to layer <inline-formula><mml:math display="inline"><mml:mi> l </mml:mi></mml:math></inline-formula> ;</p>
        <p>5. <inline-formula><mml:math><mml:mrow><mml:msub><mml:mrow><mml:mrow><mml:mo> ‖ </mml:mo><mml:mrow><mml:mtext>   </mml:mtext><mml:mo> ⋅ </mml:mo><mml:mtext>   </mml:mtext></mml:mrow><mml:mo> ‖ </mml:mo></mml:mrow></mml:mrow><mml:mi> p </mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> = chosen norm (commonly <italic>p</italic> = 2).</p>
        <p><bold>4. Average Gradient Norm Pseudocode</bold></p>
        <p>6. Initialize sum norm = 0; </p>
        <p>7. For each training step <italic>t</italic> from 1 to <italic>T</italic>: </p>
        <p>Compute the norm of the gradient for layer l at step<italic>t</italic>. Add this value to the sum norm. </p>
        <p>8. Divide the sum norm by <italic>T</italic> to get the average gradient norm for layer <inline-formula><mml:math display="inline"><mml:mi> l </mml:mi></mml:math></inline-formula> .</p>
        <p><bold>5. Average Gradient Norm SQL Code</bold></p>
        <p>Because I used a MySQL database server to collect all the gradient metrics for easy manipulation using a structured query language, below in <xref ref-type="fig" rid="fig8">Figure 8</xref> is the SQL code used to calculate the average gradient norm.</p>
        <fig id="fig8">
          <label>Figure 8</label>
          <graphic xlink:href="https://html.scirp.org/file/1733300-rId46.jpeg?20251210040052" />
        </fig>
        <p><bold>Figure 8.</bold> Average gradient norm SQL query for layer 10.</p>
        <p>In our study, we are more interested in capturing the changes in gradients by layer. To achieve this, we divide the gradient norm of layer <italic>n</italic> by that of layer <italic>n</italic> − 1. In this way, we measure how gradients change as they flow through layers. This ratio helps identify gradient flow issues such as detecting vanishing or exploding gradients. We use SQL code to compute this as shown in <xref ref-type="fig" rid="fig9">Figure 9</xref> and provide an interpretation in <bold>Table 6</bold>. </p>
        <p>Therefore, the gradient norm ratio between layer and layer +1 is:</p>
        <disp-formula id="FD4">
          <label>(4)</label>
          <mml:math>
            <mml:mrow>
              <mml:mi>R</mml:mi>
              <mml:mi>a</mml:mi>
              <mml:mi>t</mml:mi>
              <mml:mi>i</mml:mi>
              <mml:msub>
                <mml:mi>o</mml:mi>
                <mml:mrow>
                  <mml:mi>l</mml:mi>
                  <mml:mo>,</mml:mo>
                  <mml:mi>l</mml:mi>
                  <mml:mo>+</mml:mo>
                  <mml:mn>1</mml:mn>
                </mml:mrow>
              </mml:msub>
              <mml:mo>=</mml:mo>
              <mml:mfrac>
                <mml:mrow>
                  <mml:mrow>
                    <mml:mo>‖</mml:mo>
                    <mml:mrow>
                      <mml:mo>∇</mml:mo>
                      <mml:msup>
                        <mml:mi>W</mml:mi>
                        <mml:mrow>
                          <mml:mrow>
                            <mml:mo>(</mml:mo>
                            <mml:mi>l</mml:mi>
                            <mml:mo>)</mml:mo>
                          </mml:mrow>
                        </mml:mrow>
                      </mml:msup>
                    </mml:mrow>
                    <mml:mo>‖</mml:mo>
                  </mml:mrow>
                </mml:mrow>
                <mml:mrow>
                  <mml:mrow>
                    <mml:mo>‖</mml:mo>
                    <mml:mrow>
                      <mml:mo>∇</mml:mo>
                      <mml:msup>
                        <mml:mi>w</mml:mi>
                        <mml:mrow>
                          <mml:mrow>
                            <mml:mo>(</mml:mo>
                            <mml:mrow>
                              <mml:mi>l</mml:mi>
                              <mml:mo>+</mml:mo>
                              <mml:mn>1</mml:mn>
                            </mml:mrow>
                            <mml:mo>)</mml:mo>
                          </mml:mrow>
                        </mml:mrow>
                      </mml:msup>
                    </mml:mrow>
                    <mml:mo>‖</mml:mo>
                  </mml:mrow>
                </mml:mrow>
              </mml:mfrac>
            </mml:mrow>
          </mml:math>
        </disp-formula>
        <fig id="fig9">
          <label>Figure 9</label>
          <graphic xlink:href="https://html.scirp.org/file/1733300-rId49.jpeg?20251210040051" />
        </fig>
        <p><bold>Figure 9.</bold> Average gradient norm ratio SQL query for layers 2 and 1.</p>
        <p>The gradient norm ratio can be interpreted as follows.</p>
        <p><bold>Table 6.</bold> Training hyperparameters.</p>
        <table-wrap id="tbl6">
          <label>Table 6</label>
          <table>
            <tbody>
              <tr>
                <td>
                  Average Gradient Norm Ratio
                  <inline-formula>
                    <mml:math>
                      <mml:mrow>
                        <mml:mrow>
                          <mml:mrow>
                            <mml:mo>∇</mml:mo>
                            <mml:msup>
                              <mml:mi>W</mml:mi>
                              <mml:mrow>
                                <mml:mrow>
                                  <mml:mo>(</mml:mo>
                                  <mml:mi>l</mml:mi>
                                  <mml:mo>)</mml:mo>
                                </mml:mrow>
                              </mml:mrow>
                            </mml:msup>
                          </mml:mrow>
                          <mml:mo>/</mml:mo>
                          <mml:mrow>
                            <mml:mo>∇</mml:mo>
                            <mml:msup>
                              <mml:mi>w</mml:mi>
                              <mml:mrow>
                                <mml:mrow>
                                  <mml:mo>(</mml:mo>
                                  <mml:mrow>
                                    <mml:mi>l</mml:mi>
                                    <mml:mo>−</mml:mo>
                                    <mml:mn>1</mml:mn>
                                  </mml:mrow>
                                  <mml:mo>)</mml:mo>
                                </mml:mrow>
                              </mml:mrow>
                            </mml:msup>
                          </mml:mrow>
                        </mml:mrow>
                      </mml:mrow>
                    </mml:math>
                  </inline-formula>
                </td>
                <td>Interpretation</td>
              </tr>
              <tr>
                <td>&gt;5</td>
                <td>Possible exploding gradient</td>
              </tr>
              <tr>
                <td>&lt;=1e-3</td>
                <td>Possible vanishing gradient</td>
              </tr>
              <tr>
                <td>±1</td>
                <td>Healthy gradient flow</td>
              </tr>
              <tr>
                <td>It varies significantly per layer.</td>
                <td>Indicates possible instability or poor initialization</td>
              </tr>
            </tbody>
          </table>
        </table-wrap>
        <p>4.4.2. The Gradient Mean</p>
        <p>In empirical research investigating the effect of activation functions (ReLU and Sigmoid) and optimization techniques (Adam and SGD) on the vanishing gradient problem, the use of statistical summarization methods such as the mean is crucial. In a deep neural network with 12 layers, where each layer can have hundreds or thousands of gradient values during backpropagation, raw gradients are typically high-dimensional, noisy, and non-uniform. Computing the mean of gradient values per layer or per epoch provides a compact, interpretable, and scalable metric for evaluating training dynamics.</p>
      </sec>
    </sec>
    <sec id="sec5">
      <title>5. Experiments</title>
      <sec id="sec5dot1">
        <title>5.1. ReLU Activation + Adam Optimizer</title>
        <p>5.1.1. Gradient Norm Ratio</p>
        <p>In <xref ref-type="fig" rid="fig10">Figure 10</xref> below, we provide a holistic view of how gradient norms changed layer by layer.</p>
        <fig id="fig10">
          <label>Figure 10</label>
          <graphic xlink:href="https://html.scirp.org/file/1733300-rId52.jpeg?20251210040055" />
        </fig>
        <p><bold>Figure 10.</bold> ReLU-Adam gradient norm ratio per Layer.</p>
        <p><bold>1</bold><bold>.</bold><bold>Threshold Annotations</bold></p>
        <p>Red dashed line (1e−3): Vanishing gradient threshold. Purple dashed line (1e3): Exploding gradient threshold.</p>
        <p><bold>2. Observation</bold></p>
        <p>The plot uses a logarithmic y-axis, which helps clearly display values across several magnitudes (from 1e−4 to 1e4). Vanishing gradients are evident in layers with norms below 1e−3 and are visible only in one trainable layer, Layer 9. No training layer had exploding gradients (gradient norms above 1e3). The only explosion observed was in activation layers 8 and 10. <bold>Table 7</bold> provides a tabular representation of the gradient’s dynamics.</p>
        <p><bold>Table 7.</bold> ReLU-Adam gradient norm ratio classification.</p>
        <table-wrap id="tbl7">
          <label>Table 7</label>
          <table>
            <tbody>
              <tr>
                <td>
                  <bold>Epoch</bold>
                </td>
                <td>
                  <bold>Layer1</bold>
                </td>
                <td>
                  <bold>Layer2</bold>
                </td>
                <td>
                  <bold>Layer3</bold>
                </td>
                <td>
                  <bold>Layer4</bold>
                </td>
                <td>
                  <bold>Layer5</bold>
                </td>
                <td>
                  <bold>Layer6</bold>
                </td>
                <td>
                  <bold>Layer7</bold>
                </td>
                <td>
                  <bold>Layer8</bold>
                </td>
                <td>
                  <bold>Layer9</bold>
                </td>
                <td>
                  <bold>Layer10</bold>
                </td>
                <td>
                  <bold>Layer11</bold>
                </td>
              </tr>
              <tr>
                <td>1</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Exploding</td>
                <td>Stable</td>
                <td>Exploding</td>
                <td>Stable</td>
              </tr>
              <tr>
                <td>2</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Exploding</td>
                <td>Vanishing</td>
                <td>Exploding</td>
                <td>Stable</td>
              </tr>
              <tr>
                <td>3</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Exploding</td>
                <td>Vanishing</td>
                <td>Exploding</td>
                <td>Stable</td>
              </tr>
              <tr>
                <td>4</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Exploding</td>
                <td>Vanishing</td>
                <td>Exploding</td>
                <td>Stable</td>
              </tr>
              <tr>
                <td>5</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Exploding</td>
                <td>Vanishing</td>
                <td>Exploding</td>
                <td>Stable</td>
              </tr>
              <tr>
                <td>6</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Exploding</td>
                <td>Vanishing</td>
                <td>Exploding</td>
                <td>Stable</td>
              </tr>
              <tr>
                <td>7</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Exploding</td>
                <td>Vanishing</td>
                <td>Exploding</td>
                <td>Stable</td>
              </tr>
              <tr>
                <td>8</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Exploding</td>
                <td>Vanishing</td>
                <td>Exploding</td>
                <td>Stable</td>
              </tr>
              <tr>
                <td>9</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Exploding</td>
                <td>Vanishing</td>
                <td>Exploding</td>
                <td>Stable</td>
              </tr>
              <tr>
                <td>10</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Stable</td>
                <td>Exploding</td>
                <td>Vanishing</td>
                <td>Exploding</td>
                <td>Stable</td>
              </tr>
            </tbody>
          </table>
        </table-wrap>
        <p>5.1.2. Mean Gradient for Layer 9</p>
        <p>Because Layer 9 is the only trainable layer affected by the vanishing gradient problem, it is important to dive deep into it and understand how the mean gradient fluctuated over the epochs. <xref ref-type="fig" rid="fig11">Figure 11</xref> provides this focused view.</p>
        <fig id="fig11">
          <label>Figure 11</label>
          <graphic xlink:href="https://html.scirp.org/file/1733300-rId53.jpeg?20251210040056" />
        </fig>
        <p><bold>Figure 11.</bold> ReLU-Adam mean gradient per epoch in layer 9.</p>
        <p><bold>Observation</bold></p>
        <p>The red dashed lines at ±1e−3 highlight the vanishing region. The values show a gradual decline, with later epochs falling into the vanishing zones, a strong indicator of learning degradation.</p>
        <p>5.1.3. Accuracy</p>
        <p>As depicted in <xref ref-type="fig" rid="fig12">Figure 12</xref>, the trend confirms effective training progress and indicates stable gradient flow and model convergence over time.</p>
        <fig id="fig12">
          <label>Figure 12</label>
          <graphic xlink:href="https://html.scirp.org/file/1733300-rId54.jpeg?20251210040057" />
        </fig>
        <p><bold>Figure 12.</bold> ReLU-Adam accuracy and loss over epochs.</p>
        <p><bold>Observation</bold></p>
        <p>As the number of epochs increases, accuracy improves steadily from 56.3% to 80.1%. Simultaneously, the loss consistently decreases from 1.064 to 0.617. This inverse correlation is expected: as the model learns better (higher accuracy), it makes fewer prediction errors (lower loss).</p>
      </sec>
      <sec id="sec5dot2">
        <title>5.2. ReLU Activation + SGD Optimizer</title>
        <p>5.2.1. Gradient Norm Ratio</p>
        <p>This architecture experiences complete vanishing gradients from epoch 2 in all layers because the gradients are consistently 0. Hence, the gradient norm ratio tends toward infinity because of the division by 0. <bold>Table 8</bold> provides more insight.</p>
        <p><bold>Table 8.</bold> ReLU-SGD gradient norm ratio.</p>
        <table-wrap id="tbl8">
          <label>Table 8</label>
          <table>
            <tbody>
              <tr>
                <td>
                  <bold>Epoch</bold>
                </td>
                <td>
                  <bold>Layer1</bold>
                </td>
                <td>
                  <bold>Layer2</bold>
                </td>
                <td>
                  <bold>Layer3</bold>
                </td>
                <td>
                  <bold>Layer4</bold>
                </td>
                <td>
                  <bold>Layer5</bold>
                </td>
                <td>
                  <bold>Layer6</bold>
                </td>
                <td>
                  <bold>Layer7</bold>
                </td>
                <td>
                  <bold>Layer8</bold>
                </td>
                <td>
                  <bold>Layer9</bold>
                </td>
                <td>
                  <bold>Layer10</bold>
                </td>
                <td>
                  <bold>Layer11</bold>
                </td>
              </tr>
              <tr>
                <td>1</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>7.31016</td>
                <td>0</td>
                <td>Stable</td>
                <td>0.000786</td>
                <td>32368.85</td>
                <td>0.127616</td>
                <td>13472.95</td>
              </tr>
              <tr>
                <td>2</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
              </tr>
              <tr>
                <td>3</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
              </tr>
              <tr>
                <td>4</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
              </tr>
              <tr>
                <td>5</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
              </tr>
              <tr>
                <td>6</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
              </tr>
              <tr>
                <td>7</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
              </tr>
              <tr>
                <td>8</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
              </tr>
              <tr>
                <td>9</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
              </tr>
              <tr>
                <td>10</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
                <td>Infinity</td>
              </tr>
            </tbody>
          </table>
        </table-wrap>
        <p><bold>1. Epoch 1</bold><bold>Observation</bold></p>
        <p>From <xref ref-type="fig" rid="fig13">Figure 13</xref>, we can confirm the following: </p>
        <p>Layer 6 experiences complete vanishing (ratio = 0). Layer 8 experiences vanishing (a very small ratio). Layers 1 - 4, 7 are possibly inactive or cut off, since all upstream layers show ∞, meaning they were divided by zero gradient norms.</p>
        <fig id="fig13">
          <label>Figure 13</label>
          <graphic xlink:href="https://html.scirp.org/file/1733300-rId55.jpeg?20251210040058" />
        </fig>
        <p><bold>Figure 13.</bold> ReLU-SGD gradient norm ratio per layer.</p>
        <p><bold>2. Observation</bold></p>
        <p>Log scale is used to visualize both very large and very small ratios clearly. Infinity values are plotted as 1e6 and 0 values as 1e-6, for visual continuity. Only Epoch 1 shows real computed values; all other epochs have degenerated into extremes due to vanishing, where gradients are equal to 0.Backpropagation is breaking down before reaching Layer 6.Signals from the output layer (Layer 12) are not effectively flowing back to the earlier layers. This is a classic vanishing gradient problem, especially affecting deeper (earlier) layers.</p>
        <p>5.2.2. Norm Ratio SoftMax Layer 12 over Hidden Layer 11</p>
        <p>To gain insight into where gradients are equal to zero, let us inspect the ratio norm from the SoftMax layer 12 to hidden layer 11 during backpropagation based on the information provided in <bold>Table 9</bold>.</p>
        <p><bold>Table 9.</bold> ReLU-SGD gradient norm ratio layers 12-11.</p>
        <table-wrap id="tbl9">
          <label>Table 9</label>
          <table>
            <tbody>
              <tr>
                <td>Epoch</td>
                <td>Layer_11_Norm</td>
                <td>Layer_12_Norm</td>
                <td>Gradient_Norm_Ratio_L12_Over_L11</td>
              </tr>
              <tr>
                <td>1</td>
                <td>5.50477e-07</td>
                <td>0.007416549</td>
                <td>13472.949823516696</td>
              </tr>
              <tr>
                <td>2</td>
                <td>0.0</td>
                <td>0.007416314</td>
                <td>Infinity</td>
              </tr>
              <tr>
                <td>3</td>
                <td>0.0</td>
                <td>0.007416149</td>
                <td>Infinity</td>
              </tr>
              <tr>
                <td>4</td>
                <td>0.0</td>
                <td>0.00741604</td>
                <td>Infinity</td>
              </tr>
              <tr>
                <td>5</td>
                <td>0.0</td>
                <td>0.007415966</td>
                <td>Infinity</td>
              </tr>
              <tr>
                <td>6</td>
                <td>0.0</td>
                <td>0.007415922</td>
                <td>Infinity</td>
              </tr>
              <tr>
                <td>7</td>
                <td>0.0</td>
                <td>0.007415892</td>
                <td>Infinity</td>
              </tr>
              <tr>
                <td>8</td>
                <td>0.0</td>
                <td>0.007415867</td>
                <td>Infinity</td>
              </tr>
              <tr>
                <td>9</td>
                <td>0.0</td>
                <td>0.007415825</td>
                <td>Infinity</td>
              </tr>
              <tr>
                <td>10</td>
                <td>0.0</td>
                <td>0.007415816</td>
                <td>Infinity</td>
              </tr>
            </tbody>
          </table>
        </table-wrap>
        <p><bold>Observation</bold></p>
        <p>Epoch 1: Ratio ≈ 13,472.95, layer 11’s gradient norm is extremely small compared to layer 12. Epochs 2 - 10: Ratio = ∞, because layer 11’s gradient norm is zero. This is a classic and severe vanishing gradient problem.</p>
        <p>5.2.3. Mean Gradient for Layer 3</p>
        <p>To gain further insight into where gradients are equal to zero, let us inspect <xref ref-type="fig" rid="fig14">Figure 14</xref> and <xref ref-type="fig" rid="fig15">Figure 15</xref> showing the gradients received by layer 3 during backpropagation.</p>
        <fig id="fig14">
          <label>Figure 14</label>
          <graphic xlink:href="https://html.scirp.org/file/1733300-rId56.jpeg?20251210040101" />
        </fig>
        <p><bold>Figure 14.</bold> ReLU-SGD layer 3 MySQL gradient snapshot.</p>
        <p><bold>1. Observation</bold></p>
        <p>The gradient is exactly zero across all epochs. This indicates complete vanishing. Layer 3 is not receiving any learning signal at all.</p>
        <p>5.2.4. Accuracy</p>
        <p>This flat trend shown in <xref ref-type="fig" rid="fig16">Figure 16</xref> is a strong indicator of vanishing gradients, dead neurons, and optimizer failure in deep networks using Sigmoid activation with SGD, as confirmed by earlier statistical analysis of the experiment.</p>
        <fig id="fig15">
          <label>Figure 15</label>
          <graphic xlink:href="https://html.scirp.org/file/1733300-rId57.jpeg?20251210040102" />
        </fig>
        <p><bold>Figure 15.</bold> ReLU-SGD layer 3 mean gradient.</p>
        <fig id="fig16">
          <label>Figure 16</label>
          <graphic xlink:href="https://html.scirp.org/file/1733300-rId58.jpeg?20251210040102" />
        </fig>
        <p><bold>Figure 16.</bold> ReLU-SGD accuracy and loss.</p>
        <p><bold>Observation</bold></p>
        <p>Accuracy remains constant at 10%, which corresponds to random guessing in a 10-class classification task. Loss stays around 2.303 - 2.305, which is the initial entropy-based loss when predictions are uninformative. This indicates that the model has failed to learn. No gradient flow or weight updates have led to improved performance.</p>
      </sec>
      <sec id="sec5dot3">
        <title>5.3. Sigmoid Activation + Adam Optimizer</title>
        <p>5.3.1. Gradient Norm Ratio</p>
        <p>In this experiment, the earliest layers (1 - 2) have introduced ineffective learning, causing the model to fail to converge and underfit. As shown in <bold>Table 10</bold>, layers 2 and 4 are over-amplifying gradients. This causes weight explosions and loss divergence, a situation in training where the loss value increases uncontrollably instead of decreasing.</p>
        <p><bold>Table 10.</bold> Sigmoid-Adam average gradient norm ratio.</p>
        <table-wrap id="tbl10">
          <label>Table 10</label>
          <table>
            <tbody>
              <tr>
                <td>Epoch</td>
                <td>Layer 1</td>
                <td>Layer 2</td>
                <td>Layer 3</td>
                <td>Layer4</td>
                <td>Layer 5</td>
                <td>Layer6</td>
                <td>Layer 7</td>
                <td>Layer 8</td>
                <td>Layer 9</td>
                <td>Layer10</td>
                <td>Layer 11</td>
              </tr>
              <tr>
                <td>1</td>
                <td>0.004914894</td>
                <td>860.8627154</td>
                <td>0.197353164</td>
                <td>2,789,491,251,041.32</td>
                <td>1</td>
                <td>1.224744871</td>
                <td>1</td>
                <td>1.08012345</td>
                <td>1</td>
                <td>1.026436276</td>
                <td>1</td>
              </tr>
              <tr>
                <td>2</td>
                <td>0.025071687</td>
                <td>13.46757526</td>
                <td>0.157446181</td>
                <td>40,865,315,077.87</td>
                <td>1</td>
                <td>1.224744871</td>
                <td>1</td>
                <td>1.08012345</td>
                <td>1</td>
                <td>1.026436276</td>
                <td>1</td>
              </tr>
              <tr>
                <td>3</td>
                <td>0.027430868</td>
                <td>17.9886311</td>
                <td>0.145178895</td>
                <td>11,514,162,046.97</td>
                <td>1</td>
                <td>1.224744871</td>
                <td>1</td>
                <td>1.08012345</td>
                <td>1</td>
                <td>1.026436276</td>
                <td>1</td>
              </tr>
              <tr>
                <td>4</td>
                <td>0.027741735</td>
                <td>17.95290062</td>
                <td>0.150808395</td>
                <td>7,200,863,889.55</td>
                <td>1</td>
                <td>1.224744871</td>
                <td>1</td>
                <td>1.08012345</td>
                <td>1</td>
                <td>1.026436276</td>
                <td>1</td>
              </tr>
              <tr>
                <td>5</td>
                <td>0.027974071</td>
                <td>18.46727612</td>
                <td>0.157702335</td>
                <td>5,421,996,695.95</td>
                <td>1</td>
                <td>1.224744871</td>
                <td>1</td>
                <td>1.08012345</td>
                <td>1</td>
                <td>1.026436276</td>
                <td>1</td>
              </tr>
              <tr>
                <td>6</td>
                <td>0.028951381</td>
                <td>19.31739176</td>
                <td>0.167144921</td>
                <td>4,413,243,396.25</td>
                <td>1</td>
                <td>1.224744871</td>
                <td>1</td>
                <td>1.08012345</td>
                <td>1</td>
                <td>1.026436276</td>
                <td>1</td>
              </tr>
              <tr>
                <td>7</td>
                <td>0.03003981</td>
                <td>20.12576233</td>
                <td>0.178742639</td>
                <td>3,673,728,615.87</td>
                <td>1</td>
                <td>1.224744871</td>
                <td>1</td>
                <td>1.08012345</td>
                <td>1</td>
                <td>1.026436276</td>
                <td>1</td>
              </tr>
              <tr>
                <td>8</td>
                <td>0.03265061</td>
                <td>21.39081129</td>
                <td>0.196764134</td>
                <td>3,046,388,292.97</td>
                <td>1</td>
                <td>1.224744871</td>
                <td>1</td>
                <td>1.08012345</td>
                <td>1</td>
                <td>1.026436276</td>
                <td>1</td>
              </tr>
              <tr>
                <td>9</td>
                <td>0.032769058</td>
                <td>22.79576997</td>
                <td>0.208060335</td>
                <td>2,853,593,963.16</td>
                <td>1</td>
                <td>1.224744871</td>
                <td>1</td>
                <td>1.08012345</td>
                <td>1</td>
                <td>1.026436276</td>
                <td>1</td>
              </tr>
              <tr>
                <td>10</td>
                <td>0.032564155</td>
                <td>23.04775107</td>
                <td>0.211539078</td>
                <td>2,796,188,183.10</td>
                <td>1</td>
                <td>1.224744871</td>
                <td>1</td>
                <td>1.08012345</td>
                <td>1</td>
                <td>1.026436276</td>
                <td>1</td>
              </tr>
            </tbody>
          </table>
        </table-wrap>
        <p>The charts in <xref ref-type="fig" rid="fig17">Figure 17</xref> and <xref ref-type="fig" rid="fig18">Figure 18</xref> show the Gradient Norm Ratio per Epoch for all 11 layers of the deep neural network, with a red dashed line indicating the vanishing gradient threshold at 1e−3.</p>
        <fig id="fig17">
          <label>Figure 17</label>
          <graphic xlink:href="https://html.scirp.org/file/1733300-rId59.jpeg?20251210040104" />
        </fig>
        <p><bold>Figure 17.</bold> Sigmoid-Adam gradient norm ratio for layers 1 - 6.</p>
        <fig id="fig18">
          <label>Figure 18</label>
          <graphic xlink:href="https://html.scirp.org/file/1733300-rId60.jpeg?20251210040104" />
        </fig>
        <p><bold>Figure 18.</bold> Sigmoid-Adam gradient norm ratio for layers 7 - 11.</p>
        <p><bold>Observation:</bold></p>
        <p>Layer 1: Gradients start relatively well slightly above the vanishing gradient threshold (≈0.005) and remain above it. The gradient norm ratio is consistently &gt; 1e−3. Layer 2: Exploding gradients start very high (~860), then drop sharply and stabilize around still high values between 13 - 23. Layer 4: Severe exploding starts extremely high (2.79 trillion) and decreases gradually. It is still far above the threshold but exploding. Layers 5 - 11: Stable gradients all around ~1.0, a sign of healthy gradient flow.</p>
        <p>5.3.2. Accuracy</p>
        <p>In this pattern displayed in <xref ref-type="fig" rid="fig19">Figure 19</xref>, the model is partially learning, likely improving confidence on already correct predictions.</p>
        <fig id="fig19">
          <label>Figure 19</label>
          <graphic xlink:href="https://html.scirp.org/file/1733300-rId61.jpeg?20251210040105" />
        </fig>
        <p><bold>Figure 19.</bold> Sigmoid-Adam gradient norm ratio for Layers 7 - 11.</p>
        <p><bold>Observation:</bold></p>
        <p>Accuracy improves slightly from 0.100 - 0.199 by Epoch 2 and plateaus. Loss continuously decreases from 2.240 to 1.723, indicating that the model is optimizing the loss function but not achieving better classification results.</p>
      </sec>
      <sec id="sec5dot4">
        <title>5.4. Sigmoid Activation + SGD Optimizer</title>
        <p>5.4.1. Gradient Norm Ratio</p>
        <p>From the data presented in <bold>Table 11</bold>and <xref ref-type="fig" rid="fig20">Figure 20</xref>, we understand that in this architecture the backpropagation breaks down in the early layers (Layers 1\u20134). This impairs the ability of the network to learn useful low-level features.</p>
        <p><bold>Observation:</bold></p>
        <p>Stable Layers (Above the vanishing threshold): </p>
        <p>Layers 5 - 11 all maintain a gradient norm ratio of approximately 1.0 or slightly above. This means the gradient is consistently preserved across these layers, with no vanishing.</p>
        <p><bold>Table 11.</bold> Sigmoid-SGD average gradient norm ratio.</p>
        <table-wrap id="tbl11">
          <label>Table 11</label>
          <table>
            <tbody>
              <tr>
                <td>
                  <bold>Epoch</bold>
                </td>
                <td>
                  <bold>Layer1</bold>
                </td>
                <td>
                  <bold>Layer2</bold>
                </td>
                <td>
                  <bold>Layer3</bold>
                </td>
                <td>
                  <bold>Layer4</bold>
                </td>
                <td>
                  <bold>Layer5</bold>
                </td>
                <td>
                  <bold>Layer6</bold>
                </td>
                <td>
                  <bold>Layer7</bold>
                </td>
                <td>
                  <bold>Layer8</bold>
                </td>
                <td>
                  <bold>Layer9</bold>
                </td>
                <td>
                  <bold>Layer10</bold>
                </td>
                <td>
                  <bold>Layer11</bold>
                </td>
              </tr>
              <tr>
                <td>1</td>
                <td>infinity</td>
                <td>infinity</td>
                <td>infinity</td>
                <td>infinity</td>
                <td>1</td>
                <td>1.224744871</td>
                <td>1</td>
                <td>1.08012345</td>
                <td>1</td>
                <td>1.026436276</td>
                <td>1</td>
              </tr>
              <tr>
                <td>2</td>
                <td>infinity</td>
                <td>infinity</td>
                <td>infinity</td>
                <td>infinity</td>
                <td>1</td>
                <td>1.224744871</td>
                <td>1</td>
                <td>1.08012345</td>
                <td>1</td>
                <td>1.026436276</td>
                <td>1</td>
              </tr>
              <tr>
                <td>3</td>
                <td>infinity</td>
                <td>infinity</td>
                <td>infinity</td>
                <td>infinity</td>
                <td>1</td>
                <td>1.224744871</td>
                <td>1</td>
                <td>1.08012345</td>
                <td>1</td>
                <td>1.026436276</td>
                <td>1</td>
              </tr>
              <tr>
                <td>4</td>
                <td>infinity</td>
                <td>infinity</td>
                <td>infinity</td>
                <td>infinity</td>
                <td>1</td>
                <td>1.224744871</td>
                <td>1</td>
                <td>1.08012345</td>
                <td>1</td>
                <td>1.026436276</td>
                <td>1</td>
              </tr>
              <tr>
                <td>5</td>
                <td>infinity</td>
                <td>infinity</td>
                <td>infinity</td>
                <td>infinity</td>
                <td>1</td>
                <td>1.224744871</td>
                <td>1</td>
                <td>1.08012345</td>
                <td>1</td>
                <td>1.026436276</td>
                <td>1</td>
              </tr>
              <tr>
                <td>6</td>
                <td>infinity</td>
                <td>infinity</td>
                <td>infinity</td>
                <td>infinity</td>
                <td>1</td>
                <td>1.224744871</td>
                <td>1</td>
                <td>1.08012345</td>
                <td>1</td>
                <td>1.026436276</td>
                <td>1</td>
              </tr>
              <tr>
                <td>7</td>
                <td>infinity</td>
                <td>infinity</td>
                <td>infinity</td>
                <td>infinity</td>
                <td>1</td>
                <td>1.224744871</td>
                <td>1</td>
                <td>1.08012345</td>
                <td>1</td>
                <td>1.026436276</td>
                <td>1</td>
              </tr>
              <tr>
                <td>8</td>
                <td>infinity</td>
                <td>infinity</td>
                <td>infinity</td>
                <td>infinity</td>
                <td>1</td>
                <td>1.224744871</td>
                <td>1</td>
                <td>1.08012345</td>
                <td>1</td>
                <td>1.026436276</td>
                <td>1</td>
              </tr>
              <tr>
                <td>9</td>
                <td>infinity</td>
                <td>infinity</td>
                <td>infinity</td>
                <td>infinity</td>
                <td>1</td>
                <td>1.224744871</td>
                <td>1</td>
                <td>1.08012345</td>
                <td>1</td>
                <td>1.026436276</td>
                <td>1</td>
              </tr>
              <tr>
                <td>10</td>
                <td>infinity</td>
                <td>infinity</td>
                <td>infinity</td>
                <td>infinity</td>
                <td>1</td>
                <td>1.224744871</td>
                <td>1</td>
                <td>1.08012345</td>
                <td>1</td>
                <td>1.026436276</td>
                <td>1</td>
              </tr>
            </tbody>
          </table>
        </table-wrap>
        <fig id="fig20">
          <label>Figure 20</label>
          <graphic xlink:href="https://html.scirp.org/file/1733300-rId62.jpeg?20251210040109" />
        </fig>
        <p><bold>Figure 20.</bold> Sigmoid-SGD gradient norm.</p>
        <p>Vanishing Gradient (Replaced with 1e−6 for plotting): </p>
        <p>Layers 1 - 4 show a ratio of infinity in your dataset, indicating: The denominator (lower layer) had a zero-gradient norm These layers are receiving no gradient signal at all. This is a case of severe vanishing gradient. Layers are effectively disconnected from learning.</p>
        <p>5.4.2. Accuracy</p>
        <p>Based on <xref ref-type="fig" rid="fig21">Figure 21</xref>, the pattern in this experiment is characteristic of training failure due to vanishing gradients preventing signal propagation.</p>
        <fig id="fig21">
          <label>Figure 21</label>
          <graphic xlink:href="https://html.scirp.org/file/1733300-rId63.jpeg?20251210040110" />
        </fig>
        <p><bold>Figure 21.</bold> Sigmoid-SGD accuracy and loss<bold>.</bold></p>
        <p><bold>Observati</bold><bold>on:</bold></p>
        <p>Accuracy remains fixed at 10%, which is equivalent to random guessing in a 10-class classification task.Loss hovers around 2.303 - 2.304, matching the initial SoftMax cross-entropy loss when the model outputs uniform probabilities.</p>
      </sec>
    </sec>
    <sec id="sec6">
      <title>6. Findings</title>
      <p>This research investigated how different combinations of activation functions (ReLU, Sigmoid) and optimization techniques (Adam, Stochastic Gradient Descent [SGD]) influence the vanishing gradient problem in a 12-layer deep neural network. The evaluation was based on the gradient norm ratio between layers across 10 training epochs. </p>
      <p>The sections below provide a comparative interpretation of the empirical observations as well as delve into the underlying theoretical reasons for the observed differences. We will provide a more in-depth analysis connecting the findings to the mathematical properties of activation functions and optimizers under examination.</p>
      <sec id="sec6dot1">
        <title>6.1. ReLU + Adam</title>
        <p>This configuration showed the best overall gradient stability. Although mild vanishing was observed in hidden layer 9 (with gradient norm ratios around 0.0008), the earlier and deeper layers (Layers 1, 3, 5, 7, and 11) maintained stable ratios close to 1.0, indicating strong signal preservation during backpropagation. No signs of exploding gradients were detected in the input, hidden, and output layers, and the gradient values gradually stabilized over the epochs, causing the model to score 0.801 in accuracy. This makes ReLU + Adam the most effective combination in mitigating vanishing gradients while preserving training stability across the network.</p>
        <p>6.1.1. Mathematical Behavior of ReLU</p>
        <p>The Rectified Linear Unit (ReLU) activation function is defined as:</p>
        <disp-formula id="FD5">
          <label>(5)</label>
          <mml:math>
            <mml:mrow>
              <mml:mi>f</mml:mi>
              <mml:mrow>
                <mml:mo>(</mml:mo>
                <mml:mi>x</mml:mi>
                <mml:mo>)</mml:mo>
              </mml:mrow>
              <mml:mo>=</mml:mo>
              <mml:mtext>max</mml:mtext>
              <mml:mrow>
                <mml:mo>(</mml:mo>
                <mml:mrow>
                  <mml:mn>0</mml:mn>
                  <mml:mo>,</mml:mo>
                  <mml:mi>x</mml:mi>
                </mml:mrow>
                <mml:mo>)</mml:mo>
              </mml:mrow>
            </mml:mrow>
          </mml:math>
        </disp-formula>
        <p>And its derivative is:</p>
        <disp-formula id="FD6">
          <label>(6)</label>
          <mml:math>
            <mml:mrow>
              <mml:msup>
                <mml:mi>f</mml:mi>
                <mml:mo>′</mml:mo>
              </mml:msup>
              <mml:mrow>
                <mml:mo>(</mml:mo>
                <mml:mi>x</mml:mi>
                <mml:mo>)</mml:mo>
              </mml:mrow>
              <mml:mo>=</mml:mo>
              <mml:mrow>
                <mml:mo>{</mml:mo>
                <mml:mtable columnalign="left">
                  <mml:mtr>
                    <mml:mtd>
                      <mml:mn>1</mml:mn>
                      <mml:mo>,</mml:mo>
                      <mml:mtext>
                         
                      </mml:mtext>
                      <mml:mtext>
                         
                      </mml:mtext>
                      <mml:mtext>
                         
                      </mml:mtext>
                      <mml:mtext>
                         
                      </mml:mtext>
                      <mml:mtext>if</mml:mtext>
                      <mml:mtext>
                         
                      </mml:mtext>
                      <mml:mi>x</mml:mi>
                      <mml:mo>&gt;</mml:mo>
                      <mml:mn>0</mml:mn>
                    </mml:mtd>
                  </mml:mtr>
                  <mml:mtr>
                    <mml:mtd>
                      <mml:mn>0</mml:mn>
                      <mml:mo>,</mml:mo>
                      <mml:mtext>
                         
                      </mml:mtext>
                      <mml:mtext>
                         
                      </mml:mtext>
                      <mml:mtext>if</mml:mtext>
                      <mml:mtext>
                         
                      </mml:mtext>
                      <mml:mi>x</mml:mi>
                      <mml:mo>≤</mml:mo>
                      <mml:mn>0</mml:mn>
                    </mml:mtd>
                  </mml:mtr>
                </mml:mtable>
              </mml:mrow>
            </mml:mrow>
          </mml:math>
        </disp-formula>
        <p>This implies that, unlike the sigmoid function, whose derivative is bounded between 0 and 0.25 (and decays exponentially for large |<italic>x</italic>|), ReLU’s derivative is either 1 or 0. Thus, whenever a neuron in our architecture is active (<italic>x</italic> &gt; 0), the gradient passes through unchanged and no shrinking occurs. </p>
        <p>Mathematically, for a deep network with <italic>L</italic> layers (<italic>L</italic> = 12 in our case), the backpropagated gradient is approximately:</p>
        <disp-formula id="FD7">
          <label>(7)</label>
          <mml:math>
            <mml:mrow>
              <mml:mfrac>
                <mml:mrow>
                  <mml:mo>∂</mml:mo>
                  <mml:mi>ℒ</mml:mi>
                </mml:mrow>
                <mml:mrow>
                  <mml:mo>∂</mml:mo>
                  <mml:msub>
                    <mml:mi>w</mml:mi>
                    <mml:mi>l</mml:mi>
                  </mml:msub>
                </mml:mrow>
              </mml:mfrac>
              <mml:mo>≈</mml:mo>
              <mml:mstyle displaystyle="true">
                <mml:msubsup>
                  <mml:mo>∏</mml:mo>
                  <mml:mrow>
                    <mml:mi>i</mml:mi>
                    <mml:mo>=</mml:mo>
                    <mml:mi>l</mml:mi>
                  </mml:mrow>
                  <mml:mi>L</mml:mi>
                </mml:msubsup>
                <mml:mrow>
                  <mml:msup>
                    <mml:mi>f</mml:mi>
                    <mml:mo>′</mml:mo>
                  </mml:msup>
                  <mml:mrow>
                    <mml:mo>(</mml:mo>
                    <mml:mrow>
                      <mml:msub>
                        <mml:mi>z</mml:mi>
                        <mml:mi>i</mml:mi>
                      </mml:msub>
                    </mml:mrow>
                    <mml:mo>)</mml:mo>
                  </mml:mrow>
                  <mml:msub>
                    <mml:mi>w</mml:mi>
                    <mml:mi>i</mml:mi>
                  </mml:msub>
                </mml:mrow>
              </mml:mstyle>
            </mml:mrow>
          </mml:math>
        </disp-formula>
        <p>When <inline-formula><mml:math><mml:mrow><mml:msup><mml:mi> f </mml:mi><mml:mo> ′ </mml:mo></mml:msup><mml:mrow><mml:mo> ( </mml:mo><mml:mrow><mml:msub><mml:mi> z </mml:mi><mml:mi> i </mml:mi></mml:msub></mml:mrow><mml:mo> ) </mml:mo></mml:mrow><mml:mo> ≈ </mml:mo><mml:mn> 1 </mml:mn></mml:mrow></mml:math></inline-formula> for most layers (as with ReLU), the gradient magnitude stays stable.</p>
        <p>6.1.2. Adaptive Nature of the Adam Optimizer</p>
        <p>The Adam optimizer combines momentum and adaptive learning rate scaling. It maintains first and second moment estimates of the gradients:</p>
        <disp-formula id="FD8">
          <label>(8)</label>
          <mml:math>
            <mml:mrow>
              <mml:msub>
                <mml:mi>m</mml:mi>
                <mml:mi>t</mml:mi>
              </mml:msub>
              <mml:mo>=</mml:mo>
              <mml:msub>
                <mml:mi>β</mml:mi>
                <mml:mn>1</mml:mn>
              </mml:msub>
              <mml:msub>
                <mml:mi>m</mml:mi>
                <mml:mrow>
                  <mml:mi>t</mml:mi>
                  <mml:mo>−</mml:mo>
                  <mml:mn>1</mml:mn>
                </mml:mrow>
              </mml:msub>
              <mml:mo>+</mml:mo>
              <mml:mrow>
                <mml:mo>(</mml:mo>
                <mml:mrow>
                  <mml:mn>1</mml:mn>
                  <mml:mo>−</mml:mo>
                  <mml:msub>
                    <mml:mi>β</mml:mi>
                    <mml:mn>1</mml:mn>
                  </mml:msub>
                </mml:mrow>
                <mml:mo>)</mml:mo>
              </mml:mrow>
              <mml:msub>
                <mml:mi>g</mml:mi>
                <mml:mi>t</mml:mi>
              </mml:msub>
            </mml:mrow>
          </mml:math>
        </disp-formula>
        <p>And</p>
        <disp-formula id="FD9">
          <label>(9)</label>
          <mml:math>
            <mml:mrow>
              <mml:msub>
                <mml:mi>v</mml:mi>
                <mml:mi>t</mml:mi>
              </mml:msub>
              <mml:mo>=</mml:mo>
              <mml:msub>
                <mml:mi>β</mml:mi>
                <mml:mn>2</mml:mn>
              </mml:msub>
              <mml:msub>
                <mml:mi>v</mml:mi>
                <mml:mrow>
                  <mml:mi>t</mml:mi>
                  <mml:mo>−</mml:mo>
                  <mml:mn>1</mml:mn>
                </mml:mrow>
              </mml:msub>
              <mml:mo>+</mml:mo>
              <mml:mrow>
                <mml:mo>(</mml:mo>
                <mml:mrow>
                  <mml:mn>1</mml:mn>
                  <mml:mo>−</mml:mo>
                  <mml:msub>
                    <mml:mi>β</mml:mi>
                    <mml:mn>2</mml:mn>
                  </mml:msub>
                </mml:mrow>
                <mml:mo>)</mml:mo>
              </mml:mrow>
              <mml:msubsup>
                <mml:mi>g</mml:mi>
                <mml:mi>t</mml:mi>
                <mml:mn>2</mml:mn>
              </mml:msubsup>
            </mml:mrow>
          </mml:math>
        </disp-formula>
        <p>Then, it performs parameter updates as:</p>
        <disp-formula id="FD10">
          <label>(10)</label>
          <mml:math>
            <mml:mrow>
              <mml:msub>
                <mml:mi>θ</mml:mi>
                <mml:mrow>
                  <mml:mi>t</mml:mi>
                  <mml:mo>+</mml:mo>
                  <mml:mn>1</mml:mn>
                </mml:mrow>
              </mml:msub>
              <mml:mo>=</mml:mo>
              <mml:msub>
                <mml:mi>θ</mml:mi>
                <mml:mi>t</mml:mi>
              </mml:msub>
              <mml:mo>−</mml:mo>
              <mml:mi>η</mml:mi>
              <mml:mfrac>
                <mml:mrow>
                  <mml:msub>
                    <mml:mover accent="true">
                      <mml:mi>m</mml:mi>
                      <mml:mo>^</mml:mo>
                    </mml:mover>
                    <mml:mi>t</mml:mi>
                  </mml:msub>
                </mml:mrow>
                <mml:mrow>
                  <mml:msqrt>
                    <mml:mrow>
                      <mml:msub>
                        <mml:mover accent="true">
                          <mml:mi>v</mml:mi>
                          <mml:mo>^</mml:mo>
                        </mml:mover>
                        <mml:mi>t</mml:mi>
                      </mml:msub>
                    </mml:mrow>
                  </mml:msqrt>
                  <mml:mo>+</mml:mo>
                  <mml:mi>ϵ</mml:mi>
                </mml:mrow>
              </mml:mfrac>
            </mml:mrow>
          </mml:math>
        </disp-formula>
        <p>This implies that during our experiment, Adam was capable of automatically rescaling gradients based on their variance and therefore preventing: </p>
        <p>Exploding gradients from dominating updates (via <inline-formula><mml:math display="inline"><mml:mrow><mml:msqrt><mml:mrow><mml:msub><mml:mi> v </mml:mi><mml:mi> t </mml:mi></mml:msub></mml:mrow></mml:msqrt></mml:mrow></mml:math></inline-formula> ).</p>
        <p>Vanishing gradients are being neglected (via bias correction in <italic>m</italic><italic><sub>t</sub></italic> and <italic>v</italic><italic><sub>t</sub></italic>).</p>
        <p>As a result, even though some layers of our architecture such as hidden layer 9 experienced slight decay in gradient magnitude with gradient norm ratios dropping around 0.0008, Adam compensated adaptively to maintain consistent learning across layers. This explains why in our data ReLU-Adam yielded steady gradient norm ratios across epochs with layers 1, 3, 5, 7 and 11 maintaining stable ratios close to 1.0. </p>
        <p>Thus, ReLU + Adam performed better because ReLU ensured non-saturating gradients in any active neuron of our network and Adam adjusted learning rates dynamically per parameter. Combined, they preserved gradient magnitude and directionality across our 12 layers.</p>
        <p>As for the mathematical link to the Vanishing Gradient Threshold in our experiment, the vanishing threshold was defined as <inline-formula><mml:math><mml:mrow><mml:mrow><mml:mo> ‖ </mml:mo><mml:mo> ∇ </mml:mo><mml:mo> ‖ </mml:mo></mml:mrow><mml:mo> &lt; </mml:mo><mml:msup><mml:mrow><mml:mn> 10 </mml:mn></mml:mrow><mml:mrow><mml:mo> − </mml:mo><mml:mn> 3 </mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula> . For the ReLU-Adam combination, all layers stayed well above this threshold (10<sup>−2</sup> - 10<sup>0</sup> range), indicating healthy signal flow, causing ReLU-Adam to sit at the optimal balance point where gradient magnitudes neither vanish nor explode. </p>
        <p>The mathematical robustness of ReLU and the adaptive nature of Adam jointly form a gradient-stabilizing mechanism. They maintain training signal integrity across multiple layers, preventing both vanishing and exploding gradients - two sides of the same instability spectrum. Our experiment empirically confirms this theoretical expectation: only ReLU-Adam led to a convergent and accurate model, validating foundational deep learning theory (Glorot &amp; Bengio, 2010; Kingma &amp; Ba, 2015).</p>
      </sec>
      <sec id="sec6dot2">
        <title>6.2. ReLU + SGD</title>
        <p>The ReLU + SGD experiment experienced severe gradient pathologies. In the earliest layers, all gradient norm ratios were either ∞ or 0, indicating division by zero or complete gradient disappearance, a hallmark of the vanishing gradient problem. Simultaneously, several later layers (e.g., Layer 9 and 11) had exploding gradients, with values exceeding 32,000 and 13,000, respectively. This combination proved unstable, with no effective learning occurring in either shallow or deep parts of the network, amounting to a poor performance of 0.100 in accuracy.</p>
        <p>6.2.1. Behavior of ReLU with SGD Optimization</p>
        <p>In our experiment, the combination of ReLU + SGD resulted in gradient explosions and divergence, with gradient norm ratios reaching infinity after the first epoch. This can be mathematically understood through the interaction between the ReLU gradient and the SGD update rule:</p>
        <disp-formula id="FD11">
          <label>(11)</label>
          <mml:math>
            <mml:mrow>
              <mml:msub>
                <mml:mi>θ</mml:mi>
                <mml:mrow>
                  <mml:mi>t</mml:mi>
                  <mml:mo>+</mml:mo>
                  <mml:mn>1</mml:mn>
                </mml:mrow>
              </mml:msub>
              <mml:mo>=</mml:mo>
              <mml:msub>
                <mml:mi>θ</mml:mi>
                <mml:mi>t</mml:mi>
              </mml:msub>
              <mml:mo>−</mml:mo>
              <mml:mi>η</mml:mi>
              <mml:msub>
                <mml:mo>∇</mml:mo>
                <mml:mi>θ</mml:mi>
              </mml:msub>
              <mml:mi>L</mml:mi>
              <mml:mrow>
                <mml:mo>(</mml:mo>
                <mml:mrow>
                  <mml:msub>
                    <mml:mi>θ</mml:mi>
                    <mml:mi>t</mml:mi>
                  </mml:msub>
                </mml:mrow>
                <mml:mo>)</mml:mo>
              </mml:mrow>
            </mml:mrow>
          </mml:math>
        </disp-formula>
        <p>Here, <italic>η</italic> is the learning rate and <inline-formula><mml:math><mml:mrow><mml:msub><mml:mo> ∇ </mml:mo><mml:mi> θ </mml:mi></mml:msub><mml:mi> L </mml:mi><mml:mrow><mml:mo> ( </mml:mo><mml:mrow><mml:msub><mml:mi> θ </mml:mi><mml:mi> t </mml:mi></mml:msub></mml:mrow><mml:mo> ) </mml:mo></mml:mrow></mml:mrow></mml:math></inline-formula> is the gradient of the loss with respect to the model parameters.</p>
        <p>Without adaptive scaling (as in Adam), SGD applied the same global learning rate <italic>η</italic> to all parameters. Because the initial gradients in our experiment were large - which often happens with ReLU when activations are not normalized - the update <inline-formula><mml:math><mml:mrow><mml:mi> η </mml:mi><mml:msub><mml:mo> ∇ </mml:mo><mml:mi> θ </mml:mi></mml:msub><mml:mi> L </mml:mi></mml:mrow></mml:math></inline-formula> became excessively large, causing the weights to overshoot the minimum (from layer 5 we were already at 7.31 as an average gradient norm). This led to unstable updates, where successive gradients such as in layers 9 and 11 grew exponentially, reaching respectively an average of 32,368 and 13,472, resulting in loss divergence and infinite gradient norms. </p>
        <p>Moreover, because ReLU sets negative activations to zero, parts of our network received zero gradients more predominantly in layer 6, while other parts (especially those with large positive pre-activations) received large gradients. This imbalance exacerbated instability, leading to the exploding gradient phenomenon observed in our experimental dataset.</p>
        <p>6.2.2. Mathematical Indicators of Divergence</p>
        <p>The results in <bold>Table 12</bold> show heterogeneous gradient magnitudes across layers—some vanish while others explode—a strong signature of gradient instability. This instability prevented SGD from converging, as evidenced by the consistently infinite gradient norms in later epochs and the stagnant accuracy (0.1) observed in our model.</p>
        <p><bold>Table 12.</bold> ReLU-SGD mathematical divergence.</p>
        <table-wrap id="tbl12">
          <label>Table 12</label>
          <table>
            <tbody>
              <tr>
                <td>
                  <bold>Layer</bold>
                </td>
                <td>
                  <bold>Layer1</bold>
                </td>
                <td>
                  <bold>Layer2</bold>
                </td>
              </tr>
              <tr>
                <td>Layer_5</td>
                <td>7.31</td>
                <td>Exploding gradient zone</td>
              </tr>
              <tr>
                <td>Layer_6</td>
                <td>0</td>
                <td>Dead neurons (no gradient flow)</td>
              </tr>
              <tr>
                <td>Layer_8</td>
                <td>0.00078</td>
                <td>Near vanishing threshold</td>
              </tr>
              <tr>
                <td>Layer_9</td>
                <td>32,368</td>
                <td>Severe gradient explosion</td>
              </tr>
              <tr>
                <td>Layer_10</td>
                <td>0.1276</td>
                <td>Mild damping</td>
              </tr>
              <tr>
                <td>Layer_11</td>
                <td>13,472</td>
                <td>Extreme explosion</td>
              </tr>
            </tbody>
          </table>
        </table-wrap>
        <p>ReLU + SGD is prone to exploding gradients due to unbounded activations and a lack of adaptive gradient control. Vanishing gradients also occur simultaneously in “dead” ReLU neurons, where <inline-formula><mml:math display="inline"><mml:mrow><mml:msup><mml:mi> f </mml:mi><mml:mo> ′ </mml:mo></mml:msup><mml:mrow><mml:mo> ( </mml:mo><mml:mi> x </mml:mi><mml:mo> ) </mml:mo></mml:mrow><mml:mo> = </mml:mo><mml:mn> 0 </mml:mn></mml:mrow></mml:math></inline-formula> . This instability of ReLU + SGD highlights the mathematical necessity of either careful weight initialization (e.g., He initialization) or adaptive optimization algorithms for deep networks like the one we used for this experiment.</p>
      </sec>
      <sec id="sec6dot3">
        <title>6.3. Sigmoid + Adam</title>
        <p>While Sigmoid + Adam provided stable gradient norm ratios in deeper layers, it struggled in early layers. Layers 1 and 2 exhibited very small gradient norm ratios (~0.02 - 0.03), approaching the vanishing gradient threshold, and Layer 4 had exploding values reaching over 2.7 trillion, leading to a poor accuracy of 0.199. This shows that even with an adaptive optimizer like Adam, the Sigmoid activation’s saturation in deep networks remains a major issue. Nevertheless, the stability in later layers suggests that some backpropagation was preserved.</p>
        <p>6.3.1. Mathematical Behavior of Sigmoid</p>
        <p>The Sigmoid function is defined as:</p>
        <disp-formula id="FD12">
          <label>(12)</label>
          <mml:math>
            <mml:mrow>
              <mml:mi>σ</mml:mi>
              <mml:mrow>
                <mml:mo>(</mml:mo>
                <mml:mi>x</mml:mi>
                <mml:mo>)</mml:mo>
              </mml:mrow>
              <mml:mo>=</mml:mo>
              <mml:mfrac>
                <mml:mn>1</mml:mn>
                <mml:mrow>
                  <mml:mn>1</mml:mn>
                  <mml:mo>+</mml:mo>
                  <mml:msup>
                    <mml:mtext>e</mml:mtext>
                    <mml:mrow>
                      <mml:mo>−</mml:mo>
                      <mml:mi>x</mml:mi>
                    </mml:mrow>
                  </mml:msup>
                </mml:mrow>
              </mml:mfrac>
            </mml:mrow>
          </mml:math>
        </disp-formula>
        <p>Its derivative is:</p>
        <disp-formula id="FD13">
          <label>(13)</label>
          <mml:math>
            <mml:mrow>
              <mml:msup>
                <mml:mi>σ</mml:mi>
                <mml:mo>′</mml:mo>
              </mml:msup>
              <mml:mrow>
                <mml:mo>(</mml:mo>
                <mml:mi>x</mml:mi>
                <mml:mo>)</mml:mo>
              </mml:mrow>
              <mml:mo>=</mml:mo>
              <mml:mi>σ</mml:mi>
              <mml:mrow>
                <mml:mo>(</mml:mo>
                <mml:mi>x</mml:mi>
                <mml:mo>)</mml:mo>
              </mml:mrow>
              <mml:mrow>
                <mml:mo>(</mml:mo>
                <mml:mrow>
                  <mml:mn>1</mml:mn>
                  <mml:mo>−</mml:mo>
                  <mml:mi>σ</mml:mi>
                  <mml:mrow>
                    <mml:mo>(</mml:mo>
                    <mml:mi>x</mml:mi>
                    <mml:mo>)</mml:mo>
                  </mml:mrow>
                </mml:mrow>
                <mml:mo>)</mml:mo>
              </mml:mrow>
            </mml:mrow>
          </mml:math>
        </disp-formula>
        <p>This derivative reaches a maximum of 0.25 at <italic>x</italic> = 0 and quickly approaches zero as the absolute value |<italic>x</italic>| increases. In the context of our 12-layer deep neural network used for the experiment, this means that during backpropagation, the chain rule multiplies many small derivatives together:</p>
        <disp-formula id="FD14">
          <label>(14)</label>
          <mml:math>
            <mml:mrow>
              <mml:mfrac>
                <mml:mrow>
                  <mml:mo>∂</mml:mo>
                  <mml:mi>ℒ</mml:mi>
                </mml:mrow>
                <mml:mrow>
                  <mml:mo>∂</mml:mo>
                  <mml:msub>
                    <mml:mi>w</mml:mi>
                    <mml:mi>l</mml:mi>
                  </mml:msub>
                </mml:mrow>
              </mml:mfrac>
              <mml:mo>=</mml:mo>
              <mml:mfrac>
                <mml:mrow>
                  <mml:mo>∂</mml:mo>
                  <mml:mi>ℒ</mml:mi>
                </mml:mrow>
                <mml:mrow>
                  <mml:mo>∂</mml:mo>
                  <mml:msub>
                    <mml:mi>a</mml:mi>
                    <mml:mi>n</mml:mi>
                  </mml:msub>
                </mml:mrow>
              </mml:mfrac>
              <mml:mstyle displaystyle="true">
                <mml:msubsup>
                  <mml:mo>∏</mml:mo>
                  <mml:mrow>
                    <mml:mi>k</mml:mi>
                    <mml:mo>=</mml:mo>
                    <mml:mi>l</mml:mi>
                  </mml:mrow>
                  <mml:mi>n</mml:mi>
                </mml:msubsup>
                <mml:mrow>
                  <mml:msup>
                    <mml:mi>σ</mml:mi>
                    <mml:mo>′</mml:mo>
                  </mml:msup>
                  <mml:mrow>
                    <mml:mo>(</mml:mo>
                    <mml:mrow>
                      <mml:msub>
                        <mml:mi>z</mml:mi>
                        <mml:mi>k</mml:mi>
                      </mml:msub>
                    </mml:mrow>
                    <mml:mo>)</mml:mo>
                  </mml:mrow>
                </mml:mrow>
              </mml:mstyle>
            </mml:mrow>
          </mml:math>
        </disp-formula>
        <p>In our network, because <inline-formula><mml:math><mml:mrow><mml:msup><mml:mi> σ </mml:mi><mml:mo> ′ </mml:mo></mml:msup><mml:mrow><mml:mo> ( </mml:mo><mml:mrow><mml:msub><mml:mi> z </mml:mi><mml:mi> k </mml:mi></mml:msub></mml:mrow><mml:mo> ) </mml:mo></mml:mrow><mml:mo> &lt; </mml:mo><mml:mn> 1 </mml:mn></mml:mrow></mml:math></inline-formula> , these products exponentially shrank and induced the vanishing gradient problem, causing earlier layers in the network, respectively layers 1 and 2, to effectively stop learning. This can be perceived in how these two early layers exhibited very small average gradient norm ratios (~0.02 - 0.03), thus leading to stagnation in both accuracy and loss after a few epochs, as reflected in our dataset where, for example, layer 4 had exploding gradient values reaching an average of over 2.7 trillion, leading to a poor accuracy of 0.199.</p>
        <p>6.3.2. Role of the Adam Optimizer</p>
        <p>The Adam optimizer (Adaptive Moment Estimation) modifies standard gradient descent by adapting the learning rate for each parameter:</p>
        <disp-formula id="FD15">
          <label>(15)</label>
          <mml:math>
            <mml:mrow>
              <mml:msub>
                <mml:mi>m</mml:mi>
                <mml:mi>t</mml:mi>
              </mml:msub>
              <mml:mo>=</mml:mo>
              <mml:msub>
                <mml:mi>β</mml:mi>
                <mml:mn>1</mml:mn>
              </mml:msub>
              <mml:msub>
                <mml:mi>m</mml:mi>
                <mml:mrow>
                  <mml:mi>t</mml:mi>
                  <mml:mo>−</mml:mo>
                  <mml:mn>1</mml:mn>
                </mml:mrow>
              </mml:msub>
              <mml:mo>+</mml:mo>
              <mml:mrow>
                <mml:mo>(</mml:mo>
                <mml:mrow>
                  <mml:mn>1</mml:mn>
                  <mml:mo>−</mml:mo>
                  <mml:msub>
                    <mml:mi>β</mml:mi>
                    <mml:mn>1</mml:mn>
                  </mml:msub>
                </mml:mrow>
                <mml:mo>)</mml:mo>
              </mml:mrow>
              <mml:msub>
                <mml:mi>g</mml:mi>
                <mml:mi>t</mml:mi>
              </mml:msub>
            </mml:mrow>
          </mml:math>
        </disp-formula>
        <p>And</p>
        <disp-formula id="FD16">
          <label>(16)</label>
          <mml:math>
            <mml:mrow>
              <mml:msub>
                <mml:mi>v</mml:mi>
                <mml:mi>t</mml:mi>
              </mml:msub>
              <mml:mo>=</mml:mo>
              <mml:msub>
                <mml:mi>β</mml:mi>
                <mml:mn>2</mml:mn>
              </mml:msub>
              <mml:msub>
                <mml:mi>v</mml:mi>
                <mml:mrow>
                  <mml:mi>t</mml:mi>
                  <mml:mo>−</mml:mo>
                  <mml:mn>1</mml:mn>
                </mml:mrow>
              </mml:msub>
              <mml:mo>+</mml:mo>
              <mml:mrow>
                <mml:mo>(</mml:mo>
                <mml:mrow>
                  <mml:mn>1</mml:mn>
                  <mml:mo>−</mml:mo>
                  <mml:msub>
                    <mml:mi>β</mml:mi>
                    <mml:mn>2</mml:mn>
                  </mml:msub>
                </mml:mrow>
                <mml:mo>)</mml:mo>
              </mml:mrow>
              <mml:msubsup>
                <mml:mi>g</mml:mi>
                <mml:mi>t</mml:mi>
                <mml:mn>2</mml:mn>
              </mml:msubsup>
            </mml:mrow>
          </mml:math>
        </disp-formula>
        <p>In our network, <inline-formula><mml:math><mml:mrow><mml:msub><mml:mi> m </mml:mi><mml:mi> t </mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> and <inline-formula><mml:math><mml:mrow><mml:msub><mml:mi> v </mml:mi><mml:mi> t </mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> track the first and second moments of the gradient, stabilizing updates by scaling the learning rate inversely with the estimated gradient variance. </p>
        <p>This helped mitigate (but not eliminate) vanishing gradients by ensuring that even small gradients are rescaled to maintain a minimal learning signal. In our experiment, this explains why accuracy rises modestly (to around 0.199) and the loss decreases gradually from 2.24 to 1.723. This is a hallmark of slow convergence with partial vanishing rather than complete failure. The Adam optimizer preserved learning momentum despite the Sigmoid’s saturation effect. </p>
        <p>Mathematically, the Sigmoid’s limited derivative range creates a narrow gradient propagation window, while Adam’s adaptive scaling partially compensates for this. The result is nonlinear convergence. Progress is visible but plateaus quickly, confirming that Adam’s moment-based correction improves stability but cannot fully overcome Sigmoid’s intrinsic vanishing tendency.</p>
      </sec>
      <sec id="sec6dot4">
        <title>6.4. Sigmoid + SGD</title>
        <p>This configuration suffered from complete vanishing gradients in Layers 1 through 4. All values were marked as infinity, a common artifact of division by zero when upstream gradients disappear entirely, resulting in a poor accuracy of 0.100 as shown in <xref ref-type="fig" rid="fig22">Figure 22</xref> and <xref ref-type="fig" rid="fig23">Figure 23</xref>. However, learnable layers between 5 - 11 showed constant, unchanging gradient norm ratios (exactly 1.0), suggesting numerical stability there. Nonetheless, the failure to propagate learning signals through the earlier layers renders this configuration unsuitable for deep networks.</p>
        <fig id="fig22">
          <label>Figure 22</label>
          <graphic xlink:href="https://html.scirp.org/file/1733300-rId106.jpeg?20251210040125" />
        </fig>
        <p><bold>Figure 22.</bold> Model accuracy by experiment<bold>.</bold></p>
        <fig id="fig23">
          <label>Figure 23</label>
          <graphic xlink:href="https://html.scirp.org/file/1733300-rId107.jpeg?20251210040124" />
        </fig>
        <p><bold>Figure 23.</bold> Model loss by experiment<bold>.</bold></p>
        <p>6.4.1. Sigmoid Activation Function: Mathematical Behavior and Gradient Attenuation</p>
        <p>The derivative of a Sigmoid has a maximum value of 0.25, achieved when <italic>σ</italic>(<italic>x</italic>) = 0.5, and it rapidly approaches zero when <italic>x</italic> is far from zero (<italic>i.e</italic>., when the neuron is strongly activated or deactivated). This leads to two major mathematical consequences in our 12-layer deep neural network.</p>
        <p><bold>1. Gradient Shrinkage Across Layers</bold></p>
        <p>In our 12-layer deep network, the total backpropagated gradient at layer <italic>l</italic> is approximately proportional to the product of derivatives across subsequent layers:</p>
        <disp-formula id="FD17">
          <label>(17)</label>
          <mml:math>
            <mml:mrow>
              <mml:mfrac>
                <mml:mrow>
                  <mml:mo>∂</mml:mo>
                  <mml:mi>ℒ</mml:mi>
                </mml:mrow>
                <mml:mrow>
                  <mml:mo>∂</mml:mo>
                  <mml:msub>
                    <mml:mi>w</mml:mi>
                    <mml:mi>l</mml:mi>
                  </mml:msub>
                </mml:mrow>
              </mml:mfrac>
              <mml:mo>∝</mml:mo>
              <mml:mfrac>
                <mml:mrow>
                  <mml:mo>∂</mml:mo>
                  <mml:mi>ℒ</mml:mi>
                </mml:mrow>
                <mml:mrow>
                  <mml:mo>∂</mml:mo>
                  <mml:msub>
                    <mml:mi>a</mml:mi>
                    <mml:mi>n</mml:mi>
                  </mml:msub>
                </mml:mrow>
              </mml:mfrac>
              <mml:mstyle displaystyle="true">
                <mml:msubsup>
                  <mml:mo>∏</mml:mo>
                  <mml:mrow>
                    <mml:mi>i</mml:mi>
                    <mml:mo>=</mml:mo>
                    <mml:mi>l</mml:mi>
                  </mml:mrow>
                  <mml:mi>n</mml:mi>
                </mml:msubsup>
                <mml:mrow>
                  <mml:msup>
                    <mml:mi>σ</mml:mi>
                    <mml:mo>′</mml:mo>
                  </mml:msup>
                  <mml:mrow>
                    <mml:mo>(</mml:mo>
                    <mml:mrow>
                      <mml:msub>
                        <mml:mi>z</mml:mi>
                        <mml:mi>i</mml:mi>
                      </mml:msub>
                    </mml:mrow>
                    <mml:mo>)</mml:mo>
                  </mml:mrow>
                </mml:mrow>
              </mml:mstyle>
            </mml:mrow>
          </mml:math>
        </disp-formula>
        <p>Since <inline-formula><mml:math><mml:mrow><mml:msup><mml:mi> σ </mml:mi><mml:mo> ′ </mml:mo></mml:msup><mml:mrow><mml:mo> ( </mml:mo><mml:mrow><mml:msub><mml:mi> z </mml:mi><mml:mi> i </mml:mi></mml:msub></mml:mrow><mml:mo> ) </mml:mo></mml:mrow><mml:mo> ≤ </mml:mo><mml:mn> 0.25 </mml:mn></mml:mrow></mml:math></inline-formula> , this product rapidly tends toward zero as the depth <italic>n</italic> increases (from 1 to 12). This means the gradient magnitude at early layers can approach machine-level precision limits, causing training stagnation (vanishing gradient problem).</p>
        <p><bold>2. Saturation Effects</bold></p>
        <p>During the learning process, at any epoch when the inputs to the Sigmoid function were large (positive or negative), the output saturated near 1 or 0, and <inline-formula><mml:math><mml:mrow><mml:msup><mml:mi> σ </mml:mi><mml:mo> ′ </mml:mo></mml:msup><mml:mrow><mml:mo> ( </mml:mo><mml:mi> x </mml:mi><mml:mo> ) </mml:mo></mml:mrow></mml:mrow></mml:math></inline-formula> became extremely small. This effectively killed the gradient in those neurons, preventing meaningful weight updates.</p>
        <p>6.4.2. Stochastic Gradient Descent (SGD): Lack of Adaptive Scaling</p>
        <p>SGD updated the parameters in our network according to:</p>
        <disp-formula id="FD18">
          <label>(18)</label>
          <mml:math>
            <mml:mrow>
              <mml:msub>
                <mml:mi>θ</mml:mi>
                <mml:mrow>
                  <mml:mi>t</mml:mi>
                  <mml:mo>+</mml:mo>
                  <mml:mn>1</mml:mn>
                </mml:mrow>
              </mml:msub>
              <mml:mo>=</mml:mo>
              <mml:msub>
                <mml:mi>θ</mml:mi>
                <mml:mi>t</mml:mi>
              </mml:msub>
              <mml:mo>−</mml:mo>
              <mml:mi>η</mml:mi>
              <mml:msub>
                <mml:mo>∇</mml:mo>
                <mml:mi>θ</mml:mi>
              </mml:msub>
              <mml:mi>L</mml:mi>
              <mml:mrow>
                <mml:mo>(</mml:mo>
                <mml:mrow>
                  <mml:msub>
                    <mml:mi>θ</mml:mi>
                    <mml:mi>t</mml:mi>
                  </mml:msub>
                </mml:mrow>
                <mml:mo>)</mml:mo>
              </mml:mrow>
            </mml:mrow>
          </mml:math>
        </disp-formula>
        <p>where <italic>η</italic> is the learning rate, and <inline-formula><mml:math><mml:mrow><mml:msub><mml:mo> ∇ </mml:mo><mml:mi> θ </mml:mi></mml:msub><mml:mi> L </mml:mi><mml:mrow><mml:mo> ( </mml:mo><mml:mrow><mml:msub><mml:mi> θ </mml:mi><mml:mi> t </mml:mi></mml:msub></mml:mrow><mml:mo> ) </mml:mo></mml:mrow></mml:mrow></mml:math></inline-formula> is the gradient of the loss. </p>
        <p>In our case of the Sigmoid activation:</p>
        <p>The gradients were already small due to the derivative’s bounded nature.</p>
        <p>SGD applied a fixed learning rate to these small gradients.</p>
        <p>Without adaptive scaling (unlike Adam), the effective weight update becomes negligible, especially in earlier layers such as layers 1 through 4 where the average gradient is 0.</p>
        <p>This means that even when the loss decreased marginally in later layers, the initial layers remained frozen, leading to poor representational learning and a plateau in accuracy, as seen in our experimental data where accuracy stagnates around 0.1 (random chance) while the loss remains high (≈2.303).</p>
        <p>6.4.3. The Combined Effect: Severe Vanishing Gradient</p>
        <p>As we combined Sigmoid activation with SGD, the multiplicative attenuation from Sigmoid derivatives and the non-adaptive update rule of SGD interacted to create the worst-case scenario for our deep learning optimization: </p>
        <p>Early layers from layer 1 to 4 received zero or near-zero gradient signals. Weight updates approached zero, halting learning in the lower network. The model became biased toward the initial weights, unable to extract hierarchical features. </p>
        <p>This explains why our experiment showed: </p>
        <p>Constant accuracy (0.1) across epochs, No meaningful loss reduction occurred after initialization, Stable but ineffective gradient propagation, consistent with total vanishing. </p>
        <p>Sigmoid’s derivative structure inherently causes gradients to diminish exponentially in deep networks. SGD’s fixed learning rate cannot recover lost gradient signal strength. Together, they form a mathematically unstable pairing for deep architectures (12 layers or more). This validates our experimental results as the network fails to learn beyond random performance due to vanishing gradients propagating through the Sigmoid layers.</p>
      </sec>
      <sec id="sec6dot5">
        <title>6.5. Summary</title>
        <p>Across all combinations, ReLU with Adam was the most effective in minimizing vanishing gradients, showing steady gradient norm ratios without numerical instability. In contrast, SGD, when combined with either activation function, resulted in significant vanishing or exploding gradients. This highlights the importance of activation-optimizer synergy in deep network design and reinforces the preference for ReLU and adaptive optimizers like Adam in deep learning applications.</p>
      </sec>
    </sec>
    <sec id="sec7">
      <title>7. Conclusions</title>
      <p>This study examined the impact of activation functions (ReLU and Sigmoid) and optimization techniques (Adam and Stochastic Gradient Descent [SGD]) on the vanishing gradient problem within a 12-layer deep neural network architecture. By analyzing gradient norm ratios across training epochs and layers, the research aimed to uncover which combinations best preserve gradient flow and support effective learning in deep models. </p>
      <p>The experiments revealed substantial differences in gradient behavior depending on the chosen activation–optimizer pair. Notably, the combination of ReLU activation with Adam optimization exhibited the most favorable outcomes. It consistently maintained stable gradient norm ratios in the deeper layers (Layers 5 - 11) and minimized vanishing gradients in the early layers. This pairing proved resilient across all epochs, with no evidence of exploding gradients, highlighting its reliability in deep learning applications. </p>
      <p>In contrast, ReLU + SGD suffered from extreme instability, showing both complete vanishing and exploding gradients. Layers 1 - 4 experienced gradient norm ratios of 0 or infinity, implying a total breakdown in signal propagation during backpropagation. Exploding gradients in the deeper layers further destabilized learning, making this combination unsuitable for deep networks. </p>
      <p>The use of the Sigmoid activation function, regardless of optimizer, consistently led to vanishing gradients in early layers. Even when paired with Adam, which offered some adaptive gradient control, Sigmoid resulted in highly unstable gradients, especially in Layer 4, which reached explosive values in the trillions. While gradient stability was maintained in deeper layers, the inability of Sigmoid to effectively propagate gradients through shallow layers remains a critical limitation. </p>
      <p>Overall, the findings confirm that both activation choice and optimizer selection significantly affect the gradient flow in deep networks. The ReLU + Adam combination offers the best protection against vanishing gradients and ensures robust training dynamics. Conversely, SGD and Sigmoid, especially when used together, amplify the risk of vanishing or exploding gradients, impeding learning in deep architectures.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <title>References</title>
      <ref id="B1">
        <label>1.</label>
        <citation-alternatives>
          <mixed-citation publication-type="web">Pedamonti, D. (2018) Comparison of Non-Linear Activation Functions for Deep Neural Networks on MNIST Classification Task. arXiv. https://arxiv.org/abs/1804.02763</mixed-citation>
          <element-citation publication-type="web">
            <person-group person-group-type="author">
              <string-name>Pedamonti, D.</string-name>
            </person-group>
            <year>2018</year>
            <article-title>Comparison of Non-Linear Activation Functions for Deep Neural Networks on MNIST Classification Task</article-title>
          </element-citation>
        </citation-alternatives>
      </ref>
      <ref id="B2">
        <label>2.</label>
        <citation-alternatives>
          <mixed-citation publication-type="confproc">Glorot, X. and Bengio, Y. (2010) Understanding the Difficulty of Training Deep Feed Forward Neural Networks. <italic>Proceedings of the</italic>13 <italic>th International Conference on Artificial Intelligence and Statistics</italic>, 9, 249-256. http://proceedings.mlr.press/v9/glorot10a.html</mixed-citation>
          <element-citation publication-type="confproc">
            <person-group person-group-type="author">
              <string-name>Glorot, X.</string-name>
              <string-name>Bengio, Y.</string-name>
            </person-group>
            <year>2010</year>
            <article-title>Understanding the Difficulty of Training Deep Feed Forward Neural Networks</article-title>
            <source>Proceedings of the 13th International Conference on Artificial Intelligence and Statistics</source>
            <volume>9</volume>
          </element-citation>
        </citation-alternatives>
      </ref>
      <ref id="B3">
        <label>3.</label>
        <citation-alternatives>
          <mixed-citation publication-type="journal">Ramachandran, P., Zoph, B. and Le, Q.V. (2017) Swish: A Self-Gated Activation Function for Deep Neural Networks. arXiv:1710.05941. https://arxiv.org/abs/1710.05941</mixed-citation>
          <element-citation publication-type="journal">
            <person-group person-group-type="author">
              <string-name>Ramachandran, P.</string-name>
              <string-name>Zoph, B.</string-name>
              <string-name>Le, Q.V.</string-name>
            </person-group>
            <year>2017</year>
            <article-title>Swish: A Self-Gated Activation Function for Deep Neural Networks</article-title>
            <fpage>1710</fpage>
          </element-citation>
        </citation-alternatives>
      </ref>
      <ref id="B4">
        <label>4.</label>
        <citation-alternatives>
          <mixed-citation publication-type="journal">Xu, B., Wang, N., Chen, T. and Li, M. (2015) Empirical Evaluation of Rectified Activations in Convolutional Network. <italic>arXiv:1505.00853</italic><italic>.</italic> https://arxiv.org/abs/1505.00853</mixed-citation>
          <element-citation publication-type="journal">
            <person-group person-group-type="author">
              <string-name>Xu, B.</string-name>
              <string-name>Wang, N.</string-name>
              <string-name>Chen, T.</string-name>
              <string-name>Li, M.</string-name>
            </person-group>
            <year>2015</year>
            <article-title>Empirical Evaluation of Rectified Activations in Convolutional Network</article-title>
            <fpage>1505</fpage>
          </element-citation>
        </citation-alternatives>
      </ref>
      <ref id="B5">
        <label>5.</label>
        <citation-alternatives>
          <mixed-citation publication-type="other">Bengio, Y., Simard, P. and Frasconi, P. (1994) Learning Long-Term Dependencies with Gradient Descent Is Difficult. <italic>IEEE Transactions on Neural Networks</italic>, 5, 157-166. https://doi.org/10.1109/72.279181 <pub-id pub-id-type="doi">10.1109/72.279181</pub-id><pub-id pub-id-type="pmid">18267787</pub-id><ext-link ext-link-type="uri" xlink:href="https://doi.org/10.1109/72.279181">https://doi.org/10.1109/72.279181</ext-link></mixed-citation>
          <element-citation publication-type="other">
            <person-group person-group-type="author">
              <string-name>Bengio, Y.</string-name>
              <string-name>Simard, P.</string-name>
              <string-name>Frasconi, P.</string-name>
            </person-group>
            <year>1994</year>
            <article-title>Learning Long-Term Dependencies with Gradient Descent Is Difficult</article-title>
            <source>IEEE Transactions on Neural Networks</source>
            <volume>5</volume>
            <pub-id pub-id-type="doi">10.1109/72.279181</pub-id>
            <pub-id pub-id-type="pmid">18267787</pub-id>
          </element-citation>
        </citation-alternatives>
      </ref>
      <ref id="B6">
        <label>6.</label>
        <citation-alternatives>
          <mixed-citation publication-type="confproc">Glorot, X., Bordes, A. and Bengio, Y. (2011) Deep Sparse Rectifier Neural Networks. In: Gordon, G., Dunson, D. and Dudík, M., Eds., <italic>Proceedings of the Fourteenth International Conference o</italic><italic>n Artificial Intelligence and Statistics</italic>( <italic>AISTATS</italic>), Fort Lauderdale, 11-13 April 2011, 315-323. https://proceedings.mlr.press/v15/glorot11a.html</mixed-citation>
          <element-citation publication-type="confproc">
            <person-group person-group-type="author">
              <string-name>Glorot, X.</string-name>
              <string-name>Bordes, A.</string-name>
              <string-name>Bengio, Y.</string-name>
              <string-name>Gordon, G.</string-name>
              <string-name>Dunson, D.</string-name>
            </person-group>
            <year>2011</year>
            <article-title>Deep Sparse Rectifier Neural Networks</article-title>
            <source>In: Gordon</source>
            <volume>11</volume>
          </element-citation>
        </citation-alternatives>
      </ref>
      <ref id="B7">
        <label>7.</label>
        <citation-alternatives>
          <mixed-citation publication-type="confproc">Kingma, D.P. and Ba, J. (2015) Adam: A Method for Stochastic Optimization. <italic>International Conference on Learning Representations</italic>( <italic>ICLR</italic>). arXiv:1412.6980. https://arxiv.org/abs/1412.6980</mixed-citation>
          <element-citation publication-type="confproc">
            <person-group person-group-type="author">
              <string-name>Kingma, D.P.</string-name>
              <string-name>Ba, J.</string-name>
            </person-group>
            <year>2015</year>
            <article-title>Adam: A Method for Stochastic Optimization</article-title>
            <fpage>1412</fpage>
          </element-citation>
        </citation-alternatives>
      </ref>
      <ref id="B8">
        <label>8.</label>
        <citation-alternatives>
          <mixed-citation publication-type="journal">Mostafanejad, M. (2023) Unification of Popular Artificial Neural Network Activation Functions. arXiv:2302.11007.</mixed-citation>
          <element-citation publication-type="journal">
            <person-group person-group-type="author">
              <string-name>Mostafanejad, M.</string-name>
            </person-group>
            <year>2023</year>
            <article-title>Unification of Popular Artificial Neural Network Activation Functions</article-title>
            <fpage>2302</fpage>
          </element-citation>
        </citation-alternatives>
      </ref>
      <ref id="B9">
        <label>9.</label>
        <citation-alternatives>
          <mixed-citation publication-type="web">Pennington, J., Schoenholz, S.S. and Ganguli, S. (2017) Resurrecting the Sigmoid in Deep Learning Through Dynamical Isometry: Theory and Practice. <italic>Advances in Neural Information Processing Systems</italic>, 30, 4785-4795. https://arxiv.org/abs/1711.04735</mixed-citation>
          <element-citation publication-type="web">
            <person-group person-group-type="author">
              <string-name>Pennington, J.</string-name>
              <string-name>Schoenholz, S.S.</string-name>
              <string-name>Ganguli, S.</string-name>
            </person-group>
            <year>2017</year>
            <article-title>Resurrecting the Sigmoid in Deep Learning Through Dynamical Isometry: Theory and Practice</article-title>
            <source>Advances in Neural Information Processing Systems</source>
            <volume>30</volume>
          </element-citation>
        </citation-alternatives>
      </ref>
      <ref id="B10">
        <label>10.</label>
        <citation-alternatives>
          <mixed-citation publication-type="other">Szandała, L. (2021) Review and Comparison of Commonly Used Activation Functions for Deep Neural Networks. <italic>Bio</italic>- <italic>Algorithms and Med</italic>- <italic>Systems</italic>, 17, 1-12.</mixed-citation>
          <element-citation publication-type="other">
            <year>2021</year>
            <article-title>Review and Comparison of Commonly Used Activation Functions for Deep Neural Networks</article-title>
            <source>Bio-Algorithms and Med-Systems</source>
            <volume>17</volume>
          </element-citation>
        </citation-alternatives>
      </ref>
      <ref id="B11">
        <label>11.</label>
        <citation-alternatives>
          <mixed-citation publication-type="confproc">He, K., Zhang, X., Ren, S. and Sun, J. (2015) Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification. <italic>Proceedings of the IEEE International Conference on Computer Vision</italic>( <italic>ICCV</italic>), Santiago, 7-13 December 2015, 1026-1034. https://doi.org/10.1109/ICCV.2015.123 <pub-id pub-id-type="doi">10.1109/ICCV.2015.123</pub-id><ext-link ext-link-type="uri" xlink:href="https://doi.org/10.1109/ICCV.2015.123">https://doi.org/10.1109/ICCV.2015.123</ext-link></mixed-citation>
          <element-citation publication-type="confproc">
            <person-group person-group-type="author">
              <string-name>He, K.</string-name>
              <string-name>Zhang, X.</string-name>
              <string-name>Ren, S.</string-name>
              <string-name>Sun, J.</string-name>
            </person-group>
            <year>2015</year>
            <article-title>Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification</article-title>
            <source>Proceedings of the IEEE International Conference on Computer Vision (ICCV)</source>
            <volume>7</volume>
            <pub-id pub-id-type="doi">10.1109/ICCV.2015.123</pub-id>
          </element-citation>
        </citation-alternatives>
      </ref>
      <ref id="B12">
        <label>12.</label>
        <citation-alternatives>
          <mixed-citation publication-type="confproc">He, K., Zhang, X., Ren, S. and Sun, J. (2016) Deep Residual Learning for Image Recognition. 2016 <italic>IEEE Conference on Computer Vision and Pattern Recognition</italic>( <italic>CVPR</italic>), Las Vegas, 27-30 June 2016, 770-778. https://doi.org/10.1109/cvpr.2016.90 <pub-id pub-id-type="doi">10.1109/cvpr.2016.90</pub-id><ext-link ext-link-type="uri" xlink:href="https://doi.org/10.1109/cvpr.2016.90">https://doi.org/10.1109/cvpr.2016.90</ext-link></mixed-citation>
          <element-citation publication-type="confproc">
            <person-group person-group-type="author">
              <string-name>He, K.</string-name>
              <string-name>Zhang, X.</string-name>
              <string-name>Ren, S.</string-name>
              <string-name>Sun, J.</string-name>
            </person-group>
            <year>2016</year>
            <article-title>Deep Residual Learning for Image Recognition</article-title>
            <source>2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR)</source>
            <volume>27</volume>
            <pub-id pub-id-type="doi">10.1109/cvpr.2016.90</pub-id>
          </element-citation>
        </citation-alternatives>
      </ref>
      <ref id="B13">
        <label>13.</label>
        <citation-alternatives>
          <mixed-citation publication-type="confproc">Ioffe, S. and Szegedy, C. (2015) Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift. <italic>Proceedings of the</italic>32 <italic>nd International Conference on Machine Learning</italic>( <italic>ICML</italic>), Lille, 7-9 July 2015, 448-456. https://arxiv.org/abs/1502.03167</mixed-citation>
          <element-citation publication-type="confproc">
            <person-group person-group-type="author">
              <string-name>Ioffe, S.</string-name>
              <string-name>Szegedy, C.</string-name>
            </person-group>
            <year>2015</year>
            <article-title>Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift</article-title>
            <source>Proceedings of the 32nd International Conference on Machine Learning (ICML)</source>
            <volume>7</volume>
          </element-citation>
        </citation-alternatives>
      </ref>
      <ref id="B14">
        <label>14.</label>
        <citation-alternatives>
          <mixed-citation publication-type="confproc">Maas, A.L., Hannun, A.Y. and Ng, A.Y. (2013) Rectifier Nonlinearities Improve Neural Network Acoustic Models. <italic>Proceedings of the</italic>30 <italic>th International Conference on Machine Learning</italic>( <italic>ICML</italic>), Atlanta, 16-21 June 2013, 3-6. https://ai.stanford.edu/~amaas/papers/relu_hybrid_icml2013_final.pdf</mixed-citation>
          <element-citation publication-type="confproc">
            <person-group person-group-type="author">
              <string-name>Maas, A.L.</string-name>
              <string-name>Hannun, A.Y.</string-name>
              <string-name>Ng, A.Y.</string-name>
            </person-group>
            <year>2013</year>
            <article-title>Rectifier Nonlinearities Improve Neural Network Acoustic Models</article-title>
            <source>Proceedings of the 30th International Conference on Machine Learning (ICML)</source>
            <volume>16</volume>
          </element-citation>
        </citation-alternatives>
      </ref>
      <ref id="B15">
        <label>15.</label>
        <citation-alternatives>
          <mixed-citation publication-type="confproc">Pascanu, R., Mikolov, T. and Bengio, Y. (2013) On the Difficulty of Training Recurrent Neural Networks. In: Pereira, F., Burges, C.J.C., Bottou, L. and Weinberger, K.Q., Eds., <italic>Proceedings of the 30th International Conference on Machine Learning</italic>( <italic>ICML</italic> 2013), Atlanta, 16-21 June 2013, 1310-1318. https://proceedings.mlr.press/v28/pascanu13.html</mixed-citation>
          <element-citation publication-type="confproc">
            <person-group person-group-type="author">
              <string-name>Pascanu, R.</string-name>
              <string-name>Mikolov, T.</string-name>
              <string-name>Bengio, Y.</string-name>
              <string-name>Pereira, F.</string-name>
              <string-name>Burges, C.J.C.</string-name>
              <string-name>Bottou, L.</string-name>
              <string-name>Weinberger, K.Q.</string-name>
            </person-group>
            <year>2013</year>
            <article-title>On the Difficulty of Training Recurrent Neural Networks</article-title>
            <source>In: Pereira</source>
            <volume>16</volume>
          </element-citation>
        </citation-alternatives>
      </ref>
      <ref id="B16">
        <label>16.</label>
        <citation-alternatives>
          <mixed-citation publication-type="thesis">Hochreiter, S. (1991) Untersuchungen Zu Dynamischen Neuronalen Netzen. Doctoral Dissertation, Technische Universität München.</mixed-citation>
          <element-citation publication-type="thesis">
            <person-group person-group-type="author">
              <string-name>Hochreiter, S.</string-name>
              <string-name>Dissertation, T</string-name>
            </person-group>
            <year>1991</year>
            <article-title>Untersuchungen Zu Dynamischen Neuronalen Netzen</article-title>
            <source>Doctoral Dissertation</source>
          </element-citation>
        </citation-alternatives>
      </ref>
      <ref id="B17">
        <label>17.</label>
        <citation-alternatives>
          <mixed-citation publication-type="web">Wilson, A.C., Roelofs, R., Stern, M., Srebro, N. and Recht, B. (2017) The Marginal Value of Adaptive Gradient Methods in Machine Learning. <italic>Advances in Neural Information Processing Systems</italic>( <italic>Neurips</italic>), 30, 4151-4161. https://arxiv.org/abs/1705.08292</mixed-citation>
          <element-citation publication-type="web">
            <person-group person-group-type="author">
              <string-name>Wilson, A.C.</string-name>
              <string-name>Roelofs, R.</string-name>
              <string-name>Stern, M.</string-name>
              <string-name>Srebro, N.</string-name>
              <string-name>Recht, B.</string-name>
            </person-group>
            <year>2017</year>
            <article-title>The Marginal Value of Adaptive Gradient Methods in Machine Learning</article-title>
            <source>Advances in Neural Information Processing Systems (Neurips)</source>
            <volume>30</volume>
          </element-citation>
        </citation-alternatives>
      </ref>
      <ref id="B18">
        <label>18.</label>
        <citation-alternatives>
          <mixed-citation publication-type="web">Ruder, S. (2016) An Overview of Gradient Descent Optimization Algorithms. arXiv Preprint. https://arxiv.org/abs/1609.04747</mixed-citation>
          <element-citation publication-type="web">
            <person-group person-group-type="author">
              <string-name>Ruder, S.</string-name>
            </person-group>
            <year>2016</year>
            <article-title>An Overview of Gradient Descent Optimization Algorithms</article-title>
          </element-citation>
        </citation-alternatives>
      </ref>
      <ref id="B19">
        <label>19.</label>
        <citation-alternatives>
          <mixed-citation publication-type="book">Goodfellow, I., Bengio, Y. and Courville, A. (2016) Deep Learning. MIT Press. https://www.deeplearningbook.org/</mixed-citation>
          <element-citation publication-type="book">
            <person-group person-group-type="author">
              <string-name>Goodfellow, I.</string-name>
              <string-name>Bengio, Y.</string-name>
              <string-name>Courville, A.</string-name>
            </person-group>
            <year>2016</year>
            <article-title>Deep Learning</article-title>
          </element-citation>
        </citation-alternatives>
      </ref>
      <ref id="B20">
        <label>20.</label>
        <citation-alternatives>
          <mixed-citation publication-type="confproc">Lecun, Y., Bottou, L., Bengio, Y. and Haffner, P. (1998) Gradient-Based Learning Applied to Document Recognition. <italic>Proceedings</italic><italic>of the</italic><italic>IEEE</italic>, 86, 2278-2324. https://doi.org/10.1109/5.726791 <pub-id pub-id-type="doi">10.1109/5.726791</pub-id><ext-link ext-link-type="uri" xlink:href="https://doi.org/10.1109/5.726791">https://doi.org/10.1109/5.726791</ext-link></mixed-citation>
          <element-citation publication-type="confproc">
            <person-group person-group-type="author">
              <string-name>Lecun, Y.</string-name>
              <string-name>Bottou, L.</string-name>
              <string-name>Bengio, Y.</string-name>
              <string-name>Haffner, P.</string-name>
            </person-group>
            <year>1998</year>
            <article-title>Gradient-Based Learning Applied to Document Recognition</article-title>
            <source>Proceedings of the IEEE</source>
            <volume>86</volume>
            <pub-id pub-id-type="doi">10.1109/5.726791</pub-id>
          </element-citation>
        </citation-alternatives>
      </ref>
    </ref-list>
  </back>
</article>