A neural network turns input numbers into output numbers through a chain of layers. A fully connected layer multiplies the input by a weight matrix and adds a bias, and an activation function sits between layers. The weights are not written by hand; they are fitted from examples.
What it consists of
| Part | What it does |
|---|---|
| Layer | turns its input into a new representation: y = f(Wx + b) |
| Weights and biases | numbers that are adjusted during training; their total count is the model’s parameters |
| Activation function | a non-linearity such as ReLU: without it, any chain of layers would collapse into a single linear transformation |
| Loss function | a number showing how far the network’s answer is from the correct one |
How a network learns
The network computes an answer for an example (the forward pass) and compares it with the correct one using the loss function. Backpropagation then computes the gradient of the loss with respect to each weight, and gradient descent moves the weights in the direction where the loss is lower. This is repeated over many examples, many times. Libraries compute the gradients with automatic differentiation, for example torch.autograd in PyTorch.
Example: a network for 28×28 images
A tutorial network from the PyTorch documentation for the FashionMNIST dataset: an input of 784 pixels, two layers of 512 neurons with ReLU, and an output of 10 classes. It has 784·512 + 512 = 401,920 parameters in the first layer, 512·512 + 512 = 262,656 in the second and 512·10 + 10 = 5,130 in the third, 669,706 in all. Language models work on the same principle, but they have billions of parameters and a different architecture, the transformer.
Deep learning
Deep learning means training networks with many layers. The type of network depends on the data: convolutional networks work with images, while transformers work with text and more.
Sources
the term is written from these pages- PyTorch Tutorials — Build the Neural Networkdocs.pytorch.org/tutorials/beginner/basics/buildmodel_tutorial.html(opens in a new tab)
- PyTorch Tutorials — Automatic Differentiation with torch.autograddocs.pytorch.org/tutorials/beginner/basics/autogradqs_tutorial.html(opens in a new tab)
- LeCun, Bengio, Hinton — Deep learning (Nature, 2015)nature.com/articles/nature14539(opens in a new tab)
Verified 18 Nov