In Frank Schätzing’s 2004 sci-fi novel The Swarm, marine life develops a collective mind of its own. Whales band together to attack ships, while herds of jellyfish overwhelm the shores. It’s as if ocean creatures decided to jointly fight humanity, to try to reclaim their degraded environment.

Scientists say this scenario isn’t made up out of whole cloth. Animals do move in groups governed by the collective. Think of a flock of birds, a parade of ants, a school of fish — all are swarms like those envisioned by Schätzing, if not quite as murderous. “Animals regulate these vast collective structures without any leadership, without any individual animal knowing the whole state of the system,” says Nicholas Ouellette, a civil engineer at Stanford University. “And yet it works fantastically well.”

Photograph of a jackdaw in flight, with wings spread.

Jackdaws are highly social birds that sometimes travel in large flocks, making them a useful species for exploring how animals coordinate behavior in groups.

CREDIT: HEDERA.BALTICA / FLICKR

Researchers are now learning about how these swarms pull off such unusual feats. In the English countryside, birds have two distinct sets of rules for flocking, depending on the purpose of their flight. In Mexican forests, groups of ants have evolved computing-like search strategies to find their way around a disturbed environment. And in a lab in Germany, fish develop personalities that ultimately determine how they influence the rest of the school they are swimming with.

These aren’t just interesting observations about nature. Lessons from the natural world about animal group behavior could help humans better engineer our own future, collectively. Such knowledge could help scientists build drones that coordinate their flight like flocking birds, for instance, design packets of information to flow efficiently like foraging ants, or even develop ways to adapt to climate change like some fish do.

Flocks in flight

Ouellette studies how birds and insects fly, which might seem odd for someone whose background is in statistical physics. But he got interested in collective animal behavior because it lies at the intersection of many different types of science. Physicists see it as a living analog to the movement of points within an interconnected system, such as how particles and matter flow. Biologists see it as a subset of animal behavior. Either way, “it’s intellectually very exciting,” Ouellette says.

So a few years ago he began working with Alex Thornton, a biologist at the University of Exeter, England, who studies jackdaws (Corvus monedula). These highly social birds can travel in large flocks, sometimes mixed with rooks. Thornton and his colleagues track thousands of jackdaws in Cornwall, using multiple high-speed cameras to capture footage of the birds and produce three-dimensional maps of which bird flies where.

Among other discoveries, the scientists reported last year that jackdaws that pair with each other for life behave differently than unpaired birds when flying within a flock. Paired birds interact with fewer neighbors when looking for cues to which direction they should fly. Instead they rely more on their partner for information, which leads them to flap their wings more slowly and thus save energy.

On winter evenings, the jackdaws commute from their foraging grounds back to their nests, often gathering along the way at trees in “staging stops.” As the birds travel together toward their roosts they move in what’s known as a transiting flock.

To explore a different kind of coordinated group behavior, this time near the birds’ nests, Thornton and his colleagues placed a stuffed fox in the middle of a field to frighten the birds. The fox had a remote-controlled robotic bird in its mouth that flapped its wings limply. And the scientists broadcast recordings of other jackdaws making loud, scolding sounds that may signal the presence of a predator.

The fake fox worked. The jackdaws started flying around the fox, though in a completely different pattern than the scientists saw in the transiting flights. “The way the birds interacted with each other, and particularly the way they decided which birds to interact with, changed completely in the two kinds of flocks,” says Ouellette. He and his colleagues reported the findings in November in Nature Communications.

Analyzing the movements (colored lines) of individual jackdaws (black dots) within flocks reveals distinct flocking behaviors, as shown in these two videos. Top: As the birds fly between two locations, such as from their roosting site to their foraging site, they “transit” smoothly. Bottom: When faced with an apparent predator (not shown), the birds fly in a different pattern. Depending on the situation, jackdaws use different sets of rules to determine which neighboring birds to pay attention to, which in turn helps determine the density of the flock.

CREDIT: H. LING ET AL / NATURE COMMUNICATIONS 2019

