Chapter 2 · Part 2

The forward pass

So what is one run of the model? Strip away the mystique and inference is a single trip through the network, front to back: the input goes in one end, flows through layer after layer of multiply-and-add, and an answer comes out the other end. That trip is called the forward pass — and at inference time, it's the only thing that happens.

Scroll to push one input through the network.

The input enters on the left — a set of numbers (pixels, tokens, features).

scroll

Same math as training — minus the learning

Here's the thing that surprises people: the forward pass at inference is the exact same computation as the forward pass during training. The difference is what happens next:

  • During training, the forward pass is followed by a backward pass — backpropagation computes how to adjust every weight, and they change.
  • During inference, there is no backward pass. The weights are frozen. You compute the output and you're done.

That's why inference is so much cheaper per run: it skips backprop entirely, and it doesn't need to store all the intermediate values that training keeps around for the gradient.

Same idea, any model

Image classifier, recommendation model, or a giant language model — inference is always "run the forward pass." The only twist is that some models run one forward pass per answer, while others (like chatbots) run many — one per word. That twist is the whole next chapter.

Next: one token at a time — why a language model's inference is a loop.