It Takes Two Neurons To Ride a Bicycle¶
Source: Fermat's Library — annotated version
Date Published: 2004 (NIPS 2004)
Author: Matthew Cook (California Institute of Technology)
TL;DR¶
A classic paper from NIPS 2004 demonstrating that a remarkably simple two-neuron network can control a bicycle in a desired direction. The network achieves accurate long-range goal following while stability issues dominate short-run behavior — not by explicit design, but as a natural consequence of how the network controls the bicycle.
Abstract¶
"Past attempts to get computers to ride bicycles have required an inordinate amount of learning time (1700 practice rides for a reinforcement learning approach, while still failing to be able to ride in a straight line), or have required an algebraic analysis of the exact equations of motion for the specific bicycle to be controlled. Mysteriously, humans do not need to do either of these when learning to ride a bicycle. Here we present a two-neuron network that can ride a bicycle in a desired direction (for example, towards a desired goal or along a desired path), which may be chosen or changed at run time."
The Counterintuitive Physics¶
The author describes riding a "virtual bicycle" and finding it surprisingly difficult despite being an experienced real-world cyclist. The key insight: to turn right, you must first push the handlebars to the left, shifting the point of contact to initiate a lean. Once leaning, the bicycle's inherent stability mechanism pushes the handlebars right with even greater force.
"I even thought at first that there must be a bug in the simulator, since to turn right I found I had to push the handlebars to the left."
Methodology: The Simulator System¶
The Physics¶
A general-purpose robot simulator reads a description of an arbitrary robot (rigid bodies linked by hinge-like connections) and simulates motion given applied forces.
The Bicycle Robot¶
Four rigid bodies: two wheels, the frame, and the front fork. Sensors provide: position, heading, speed, handlebar angle (and rate of change), and lean angle (and rate of change). Actuators: torque on the back wheel and torque on the handlebars.
The Controller¶
The controller does not know the specifics of the bicycle's proportions or masses — mirroring the human experience.
Three Controller Styles¶
1. The Prescient Controller (Reinforcement Learning)¶
Cheats by using the simulator to test three actions at each step (push left, push right, or no touch), simulating each to see which keeps the bicycle upright longest. This approximates one step of policy iteration starting from the null policy.
2. The Human Controller¶
Based on the author's own intuition. Uses different regimes: for small lean angles, countersteer; for moderate, use lean as proportional control; for large, aggressively turn into the lean. Accurately tracks targets but produces a "wiggly" path.
3. The Two-Neuron Controller¶
A minimal network that can ride the bicycle in any desired direction. Neurons use simple activation functions and connect directly to sensor inputs and actuator outputs.
"The title of this paper is unproven. We have not ruled out the possibility that a single neuron could ride a bicycle."
Key Insights¶
- The two-neuron network is very accurate for long-range goals but stability issues dominate short-run behavior
- This happens not by explicit design but as a natural consequence of the network structure
- Humans also exhibit this same pattern — accurate destination reaching with short-term wobbles
- The approach demonstrates that complex control tasks can emerge from remarkably simple neural architectures
Key Takeaways¶
- A two-neuron network can successfully control a bicycle — a surprisingly minimal architecture for a complex dynamical control task
- The network achieves long-range goal accuracy while short-term stability issues naturally emerge
- The counterintuitive physics of bicycle control (countersteering) makes the problem harder than it appears
- Simple neural architectures can capture complex control dynamics without explicit mathematical modeling of equations of motion
- The paper challenges assumptions about the complexity required for sensorimotor control tasks