Yet the pipeline is more fruitful than tech companies make it out to be. Among young computer science and engineering graduates with bachelor’s or advanced degrees, 57 percent are white, 26 percent are Asian, 8 percent are Hispanic and 6 percent are black, according to American Community Survey data. At the top 25 undergraduate programs, nearly 9 percent of graduates are underrepresented minorities, according to Education Department data analyzed by Maya A. Beasley, a sociologist at the University of Connecticut.

But technical workers at Google, Microsoft, Facebook and Twitter, according to the companies’ diversity reports, are on average 56 percent white, 37 percent Asian, 3 percent Hispanic and 1 percent black.

One issue is that black and Hispanic computer science and engineering graduates are less likely than white and Asian ones to go into tech jobs. Forty percent of young Asian graduates do so, compared with 16 percent of black graduates and 12 percent of Hispanics, according to American Community Survey data.

Meanwhile, 10 percent of black computer science and engineering graduates have office support jobs, which include administrative support and accounting jobs, compared with 5 percent of white graduates and 3 percent of Asians.

Ms. Beasley studied why talented black students ended up in lower-paying, lower-status careers for her book “Opting Out: Losing the Potential of America’s Young Black Elite.” Those who studied science and technology were less likely than white students to stick with their majors when they felt they were underperforming, she found. Those who did stick with their majors were less likely to apply for technical jobs. They often pursued nonprofit or business work instead, she said, sometimes because they had heard negative things about the culture at tech companies, and seen how few black people worked there.