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 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."

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

Researchers are now learning about how these swarms operate. 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 determine how they influence the rest of the school they are swimming with.

These aren't just interesting observations about nature. Lessons from 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, or design packets of information to flow efficiently like foraging ants.

Flocks in flight

Ouellette studies how birds and insects fly. 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. Thornton and colleagues track thousands of jackdaws in Cornwall, using high-speed cameras to capture footage of the birds' flight paths.

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 in what's known as a transiting flock. To disrupt that behavior, Thornton and colleagues placed a stuffed fox in the middle of a field and broadcast recordings of other jackdaws making sounds that might signal the presence of a predator. The jackdaws started flying around the fox in a completely different pattern than 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.

There are two ways birds within a flock can decide how many other birds to pay attention to for cues on where to move. If they pay attention just to the birds within a fixed distance of them, scientists call that a metric interaction. If a bird pays attention to a certain number of birds nearby, no matter how far away they are, it's a topological interaction. Flocks operating by metric rules behave differently than flocks operating by topological rules.

Transiting flocks operate by topological rules. But the stuffed fox freaked the birds out, switching them to metric rules. Why? "We don't know," says Ouellette. Perhaps the birds may be trying to keep a certain distance from the fox. That would put them in metric mode, which they then use to govern their distances from other birds as well.

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 how ants make collective decisions, such as when and where to forage for food.

One of her favorite species is the red harvester ant (Pogonomyrmex barbatus), which searches for seeds scattered across the landscape. A red harvester colony typically has some foragers waiting in the nest while others venture out. Studying these ants in New Mexico, Gordon showed that they 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 kicks off more ants leaving the nest. But if little food is available, forager return slows and the process throttles down.

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. (LEFT: DAVE HUTH / FLICKR. RIGHT: WADE LEE / ANTWEB.ORG)

In 2012, working with her student Katherine Dektar and computer scientist Balaji Prabhakar, Gordon found that information flowing among the ants was similar to the way Internet protocols regulate the rate of data transfer depending on how much bandwidth is available. The scientists dubbed this naturally produced algorithm — a step-by-step problem-solving rule — the "Anternet." The Anternet information seems to help the colony to forage efficiently.

Gordon is now studying the turtle ant (Cephalotes goniodontus), a tree-dwelling species from western Mexico. These ants travel entirely along tree branches and vines, laying down a pheromone trail that connects the ants' nests and food sources, forming a 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 by finding new paths to get them around the break.

By mapping many paths and examples of how turtle ants found their way around a break, Gordon and colleagues identified an algorithm that describes the ants' behavior. It may not be the most efficient in any one situation, but it works well 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.

Swimming schools

Jolle Jolles, a behavioral biologist at the University of Konstanz in Germany, studies how the individuality of animals affects their collective behavior — mostly in the fish species known as the three-spined stickleback (Gasterosteus aculeatus).

Traits of individual sticklebacks include sociability — how closely a given fish likes to hang out with other fish — and boldness, 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.

In experiments involving 80 fish over 10 weeks, Jolles and colleagues found that bold fish tended to remain bold, as shown by the time spent away from the deep 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 long-term behavior.

Jolles has also worked with robotic fish. In soon-to-be-published experiments with collaborators in Berlin, he put guppies into a tank with a robofish programed to display all sorts of behavior, including being extremely social with the guppies. The study showed that 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.

Now, Jolles is trying to expand his ideas to other animals, hoping to find universal laws underlying the collective behavior of species from elephants to killer whales.

Collective wisdom

Studies of collective behavior in birds and ants and fish have 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 inspecting a dam. Like the jackdaws, they need rules to determine how far away to fly from their nearest neighbor. If the wind is calm, they might 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 rules for robots navigating an unfamiliar 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 start tracking several species of fish in mountain rivers in the Spanish Pyrenees to see how they respond 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. "I want to understand how fish can deal with these harsh conditions to help make predictions for the future," he says.

Read the rest of the story at Knowable Magazine, an independent journalistic endeavor from Annual Reviews. Sign up for the newsletter.