A Computer with Just 2 'Neurons' Can Learn to Ride a Bike

Virtual bike used in the study.
Virtual bike used in the study. (Image credit: Matthew Cook)

It doesn't take a whole lot of brain to ride a bicycle. In fact, it takes just two neurons — or, to be precise, two nodes on a digital neural network.

Matthew Cook, a researcher at the Institute for Neuroinformatics in Zurich, showed this in a self-published report from 2004, written when he was a professor at the California Institute of Technology. Cook studies thinking — how it works, how it's structured and how it evolves in response to the outside world. Building simple "neural networks" designed to solve specific problems can help researchers model the process of thinking in the brain or move toward smarter artificial intelligence.

To be clear: These neural networks don't involve stringing together any actual neurons. Instead, they're clusters of simulated nodes, or model neurons, on a computer that can interact with one another by strengthening and weakening their connections. These networks have proved remarkably talented at tackling, understanding and solving complex problems even without any information programmed into them in advance. [History of A.I.: Artificial Intelligence (Infographic)]

When Cook built a stripped-down two-node network, he found that, compared with human beings or a sophisticated, dedicated algorithm, it was more talented at piloting a bicycle in a little physics simulator — despite getting no direct information in advance about how to pull it off.

Everyone — algorithm, human or neural network — who tried to pilot the bicycle got the same information and means of control. They could watch the bike's speed, its direction, its position in space, the angle of its handlebars and how far it leaned to one side or another. And they could push and pull on the handlebars and apply a torque to the back wheel that simulated pedaling.

First, the algorithm got its turn. Cook built it to choose a "move" moment by moment in "what if" terms, by studying every possible outcome of every possible move: What move will keep the bike upright? What move will keep it moving in a straight line? Moving fast?

But the algorithm was bad at trying to do more than one thing at once. When told to focus on staying upright, Cook wrote, it would do weird "tricks," turning the handle in circles and not making forward progress. When told to move in a straight line, it would pedal forward for a moment before toppling. And when told to focus on speed, it would "swoop" the bicycle from side to side to generate little jumps in speed.

Anyway, Cook wrote, such an algorithm would be useless in the real world, where it couldn't predict the future well enough to make good judgments.

Next, humans got a turn, controlling the bike's motion with a keyboard and watching it on a screen.

"I had thought that, knowing perfectly well how to ride a bicycle in real life, it would be no problem in simulation," Cook wrote.

But he found that, without the physical sensations of riding a bike in the real world, the task was much more counterintuitive and complicated than he expected.

"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," he wrote. "Of course, if you stop to think about it, that is exactly correct. To turn right, the bicycle has to lean to the right, and the only way to make that happen is to shift the point of contact with the ground to the left, which requires an initial push to the left."

The paths of an un-steered bicycle after 800 pushes. (Image credit: Matthew Cook)

Still, Cook was able to learn to pilot the bike around reasonably well. And other people who tried the program figured it out as well. Based on his own experience and the descriptions other players gave him of their strategies, Cook built a simple two-node network that he felt could successfully learn to ride a bike.

The first neuron in the network senses the world of the bike and where it's been instructed to take the bike. It also decides how far it wants the bike to lean and in what direction. The neuron then sends that information to the second neuron in the network, which has direct control over the bike and decides what to do with those controls to make that lean happen. [Inside the Brain: A Photo Journey Through Time]

Immediately, this simple system picked up the task and worked out the parameters it needed to get the bike where it was told to go. At very slow speeds, it became unstable, but as long as the bike had a good head of steam going, it could pilot along some very complex paths.

The path, from waypoint to waypoint, that Cook trained the neural network to follow. He notes that any handwriting issues are his, and "not the fault of the bicycle." (Image credit: Matthew Cook)

The next step for this kind of project, Cook wrote, would be to build networks that don't just respond to stimuli, but develop and refine "beliefs" — ideas about why they need to do certain things to pull off their tasks, not just simple reflexes that let them do so.

Originally published on Live Science.

Rafi Letzter
Staff Writer
Rafi joined Live Science in 2017. He has a bachelor's degree in journalism from Northwestern University’s Medill School of journalism. You can find his past science reporting at Inverse, Business Insider and Popular Science, and his past photojournalism on the Flash90 wire service and in the pages of The Courier Post of southern New Jersey.