Would you feel relatively sanguine if your job were at risk of being automated? You might if you lived in Sweden. That's because most Swedish workers who are replaced by machines fairly quickly land another job as good as their old one, thanks to a network of job security councils jointly run by industries and unions that retrain laid off workers in skills that are still in demand and out of reach of robots. Moreover, while unemployed and learning new skills, workers are buoyed by a safety net that includes generous jobless benefits.

"Our system of retraining could be better, but it's better than those in most countries," says Carl Melin, research director at Futurion, a union-funded Stockholm think tank.

That's great for Sweden, but challenges remain for much of the rest of the world.

Here's why. A recent report by consultants McKinsey Global Institute states that millions of jobs worldwide are at risk of being automated by 2030. As alarming as that sounds, the labor market upheaval caused by rapidly advancing technologies, including artificial intelligence and robotics, should still have a happy ending. Because McKinsey also says that the inevitable march of mechanization will likewise spur greater productivity, boosting wages, consumption and economic growth – thus creating a boom that leads to an even greater number of new jobs.

But there's a big caveat to reaching that win-win scenario: retraining and public assistance programs at an unprecedented level will be needed.

(MCKINSEY&COMPANY/MCKINSEY GLOBAL INSTITUTE)

"This will require training at the mid-career level at a scale we've not seen in this country (the U.S.), or any other country before," says Susan Lund, a McKinsey partner and one of the study's co-authors.

The McKinsey report says up to 800 million jobs could be automated by 2030, or a third of the global workforce. Many of those workers will quickly find new, similar jobs. But as many as 375 million people – including around 23 percent of U.S. workers – will see their jobs become defunct, forcing them to find new occupations. There's a silver lining in McKinsey's prediction, however: new technologies could also deliver as many as 890 million new jobs.

But for now, the kinds of training and support needed to help workers overcome the onslaught of automation is pretty much limited to Sweden and a handful of other countries. Most developed nations around the world have been spending less on worker training and unemployment benefits.

The U.S., for example, spent just 0.05 percent of gross domestic product (GDP) on income support (including unemployment insurance) in 2015 – 37 percent less than 25 years ago, and one of the lowest amounts among members of the Organization for Economic Cooperation and Development (OECD), the global economic body. That's a problem, explains Mark Muro, a senior fellow at Washington think tank the Brookings Institution, because strong financial support is key for retraining efforts to work.

"We need to take the pressure off people so that they can make the transition," more smoothly, he says.

Meanwhile, the U.S. spent just 0.03 percent of its GDP on labor training in 2015, a decline of 63 percent from 1993 levels. One way to compensate for relatively small amounts of public funding is for industry to spend more on training, Lund says. "We are not saying the government needs to do it all."

Indeed, while Sweden's federal unemployment agency also runs retraining and counseling schemes, the industry-union councils do a better job of tracking which jobs and skills are most in demand, and they can adapt more quickly to market changes, Melin says. One council, TRR Trygghetsradet, had a success rate of 90 percent last year, and 34 percent of those re-employed workers found jobs that paid the same or more than their former ones.

Swedish union officials and members don't feel the need to fight against automation, Melin says, because of the resources available to laid-off members that support them while they are idled. "In the long run, they know employers are less competitive if they're not upgrading technologies." And that union flexibility allows companies to more freely invest in money-saving technologies, which is why they're happy to spend 0.3 percent of their total wage costs in supporting the councils.

A few other countries have also found success in helping the jobless find new work. Germany, for instance, refashioned its national unemployment agency into a job-matching entity that gives career advice and vouchers to cover retraining costs. "It's become more of a one-stop shop to make the transition more smooth," explains Thomas Biegert, a sociologist at the London School of Economics. Nevertheless, while Biegert credits that effort, and other reforms of Germany's unemployment system, with having greatly reduced its unemployment rate, his research finds that such success came at a cost. Many workers migrated into "precarious jobs" that were part-time or temporary.

In the U.S., not only is funding scarce for midcareer retraining programs, but many stumble because they fail to train people in skills that industries actually need. There's not enough effort to collect and use job-projection data, Muro says. "There's no intel on where to work, even if there's a hot job market just 200 miles away."

There are, however, some bright spots, particularly at the state and regional level, Muro says. Two examples he points to: Ascend, a scheme created by businesses, foundations and universities in central Indiana that aims to generate better data to find gaps in the state's workforce, train workers in skills industry needs and help match those workers to companies with openings. Another effort, Skillful, is a collaboration between organizations such as the Markle Foundation, LinkedIn and the state of Colorado that's also crunching data to ensure training programs are better aligned to industrial needs.

Still, while Sweden's job security councils and generous safety net have encouraged Swedish workers to more fully embrace job-stealing technologies, many workers remain troubled by the accelerating pace of automation, Melin's latest research indicates. "We see the average age (of workers needing retraining) going down every year," he says. Increasingly, workers only in their mid-30s are finding their skills are out of date.