Skip to content
GenAI Learn/Neural Networks From First Principles
Browsing as a guest. Sign in to save your progress and earn XP as you complete chapters.

The Forward Pass: How a Network Predicts

6 min read

You'll learn to

  • -Trace exactly how input data flows through a network to produce a prediction
  • -Implement a full forward pass through a small network, matching a live diagram number for number
  • -Understand this "forward pass" as distinct from the training process

With layers and activation functions in place, this chapter walks through the actual mechanical process of turning an input into a prediction, called the forward pass, since data flows forward through the network, layer by layer, from input to output. Step through the diagram below. It uses a small, fixed network, two inputs, two ReLU hidden neurons, one sigmoid output, that the code sample beneath it reproduces exactly.

The Forward Pass, Step by Step

Data flows left to right: weighted sum, then activation, layer by layer.

x11.50x2-0.80h1?h2?out?

Two inputs enter the network: x1 = 1.50, x2 = -0.80. Step forward to compute the first hidden neuron.

Inputs

Step by Step Through the Network

  • -The input layer receives the raw data as a vector: pixel values, numeric features, or a text representation, depending on the task.
  • -Each neuron in the first hidden layer computes its weighted sum plus bias, then applies its activation function.
  • -That layer's outputs become the next layer's inputs, and the same weighted-sum-plus-activation process repeats.
  • -This continues through every hidden layer until reaching the output layer, whose format matches the task: a single number for regression, a probability per category for classification.
The exact forward pass shown above, implemented from scratch

Every one of these steps is pure arithmetic: multiplication, addition, and a fixed activation function, repeated many times. There is nothing mysterious happening inside a forward pass. The apparent intelligence of the output emerges from the accumulated effect of millions, or billions, of individually simple weighted sums, using weights that were carefully shaped by training.

Forward Pass vs. Training

It is worth being precise about a distinction that trips people up. The forward pass is what happens every time the network makes a prediction, whether during training or in production. Training additionally runs backpropagation, the next chapter, after each forward pass, to figure out how to adjust the weights. In production, only the forward pass runs. The weights are frozen at whatever training left them, and each prediction is just this same forward flow of arithmetic through fixed weights.

This is exactly why a trained model can respond so quickly. Generating a prediction from a deployed model is "only" a forward pass, with no gradient computation or weight adjustment involved, which is a much cheaper operation than training.

Interview Signal is part of Pro

See a real weak answer next to a real strong one for this exact topic.

Quiz is part of Pro

Test what you just read with a short quiz, and bank the XP.

ScaleDojo Logo
Initializing ScaleDojo