{"slug": "your-entire-neural-network-is-just-one-equation-let-s-prove-it-in-node-js", "title": "Your Entire Neural Network Is Just One Equation (Let's Prove It in Node.js)", "summary": "A developer built a minimal neural network from scratch in Node.js and TypeScript, using three neurons and eight learnable parameters, to demonstrate that any network—however deep—collapses into a single equation once layer outputs are substituted into one another. The writeup shows that ReLU has no learnable parameters and exists solely to prevent stacked weighted sums from collapsing into one, and frames training as turning those weights and biases until the squared-error loss approaches zero. The work is part of a free book and open-source repository documenting a full LLM built in Node.js, with LayerNorm planned next.", "body_md": "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.\n\nThis 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 **one single equation**. \n\nLet's build it.\n\nOur 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.\n\nEvery neuron follows the same 4-step recipe. Multiply each input by its own weight, add them up, add a bias, then squash the result:\n\nThat's it. That is everything a neuron does. The whole field runs on this recipe repeated at scale.\n\nTake `x = [1, 2, 3]` and some hand-picked weights:\n\n| Neuron | Weights | Bias | Weighted sum | After ReLU | \n|---|---|---|---|---|\n| 1 | `[0.5, -1, 0.5]` | 0.1 | 0.5 - 2 + 1.5 + 0.1 = 0.1 | **0.1** | \n| 2 | `[-1, 0, -0.5]` | 0 | -1 + 0 - 1.5 = -2.5 | **0** | \n\nNotice neuron 2: negative sum, so ReLU flattened it to a hard zero. This is why real network activations are full of zeros.\n\nAnd the entire network is three calls:\n\nQuick 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. \n\nPeople call it a \"layer\" because that is how frameworks expose it (looking at you, tf.layers.reLU()), but there are zero parameters inside it.\n\nAnd 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.\n\nHere is the interesting part. Take layer two's equation and plug layer one into it:\n\nThe 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.\n\nOnce you see this, \"training\" stops being magic. We know what the network produced (ŷ) and what it should have produced (y).\n\nMeasuring the gap is the loss function:\n\n*loss = (ŷ - y)²*\n\nTraining 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.\n\nWhy I care\n\nThis 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.\n\nI'm documenting the whole journey, building an LLM from scratch in Node.js and TypeScript, chapter by chapter. Fully runnable code, zero black boxes:\n\n📖 **The free book: book.humanexperiences.io**\n\n⭐ **The code: github.com/BaraaSoft/node-llm**\n\nNext up: LayerNorm, or why stacking these layers makes numbers explode 58× by layer 10, and the elegant fix every transformer uses.\n\n*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.*", "url": "https://wpnews.pro/news/your-entire-neural-network-is-just-one-equation-let-s-prove-it-in-node-js", "canonical_source": "https://dev.to/br_/your-entire-neural-network-is-just-one-equation-lets-prove-it-in-nodejs-2da8", "published_at": "2026-11-13 12:14:49+00:00", "updated_at": "2026-11-13 12:22:11.873152+00:00", "lang": "en", "topics": ["neural-networks", "machine-learning", "artificial-intelligence", "developer-tools"], "entities": ["Node.js", "TypeScript", "GitHub", "Python", "GPT"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/your-entire-neural-network-is-just-one-equation-let-s-prove-it-in-node-js", "markdown": "https://wpnews.pro/news/your-entire-neural-network-is-just-one-equation-let-s-prove-it-in-node-js.md", "text": "https://wpnews.pro/news/your-entire-neural-network-is-just-one-equation-let-s-prove-it-in-node-js.txt", "jsonld": "https://wpnews.pro/news/your-entire-neural-network-is-just-one-equation-let-s-prove-it-in-node-js.jsonld"}}