Self-driving cars should swerve to protect young people over the elderly and humans over animals, according to the Moral Machine survey of more than two million people, conducted by researchers at the Massachusetts Institute of Technology.

The online survey presented participants with versions of the classic ethical conundrum known as the Trolley Problem, requiring them to choose between two options of who to hit with a car headed for a collision.

The researchers aimed to find areas of agreement and disagreement that could inform engineers developing software for autonomous vehicles in some of the biggest car companies in the world.

"There are so many moral decisions we make during the day and don't realise," says one of the MIT researchers, Edmond Awad, in a video for Nature. Awad is the lead author of a paper on the project published this week in that journal.

"In driverless cars, these decisions will have to be implemented ahead of time," he continues. "The goal was to open these discussions to the public."

Survey identified three areas of consensus

The survey — conducted via an online game, Moral Machine, that went viral, garnering input from 2.3 million people across almost every country in the world— suggested three key areas of consensus.

It found there was broad agreement on saving humans over other animals, larger groups over smaller groups or individuals, and children or young people over the elderly. Respondents also tended to favour individuals who were law-abiding, female or had greater social status.

Related story Jaguar Land Rover's prototype driverless car makes eye contact with pedestrians

However, the researchers also identified regional and cultural variation in the degree to which people agreed with these principles.

Based on these patterns of moral judgement, they grouped countries into three clusters — western, eastern and southern. The west includes most of Europe, as well as the USA, Australia and Brazil, while the east encompasses most of Asia.

The south is chiefly Latin American countries, along with France and its former colonies, like Morocco and Algeria.

Opinions vary around the world

The sparing of young lives is one area where these clusters showed a lot of variation. Respondents in the southern cluster were highly likely to preference children and young people, while those in the east showed them no favour over older people. Respondents in the west fell somewhere in between.

"Eastern countries seem to be more respectful of older people," says Jean-François Bonnefon, a professor at the Toulouse School of Economics and another author on the paper, in the same video.

The difference was also apparent when the Moral Machine asked respondents to choose between saving the life of a businessperson and someone who was homeless.

Related story Fully driverless cars receive go-ahead to operate in California

Across the board there was a tendency to preference the higher-status individual, this was greater in southern countries, where the researchers observed that there is generally more economic inequality.

Respondents in the southern cluster were also more likely than others to spare women, as well as fit people. The east slightly preferred to spare the lawful rather than jaywalkers, and pedestrians rather than drivers, while the west showed the greatest preference for inaction — leaving the car on its original course rather than swerving on the basis of an ethical judgement.

Survey will help align AI with human values

"In the grand scheme of it, I think these results are going to be very important to align artificial intelligence to human values," says Bonnefon.

"I so much hope that we can converge, that we avoid a future where you have to learn about the new ethical setting of your car every time you cross a border."

Most of the world's leading auto manufacturers are now working on driverless innovations, often in collaboration with tech companies like Waymo and Uber.

It's believed — including by the US Department of Transportation — that autonomous technology will make the roads safer and more efficient.

Anxiety around it still exists, however, and has flared up as the cars have been involved in their first fatal accidents. Earlier this year, Uber paused and re-evaluated its driverless vehicle testing after one of its cars killed a pedestrian.