The ringed bird's notes
Part 1/The simulator
How little does it take to make a flock?
I started by writing a small simulator. There is no leader in it. Each bird only watches the birds near it and follows three rules, and each rule has a switch.
Switch one off and you can see what it was doing for the group. I've already switched line up off, which is why this flock is a mess. Try switching it back on.
None of those rules says anything about a flock. A flock only shows up when every bird follows all three at once, which is, pretty cool and spooky.
Part 2/The machine
Can a machine learn this just by watching?
Next I recorded my simulator flying flocks of twelve birds and trained a small AI model on the recordings. It is a transformer, the kind of model behind chatbots, only tiny. I'll call it the machine. It never saw my three rules.
All it gets is : where each bird is and which way it is heading. The right half of the sky shows the same moment that way. Its only job is to guess where each bird will be a moment later, and each ring is one guess.
It only ever saw flocks of twelve. Given fifty, a size it had never seen, it still flies them as one flock, about as tightly as my simulator does.
That made me curious. Did it work out my three rules, or did it find some other way to do the job? To find out, I had to look inside it.
Note: from here on, the flocks in the frame replay what I measured, using the simulator's rules. The trained model itself is not running in your browser. What is real on this page
Part 3/Inside the machine
What is going on inside it?
Here is the short version of how the machine works. For every bird it keeps a short list of numbers, which I'll call that bird's notes. The technical name is its hidden state. The pad in the corner of the sky shows the ringed bird's notes, one page for each round of listening, and you can click another bird to follow that one instead.
Before each move there are two rounds of listening, called attention. Press a step to hold it.
: every bird hears where the other eleven are and which way they are heading, and writes that on its first page.
: it listens again, but now what it hears is the others' first pages. Each of those already holds what that bird heard, so in round two a bird is hearing what the others already heard. It writes that on its second page.
, using only what is on its two pages.
Part 4/The reader
Are my three rules somewhere in those notes?
To check, I built a second, much simpler tool, the kind researchers call a linear probe. On this page it is the reader, the teal bird with the glasses. It never sees the sky. It gets one page of a bird's notes and has to guess what each of my three rules is doing to that bird.
Here it is on , the notes after round one. Every time that page is rewritten, the reader throws three teal rings at the bird, one for each rule, aiming for the tip of that rule's arrow. A ring that lands on the tip is a good guess. The numbers in the corner score how close its guesses are for each rule.
All three rules can be read after a single round of listening. That felt almost too easy, so I kept checking.
On , the notes after round two, line up and stay close are easier to read and keep your distance is slightly harder. All three were already readable after round one, though.
Part 5/A machine that never practised
Does finding a rule mean the machine learned it?
To test that, I gave the reader a machine that has never practised. It still has its random starting numbers and has never watched a single flock.
Here it is. It can't fly at all, and it does nothing the rules ask for, which is why its arrows have gone faint.
Now compare the two columns of scores in the sky. The reader still finds stay close in these notes, and in this run it scores higher here than on the machine that can fly. That makes sense once you remember that every bird is told where the others are, which is most of what stay close needs.
So being able to read a rule in the notes doesn't prove the machine learned it. I needed a different kind of test.
Part 6/Breaking it on purpose
Does the machine use what the reader found?
The other kind of test is to break something and watch what happens, which is called an ablation. I can make one round of listening deaf: every bird hears only itself during that round, and whatever it had already written stays in its notes.
All three rules were readable after round one. If the machine flies from those notes, then losing round two shouldn't matter much.
Your guess first
Which round can the machine lose and still fly?
So I , and the flock fell apart. It looks like my simulator with line up switched off.
The first page of notes hasn't changed, and the reader can still read all three rules there. The machine just wasn't flying from them.
Then I instead. The flock gets sloppier, but it stays a flock, and it keeps half or more of every rule. The round where I could read everything is the one the machine can best do without.
Part 7/Watching it learn
When did it start using what was in its notes?
I saved copies of the machine all through its practice (checkpoints from its training), so I can replay how it learned. Here I follow one rule, stay close, in the notes after round two, and the buttons under this paragraph switch to the other two. Keep scrolling to move through practice. The bottom axis is a log scale, so each mark is ten times the one before.
The reader finds stay close at 85% before any practice. The machine starts out using it at 6% and builds up from there: above half from step 431 and above 80% from step 1,117, both inside the first of its 30 passes through the recordings. It ends at 99%.
Part 8/Four runs
Would I get the same machine if I trained it again?
I trained the same machine four times. The only difference between the runs is the random numbers each one started from, called the seed. All four guess the next move about equally well, so from the outside you can't tell them apart. Each flock has three bars beside it, one for each rule. A full bar means the machine's answer still holds all of that rule's push.
Every number, run by run
Then I in all four. The same cut does different damage each time. Run 1 keeps about half or more of every rule. Run 4 keeps less than a third of any of them. Runs 2 and 3 each lose their own mix. All four still mostly fly the same way, just less neatly than before.
With , none of the four flies as a flock any more. Each one ends up heading about as randomly as my simulator does with line up switched off. Watch the blue bars: line up drains to almost nothing in all four at once. That happens even though the reader could find line up after round one in all four runs (87%, 86%, 78% and 89%). The other two bars don't move together. Runs 1 to 3 lose nearly all of keep your distance and stay close as well. Run 4 keeps about 63% of both. Line up is the one rule every run loses.