Ever wonder what’s actually happening under the hood when AI recognizes your face, transcribes your voice, or writes a snippet of code? Terms like "deep learning" and "neural networks" get thrown around constantly, making them sound like black magic reserved for PhD mathematicians.
The truth? The core idea behind a neural network is surprisingly straightforward, and it’s heavily inspired by the very brain you’re using to read this right now.
In this guide, we’re going to strip away the overwhelming math formulas and break down what a neural network actually is, how its different layers work together, and how it learns from its own mistakes (using a little trick called backpropagation). Let’s dive in 🤿🌊🌊🌊🌊
What is a neural network?
The words "neural network" is taken from what is in our human brain, we house a massive neural network that has billions and billions of neurons (brain cells). Each neuron is connected to many other neurons through what is called "synapses".
In machine learning, it uses the same word to describe kind of the same thing, but where neurons are separated into layers; the input layer, the hidden layer and the output layer. Each layer has a job, none do the same thing.
Input layer (the doorway to the process)
This layer has just one job, take in raw data, and pass it into the hidden layer. So in a neural network that specialises in image detection, each node in this layer would represent/expect the data it receives to be a certain pixel coordinate from the picture. So for example, a 4x4 pixel picture would have 16 nodes in the input layer, ready to receive data from each pixel coordinate.
Hidden layer (best to keep this one last)
Output layer (where the decisions are made)
Once the hidden layer does it's mathemagical stuff, it then passes the results to the final, output, layer. This layer may have one node, may have two nodes, or many many more. It all depends on what the intended answer is supposed to be, is it a yes/no, or maybe just a number?
For example, going back to the 4x4 pixel picture, if the quest was to find out what alphanumerical number this pixel shows, then we would have an output layer that would contain (most likely) 10 nodes, one for each number. And the data going into these nodes are the percentage likelihood that it is that number.
E.g some of the calculations of a combination of nodes in the hidden layer, combined with a mathematical calculation, output an 82% chance that the number we are looking at is a 5, while other output nodes get smaller percentages. This then makes the computer essentially say "it crossed a confidence threshold we set in our system, so we're going to say it's 5".
Hidden layer (Where the magic happens)
This is where the decisions come from. They are tasked with different tools/functions, each node it receives a connection from has a "weight", think of this term as "how much does this node care about this connection/node".
In a real world sense, imagine the question "should I go to a restaurant tonight?", also imagine these arbitrary reasons or factors to making this decision, one reason can be a question of "do I have enough money to spend outside today?", another reason can be "will my friends also join?" and the third node could be "is it a good weather tonight?".
Oops, did I say node in the last sentence? Well it kind of is a "node" if you look at it from a neural network sense.
This is what a node would look like, and it's connected nodes. The w1, 2 and 3 represent weights, as we mentioned before. The weights are typically between 0.0 and 1.0, the closer to 1.0 the more you "care" about this reason or node's output. And depending on the output of these nodes/reasons, if the influence, or the weight, is strong enough on the main question node, then it could determine the outcome.
If we zoom out of this example and think about a slightly more complex processes like the 4x4 pixel number recognition; we begin to see a stream of possible paths to take to land at a particular reason. If we zoom out to an LLM that can do coding, that can recognize complex images or detect voices etc, we'd be pulling our hair out how deep that neural network goes!
Also, apparently, the reason for the layer name "hidden" is simply because it sits between the input and output layers, so it's not seen or received by the user as opposed to the other two mentioned. don't quote me on it.
How does it learn?
So we have all the definitions of the type of layers and what the nodes in these layers do, and how they come to a decision. But where does the ability to make a decision come from, how does a neural network know to place a higher weight on one node connection as opposed to another? This comes via "learning", one specific way is called backward propagation (shorted as backpropagation).
Backpropagation
to define it properly, we just want to clarify the direction that the "synapses" fire in when looking to use the neural network to find out a result. This is called forward propagation, a process where the input data goes through the whole network, from input to hidden to output, all the while using biases and weights and "activation" functions to eventually find a final output value in the output layer.
Logically speaking, the neural network would really never get it 100% right the first time for whatever you're asking it to predict, because it doesn't know what you value or what you see as the right answer. The difference between what it got wrong and what you expect it to get (right) is calculated using what is called the "loss function"; Simply error = expected output - real output.
Once you have this error, we'd want to let the whole neural network know that "hey, we got it wrong by this much", we can't do a one size fits all and do the whole thing, we must let them figure out among themselves how much they were wrong (meaning a change in each weighted connection by x% amount to get closer to the right answer, or at least a decrease in error size). We do that by the numbers we already have at our disposal; we have the weights of connections in the hidden layer, we have the value of the first output node, and we also have the error value (the difference between expected and reality).
I won't go into too much detail about the math of it all, but we would essentially "propagate that same principle for every single node starting from the output layer all the way to the first hidden input.
When I think if the loss function I kind of get reminded of a process of home movers trying to hang up a painting on the wall in a specific area, and the owner of the painting is constantly telling the movers "nope, a little to the left, a little to the right..yes! On the wall right there, stop!"
Wrapping your head around neural networks can feel a bit abstract at first, but once you break them down into inputs, decisions (hidden layers), and outputs, the magic starts looking a lot more like logic.
To recap:
- Input layers take in raw facts (like pixels or survey answers).
- Hidden layers weigh those facts to decide what matters most.
- Output layers give us a final answer or prediction based on confidence.
- Backpropagation acts like that friend telling us to adjust the painting on the wall until the picture looks just right.
Modern AI models might stack hundreds of these hidden layers together, but at their core, they’re all just doing this same dance on a much massive scale.
Hope you enjoyed this read, I learnt a lot writing it! 🙌🏻 Until next time, peace. love. code. 💯



Top comments (0)