Photo by Steve Jurvetson

What does the Internet have in common with an ant colony? More than you might think.

The Internet doesn’t have much in common with the common ant, of course. As the anteater in Douglas Hofstadter’s Gödel Escher Bach puts it, “Just as you would never confuse an individual tree with a forest, so here you must not take an ant for the colony.”

It’s a fanciful chapter: the anteater claims to be a close friend of a “witty” ant hill named “Aunt Hillary”, despite being feared by her comparatively simple-minded component ants. But Hofstadter uses Aunt Hillary and her ants as a metaphor for human minds and their neurons, and computer programs and their ones and zeros.

In the decades since Gödel Escher Bach was published, this computation metaphor has proven uncannily useful. Some ant colonies seem capable of achieving great cunning through their little insects. Studying ant colonies has helped engineers build better computer programs—like the “ant colony” algorithm used to optimize route planning—and recently a computer scientist and biologist discovered the shadow of protocols that make up the Internet in the foraging patterns of certain ant colonies.

To honor their independent discovery, Balaji Prabhakar, a professor of electrical engineering and computer science, called the ant’s algorithm the “anternet.” He remarked, "Ants have discovered an algorithm that we know well, and they've been doing it for millions of years.”

The Sum of its Parts

After years of watching ant colonies in the Arizona desert, Stanford biologist Debra Gordon made a discovery: harvester ants, the species she was studying, had a very particular foraging technique.

Individual harvester ants would forage for seeds to bring back to the colony. Once they’d left, they would not come back until they found something. As you might imagine, this didn’t work out for some ants: ants would often perish before ever finding food, or while carrying a seed back to the nest, particularly on the hottest and driest of days.

Gordon noticed that colonies had adapted to their desert environment by not “sending out” as many foragers on extremely hot and dry days, subsisting on the seeds they had stored up instead. But what she didn’t know was how this was regulated. After all, there were no paternalistic ant “managers” monitoring the weather reports and issuing memos to the foragers. (As you may know, colonies do have a special ant we call a “queen,” which other ants feed and wait upon. But a queen actually holds very little political power, and is essentially a worker which specializes in breeding.)

Through careful observation and experimentation, Gordon discovered that would-be foragers wait at a narrow tunnel entrance to the colony. Whenever another forager ant returns with food, it drops off its load and touches antennae with waiting ants. Whether or not any individual forager sallies forth depends on the number of interactions it has with returning foragers and the timing of those interactions. So a complex collective behavior is governed solely through simple individual interactions.

"A forager won't come back until it finds something," Gordon told National Geographic. "The less food there is [within reach], the longer it takes the forager to find it and get back. The more food there is, the faster it comes back. So nobody's deciding whether it's a good day to forage. The collective is, but no particular ant is."

The Anternet

This might seem like nothing more than a curiosity. But when Gordon showed her data to Prabhakar to model computationally, he had a revelation. "The algorithm the ants were using to discover how much food there is available is essentially the same as that used in the Transmission Control Protocol," he said

Transmission Control Protocol, also known as TCP, is a big part of what makes the Internet possible. The Internet involves a lot of machines sending each other files—including websites, videos, text documents, and audio—over a vast network of hardware including routers, cables, satellites, cellphone towers, and computers. The problem is that sometimes parts of the network fail—hardware can break or become overloaded and slow down dramatically.

Elad Yarom; Priceonomics

If a source hosting a file is using TCP, it breaks the file down into smaller chunks, called “packets”. It sends out a bunch of packets to the requester and monitors the acknowledgements of receipt, called “acks”, to calibrate how quickly to send the rest of the packets.

If we consider that the ant colony’s goal is to collect more food and expend fewer ants, and a server’s goal is to send a file and avoid congestion or overload, then the similarities are clear. Sending a packet through the Internet is analogous to releasing a forager ant into the wild. Getting an ack of a packet’s receipt is analogous to a forager ant returning with food. If lots of acks come back quickly, this corresponds to good bandwidth availability—just like if a lot of ants come back quickly, this corresponds to good food availability. Good availability means the release of more ants or more packets. And if ants or acks come back slowly, or don’t come back at all, then release is either slowed or shut down entirely. In the case of harvester ants, shut down means foragers stop going out for a while. In the case of the Internet, the connection times out.

And now, maybe, you understand this joke.

(It's worth noting that this is a simplification of TCP, and TCP also has other important features, like error detection. But congestion handling is the feature relevant to the metaphor.)

Through these systems, an ant colony is able to gather food while minimizing casualties, and the Internet permits file transfer between machines while minimizing congestion—all while avoiding the complexity of an active, overseeing authority. Gordon has said that, because each individual ant is so limited in its abilities, “ant algorithms have to be simple, distributed, and scalable -- the very qualities that we need in engineered distributed systems.” This is what made a functional Internet scalable from a few dozen initial machines to the billions that comprise it today.

Prabhakar said that had the ant colony's foraging methods been discovered in the early 1970s, before Vint Cerf and Bob Kahn developed TCP, it could have influenced the design of the Internet.

Vince Cerf and Robert Kahn receiving the Presidential Medal of Freedom for being the harvester ants of the human Internet

Luckily for us, humans managed to put something similar together without their example. But Gordon is optimistic that more useful network algorithms lie locked in ant behavior: “I think as we start understanding more about how species of ants regulate their behavior, we'll find many more useful applications.”

The Inhuman Engineers of Tomorrow

Slime mold, urban planning. Image from "Rules for Biologically Inspired Adaptive Network Design" by Atsushi Tero et al.

Gordon and Prabhakar are not alone in this belief. The January 2015 issue of Communications of the Association for Computing Machinery includes an article titled “Distributed Information Processing in Biological and Computational Systems.” In addition to the anternet and the route-planning ants, it lists other biological analogs to computational systems, including a slime mold that reproduced the geography of the Tokyo rail system.

Biological systems and their computational analogs in "Distributed Information Processing in Biological and Computational Systems" by Saket Navlakha and Ziv Bar-Joseph. Published in Communications of the ACM.

Gordon’s most recent research suggests that at least certain aspects of foraging technique—a collective behavior—are heritable. This not only means that complex algorithms like these might have developed through natural selection, but that these inhuman engineers could be developing new ones, right now.

So maybe think twice before waging war against the ants in your kitchen. Each ant may be a dumb pest, but the colony could be a computationally valuable specimen, containing solutions to distributed computing problems we haven’t even come up with yet. And who knows, if you’re not careful, it might just outsmart you.

Our next article uses Census data to investigate how the tech boom is changing the demographics of San Francisco. To get notified when we post it   join our email list.

This article was first published on February 3, 2015.

Note: If you’re a company that wants to work with Priceonomics to turn your data into great stories, learn more about the Priceonomics Data Studio

Woah. We are flattered you shared our blog post!

If you want to be notified when we write a "halfway decent" blog post in the future, leave your email here below.