What is Neural Network?
A neural network is a machine learning model built from layers of simple weighted units that learn to map inputs to outputs by repeatedly adjusting those weights to reduce prediction error.
The plain definition
A neural network is a stack of layers. Each layer takes a list of numbers, multiplies them by a matrix of weights, adds a bias, and passes the result through a non-linear function. Stack enough of these and the whole thing becomes a very flexible function approximator: given examples of inputs and correct outputs, it can learn a mapping between them.
The biological metaphor is where the name comes from, and it is where most explanations go wrong. A neural network does not think, reason, or understand. It is arithmetic — a large pile of multiplications arranged so that a gradient can be computed and followed downhill.
How training actually works
Training has three moving parts. A loss function measures how wrong the current predictions are. Backpropagation computes, for every weight in the network, the derivative of that loss with respect to that weight. An optimiser (usually Adam or SGD) nudges each weight a small step in the direction that reduces loss.
Repeat that loop over batches of training data for a few thousand to a few million steps and the weights settle into a configuration that makes good predictions. Nothing else happens. There is no insight, only a long descent down an error surface.
The non-linearity matters more than people expect. Without it — if every layer were purely a matrix multiply — a hundred stacked layers would collapse algebraically into a single matrix, and the network could only learn straight lines. The non-linear activation (ReLU, GELU, tanh) is what buys the ability to model curves, interactions, and conditional logic.
When a neural network is the wrong choice
This is the part most introductions skip. Neural networks are strong on perceptual data — images, audio, free text — where the useful features are buried in raw signal and nobody can write them down by hand.
On tabular business data (rows of numbers and categories from a database), gradient-boosted trees such as XGBoost or LightGBM usually match or beat a neural network while training in seconds instead of hours, needing far less data, and producing feature importances you can actually explain to a stakeholder. If your problem is churn prediction on 40 columns of CRM data, a neural network is very often the more expensive way to get a slightly worse answer.
Neural networks also want data volume. With a few hundred labelled examples, a deep network will memorise rather than generalise — see overfitting. Regularisation helps; it does not conjure signal that is not there.
The vocabulary you will hear
Epoch — one full pass over the training set. Batch size — how many examples are averaged before each weight update. Learning rate — how big each step is; the single most important hyperparameter to get right. Depth — number of layers. Width — units per layer.
Vanishing gradients — in very deep networks the derivative can shrink toward zero as it propagates backward, so early layers stop learning. Residual connections (the core trick in ResNets and in every transformer) exist mainly to give the gradient a clean path back.
- It is a function, not a mind — layers of weighted sums plus a non-linearity, fitted by gradient descent
- Strong on raw signal — images, audio, and text where features cannot be hand-written
- Often beaten on tabular data — gradient-boosted trees are usually faster, cheaper, and more explainable
- Data-hungry — capacity without volume produces memorisation, not generalisation
More on Neural Network.
How many layers does a neural network need?
There is no universal number. For tabular problems, two or three hidden layers is usually the point of diminishing returns. For image and language tasks, useful architectures run from dozens to hundreds of layers, but in practice you would start from a pretrained model rather than choosing a depth from scratch. Depth is a hyperparameter to be tuned against a validation set, not a virtue in itself.
What is the difference between a neural network and deep learning?
Deep learning is the practice of using neural networks with many layers. A single-hidden-layer network is a neural network but is not usually called deep learning. The distinction is one of degree rather than kind — the algorithms are the same, but depth changes which problems become tractable and which engineering issues dominate.
Do neural networks need a GPU?
For training on any non-trivial dataset, yes, in practice. Training is dominated by large matrix multiplications, which GPUs perform an order of magnitude or two faster than CPUs. Inference is a different question: many trained models, especially after quantisation, serve perfectly well on CPU.
Related terms.
Supervised Learning
Supervised learning is training a model on examples that already carry the correct answer, so the model learns a mapping it can ap…
ReadOverfitting
Overfitting is when a model fits the particular noise and quirks of its training data so closely that its performance on new, unse…
ReadTransformer
A transformer is a neural network architecture that processes a whole sequence at once using an attention mechanism, letting every…
ReadHyperparameter Tuning
Hyperparameter tuning is the search for configuration values that are set before training rather than learned during it, such as l…
ReadNeed this built?
Applying this to a
real system?
We build and ship production machine learning. If neural network is part of a problem you are working on, tell us about it.
Start the conversationor write to us at [email protected]