A few years ago, Jason Sheltzer and Joan Smith were at a dinner party, chatting with a physics graduate student. When she offhandedly mentioned that she was the first female student her adviser had graduated in 20 years, they were appalled. “We thought that that was amazing,” Sheltzer told me. “Twenty years without a single woman!”

So Sheltzer, a biology graduate student, and Smith, a software engineer at Twitter, decided to take a more comprehensive look at the gender balance of American science labs to see if the physics student was part of a wider trend. They looked at 39 biology departments in more than 20 top research institutions in the United States and noted the numbers of male and female trainees (including graduate students and postdoctoral researchers) in each lab. Their results, published today in the Proceedings of the National Academy of Sciences, show that male faculty members are significantly less likely than female faculty to bring female trainees into their labs. On average, men’s labs had 47 percent female graduate students and 36 percent female postdocs, whereas women’s labs had 53 percent female graduate students and 47 percent female postdocs. Even more depressing: If the male professor had won a prestigious award, he was even less likely to take women into his lab. The study found that male postdocs were 90 percent more likely than women to have an adviser with a Nobel laureate. This feeds into a cycle: Because female trainees are boxed out of elite labs, it’s less likely that they’ll be considered for top academic jobs, where they could start their own labs and, hopefully, reverse the trend.

The finding isolates just one stage in what researchers call “the leaky pipeline problem”: Though women are well-represented in undergraduate science courses, fewer and fewer women appear at each subsequent level of study. Fifty-two percent of biology Ph.D.s are women, but their representation shrinks to 39 percent at the postdoc level, and only 18 percent at the tenured professor level. It’s not just biology, either: A 2012 study found that while 50 percent of Ph.D. candidates across the sciences are female, only 21 percent of tenured professors are women.

Even in traditionally female-dominated subfields like child psychology, the pipeline still leaks. One clinical psychologist who studies children told me that while the graduate students in her program are 95 percent female, only one of the seven tenured professors in her department is a woman. And a paleoanthropology graduate student said that while her department has been around for decades, it was only in the last few years that the first woman got tenure. “If you’re going to name someone famous in the field, 90 percent of the time, it’s a man,” she said.

While Sheltzer and Smith’s study shows that there are fewer women in high-powered academic positions, it doesn’t tell us why. And like all survey studies, this one can’t tell us anything about the practices and motivations of any individual male professor. “Not everyone who runs a lab with greater than 50 percent men is sexist or discriminating,” Sheltzer told me. One explanation proffered by gender essentialists is that women don’t like or just aren’t good at science and math. In a particularly unempirical Scientific American blog post published earlier this year, sociology student Chris Martin claimed that women “have a stronger nurturing tendency than men,” speculated that “this might explain why women show more interest in veterinary medicine than human medicine, animals being childlike in their behavior,” and asserted that “men, on average, are superior at mathematical reasoning.” These claims are scientifically questionable (gender differences could be a result of socialization, not innate traits, among other problems). But they also can’t explain why scientific programs experience a steady loss of women at each level. If women are truly uninterested in the sciences, why is the gender balance equal at the undergraduate and even the Ph.D. level, but unequal at higher levels? And why are female trainees less likely to end up in labs led by men?

When I interviewed nine female science students about their own experiences, they spoke to an alternate theory. Three of the students spontaneously disclosed that they or a close friend had been sexually harassed or assaulted by lab-mates or professors. The threat of harassment or assault can directly affect the decisions women make about their academic plans: Anonymous science blogger Acclimatrix wrote earlier this month that being harassed by a colleague led her to turn down a potentially career-advancing research trip with him because she felt unsafe.

