To us humans, one paper wasp looks pretty much like any other paper wasp. Most insects can't tell each other apart visually either - which makes the evolutionary path of one particular wasp species all the more intriguing.

The northern paper wasp (Polistes fuscatus) has evolved the ability to recognise the faces of its swarm-mates, joining the ranks of a mere handful of other wasps and bees who possess this social skill.

Now, new research has shown that this ability evolved really rapidly, just within the last few thousand years. This rapid evolution suggests, the researchers said, that increasing intelligence resulted in an evolutionary advantage.

"The big question we want to explore is how complex traits evolve. What is the mode and tempo of cognitive evolution?" said neurobiologist Michael Sheehan of Cornell University.

"The really surprising conclusion here is that the most intense selection pressures in the recent history of these wasps has not been dealing with climate, catching food or parasites, but getting better at dealing with each other. That's pretty profound."

It was back in 2002 that researchers discovered northern paper wasps used sight to identify each other. To determine this, they altered the faces of some wasps with paint, and found that these altered wasps copped more aggression from their nest-mates than wasps who had been painted in a way that didn't alter their markings.

As those altered wasps spent more time in the nest, aggression towards them declined - suggesting they became more familiar to their mates once more.

Such apparent facial recognition is rarely observed in insects, so the research team decided to investigate wasp genomes to figure out why the northern paper wasps can do what other wasps cannot.

The researchers compiled and compared the genomes of P. fuscatus and two closely related wasps that don't have facial recognition, P. metricus and P. dorsalis. They found pronounced cognitive changes in P. fuscatus just from the last few thousand years that did not occur in the other two wasp genomes.

"Recent, strong, hard selective sweeps in P. fuscatus contain loci annotated with functions in long-term memory formation, mushroom body development, and visual processing, traits which have recently evolved in association with individual recognition," the researchers wrote in their paper.

"Indeed, the prevalence of candidate cognition loci within the strongest selective sweeps suggests that the evolution of cognitive abilities has been among the strongest selection pressures in P. fuscatus' recent evolutionary history."

As we mentioned above, there are other insects that can recognise faces. Interestingly, these are also colony insects, such as the honeybee (Apis mellifera) and the tropical hover wasp (Liostenogaster flavolineata). They share a common dynamic, too - their hives and nests can have multiple queens.

In these colonies, the queens form a hierarchy, with one queen at the top, and the other queens taking subordinate roles; with L. flavolineata, for instance, only the dominant queen lays female eggs, and the subordinate queens produce males.

These queens can sometimes scuffle for dominance; the research team believes that facial recognition could allow them to keep track of whom they've bested, or been bested by.

"There are benefits to working in a group, but also costs to the individual," Sheehan said. "In these societies where multiple queens are interacting with one another, that's where recognition becomes so useful."

But the research has broader implications as a whole. It joins a growing body of work that indicates how cognitive evolution can be shaped by natural selection. And it shows that such cognitive changes can happen very quickly.

"Our finding indicated that cognitive evolution is not necessarily incremental," Sheehan said.

"There are mutations happening that cause big shifts. This suggests the possibility that rapid adaptation of cognitive ability could have been important in other species as well, like language in humans."

The research has been published in PNAS.