Birds flying within a flock have to decide how many other birds they are going to pay attention to for cues on where to move. In a flock of 100 birds, each bird doesn’t need to pay attention to 99 others — it just needs to figure out how many birds to bother watching.

There are two ways birds can go about this. If they pay attention just to the birds within a fixed distance of them, scientists call that a metric interaction. If the bird pays attention to a certain number of birds nearby, no matter how far away they are, it is called a topological interaction. Flocks operating by metric rules behave differently than flocks operating by topological rules; the density of the flock matters only if it is following metric rules.

The group led by Ouellette and Thornton has shown that transiting flocks operate by topological rules. But the stuffed fox led to flocking by metric rules as the birds freaked out. Why the difference? “We don’t know,” says Ouellette. One possibility is that the birds may be trying to keep a certain distance between themselves and the fox. By doing so they start operating in metric mode, which they then use to govern their distances from other birds as well.

This change in behavior is surprising, he says — and might be transmitted among the animals by visual or sound cues as they fly around, calling to one another.

Algorithmic foraging

For the jackdaws, environment shapes behavior. The same is true for ants, says Deborah Gordon, a biologist at Stanford and author of an article on collective behavior in ants in the 2019 Annual Review of Entomology. She studies several species of ants and how they make collective decisions, such as when and where to forage for food.

All of the roughly 14,000 known ant species live in colonies, and so must share information in their search for food and other resources. Gordon studies how ants develop networks of interactions that allow them to pull this off.

Photos show representatives of two ant species.

Red harvester ants (left) and arboreal turtle ants (right) are among the roughly 14,000 species of ants that live in colonies and make decisions collectively.

CREDIT: LEFT: DAVE HUTH / FLICKR. RIGHT: WADE LEE / ANTWEB.ORG

One of her favorite species is the red harvester ant (Pogonomyrmex barbatus), which searches for seeds that are scattered across the landscape. A red harvester colony typically has some foragers waiting in the nest while others venture out for food. Studying these ants in New Mexico, Gordon showed that ants leave the nest at a rate determined by how often foragers return with food. The more food available, the more often foragers return to the nest; this, in turn, kicks off more ants leaving the nest. But if there is little food available, the rate of forager return slows and the whole process throttles down.

In 2012, working with her student Katherine Dektar and Balaji Prabhakar, a computer scientist at Stanford, Gordon calculated how information was flowing among the ants. The researchers found it was similar to the way Internet protocols regulate the rate at which data is transferred depending on how much bandwidth is available for transferring it. The scientists dubbed this naturally produced set of problem-solving rules the “Anternet.” The Anternet information seems to help the colony to forage efficiently.

Since then, Gordon has continued to explore the step-by-step problem-solving rules, or algorithms, that regulate how ants collectively search for food and make their way around the environment. She is now studying a tree-dwelling species from western Mexico known as the turtle ant (Cephalotes goniodontus). These ants travel entirely along tree branches and vines, laying down a pheromone trail behind them so that others can follow. The trails connect the ants’ nests and sources of food, forming a sort of communication network in which junctions in the vegetation serve as nodes.

But that network can be easily broken if, say, a windstorm breaks one of the vines. The ants then have to reestablish the trail connectivity. They do so by exploring and choosing new paths to get them around the break. It’s sort of like the way Google Maps suggests alternate routes to get around a traffic accident.

By mapping many paths and examples of how turtle ants found their way around a break, Gordon and her colleagues identified an algorithm that describes the ants’ behavior. The algorithm may not be the most efficient in any one situation, but it works well to find a new route in many different situations. This suggests that evolution has found ways for ant colonies to adapt to their ever-changing environment.

“Evolution has already done a lot of experiments for us, by shaping the way that the ants work collectively to respond to different kinds of conditions,” she says.

Graphic shows a map of turtle ants’ pathways through trees. One panel shows a map in which one pathway is blocked; the next shows how ant traffic patterns changed to a number of alternate routes; the final shows that most ant traffic is now following one main new route.

