Neural Networks, Minus the Mystique: A Developer's Napkin Guide
The whole idea in twenty lines of PyTorch: neurons, layers, backprop as a feedback loop, the architecture zoo in one paragraph, and what it actually means for people who ship software.
Somewhere along the way, "neural network" became a phrase people say the way medieval maps said here be dragons — a label for the part of the system nobody wants to explain. Which is a shame, because the core idea fits on a napkin, and once you've seen it, a lot of modern AI stops being magic and starts being engineering. This is my napkin version, written for developers who'd rather see code than calculus, loosely following the structure of AWS's neural network explainer but with the hand-waving replaced by a working example.
The napkin
A neural network is a pile of very small, very dumb functions. Each neuron does exactly this: multiply each input by a weight, add them up, add a bias, squash the result through a non-linear function. That's it. That's the neuron.
def neuron(inputs, weights, bias):
total = sum(x * w for x, w in zip(inputs, weights)) + bias
return max(0.0, total) # ReLU: the world's least glamorous function
Stack a few of these side by side and you have a layer. Feed one layer's outputs into the next and you have a network: an input layer (your data, as numbers), some hidden layers (where combinations of features get detected), and an output layer (the prediction). "Deep learning" is marketing for "we stacked a lot of layers". The dragons were arithmetic all along.
The interesting question was never the forward pass — it's where do the weights come from? Answer: they start random and get nudged. Show the network an example, measure how wrong it was (the loss), then adjust every weight slightly in the direction that would have made it less wrong. Do this a few million times. That nudging algorithm is backpropagation plus gradient descent, and conceptually it's the same feedback loop as tuning a PID controller or fixing your golf swing: error out, correction in, repeat.
Okay, but show me
Here's a complete, honest-to-goodness network learning XOR — the classic "you literally cannot do this without a hidden layer" example — in PyTorch:
import torch, torch.nn as nn
X = torch.tensor([[0.,0.],[0.,1.],[1.,0.],[1.,1.]])
y = torch.tensor([[0.],[1.],[1.],[0.]]) # XOR truth table
model = nn.Sequential(
nn.Linear(2, 8), # input → hidden: 2 features to 8 neurons
nn.ReLU(),
nn.Linear(8, 1), # hidden → output
nn.Sigmoid(), # squash to a 0..1 "probability"
)
opt, loss_fn = torch.optim.Adam(model.parameters(), lr=0.05), nn.BCELoss()
for epoch in range(2000):
opt.zero_grad()
loss = loss_fn(model(X), y)
loss.backward() # backprop: compute the nudges
opt.step() # apply them
print(model(X).round().flatten()) # tensor([0., 1., 1., 0.]) — learned it
Twenty lines. Run it and watch the loss fall. Every giant model you've read about is this loop with more data, more layers, and an electricity bill.
The zoo, briefly
Different data shapes bred different architectures, and knowing which is which covers 90% of conversations:
- Feedforward networks — the plain stack above. Tabular data, simple classification, the baseline you should always try first.
- CNNs (convolutional) — slide small learned filters across images so an edge-detector learned in one corner works everywhere. Vision's workhorse for a decade, still excellent.
- Transformers — process sequences by letting every position attend to every other. The architecture behind the LLM boom, including the models I write about in the practical AI trainings.
- Autoencoders, GANs, U-Nets, RL — compression, generation, segmentation, decision-making. Same neurons, different plumbing.
What this means if you build software for a living
A few conclusions I've come to that the explainers usually skip:
- You will more often use networks than train them. For most product work, the leverage is in APIs and fine-tuning, not architecture design. Knowing the napkin version keeps vendors honest; you don't need to derive backprop to ship.
- Data quality beats model cleverness, every time. The training loop faithfully learns whatever your labels teach — including your labeling mistakes and biases. Garbage in is not a cliché here; it's the failure mode.
- Networks are confident, not correct. That sigmoid outputs 0.97 with equal enthusiasm for right and wrong answers. Any system that acts on predictions needs thresholds, fallbacks and a human path — the same defensive design as any unreliable dependency.
- Inference is just compute. A trained model is a function: version it, containerize it, monitor its latency and its drift like any other service. (Yes, it can live behind the same Rancher-managed cluster as everything else.)
For a striking case study of where all this lands when the stakes are highest, I went through a peer-reviewed medical AI review next — machine learning in medicine — where the difference between 80% and 85% accuracy is not an A/B test.
Want the hands-on version with your team's own data? That's what the AI/LLM trainings are for — or bring the product idea and we'll design the ML-shaped parts together.