An AI learning to balance
The purple cart can only do two things: push left or push right. Nobody tells it which is correct. It starts out choosing at random, the pole falls, and it tries again. Each batch of failures nudges it towards whatever kept the pole up a little longer. This is reinforcement learning, running on gradlab, an engine written from scratch. All of it happens in your browser.
What it is doing right now
Loading…
How long it stays up, as it practises
Each point is the average of 8 practice attempts. The top of the chart is 10 seconds, where an attempt is stopped and counted as a success.
Try it
Knock the pole to see whether it can recover. Before practice it cannot. Afterwards it usually can.
Progress
- Practice attempts 0
- This attempt 0.0 s
- Longest on screen 0.0 s
- Recent practice average not started
About this agent
- What it sees 4 numbers
- What it can do push left or right
- Parameters
- Starts with random weights
The four numbers are the cart's position and speed, and the pole's angle and how fast it is tipping. An attempt ends when the pole leans more than 12° or the cart leaves the track. Every run of this page learns from scratch, so no two runs are the same.