We know that Homo sapiens (meaning the wise one) co-inhabited the earth with Neandertals. What’s more, DNA analysis proves that men and women of both species (or subspecies if you prefer), mated. Of course, there was no Valentine’s Day back when the daily grind for a working man meant bringing down a woolly mammoth with a sharp stick. But the same spark that draws men and women together today, must have been just as hot in prehistoric times. Otherwise, we wouldn’t be here.

Imagine the scene. The “wise one” is squeezing red clay in her hands to make a lovely pot, as she spots the big hairy brute lumbering toward her in his dashing leopard skin loincloth, and she starts thinking, “This guy’s the one.” Or the opposite, the chunky Neandertal woman, chewing on dry deer skin to make leather, is captivated by the brilliant skinny dude who can chip stones into intricate arrowheads and adorn cave walls with dazzling art, and says, “He’s mine.”

Since we are dealing here with consensual mating (the alternative is possible too, but that’s a different story), we need only consider the lady’s perspective, because it is the female who decides. Does she go with the big-chested bloke extending a fist full of wilted flowers and mastodon meat, or fall for the skinny one offering her lovely jewelry carved from exotic shells?

By and large, H. sapiens and H. neanderthalensis stuck to their own when it came to romance. This like-attracts-like is a strong behavioral drive in mating that continues today. Men and women tend to consort with and marry others who are of similar characteristics, what psychologists call assortative mating. We much prefer to become romantically involved with someone of the same race, and we also pick mates who are self-similar in education, height, body mass index, social positions, attitudes, religiosity and even genes. The biggest factor in mate choice is having a similar IQ and this is highly correlated with years of education.

But sometimes women marry up (the lady Neandertal bedding H. sapiens), and sometimes women marry down (the “wise one” female falling in love with the Neandertal). Psychologists have terms for this behavior of selecting mates outside one’s own group: “hypergamy” and “hypogamy,” for marrying up or down, respectively, but as with most technical jargon, the scholarly vocab contributes little. The question is, why do women do it?

We needn’t dwell on marrying up—gold digging everyone understands—but marrying down is another matter. What do women see in the dumb but lovable Neandertals they pick today and in the prehistoric mating game 100,000 years ago? This question is especially important now, because women are making the Neandertal choice more now than ever, and the trends are likely to continue into the future.

Generally, when a woman chooses a mate outside her own IQ or educational group, she tends to marry up. This tendency cuts across culture, ethnic group and race. Even in developing countries, such as Nigeria, romantic partners tend to have the same level of education, but when there is a difference in schooling, females usually marry up. This is the long-standing pattern in the United States, but it is an inescapable consequence of the fact that females were excluded from higher education. More recently, the number of females earning advanced degrees has climbed steadily, surpassing the number of males in 2003, while the trend line has been dropping for men. Now that the gender gap in education favors females, women in the modern world are more frequently marrying down when it comes to scholastic smarts and income.

At times and in places where choices are limited, women, with biological clocks ticking, will be satisfied with the Neandertal rather than remain unsatisfied—the CSN law of compromise under scarcity, “Love the One You Are With.” One can imagine that at times of male scarcity in the struggle for survival through ice ages, disease, and men killing each other in battle, the attractiveness of eligible males would rise, even if they were Neandertals.

An effect like this can be seen today. Mexican migrants to the U.S. are predominantly young, single men, creating a scarcity of marriageable men in Mexican communities with high rates of outward migration. Statistics show that women in such communities buck the trend and marry outside their educational group more frequently, because they have to widen their search. The same study shows that women in the United States who marry Mexican migrants, marry down in higher numbers, because women in the U.S. generally have a higher level of education.

Another development in the modern world contributing to a shift in women choosing to mate outside their co-equal group is the internet. A 2017 study finds that couples who meet online have significantly fewer attributes in common than the traditional face-to-face pairings between folks off-line, where the couple seeking romance is more likely to meet at school, among friends, or at religious venues.

But these patterns of mating outside one’s intellectual group are more complicated, because IQ is only one measure of intelligence. Likewise, level of education has socioeconomic underpinnings that partly reflect family background, and so IQ and level of education are tangled together with a complex knot of other factors that go into mate selection. Even height and IQ are correlated and largely genetically determined. Genes affect behaviors driving mate selection, but mating affects the gene pool. The many factors involved in mate selection, and the complex way they interact, can push the lady to select a mate who is outside her group in some respects but inside in others.

Despite the attraction to romantic partners who resemble ourselves, there is an advantage to mating someone who is different. There is a dark side to the tendency of likes-to-attract-likes. A study of Latinos in Mexico and Puerto Rico, published in the journal Proceedings of the Academy of Science in 2015 found that within this highly homogenous group, romantic partners had more similar genes than non-couples in the population. The shared genetic ancestry of these couples was equivalent to marriage between third and fourth cousins, increasing the risk of inherited disease.

Romantic partners tend to share the same psychiatric disorders, such as autism, schizophrenia and depression. The same goes for smoking, substance abuse and criminality. A 2017 study finds that people with criminal offences prior to marriage are significantly more likely to marry others with criminal records. After they became hitched, the spouses committed even more similar criminal offenses. To the extent that genetics contributes to such illnesses and criminal tendencies, this is something to ponder in terms of mating choices breeding future problems.

Inbreeding between early hominids was likely a problem in prehistoric times, and breeding outside one’s group has the advantage of increasing genetic diversity in the population. The Neandertal DNA in the H. sapiens genome today persists because it conveys survival value of some kind. For example, Neandertal genes involved in innate immunity that got mixed into H. sapiens DNA gave their descendants an advantage.

So, on Valentine’s Day, as you are standing there with a fist full of flowers you grabbed on the way out of Safeway, reflect a minute on what a momentous thing it is for someone to contemplate or commit to spending the rest of her life with you. What hangs in the balance is not only your lifetime of happiness as a couple, but the fate of the entire species. Looking back from a biological perspective at how our species has flourished the world over, she’s done a remarkably consistent good job. How she does it is one of life’s great mysteries, but clearly there’s more to it than being intellectually well-endowed.