Fei Fang has saved lives. But she isn’t a lifeguard, medical doctor, or superhero. She’s an assistant professor at Carnegie Mellon University, specializing in artificial intelligence for societal challenges.

At MIT Technology Review’s EmTech conference on Wednesday, Fang outlined recent work across academia that applies AI to protect critical national infrastructure, reduce homelessness, and even prevent suicides.

Fang explained how a system she developed in 2013, while doing her PhD at the University of Southern California, is used every day to protect 60,000 passengers on the Staten Island Ferry in New York City.

There are more ferries traveling between Staten Island and Manhattan than US Coast Guard patrol boats in the same territory. Previously, one patrol boat would follow one ferry for the whole journey, leaving the other ferries unprotected. Fang and her team created an algorithm that makes the patrol routes random and unpredictable, with regular speed changes and U-turns, in hopes of deterring nefarious actions against the ferries.

“The feedback has been terrific. We’re protecting against potential attacks in high-risk zones by increasing randomness, making it harder to plan an attack,” she told the audience at EmTech.

“This can reduce the likelihood of a successful attack by half. Professional mariners have told us they now have better protection, but with the exact same number of boats,” she added.

Fang’s AI work is not only protecting people. She has applied a similar approach to help prevent animal poaching in Uganda, Malaysia, and China. The PAWS (protection assistant for wildlife security) system she developed predicts which areas have a high threat of poaching, allowing patrols to better target their limited resources.

Although the problems are different, the common solution lies in blending machine learning and game theory, she said.

Each challenge is conceptualized as a zero-sum, two-player game against two adversaries, where it’s very important to randomize patterns so it’s harder for attackers to find the weakest points.

She outlined how colleagues in the field are adopting similar approaches to detect illegal mining sites, crack down on predatory payday lending, and predict crop yields to help prevent hunger.

“There is a huge potential to develop AI without an immediate commercial benefit, but for the good of all of society,” Fang said.

“I believe with our continuous efforts, we can leverage the positive aspects of AI and build a better world,” she added.