In a time of intense corporate competition for talent, the technology company GSoft in Montreal provides the Chill Room, which features amenities for employee comfort. (Alex Tran/For The Hechinger Report)

Lunchtime yoga has just ended in the Chill Room, which is carpeted with AstroTurf and furnished with beach, beanbag and Adirondack chairs, a hammock, a playful mural of the city skyline and some potted plants.

The in-house barista, Sébastien, is serving coffee that will fuel an afternoon of work at long common desks that drip with cables, library-style carrels big enough for power-napping, a conference room with a table custom-made of 36,000 Lego blocks and a meeting area with bleacher-style seating. It’s all in a rehabbed 1913 industrial building in the Pointe-Saint-Charles neighborhood with exposed brick walls, blond wood floors and floor-to-ceiling windows.

If employees have any stress, they can blow it off on the indoor skateboard ramp, or by playing the vintage video games or the guitars strewn about one of the many break rooms, or with a round of “Magic: The Gathering,” a Dungeons and Dragons-style game, in the replica Airstream trailer.

It’s a typical day at GSoft, a technology company whose meteoric rise from its founding in 2006 has required a constant supply of workers — and the over-the-top amenities increasingly needed to recruit and keep them.

At a time of rising demand and infinitesimal unemployment, that’s gotten “really hard,” said Florian Pradon, candidate experience manager at GSoft. “Really, really, really hard.”

Now, many of the places that are finding it increasingly challenging to attract scarce talent are turning their attention to preventing that talent from leaving in the first place, responding with near panic to the suddenly rediscovered phenomenon of brain drain.

Florian Pradon, candidate experience manager at GSoft, says Montreal has no choice but to work to keep talent from leaving. (Alex Tran/For The Hechinger Report)

Many American states are struggling to stem a growing exodus of high school graduates to other states for college; once that happens, according to research in one largely rural state, a third do not come back.

Even in states that attract university and college students, graduates often pick up their degrees and move away.

That has long been a challenge in Montreal, which has a wealth of universities but loses many of its graduates to Toronto, Vancouver, B.C., and Calgary, Alberta. It also means this city and the surrounding province got an earlier start confronting brain drain than most other provinces, states and cities on both sides of the U.S.-Canada border, trying solutions to get graduates to stay and investigating why graduates leave and what can stop it.

“We’re ahead of the game in terms of awareness of the problem,” said Daniel Weinstock, director of the Institute for Health and Social Policy at McGill University in Montreal, which has received a grant of about $730,000 from the government of Quebec to study why people leave the province and what might make them change their minds.

Samantha Denzler, employee experience specialist at GSoft, says Montreal has a long history of defending its interests against the rest of Canada. (Alex Tran/For The Hechinger Report)

The province has taken measures such as providing capital for start-ups, teaching coding as early as kindergarten and requiring students in some fields to remain after graduation as a condition of financial aid.

“The government is working really closely with the private sector, realizing what they’re losing when people move away,” GSoft’s Pradon said. “It’s costing money. And people are leaving with knowledge.”

Despite its European style and bilingual charm, Montreal has been facing this problem for decades. More Canadians have left it and the surrounding province of Quebec every year since 1963 than have arrived, according to the Institut de la statistique du Quebec. As recently as 2014, twice as many moved out as moved in. The population has grown only because of international immigration.

That has given Montreal something of an inferiority complex, which flared with the separatist movement that peaked when sovereignty was narrowly rejected in a referendum in 1995. Even today, gift shops at Pierre Elliott Trudeau International Airport sell T-shirts that read, “Montreal vs. Everybody.”

“It’s just the long history of having to defend ourselves against the rest of the country,” said Samantha Denzler, one of Pradon’s colleagues at GSoft, where her title is employee experience specialist.

What Montreal and Quebec are doing — making financial aid contingent on graduates’ staying put, offering start-up funding to entrepreneurs, having experts study the brain-dran problem and propose additional solutions — may serve as a model for U.S. places that are also suddenly rediscovering brain drain and scrambling to address it.

With a record 7.1 million job openings in the United States at the end of October, some 46 percent of American employers have trouble recruiting the workers they need, the highest proportion since 2006, according to ManpowerGroup’s Talent Shortage Survey.

In Utah, the chairman of the State Board of Regents testified before the legislature that the shortage of skilled workers was so severe that his own financial-services company had to hire workers from India. New Mexico saw a net loss of 42,000 people from 2011 to 2016, including 17,000 with much-needed bachelor’s degrees, the University of New Mexico Bureau of Business and Economic Research found.

