Have you ever worried that robots would one day make humans obsolete? A new study suggests you might not be too far off base.

Four researchers from Boston University and Columbia University simulated an economy featuring two types of workers – high-tech employees who produce new software code, and low-tech workers who produce human services (people such as artists, priests, psychologists and the like).

At first, high demand for code-writing high-tech employees increases their wages. However, over time, the amount of legacy code grows. As this happens, and as some smart machines become better able to learn tasks, writing new code becomes redundant, the authors state.

Demand for code-writing high-tech workers then becomes limited to those who are needed for general code maintenance like updates and repairs. The rest of the high-tech workers end up going into the service sector, which consequently pushes down wages for employees in that industry. And lower incomes reduce the amount of goods and services that workers are able to buy.

While there can be several of these so-called “boom-bust” tech cycles, over time robots “can leave all future high-tech workers and, potentially, all future low-tech workers worse off,” the paper states. “In short, when smart machines replace people, they eventually bite the hands of those that finance them.” The model also predicts a long-run decline in labor’s share of income, which has been underway in the U.S. since the 2000s, as well as “a growing dependency of current output on past software investment.”

So what can be done to stem the impact of our robot overlords? One solution may be to tax those who initially see benefit from the new technology and then use the proceeds to supplement workers’ pay once wages start to wane, the authors said.

The model’s “central message is disturbing,” the paper states. “Absent appropriate fiscal policy that redistributes from winners to losers, smart machines can mean long-term misery for all.”