What you're seeing
A grid of independent flashers. Each firefly carries a hidden phase φ that climbs steadily from 0 toward 1 — think of it charging up. When it reaches the top it flashes, snaps back to 0, and starts charging again. Left alone, every firefly would blink at its own steady beat and the field would be a meaningless shimmer of out-of-step lights. But they are not alone: every time one fires, it gives each of its neighbors a small shove, advancing their phase a little closer to firing. That single rule, applied everywhere at once, is enough. Pockets of fireflies fall into step, the synchronized patches spread as visible waves, neighboring patches swallow one another, and within seconds the entire grid is blinking as one — no conductor, no shared clock, no signal telling anyone when "now" is.
The rule
This is a grid of pulse-coupled integrate-and-fire oscillators. Each firefly does four things:
- Integrate. Every tick, raise the phase: φ ← φ + dt (optionally times a small per-firefly frequency, so they can run at slightly different natural rates — the jitter control).
- Fire. When φ ≥ 1, the firefly flashes.
- Reset. On firing, set φ ← 0 and start charging again.
- Kick neighbors. On firing, bump each grid neighbor's phase up by the coupling amount: φneighbor ← min(φneighbor + ε, 1).
That last step is the whole trick, and it has a twist: if a kick pushes a neighbor's phase to 1, that firefly fires too, in the same instant — and kicks its neighbors. So one flash can set off a cascade that ripples across a region in a single step. (We resolve each cascade with a queue and a "flashed-this-step" flag, so every firefly fires at most once per step and the chain always terminates.) Because the kick is excitatory — it only ever moves neighbors closer to firing — a firefly that flashes slightly early drags the laggards forward and the population ratchets toward a common rhythm.
This is the discrete, all-or-nothing cousin of the Kuramoto model. There, oscillators couple continuously and smoothly through the sine of their phase difference, each gently and constantly easing toward the crowd's average. Here the coupling is a single sharp pulse delivered only at the moment of firing, and only to immediate grid neighbors — closer to how real spiking systems actually talk to one another. Kuramoto is the abstract, all-to-all picture; fireflies are the concrete, local-grid one. Both end in the same place: spontaneous synchrony out of disorder.
Why it matters
The astonishing fact is that this works with no leader and no global clock. Nothing in the system broadcasts the beat; the beat is a collective property of fireflies each reacting only to the flashes they happen to see. In 1990 Renato Mirollo and Steven Strogatz proved a sharp result for this class of models: for a population of pulse-coupled oscillators that are identical and coupled all-to-all, with a charging curve that is concave (the firefly speeds toward threshold and slows near the bottom — true of the original Peskin pacemaker model), almost every starting configuration drives the entire population to fire in perfect unison. Synchrony is not a lucky accident of initial conditions; it is the inevitable destination. (Their theorem is for the all-to-all case; the simulation above couples each firefly only to its grid neighbors, which is not covered by the proof — but local pulse coupling still drives synchrony in practice, usually via the traveling waves you can watch form.) Pulse coupling is exactly how many real spiking systems lock together, which is why this toy is worth taking seriously.
In the wild
This is a model, and it abstracts away a great deal — so read these as the phenomenon it captures, not a literal mechanism:
- Synchronous fireflies. Along riverbanks in Southeast Asia, males of the genus Pteroptyx gather in trees by the thousands and flash in near-perfect unison, a spectacle documented for over a century. Each firefly shifts the timing of its own flash in response to the flashes it sees — a phase response — which is precisely the pulse coupling modeled here. (Real fireflies have a richer phase-response curve than a simple additive kick, and can both advance and delay; the additive bump is the simplest version that captures the essential drive toward sync.)
- Cardiac pacemaker cells. The sinoatrial node — the heart's natural pacemaker — is a population of self-oscillating cells that must fire together to produce one clean heartbeat. Charles Peskin's 1975 integrate-and-fire model of these cells is the direct ancestor of the rule on screen; Mirollo and Strogatz generalized it and proved when it synchronizes.
- Networks of spiking neurons. Neurons integrate input until they reach a threshold, fire a spike, reset, and pulse their neighbors across synapses — the same integrate-fire-reset-kick loop. Pulse-coupled oscillator models are a standard tool for studying how populations of neurons fall into synchronous rhythms.
In each case the honest statement is the same: the model shows that local excitatory pulse coupling suffices for leaderless synchronization, while each real system layers its own physiology and its own coupling geometry on top.
Try this
- Set coupling ε to 0 and watch the grid stay a permanent random twinkle — with no kick, the fireflies never influence one another and r hovers near zero forever.
- Raise ε from zero and watch the sequence: first scattered patches lock, then synchronized regions spread as traveling waves, then the waves collide and the whole grid snaps into a single unison pulse and r shoots toward 1.
- With the grid locked, add jitter (a spread in natural flash rates). A little disorder roughens the pulse; enough of it overwhelms the coupling and synchrony breaks back down — the same competition between coupling and disorder you can tune in Kuramoto.
- Switch the coupling range from Moore (8 neighbors) to von Neumann (4) and watch sync take longer — fewer neighbors means each flash recruits fewer followers.
References
- Mirollo, R. E. & Strogatz, S. H. (1990). "Synchronization of Pulse-Coupled Biological Oscillators." SIAM Journal on Applied Mathematics 50(6), 1645–1662. (The proof that almost all initial conditions synchronize for a class of pulse-coupled oscillators.)
- Peskin, C. S. (1975). Mathematical Aspects of Heart Physiology. Courant Institute of Mathematical Sciences, New York University, 268–278. (The integrate-and-fire pacemaker model Mirollo & Strogatz generalized.)
- Buck, J. (1988). "Synchronous Rhythmic Flashing of Fireflies. II." The Quarterly Review of Biology 63(3), 265–289. (Review of the biology of firefly synchrony.)
- Strogatz, S. H. (2003). Sync: The Emerging Science of Spontaneous Order. Hyperion, New York. (Popular account of pulse coupling, fireflies, and pacemaker cells.)