Zero to AI Engineer

Module 4 of 54

Module 4: How Neural Networks Work

5 min read852 words
What you'll learn
Describe a neuron and what it doesExplain how neurons form layers and a networkUnderstand weights and activation in plain termsSee why "deep" networks are so powerful

"Stack up thousands of tiny, simple math units and something remarkable emerges — a network that can recognize faces, translate languages, and more."

Level: Beginner · Time: ~14 min · Prerequisites: Module 3

Learning Objectives

By the end of this module, you will be able to:

  • Describe a neuron and what it does
  • Explain how neurons form layers and a network
  • Understand weights and activation in plain terms
  • See why "deep" networks are so powerful

1. The Neuron: A Tiny Decision-Maker

A neural network is built from neurons — simple units that take some numbers in, multiply each by a weight, add them up, and pass the result through an activation that decides how strongly to "fire."

That's it. One neuron is almost trivially simple. The magic comes from connecting many of them. The design is loosely inspired by the brain — biological neurons also receive signals, combine them, and "fire" past a threshold — but an artificial neuron is far simpler: just a weighted sum and a small math function. Don't picture a tiny brain cell; picture a pocket calculator that does one add-and-decide step.

A neural network with input, hidden, and output layers connected by weighted links
A neural network with input, hidden, and output layers connected by weighted links

Explain like I'm new: Think of each neuron as a tiny voter that weighs its inputs and says "I'm 80% convinced." Thousands of these votes, layered and combined, add up to a confident final decision like "this is a photo of a dog."

2. Layers Make a Network

Neurons are organized into layers:

  • Input layer — takes the raw data (e.g., pixel values)
  • Hidden layers — transform the data, step by step
  • Output layer — produces the answer (e.g., "cat: 92%")

Data flows left to right, each layer passing its output to the next. Every connection has a weight — a number the network adjusts as it learns. A tiny digit-recognizing network, for instance, might take 784 inputs (the pixels of a 28×28 image), pass them through a couple of hidden layers, and end with 10 output neurons — one for each digit 0–9. The output neuron that "fires" hardest is the network's guess.

Key idea: Early layers learn simple features (edges, colors); deeper layers combine those into complex ones (shapes, then faces). "Deep learning" simply means a network with many hidden layers — depth is what lets it capture complexity.

3. Why Weights Matter

The weights are the network's memory — its learned knowledge. A freshly built network has random weights and outputs nonsense. Training (Module 5) nudges those weights until the network's outputs match reality. A trained network is really just a giant collection of well-tuned weights.

Real-world use case: Your phone's face unlock is a neural network. Pixel values enter the input layer; hidden layers detect edges, then facial features, then "is this the owner?"; the output says yes or no in milliseconds — all through weighted connections learned from example faces.

4. Activation Functions (Gently)

Between layers, an activation function adds a little "bend" so the network can learn non-linear patterns — the curvy, complex relationships real data has. Without activations, stacking layers would just be one big straight-line equation. Common ones (ReLU, sigmoid) are simple math tricks that unlock this power. You don't need the formulas yet — just the idea that activations let networks learn complex shapes.

Explain like I'm new: Imagine trying to trace the outline of a country using only straight rulers — you'd get a jagged, wrong shape. Activations are like being allowed to bend the ruler, so the network can trace the true, curvy boundary between "cat" and "not cat." Stack enough bends and almost any shape becomes traceable.

Hands-On: Try This

Try this: Search for the "TensorFlow Playground" (a free browser tool). Add hidden layers and watch the network learn to separate dots in real time. Seeing the boundary bend as you add neurons makes "layers learning features" click instantly.

Common Mistakes

Common mistake: Thinking more layers is always better. Bigger networks need far more data and computing power and can overfit (memorize noise). Start small; add depth only when the problem truly needs it.

✅ Checkpoint

  1. What does a single neuron do?
  2. What are the three kinds of layers?
  3. What does "deep" in deep learning refer to?

Answers: 1) Multiplies inputs by weights, sums them, applies an activation. 2) Input, hidden, output. 3) Having many hidden layers.

Key Takeaway: A neural network is many simple neurons (weighted sum + activation) arranged in input, hidden, and output layers. Data flows through, and the weights — adjusted during training — hold the learned knowledge. Early layers catch simple features, deeper ones combine them; "deep learning" just means many hidden layers, and activations let it learn complex, non-linear patterns.

Further Learning

Adapted from Microsoft's AI for Beginners (MIT License).