Women in the sciences also report small but constant microaggressions from oblivious male colleagues. A former biology graduate student told me that a male postdoc in her lab said that her ponytail was “too flouncy for cancer research.” When she pressed him on what he meant, he smiled and said she didn’t belong. The paleoanthropology grad student mentioned that on a research trip, a male professor split up students by gender. “Women are good at sewing, and we want people with precise hands at this site,” he said. And a chemistry grad student recounted how after her organic chemistry class received their molecular model kits, her male professor warned the class that women would have to practice more, since men are better at 3-D reasoning. “From what I can tell, there are many people who mean well, but don’t understand the perspective of a [woman],” an electrical engineering graduate student told me. “[They] don’t know how their actions, although intended as jokes or a harmless comment, affect the recipients and bystanders.”

For female scientists who experience harassment, it just doesn’t seem worth it to take action in response to sexist behavior, or even assault. The women I spoke to told me that many academic departments lack established venues through which to report inappropriate behavior, or don’t make it clear to students how to do so, so navigating the process can be confusing and frustrating. Filing a formal complaint could have negative repercussions for the accuser, and even those who win their cases don’t always feel like they gain much from having reported the incident. One student told me that after a particularly stressful summer program led by a sexist male professor, she felt conflicted about whether or not to report him. “I realized there was not a lot I could do,” she said. “I had no choice but to keep quiet or risk losing whatever it’s taken to get to this point.” She’s not the only one: All of the women interviewed for this piece requested anonymity out of fear that they would be identified by their colleagues.

Instead of reporting men through official channels, some women in academia have developed a more discreet way to navigate around difficult male faculty: The grapevine. One student said that when she asked a senior female professor for advice, the professor suggested warning other women in their field about men who were hard to work with. Sheltzer speculates that this could help explain why there are fewer women in specific labs, especially elite ones: “If certain labs are rumored to be more hostile to women, not safe spaces, or have [principal investigators] who are less comfortable with their trainees taking maternity leave, that itself could spur fewer applications from women, if these rumors are known to the community,” he said.

Insensitive comments are frustrating, but at least they’re identifiable. Professors’ implicit biases are not always observable but are equally insidious. In a widely cited study, psychologist Corinne Moss-Racusin and her colleagues sent 127 biology, chemistry, and physics professors applications for a lab manager position. The same application was sent to everyone, but half the copies bore a male name, while the other half had a female one. They found that applications with the male name were judged to be more competent and hirable, and were offered a higher starting salary than those with the female name. Other researchers sent emails to professors posing as an undergrad seeking out a faculty mentor, using names that indicated different ethnicities and genders. They found that professors were most likely to respond to a student named “Brad Anderson,” and that in some cases, they were 25 percentage points more likely to respond to him than to hypothetical students like Meredith Roberts, Lamar Washington, LaToya Brown, Juanita Martinez, Deepak Patel, Sonali Desai, Chang Wong, or Mei Chen.

Practical pressures also disincentivize women from moving forward in the sciences. On average, a graduate degree takes five or six years to complete, so many women are applying for their first academic job in their late 20s or 30s—prime time for starting a family. And many studies support the fact that familial duties affect women’s ability to participate in academia. Female postdocs are more likely than male postdocs to have a partner who also works fulltime, and yet male postdocs are twice as likely as female postdocs to expect their spouses to make career sacrifices for them. Female postdocs with children spend more time on childrearing duties than their male partners, and are 35 percent less likely to get a tenure-track professor position than men with children. The expectation of women to make familial sacrifices affects how faculty members perceive female trainees even before they have kids. One psychology graduate student recalled that after a male professor saw her engagement ring, he asked about her post-grad school plans, warning her that marriage would “make things harder” and “limit [her] locations.”

These dynamics lead some observers to claim that women’s absence in academia is the result of their own choices. But the “choice” framing implies that women are in control of the situation, and ignores the many systemic issues that conspire to prevent women from moving forward in their fields. Universities can begin to address this problem by creating more serious repercussions for sexist behavior and protections for women who speak out against it, and adopting more flexible parental leave policies. Sheltzer suggests that male professors take a cold, hard look at their lab’s culture. They could make an effort to invite talented women to join their labs, and be more responsive to incidents that occur under their watch that “may make their labs not safe spaces for female scientists,” he says. Until that happens, we will continue to lose women through the leaky pipeline.