Methods

Agent-based models, explained, and how to use them without profiling people

Simple rules for many simulated individuals can produce patterns nobody planned. That is the power of agent-based models, and also why they need care.

Published: 6 min readKassandra Labs
Server racks in a dimly lit room, with bundles of network cables and small status lights glowing in the dark.
Photo: Taylor Vick · Unsplash License

What an agent-based model is

An agent-based model (ABM) describes a system from the bottom up. Instead of writing one equation for a whole city or market, you define many individual "agents", give each one simple rules, let them interact, and watch what the system as a whole does. In his widely cited 2002 review in PNAS, Eric Bonabeau describes an ABM as a collection of autonomous decision-making entities, each assessing its situation and acting on a set of rules.

The appeal is emergence: patterns at the level of the whole that no single agent intends. Bonabeau's example is a traffic jam, which is made by individual drivers but can move backwards while every car moves forwards. Such outcomes are often counter-intuitive, which is exactly why it helps to simulate them rather than guess.

A classic: Schelling's segregation model

The best-known early example was worked out with no computer at all. In 1971 the economist Thomas Schelling published "Dynamic Models of Segregation" in the Journal of Mathematical Sociology. As Rainer Hegselmann's history of the model explains, the standard version works like this:

  1. Two groups of tokens are scattered at random on a checkerboard, with roughly a quarter of the cells left empty so there is room to move.
  2. Each token looks at its eight neighbouring cells.
  3. A token is content if the share of neighbours like itself meets a threshold, for example "I don't want to be in the minority". If not, it moves to the nearest spot that satisfies it.

The striking result: mild preferences, such as only wanting to avoid minority status, are enough to produce a heavily segregated board. Strong segregation does not require strongly segregationist individuals. Hegselmann also points out that James Sakoda published a closely related checkerboard model in the same journal's first issue, and that Schelling's model can be seen as a special case of it.

Epidemics and evacuations

Bonabeau groups business uses of ABMs into four areas: flows (evacuation, traffic, customer flows), markets, organisations and diffusion of innovations. One figure in his paper reproduces a fire-escape simulation by Helbing and colleagues, in which placing a column in front of a room's exit let more simulated people out in the first 45 seconds, with fewer injuries. Small design details can change crowd behaviour in ways intuition misses.

Epidemic modelling is another major use. Covasim, an open-source model built during the COVID-19 pandemic, represents each agent as a simulated person with attributes such as age, linked through contact "layers" for households, schools, workplaces and the community. It is used to compare interventions such as testing, contact tracing, quarantine and vaccination.

Where ABMs go wrong

Bonabeau is frank about the limits:

  • Purpose first. A general-purpose model cannot work. The level of detail has to fit the question.
  • Soft factors. Human agents involve irrational behaviour and subjective choices that are hard to measure and calibrate.
  • Read outputs honestly. A result that should be read qualitatively must not be used as a precise number.
  • Cost. Simulating many individuals can be very computation-intensive.

Using ABMs without profiling people

An agent in a model is not a real person, and it should not become one. The safest designs never touch individual records at all. Two ideas help:

  • Synthetic populations. Agents are generated so that, together, they match published aggregate statistics such as age structure and household sizes. Covasim's companion tool SynthPops, for example, builds synthetic contact networks from census and survey data. For large epidemics, Covasim can also let one agent stand for several people.
  • Anonymous, aggregate inputs. Under the EU's General Data Protection Regulation, Recital 26 says the rules do not apply to truly anonymous information, including for statistical or research purposes. The same recital warns that pseudonymised data, which can be linked back to a person with extra information, still counts as personal data.

The line to avoid is what the GDPR calls profiling: Article 4(4) defines it as automated processing of personal data to evaluate or predict things about a specific person, such as their behaviour, preferences or movements. A simulation of how a synthetic neighbourhood might respond to a new bus line does not need any of that. The data minimisation principle points the same way: use only what the question needs. (This is a description of the principles, not legal advice.)

How Kassandra Labs thinks about it

Kassandra Labs is at concept stage. If we use agent-based components, for example for elections and society scenarios, the plan is to build agents from published aggregate statistics, never from individual records, and to show assumptions next to every result. More on the overall approach is on how it works.

Related

Early access

Want to read it first?

Join the waitlist for new articles and the first pilots.

We only use your details to contact you about Kassandra Labs. You can ask us to delete them at any time.