IBM's Rometty: How to survive when AI comes for your job

IBM's Ginni Rometty speaking at the 2016 Code Conference.
Asa Mathat | Vox Media
IBM's Ginni Rometty speaking at the 2016 Code Conference.

Whether artificial intelligence becomes a benefit or scourge for mankind depends ultimately on who "trains" the machines, said IBM CEO Ginni Rometty at the Code Conference.

Using IBM's Watson as an example, Rometty said that the famed AI chess champion is being "trained" by the world's best oncologists, which will ultimately result in substantially better health care.

As for AI replacing jobs that are based on repetitive tasks, "you aren't going to stop it," Rometty said.

The best option is more training and education for people who are displaced, a pattern that has repeated itself since the dawn of the industrial age, she said.

Artificial intelligence will create many jobs as it eliminates others, but the challenging thing for those displaced is that new opportunities do not always line up perfectly with the losses, she said.

CNBC's parent NBCUniversal is an investor in Recode's parent Vox, and the companies have a content-sharing arrangement.