Start with an Analogy: The Recipe Adjuster
Imagine you are learning to bake bread. You have a recipe that says: add 2 cups of flour, 1 teaspoon of salt, and 1 tablespoon of yeast. After baking, someone tastes it and says it is too salty. Next time, you reduce the salt. They say it is better, but now too dense. You increase the yeast a little. You are adjusting the ingredients based on feedback until the bread turns out right.
An AI model does exactly this, except instead of salt and yeast, it adjusts numbers called weights. And instead of a human taster giving feedback, a mathematical score called loss tells it how wrong it was. It adjusts, bakes again, checks the score, adjusts again, thousands of times, until its predictions are good. That entire process is called training.
What a Weight Actually Is
A weight is a number that tells the model how much to care about a particular piece of information. Think of it like an importance dial. If you are predicting whether an email is spam, the word "congratulations" might have a high weight (it matters a lot), while the sender's email length might have a very low weight (it barely matters).
Before training, every weight starts as a random number, essentially a guess. Training is the process of discovering what each weight should actually be. A model with a billion parameters simply has a billion of these dials, all being tuned at once.
Here is the simplest possible model: predicting tomorrow's temperature from today's. The formula is just: prediction = weight × today's temperature. If today is 20°C and the weight is 1.0, you predict 20°C. If the weight is 0.9, you predict 18°C. The weight is your belief about the relationship. Training finds the weight that makes the best predictions on average.
A real model has many inputs and many weights. A model predicting house prices might use square footage, number of bedrooms, and distance from the city center, each multiplied by its own weight and added together: price = w1×sqft + w2×bedrooms + w3×distance + bias. The bias is just an extra adjustable number that shifts the whole output up or down, like a baseline. Think of it as the model's starting point before it even looks at the inputs.
Why the Model Needs a "Gate" at Each Step
Here is a subtle problem. If you just stack multiplications on top of multiplications, you always end up with one multiplication. Ten layers of "multiply by a number" is the same as one layer of "multiply by a slightly different number." The layers are not actually adding depth, they are just folding into each other.
This matters because the real world is not simple multiplication. Whether an email is spam does not change in a straight line as you add more words. Whether a tumor is malignant is not a simple linear combination of measurements. Real relationships are curved, with thresholds and interactions.
The solution is to add a small "gate" between layers called an activation function. The gate decides how much of the signal to pass through. The most common one is called ReLU (Rectified Linear Unit). Its rule is simple: if the number coming in is positive, let it through unchanged. If it is negative, output zero instead.
That one gate, that one "if positive pass through, otherwise zero," is what makes deep networks powerful. By adding it between every layer, you allow the model to represent curved, complex, non-straight-line relationships. Without it, depth is meaningless. With it, depth lets the model learn almost anything.
Another gate you will see is the sigmoid function. Sigmoid squashes any number, no matter how large or small, into a value between 0 and 1. This is useful for the final output when you want the model to express a probability: "I am 87% confident this is spam."
How the Model Produces an Answer: The Forward Pass
A forward pass is what happens when you feed an input to the model and it produces an output. Think of it like dropping a ball through a pinball machine. The ball (your input) enters at the top, hits bumpers (the layers), bounces around, and exits at the bottom as a score (the prediction). It always moves forward, from input to output, never backwards.
Here is a concrete example: a model checking whether a medical scan might show a problem. Step by step:
- Input: 30 measurements from the scan (size, texture, shape, and so on). Each is a number.
- Layer 1: Each measurement gets multiplied by its weight, all results are added together, and the gate (ReLU) decides what passes through. This produces 64 new numbers, one per neuron. Each neuron has spotted a different pattern in the measurements.
- Layer 2: Those 64 numbers go through the same process again. Now the model is combining the patterns it found in Layer 1 into higher-level patterns. Output: 32 numbers.
- Output layer: All 32 numbers are combined into a single number, passed through sigmoid, and expressed as a probability between 0 and 1.
The final number, say 0.87, means: "I am 87% confident there is a problem here." The forward pass is always the same given the same inputs and the same weights. It is not random. It is a calculation.