HomeAI & Machine LearningCartPole REINFORCE: Policy Gradient with Baseline

CartPole REINFORCE: Policy Gradient with Baseline

Watch a real REINFORCE Monte-Carlo policy-gradient agent learn to balance a cart-pole from scratch in your browser — a softmax policy network trained live by true log-likelihood-ratio gradient ascent, with an optional baseline to cut variance.

AI & Machine Learning3DAdvanced60 FPS📱 Mobile-adapted⇄ 2D version
reinforcement-learning-policy-gradient-cartpole ↗ Open standalone

This simulator trains a real reinforcement-learning agent live, in the browser, on the classic cart-pole balancing task. A linear softmax policy network picks left/right pushes, and after every episode its weights are updated with the true REINFORCE Monte-Carlo policy-gradient rule — ∇log π(a|s) times the episode's discounted return, optionally minus a baseline to reduce variance. Watch the pole go from falling in a few steps to balancing for hundreds, while the learning-curve graph and live stats track episode length, running average, and the best run so far.

⚙ Under the hood

Watch a real REINFORCE Monte-Carlo policy-gradient agent learn to balance a cart-pole from scratch in your browser — a softmax policy network trained live by true log-likelihood-ratio gradient ascent, with an optional variance-reducing baseline.

reinforcement-learningpolicy-gradientREINFORCEcartpolecontrol-theoryneural-network

3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)