Training a Neural Network to Solve XOR

In this interactive tutorial, you'll learn how neural networks learn by training one to solve the XOR (exclusive or) problem - a classic challenge that simple linear classifiers cannot solve.

The XOR Truth Table

Input A Input B Output (A XOR B)
000
011
101
110

XOR outputs 1 when inputs are different, and 0 when they're the same.

What You'll Learn

  • How neural networks are structured with layers, neurons, and weights
  • How the forward pass computes predictions
  • How backpropagation adjusts weights to reduce error
  • How loss measures prediction accuracy
  • How to run inference on a trained network

Scroll down to begin the training journey ↓

Training the Network

The Trained Network

Running Inference