Train an MLP on XOR with Manual Backprop

hard
Unit 21 · Backprop & Attention0/1 to milestone

XOR famously can't be learned by a single linear layer, but one hidden layer solves it. Train a tiny network end to end with your own forward pass, backward pass and gradient descent.

Pro problem

Unlock this and every premium problem across all tracks — plus hidden-test grading, advanced AI engineering modules and new content every week.

Start 7-day free trial
solution.py · Python 3.13
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Train an MLP on XOR with Manual Backprop · TechGradify