Neural Networks Basics

Learn how neural networks learn patterns through layers, weights, and backpropagation.

Difficulty beginner
Read time 8 min
neural-networks deep-learning weights backpropagation activation-functions layers
Updated February 14, 2026

What Is a Neural Network?

Think of a neural network as a pattern-recognition machine. It takes some input (text, an image, numbers), passes it through a series of processing steps, and produces an output (a prediction, a classification, a generated token).

The name comes from a loose analogy to the brain. A neural network is made up of neurons organized into layers. Each neuron receives input values, multiplies them by weights (numbers that represent how important each input is), adds them up, and passes the result through an activation function that decides whether and how strongly the neuron “fires.”

A single neuron isn’t very powerful. But stack thousands of neurons in multiple layers, and the network can learn incredibly complex patterns — from recognizing faces in photos to generating human-like text.

How It Learns

The learning process has three key steps that repeat over and over:

1. Forward pass — Data flows through the network from input to output. Each layer transforms the data using its current weights. The final layer produces a prediction.

2. Loss calculation — The prediction is compared to the correct answer using a loss function. The loss is a number that measures how wrong the prediction is. Lower is better.

3. Backpropagation — This is the clever part. The network works backward through the layers, calculating how much each weight contributed to the error. Then it nudges each weight slightly in the direction that would reduce the error. This nudging is controlled by a value called the learning rate — too large and the model overshoots, too small and learning is painfully slow.

This cycle — predict, measure error, adjust weights — repeats millions of times across the training data. Gradually, the weights converge to values that make good predictions.

Key Building Blocks

Layers come in different types. The most basic is a dense (fully connected) layer where every neuron connects to every neuron in the next layer. Modern networks use specialized layers — convolutional layers for images, attention layers for sequences (the foundation of Transformers).

Activation functions add non-linearity. Without them, stacking layers would be pointless — multiple linear operations collapse into a single linear operation. Common activations include ReLU (passes positive values through, blocks negatives) and softmax (converts raw scores into probabilities that sum to 1, used in the output layer of classifiers and language models).

Bias is an extra number added to each neuron’s calculation. It lets the neuron adjust its threshold — how much input it needs before it activates. Without bias, every neuron would be forced to pass through zero.

From Shallow to Deep

A network with just one hidden layer (the layers between input and output) can theoretically learn any function, but it might need an impossibly large number of neurons. Deep networks — networks with many layers — can learn the same patterns with far fewer total neurons by building up features hierarchically.

In an image network, early layers might learn to detect edges. Middle layers combine edges into shapes. Deep layers recognize objects. In a language model, early layers might capture word similarities, middle layers handle grammar and syntax, and deep layers grasp meaning and context.

This hierarchical feature learning is why depth matters, and why we call it deep learning.

Key Terminology

  • Epoch — One complete pass through the entire training dataset. Training typically runs for many epochs.
  • Batch — A subset of training data processed together. Instead of updating weights after every single example, the network processes a batch and averages the updates. This is faster and produces smoother learning.
  • Gradient — The direction and magnitude of the slope of the loss function. Backpropagation computes gradients for each weight, telling the optimizer which direction to adjust.
  • Overfitting — When a model memorizes the training data instead of learning generalizable patterns. It performs well on training data but poorly on new data.
  • Underfitting — When a model is too simple to capture the patterns in the data. It performs poorly on both training and new data.

Why Does It Matter?

Every modern AI system — from image recognition to language models to game-playing agents — is built on neural networks. Understanding the basics of how they learn (forward pass → loss → backpropagation) gives you the mental model needed to understand more advanced concepts like Transformers, attention mechanisms, and fine-tuning.

You don’t need to implement neural networks from scratch to use AI effectively, but knowing what’s happening under the hood helps you make better decisions: why some models need more data, why training is expensive, why fine-tuning works, and why models sometimes fail in predictable ways.

Common Misconceptions

“Neural networks work like the brain.” The analogy is very loose. Biological neurons are far more complex than artificial ones. Neural networks are inspired by the brain’s structure but work very differently in practice.

“More layers always helps.” Deeper isn’t always better. Very deep networks can suffer from vanishing gradients (signals shrink to near-zero as they flow backward) and are harder to train. Techniques like residual connections (skip connections) were invented to address this.

“Neural networks understand what they’re doing.” They optimize a mathematical objective (minimize loss). They don’t have goals, understanding, or awareness. A network that classifies cat photos doesn’t know what a cat is — it has learned pixel patterns that correlate with the label “cat.”

Further Reading

  • 3Blue1Brown’s “Neural Networks” YouTube series — brilliant visual explanations
  • Michael Nielsen’s “Neural Networks and Deep Learning” — free online book
  • The Transformer Architecture concept in this hub for how modern LLMs build on these foundations