Back to Blog
neural-networksdeep-learningAIbeginner

What is a Neural Network? Explained Simply

Neural networks are the foundation of modern AI. Learn how layers of simple math operations combine to recognize images, understand language, and make predictions.

CS VisualizationsFebruary 18, 20269 min

Interactive Visualization

Neural Network Forward Pass

See this concept in action with our step-by-step interactive visualization.

Try the Visualization

Every time you ask Siri a question, unlock your phone with your face, or get a movie recommendation, a neural network is doing the work behind the scenes. But what actually is a neural network, and how does it work?

Let's break it down — no math degree required.

The Simplest Explanation

A neural network is a program that learns to recognize patterns by looking at examples, rather than being explicitly programmed with rules.

Think of it like teaching a child to recognize dogs. You don't give them a rulebook ("four legs, fur, tail, barks"). Instead, you show them hundreds of dogs, and they gradually learn to recognize the pattern. Neural networks work the same way — they learn from examples.

The Structure: Layers of Neurons

x₁x₂h₁h₂h₃ŷInputHiddenOutput
A simple neural network: inputs → hidden layer → output. Each connection has a learnable weight.

A neural network is organized into layers:

Input Layer: Receives the raw data. For an image, this might be the pixel values. For our student exam example, it's hours studied and hours slept.

Hidden Layers: The middle layers where the real work happens. Each neuron takes inputs, multiplies them by weights, adds a bias, and passes the result through an activation function. These layers transform the input into increasingly useful representations.

Output Layer: Produces the final answer. For classification, this might be "cat" or "dog." For our exam predictor, it's "pass" or "fail."

How a Single Neuron Works

Each neuron performs a simple calculation:

output = activation(weight₁ × input₁ + weight₂ × input₂ + ... + bias)
  1. Multiply each input by a weight (how important is this input?)
  2. Sum all the weighted inputs
  3. Add a bias (a learnable offset)
  4. Apply an activation function (introduce non-linearity)

One neuron can only learn simple patterns — like drawing a straight line to separate two groups. But stack hundreds of neurons across multiple layers, and the network can learn incredibly complex patterns.

A Concrete Example

Let's predict whether a student passes an exam using two inputs:

  • Hours studied: 7 (on a 0-10 scale)
  • Hours slept: 8 (on a 0-10 scale)

The network has learned these weights through training:

  • Study weight: 0.6 (studying helps a lot)
  • Sleep weight: 0.4 (sleep helps too)
  • Bias: -4.0

Calculation:

z = (0.6 × 7) + (0.4 × 8) + (-4.0)
z = 4.2 + 3.2 - 4.0 = 3.4

output = sigmoid(3.4) = 0.97

The sigmoid function squashes 3.4 into 0.97, which we interpret as a 97% probability of passing. Makes sense — 7 hours of study and 8 hours of sleep is a good combination!

Why "Deep" Learning?

A neural network with many hidden layers is called a deep neural network, and training it is called deep learning. The depth matters because:

  • Layer 1 might learn simple features (edges in an image, word frequencies in text)
  • Layer 2 combines simple features into more complex ones (edges become corners, shapes)
  • Layer 3 combines those into even higher-level concepts (shapes become eyes, ears, faces)

This hierarchical feature learning is what makes deep networks so powerful. Each layer builds on what the previous layer discovered.

Training: How Networks Learn

ForwardPredictLossHow wrong?BackpropGradientsUpdateWeights
The training loop: forward pass → compute loss → backpropagation → update weights → repeat.

A neural network starts with random weights — it knows nothing. Training is the process of adjusting those weights to make accurate predictions:

  1. Forward pass: Feed input through the network, get a prediction
  2. Calculate loss: Measure how wrong the prediction is
  3. Backpropagation: Figure out which weights caused the error
  4. Update weights: Adjust each weight to reduce the error
  5. Repeat: Do this thousands of times with different training examples

After enough iterations, the random weights have been refined into a model that captures the underlying patterns in the data.

Types of Neural Networks

Different architectures are designed for different types of data:

Feedforward Networks (MLPs)

The basic architecture — data flows in one direction from input to output. Good for tabular data and simple classification tasks.

Convolutional Neural Networks (CNNs)

Specialized for images. They use small filters that slide across the image to detect patterns like edges, textures, and shapes. Powers image recognition, medical imaging, and self-driving cars.

Recurrent Neural Networks (RNNs)

Designed for sequential data. They maintain a "memory" that carries information from previous time steps. Used for text, audio, and time series data. LSTM and GRU are improved versions that solve the vanishing gradient problem.

Transformers

The architecture behind ChatGPT, BERT, and modern language models. They use "attention" mechanisms to process all parts of the input simultaneously, making them much faster than RNNs for long sequences.

What Can Neural Networks Do?

The applications are staggering:

  • Computer Vision: Face recognition, medical diagnosis from X-rays, autonomous driving
  • Natural Language: Translation, summarization, chatbots, code generation
  • Audio: Speech recognition, music generation, voice cloning
  • Science: Protein folding (AlphaFold), drug discovery, weather prediction
  • Creative: Image generation (DALL-E), video creation, game playing

Common Misconceptions

"Neural networks work like the brain." Not really. They're loosely inspired by biological neurons, but the similarity ends there. Real brains are vastly more complex and work very differently.

"More neurons = better." Not always. Too many neurons can lead to overfitting — the network memorizes the training data instead of learning general patterns. Choosing the right size is an art.

"Neural networks understand things." They don't. They're sophisticated pattern-matching machines. A network that classifies cat photos doesn't "understand" what a cat is — it has learned statistical patterns in pixel arrangements that correlate with the label "cat."

See It In Action

Reading about neural networks only takes you so far. To really understand them, you need to see data flowing through the layers, watch weights update during training, and observe how predictions improve over time.

Our interactive visualization lets you do exactly that — step through a forward pass, see every weight and activation, and build intuition for how neural networks transform inputs into predictions.

Where to Start

If you're new to neural networks, follow this path:

  1. Perceptron — The simplest neural network (one neuron)
  2. Forward Pass — Watch data flow through multiple layers
  3. Loss Functions — How we measure prediction errors
  4. Gradient Descent — How the network finds better weights
  5. Backpropagation — How errors flow backward to update weights
  6. Full Training — Watch a network learn from scratch

Each concept builds on the last, and our visualizations make the abstract concrete.

Related Articles

Interactive Visualization

Neural Network Forward Pass

See this concept in action with our step-by-step interactive visualization.

Try the Visualization