<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Baraa</title>
    <description>The latest articles on DEV Community by Baraa (@br_).</description>
    <link>https://dev.to/br_</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4162615%2Fd37fc1af-f0f0-40ff-9a7d-fcc07f418ad5.jpg</url>
      <title>DEV Community: Baraa</title>
      <link>https://dev.to/br_</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/br_"/>
    <language>en</language>
    <item>
      <title>Your Entire Neural Network Is Just One Equation (Let's Prove It in Node.js)</title>
      <dc:creator>Baraa</dc:creator>
      <pubDate>Fri, 13 Nov 2026 12:14:49 +0000</pubDate>
      <link>https://dev.to/br_/your-entire-neural-network-is-just-one-equation-lets-prove-it-in-nodejs-2da8</link>
      <guid>https://dev.to/br_/your-entire-neural-network-is-just-one-equation-lets-prove-it-in-nodejs-2da8</guid>
      <description>&lt;p&gt;Everyone learns neural networks in Python. I decided to build a full LLM from scratch in Node.js instead, and write down everything that confused me along the way. Not because TypeScript is better, and not to replace Python. It is just that rebuilding an idea in a different language is what makes it stick.&lt;/p&gt;

&lt;p&gt;This is the smallest piece of the whole machine: one tiny network, 3 neurons, 8 learnable numbers. By the end of this post I'll show you something that genuinely fascinated me: your entire network, no matter how deep, collapses into &lt;strong&gt;one single equation&lt;/strong&gt;. &lt;br&gt;
Let's build it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The smallest network that still counts
&lt;/h2&gt;

&lt;p&gt;Our mini network: an input row with 3 features, then two layers holding 3 neurons in total. Two in the first layer, one in the second.&lt;/p&gt;

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

&lt;p&gt;Every neuron follows the same 4-step recipe. Multiply each input by its own weight, add them up, add a bias, then squash the result:&lt;/p&gt;

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

&lt;p&gt;That's it. That is everything a neuron does. The whole field runs on this recipe repeated at scale.&lt;/p&gt;

&lt;h2&gt;
  
  
  Run real numbers through it
&lt;/h2&gt;

&lt;p&gt;Take &lt;code&gt;x = [1, 2, 3]&lt;/code&gt; and some hand-picked weights:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Neuron&lt;/th&gt;
&lt;th&gt;Weights&lt;/th&gt;
&lt;th&gt;Bias&lt;/th&gt;
&lt;th&gt;Weighted sum&lt;/th&gt;
&lt;th&gt;After ReLU&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;&lt;code&gt;[0.5, -1, 0.5]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;0.1&lt;/td&gt;
&lt;td&gt;0.5 - 2 + 1.5 + 0.1 = 0.1&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.1&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;&lt;code&gt;[-1, 0, -0.5]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;-1 + 0 - 1.5 = -2.5&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Notice neuron 2: negative sum, so ReLU flattened it to a hard zero. This is why real network activations are full of zeros.&lt;/p&gt;

&lt;p&gt;And the entire network is three calls:&lt;/p&gt;

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

&lt;h2&gt;
  
  
  ReLU is not a layer
&lt;/h2&gt;

&lt;p&gt;Quick rant, because this confused me for sometime. ReLU has no weights and nothing to learn. It is an operation applied to each number on its own. &lt;br&gt;
People call it a "layer" because that is how frameworks expose it (looking at you, tf.layers.reLU()), but there are zero parameters inside it.&lt;/p&gt;

&lt;p&gt;And here is why it exists at all: without it, stacking layers is pointless. Two weighted sums back to back collapse into one weighted sum. The squash in the middle is the only thing that makes "deep" mean anything.&lt;/p&gt;

&lt;h2&gt;
  
  
  The moment it clicked for me
&lt;/h2&gt;

&lt;p&gt;Here is the interesting part. Take layer two's equation and plug layer one into it:&lt;/p&gt;

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

&lt;p&gt;The whole network folds into a single equation. Input goes in, one number comes out. The network IS that equation, and every weight and bias inside it is a knob we are allowed to turn.&lt;/p&gt;

&lt;p&gt;Once you see this, "training" stops being magic. We know what the network produced (ŷ) and what it should have produced (y). &lt;/p&gt;

&lt;p&gt;Measuring the gap is the loss function:&lt;br&gt;
&lt;em&gt;loss = (ŷ - y)²&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Training is nothing more than turning the knobs until that gap collapses toward zero. One number, sitting outside every layer, driving the updates inside all of them at once.&lt;/p&gt;

&lt;p&gt;Why I care&lt;br&gt;
This tiny network is the same recipe that runs inside GPT, just with 175 billion more knobs. The attention block, the feed-forward block, all of it: weighted sum, bias, squash, repeat.&lt;/p&gt;

&lt;p&gt;I'm documenting the whole journey, building an LLM from scratch in Node.js and TypeScript, chapter by chapter. Fully runnable code, zero black boxes:&lt;/p&gt;

&lt;p&gt;📖 &lt;a href="//book.humanexperiences.io"&gt;&lt;strong&gt;The free book: book.humanexperiences.io&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
⭐ &lt;a href="//github.com/BaraaSoft/node-llm"&gt;&lt;strong&gt;The code: github.com/BaraaSoft/node-llm&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next up: LayerNorm, or why stacking these layers makes numbers explode 58× by layer 10, and the elegant fix every transformer uses.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;What confused YOU most when you first learned neural networks? Drop it in the comments, there's a good chance I got stuck on the exact same thing.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>javascript</category>
      <category>machinelearning</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
