Here's a scary chart* that shows that only white males stick with their plans to major in STEM fields in college:
This paper goes on to show that the racial gap in sticking with STEM majors is entirely explained by preparedness/ability (SAT scores etc); i.e. since affirmative action policies lead black Duke students to underperform their white peers, and since STEM majors are harder than humanities majors, more black students switch to the easier majors. BUT, the male/female gap is not explained in this way (as you might expect, since a majority of the Duke student body is female, and they are therefore definitely not being targeted by affirmative action policies.)
So what the heck is going on with the girls? Stably with respect to all kinds of aptitude/background controls, almost 20% of girls switch from STEM to humanities majors. Is it possible that high school STEM education is so bad that girls don't realize their humanities-leaning preferences until college? Do women care more about grades and therefore lean towards the majors with more grade inflation? (This entanglement between STEM classes, cognitively hard/quantitative classes, and classes with relatively low grade inflation, makes it very hard to distinguish between many of these explanations...) Is the impact of STEM professor gender, known to be at least a contributor to this gender gap, actually large enough to explain most of this away?
There's lot of research on STEM participation/achievement gender gaps but I've seen little that looks at this specific choice to switch from a career in science to the humanities**. That switch is the most interesting piece of the puzzle to me: if girls aren't as good at science or they don't like science, fine, but if they want to be scientists and aren't realizing that dream, the educational system may be failing them.
**Please do send me other papers that I might've missed :)
Update: Correction: 70% of the black student body at Duke is female, not the overall student body.