Skip to content
TeachTrails
Neural NetworksAI Basics

Neural Networks Explained Simply (With Interactive Demo)

What is a neural network? A plain-English guide to neurons, weights, layers and how networks learn from mistakes, with a neuron you can train in your browser.

Sudipta Biswas, AI Engineer

10 min read

Beginner friendly
NEURAL NETWORKinput layerhidden layer 1hidden layer 2output layerpixelscat 92%dog 8%

Every big AI tool you've heard of (ChatGPT, Claude, face unlock, Google Translate, AI image generators) runs on the same core idea: a neural network. The name sounds intimidating, but the building block is surprisingly simple, and by the end of this guide you'll have trained one yourself, in your browser, without writing any code.

What is a neural network?

In the machine learning guide you saw that computers can learn patterns from examples. A neural network is the most powerful way we know to do that. It's a chain of layers:

  • Input layer: the raw data, turned into numbers (pixel brightness, words, sensor readings).
  • Hidden layers: where the learning happens. Each layer finds patterns in the layer before it.
  • Output layer: the answer, such as “cat 92%, dog 8%” or the next word in a sentence.

Inside one neuron

Say a neuron must decide “will it rain?” It gets three inputs and gives each one a weight: how much that input matters. Clouds matter a lot (big positive weight), humidity matters too, wind actually makes rain less likely here (negative weight).

cloudy?1× 2.0humidity0.8× 1.5windy?0× −0.5Σ + biasadd it all upactivation0.95rain likely
One neuron: multiply each input by its weight, add a bias, then squash the total into a 0–1 score.

The neuron multiplies each input by its weight, adds them up, adds a bias (a nudge that makes it easier or harder to say yes), and runs the total through an activation function that squashes it into a score between 0 and 1. That's it. A neural network is just thousands or billions of these, wired together.

Try it: train a neuron yourself

Here's a real neuron with two inputs. First drag the sliders and try to separate rainy days from dry days by hand. Then press Train and watch the computer do it automatically:

🎮 Train a neuron to predict rain

Each dot is a past day: how cloudy and how humid it was, and whether it rained. The neuron must learn where to draw the line.

cloudiness →humidity →🌧🌧🌧🌧🌧☀☀☀☀☀
correct
4/10
loss (error)
0.78
training steps
0

These starting weights are random-ish, so the neuron guesses badly. Drag the sliders yourself, or press “Train” and let gradient descent fix them.

Dots with a red ring are on the wrong side of the line. Real networks do exactly this, just with millions of weights instead of three.

How neural networks learn

Nobody sets the weights by hand in a real network; there are far too many. Instead, the network learns them with a four-step loop:

1

Guess

Run the example through the network

2

Measure

How wrong was it? (the loss)

3

Blame

Backpropagation: which weights caused it?

4

Nudge

Gradient descent: adjust each weight a little

Repeat millions of times and the weights settle into values that give good answers.
  • Loss: a single number for “how wrong”. Lower is better.
  • Backpropagation: works backwards from the error to figure out how much each weight was to blame.
  • Gradient descent: nudges every weight a tiny bit downhill, towards a lower loss.

Why more layers make networks smarter

One neuron can only draw a straight line, as you saw above. Stack many neurons in many layers and the network can learn curves, then shapes, then whole concepts. Each layer builds on the one before:

🔍 What does each layer see?

Input

Raw pixels: just numbers for brightness and colour.

Nobody programs these features. The network discovers them during training because they help it get the answer right.

That's what deep learning means: neural networks with many layers. GPT-style language models have dozens of layers and billions of weights.

Types of neural networks you'll hear about

TypeBig ideaUsed for
Feedforward (MLP)Data flows straight through layersTabular data, simple predictions
Convolutional (CNN)Scans small patches of an imagePhotos, medical scans, face unlock
Recurrent (RNN / LSTM)Remembers earlier items in a sequenceOlder speech and text models
TransformerPays attention to every word at onceChatGPT, Claude, Gemini, translation
Diffusion modelLearns to turn noise into a pictureMidjourney, DALL·E, Stable Diffusion

The transformer is the one behind today's chatbots. You'll see exactly how it predicts text in the next part: how ChatGPT works.

The limits of neural networks

  • They need lots of data and computing power to train well.
  • They're hard to explain. Billions of weights don't tell you why an answer came out.
  • They learn whatever is in the data, including mistakes and unfair patterns.
  • They predict, they don't “know”. This is why chatbots can sound confident and still be wrong.

Where to go next

You now know what's inside every modern AI model. Next, see how a giant neural network turns all of this into conversation: how ChatGPT works.

Key takeaways

  • A neural network is many simple neurons arranged in layers.
  • Each neuron multiplies inputs by weights, adds a bias, and squashes the result.
  • Networks learn by guessing, measuring the error (loss), and nudging weights (gradient descent).
  • Early layers find simple patterns; deeper layers combine them into complex ideas.
  • Deep learning = neural networks with many layers. Transformers power today's chatbots.

Frequently asked questions

What is a neural network in simple words?

A neural network is a computer program made of many small, simple units called neurons, connected in layers. Each neuron takes some numbers in, weighs how important each one is, adds them up and passes a result on. By adjusting those weights over many examples, the network learns to turn inputs (like the pixels of a photo) into useful outputs (like “this is a cat”).

Is a neural network like the human brain?

Only loosely. The idea was inspired by brain cells that pass signals to each other, but artificial neurons are just simple maths: multiply, add, squash. Real brains are far more complex, use chemistry and timing, and learn very differently. Think of “neural network” as a name, not a copy of the brain.

What is the difference between machine learning, neural networks and deep learning?

Machine learning is the broad idea of computers learning from examples. Neural networks are one family of machine learning models. Deep learning means neural networks with many layers (“deep”), which is what powers modern AI like ChatGPT, image generators and voice assistants.

How does a neural network learn?

It starts with random weights and makes a guess. A loss function measures how wrong the guess was. Backpropagation works out how much each weight contributed to the error, and gradient descent nudges every weight slightly in the direction that reduces it. Repeating this over many examples gradually turns bad guesses into good ones.

What are weights and biases?

Weights are numbers that say how much each input matters to a neuron: a large weight means “pay attention to this”, a negative weight means “this points the other way”. The bias is an extra number that shifts the neuron's threshold, making it easier or harder to activate. Training is the process of finding good values for all of them.

🧠 Quick check: neural networks

  1. 1. What does a single artificial neuron do?

  2. 2. What is “training” a neural network?

  3. 3. What does “deep” mean in deep learning?

  4. 4. In an image classifier, what do the early layers usually detect?

AI for Beginners

Part 2 of 10: Neural Networks Explained Simply