“When it gets generalized to all of STEM, it’s misleading,” said Mr. Teitelbaum, a senior research associate in the Labor and Worklife Program at Harvard Law School. “We’re misleading a lot of young people.”

Unemployment rates for STEM majors may be low, but not all of those with undergraduate degrees end up in their field of study — only 13 percent in life sciences and 17 percent in physical sciences, according to a 2013 National Science Foundation survey. Computer science is the only STEM field where more than half of graduates are employed in their field.

If physicists and biologists want to enjoy the boom times in the digital economy, a few specialist start-ups will train them and find them jobs as data scientists and artificial intelligence programmers.

Insight Data Science Fellows Program, which has offices in New York, Boston, Seattle and Palo Alto, Calif., began its first training program five years ago and now has 900 alumni working at companies like Facebook, LinkedIn, Airbnb, Amazon and Microsoft. Jake Klamka, a physicist who founded the program, kept hearing from Silicon Valley executives that they had considered hiring traditional scientists, but converting them to technologists seemed time-consuming and risky. So Mr. Klamka decided he would start a company to provide scientists a smoother pathway into the tech industry.

Carlos Faham made that passage. He had an impressive academic career, with a string of grant awards and fellowships. His Ph.D. from Brown University was in dark-matter physics. After Brown, he was a postdoctoral fellow at the Lawrence Berkeley National Laboratory.

Dr. Faham loved the research, but after nearly two years he was feeling the strain of that life. By then, he had spent 12 years in college, graduate school and postgraduate research. His next step would be to compete for a handful of tenure-track teaching openings across the country. For the pricey Bay Area, he wasn’t making enough. A postdoc researcher typically makes $40,000 to $60,000 a year.

Dr. Faham had done serious programming for his physics research. He applied to tech companies, figuring they would be eager to hire someone with his intellectual firepower. He couldn’t get an in-person interview. He was told his background was too academic. He fumbled a couple of phone screening interviews because the statistical and machine-learning problems were unfamiliar to him.