When faced with an obstacle blocking their usual routes, tree-dwelling turtle ants explore multiple alternative routes before settling on one. Here, researchers disrupted the ants’ usual network of paths (left), but within hours the ants were exploring several new workarounds (center). By the following day (right) the ants had eliminated most of those possibilities and had settled on one main new trail.

Swimming schools

Jolle Jolles, a behavioral biologist at the University of Konstanz in Germany, has also been thinking about collective behavior in the environment. He studies how the individuality of animals affects how they behave within a group — mostly in the fish species known as the three-spined stickleback (Gasterosteus aculeatus).

Biologists studying collective behavior often choose to use fish, in part because they are relatively easy to work with. It’s a lot easier to raise minnows in a tank than to chase jackdaws around southwestern England or ants through a Mexican forest. Sticklebacks in particular are popular and are hardy enough to survive being washed down a drain, as Jolles knows too well. Perhaps most important, sticklebacks also show a huge range of behavior, both individually and in groups, and are well studied. “They are really great little fish,” he says.

Traits of individual sticklebacks include sociability — how closely a given fish likes to hang out with other fish — and boldness, which is how likely a fish is to take risks to find food. In work published in 2018, Jolles showed that schools of fish made up of randomly selected individuals swam in groups that behaved quite differently from one another, even when tested in different kinds of environments. Some groups swam consistently faster, with the fish more aligned with one another than they were in other randomly assigned groups. That suggests that individual differences among fish helped shape their collective actions. The fish could be picking up on visual cues from other fish, and perhaps relying on information from sensory organs that detect movement and other changes in the water. “These group-level behaviors are a result of individual behaviors,” he says.

In Lake Constance in central Europe, fish known as three-spined sticklebacks swim in dense, coordinated schools. The behavior of individual fishes can influence the behavior of the group as a whole.

CREDIT: JOLLE JOLLES

In experiments involving 80 fish over a 10-week period, Jolles and his colleagues found that bold fish tended to remain bold, as shown by the time spent away from the deep, sheltered end of a tank to venture into bright, shallow areas and look for food. In contrast, shy fish ventured out more and more as the experiments went on, the team reported last year in Animal Behaviour. That suggests that shy fish are less predictable in their behavior over the long term.

Jolles has also worked with robotic fish to explore his ideas. In recent, soon-to-be-published experiments with collaborators in Berlin, he put guppies into a tank with a robofish. The scientists could program the robofish to display all sorts of behavior, including being extremely social with the guppies. With it, the researchers were able to show that the individual speeds of various guppies — which wouldn’t seem like that important a factor — turned out to be the major force that drove patterns in how the fish schooled together.

Jolles is now trying to expand his ideas to other animals, hoping to find universal laws underlying the collective behavior of species from elephants to killer whales. Such laws could show how different traits, such as boldness in sticklebacks, determine which animals end up leading the group and how the group behaves as a whole.

Collective wisdom

From birds to ants to fish, studies of collective behavior have illuminated the basic workings of many animal species. But there are also broader implications for humans. Engineers can take lessons from animals that swarm effectively together to build better swarms of small robots.

Imagine a set of drones hovering over a dam to inspect it. Like the jackdaws, they have to use some sort of rules to determine how far away to fly from their nearest neighbor. If the wind is calm, they might be able to count neighboring drones, through topological rules, to figure out their best position. But if the wind picks up, disrupting the whole flock, they might need to shift to metric rules to avoid crashing into one another.

And understanding how ants collectively adapt to changes in their network, such as when a tree blows down, could help researchers develop flexible and responsive rules for how robots navigate an unfamiliar and changing environment, such as in a burning building. “That’s a lesson for engineering,” Gordon says.

The behavior of swarming animals could even reveal clues for adapting to perhaps the biggest threat of all: climate change. Jolles plans to soon start tracking several species of fish, including sticklebacks, in mountain rivers in the Spanish Pyrenees that are vulnerable to drought and rising temperatures. By studying individual differences among the fish as well as how they behave collectively, Jolles hopes to learn which of them are most resilient in a changing climate and why. “I want to understand how fish can deal with these harsh conditions to help make predictions for the future,” he says.