One of the reasons so few women work in tech is that few choose to study computer science or engineering. Only 18 percent of computer science graduates in the United States are women, down from 37 percent in 1985.

At a few top college programs, though, that appears to be changing.

At Carnegie Mellon University, 40 percent of incoming freshmen to the School of Computer Science are women, the largest group ever. At the University of Washington, another technology powerhouse, women earned 30 percent of computer science degrees this year. At Harvey Mudd College, 40 percent of computer science majors are women, and this year, women represented more than half of the engineering graduates for the first time.

These examples provide a road map for how colleges can help produce a more diverse group of computer science graduates. They also help answer a controversial question: Does the substance of computer science instruction need to be adjusted to attract women, or does recruitment and mentorship? It’s an important question because tech companies have so many jobs to fill, and because computer science skills have become necessary in almost every other industry, too.

So how have these colleges changed the ratio?

One factor is that more students of both sexes are choosing to major in computer science. That’s simply because they see plentiful jobs, the applicability to many professions and the attention tech is receiving in the business pages and in pop culture.