Vermont is offering $10,000 to people who move there to work remotely; the plan takes effect in January. Maine is offering a tax credit to help college graduates who relocate there repay their college loans.

States have turned to universities and colleges to stem this flow. With nearly half of Illinois high school graduates leaving for college out of state, the University of Illinois System has frozen tuition for a fourth straight year “to keep them here at home to study and to use their talents to move our state forward after they graduate,” as the system’s president, Tim Killeen, put it. Starting next year, the state will spend $25 million on new scholarships for residents who stay in Illinois for college.

A study of brain drain from Illinois found that a third of students who go elsewhere after finishing high school don’t come back. In Michigan, a survey found that an even higher proportion — 42 percent — of residents who graduated from public universities in that state still planned to leave. So did about half of nonresidents who studied there. Officials have launched a campaign to try to talk them out of it, called Choose Michigan.

In many places, the more advanced a graduate’s degree, the more likely that graduate will take it elsewhere. In Montana, 84 percent of associate-degree holders and 67 percent of bachelor’s-degree earners remained in the state one year after graduating, but only about half of doctoral recipients remained, state data show. Nearly 4 in 5 doctoral recipients who attended eight major universities — Indiana, Iowa, Michigan, Minnesota, Ohio State, Penn State, Purdue and Wisconsin — left those institutions’ states, research published in the journal Science found.

All of these trends have far-reaching effects on the economy, and they worsen divisions between areas where the economy is growing and those often rural or declining industrial regions where it’s not.

Quebec leverages financial aid to dissuade its graduates in some fields, such as health and medicine, from leaving.

Cecilia Rodriguez — whose family moved to Montreal from New Mexico — is required as a condition of her grant to stay for at least three years after she finishes her nurse practitioner program at McGill.

“It’s an incentive and sort of motivation,” Rodriguez said.

But Montreal’s experience also proves that in an age of increasing mobility, powerful forces are pushing students to leave.

“Long term, I can’t really see myself living here for the rest of my life. Number one is winter,” said Manuela Parra-Lokhorst, an international development major in her last semester at McGill.

Nathan Ladd is in his final year of studying immunology and plans to get a graduate degree in computer science. Both subjects are in high demand. “I like to think that if there’s a place I want to go, I’ll be able to,” Ladd said outside McGill’s main library. “I’ll go wherever the best offer is.”

And Graeme Denhoff-Ball plans to take his master’s in business administration to a broader stage. “There’s a lot more opportunity in Toronto,” ­he said. “I’m also ambitious. I want to go to the big city and test my mettle against everybody else.”

Montreal cannot change the weather or the fact that Toronto is larger. So it has turned to carving out a reputation in industries — artificial intelligence, video gaming — to trigger the interest of the people it wants to stay.

“That’s been kind of like a magnet,” said Paul Raymond, chief executive of the Montreal-based information technology consulting firm Alithya. “If the projects aren’t cool, the techies won’t stay.”

Quebec now has Canada’s highest proportion of people age 25 to 34 with degrees in science, technology, engineering and math who work in science and technology occupations, the government agency Statistics Canada reports. And the flight of Canadians from the province has slowed; last year, 28,738 left, and 22,232 arrived.

“Anybody who thinks that Montreal is going to become the economic center of Canada again, that’s not going to happen,” said McGill’s Weinstock. “So Montreal, having been in the doldrums for decades, no longer being the banking and financial services capital, has had to re­invent itself. Which is what ­medium-sized cities have to do: They have to identify sectors where they can thrive.”

That requires “trying to make the economic backdrop as attractive as possible,” said Doug Porter, chief economist of the BMO Financial Group in Toronto. “If you try to force students to stay and the jobs aren’t there, nobody’s going to be happy.”

There’s another trend emerging that could reverse brain drain, Porter said: Cities that once drew talent, on both sides of the U.S.-Canada border, have become expensive and crowded, encouraging college graduates to seek other places to settle.

“Maybe that’s the answer — for these smaller communities to sell their simpler, lower-cost lifestyle,” he said.

Toronto and Vancouver have fallen to the bottom of the Statistics Canada Life Satisfaction Index, while Montreal now comes in respectably above the average.

“Fortune,” Weinstock said, “will reward the ingenious.”

This report about brain drain was produced by the Hechinger Report, a nonprofit, independent news organization focused on inequality and innovation in education.