This summer, the Google X lab launched a balloon into the stratosphere over Peru, and it stayed there for 98 days.

Launching balloons into the stratosphere is a usual thing for the Google X lab—or just X, as it's now called after spinning off from Google and nestling under the new umbrella called Alphabet. X is home to Project Loon, an effort to beam the Internet from the stratosphere down to people here on Earth. The hope is that these balloons can fly over areas of the globe where the Internet is otherwise unavailable and stay there long enough to provide people with a reliable connection. But there's a problem: balloons tend to float away.

That's why it's so impressive that the company managed to keep a balloon in Peruvian airspace for over three months. And it's doubly impressive when you consider that the navigation system can only move these balloons up and down—not forward and back or side to side. They move like hot-air balloons—avoiding the weather or catching it at the right time, rather than pushing right through it—and that's because a more complex navigation system would be too heavy and too expensive for the task at hand. Rather than navigate Peruvian air space with some sort of jet propulsion system, the Loon team turned to artificial intelligence.

We use the term—artificial intelligence—in the broad sense. And why not? Everyone else does. But whatever you want to call the new algorithms that guide these high-altitude balloons, they're effective. And they represent a very real and very large shift across the tech world as a whole.

In the beginning, you see, the Loon team guided its balloons largely with handcrafted algorithms, algorithms that would respond to a predetermined set of variables, like altitude, location, wind speed, and time of day. But the new algorithms make greater use of machine learning. By analyzing massive amounts of data, they can learn as time goes on. Based on what has happened in the past, they can change their behavior in the future. "We have more machine learning in more of the right places," says Sal Candido, the former Google search engineer who oversaw this work on Loon. "These algorithms are handling things more efficiently than any person could."

That doesn't mean that these algorithms always make the right choice. Candido holds a PhD is what's called stochastic optimal control. That means he specializes in trying to control stuff in the face of uncertainty, and he's putting this training to good use. When you launch a balloon into the stratosphere, there's an awful lot of uncertainty, and you can't change that. But with help from machine learning, Candido and team are finding better ways of managing it.

When the team first started the Loon project, they thought the only way of blanketing an area with Internet coverage would be to launch scads of balloons and let them float over vast distances. But now, they have far more control over where they float, and ultimately, that means they can beam the Internet down to Earth with fewer balloons. "Instead of being of over oceans," Candido says, "we can spend more time over users."

The rise of machine learning inside Project Loon is kinda like what's happening across all of Google—and across so many other companies too, including Facebook and Microsoft and Twitter. Most notably, these companies are moving towards deep neural networks, algorithms loosely based on the networks of neurons in the human brain. This is what recognizes the commands you speak into your Android phone, identifies faces in photos posted to Facebook, helps choose links on the Google search engine, and so much more. In the past, engineers hand-coded the algorithms that drove Google Search. Now, algorithms can learn on their own, analyzing mountains of data showing what people click on and what they don't.

Project Loon's navigation system does not use deep neural networks. It uses a another form of machine learning called Gaussian processes. But the basic dynamic is the same. And it underlines the little acknowledged reality that deep learning is just part of the AI revolution. Over the course of Project Loon, the company has collected data on over 17 million kilometers of balloon flights, and through those Gaussian processes, the navigation system can start predicting what course the balloon should take, when it should move the balloon up and when it should move the balloon down (which involves pumping air into a balloon inside the balloon—or pumping the air out).

These predictions aren't perfect—in large part because of the weather up in the stratosphere is so, well, unpredictable. The stratosphere sits above a lot of the weather, but according to Candido, the balloons have encountered far more uncertainty than the team expected. So, they've also beefed up the navigation system with what's called reinforcement learning. After the predictions are made, the system continues to collect additional data on what the balloon is facing—what's working and what's not—and then it uses this data to hone its behavior.

In broad terms—(broad terms can be good!)—this is how another team of Google researchers built AlphaGo, the artificially intelligent system that recently beat one of the world's top players at the ancient game of Go. The system learned to play the game by analyzing millions of humans moves, and then, as it played game after game after game, it improved its abilities through reinforcement learning, keeping careful track of what is successful and what isn't. The designers of AlphaGo believe these same techniques can apply to robotics and all sorts of other tasks, both online and off.

None of this is magic. It's just data and math and processing power—lots and lots of processing power. As Candido says, Loon's navigation system is only possible because it can tap into enormous Google data centers can process information across thousands upon thousands of machines. He also says that Loon's machine learning is far from perfect. And that too is true of machine learning in general. Very true. Artificial intelligence isn't always intelligent. It doesn't always get us where we want to go. But as time goes on, it's getting better at getting us where we want to go—even in the stratosphere.