animacy⁠ (opens in a new tab)

A tiny autoregressive transformer, trained on trajectories of fish and flies, that samples each next step from a Gaussian mixture.

How it works

A trajectory is read like text: each token is an animal's step over 1/30 s, and the model predicts the next step as a mixture of five Gaussians. Three versions were trained on idtracker.ai (opens in a new tab) recordings: about 100 hours of fish, 60 of fruit flies, and both pooled.

Animacy architecture A trajectory is read like text: each token is the animal's step over 1/30 s. Its 16 nearest neighbours are each encoded and pooled into a vector added to the step's embedding. Four causal decoder blocks follow, and a head gives the next step as a mixture of five Gaussians. At each step, 16 proposals are drawn from the mixture, rules about walls, rocks, food and the predator score them, and one is picked with probability proportional to the exponential of its score. Animacy architecture Decoder-only transformer over animal trajectories, 804,865 parameters A Model B Taking a step Steps of 1/30 s Neighbours Encoder Pooling Step embedding Decoder block × 4 causal attention Mixture head 5 Gaussians Next step rock picked 16 proposals hollow: scored down Propose 16 steps Score with rules Pick ∝ exp(score) Walls, rocks turn away Food swim towards it Predator flee when it looms
Animacy architecture A trajectory is read like text: each token is the animal's step over 1/30 s. Its 16 nearest neighbours are each encoded and pooled into a vector added to the step's embedding. Four causal decoder blocks follow, and a head gives the next step as a mixture of five Gaussians. At each step, 16 proposals are drawn from the mixture, rules about walls, rocks, food and the predator score them, and one is picked with probability proportional to the exponential of its score. Animacy architecture Decoder-only transformer over animal trajectories, 804,865 parameters A Model Steps of 1/30 s Neighbours Encoder Pooling Step embedding Decoder block × 4 causal attention Mixture head 5 Gaussians Next step B Taking a step rock picked 16 proposals hollow: scored down Propose 16 steps Score with rules Pick ∝ exp(score) Walls, rocks turn away Food swim towards it Predator flee when it looms

Rocks, food, walls and the predator never enter the model. At each step, rules from studies of real fish score its 16 proposals, such as turning away from a wall ahead (Calovi et al., 2018) or fleeing a predator that looms (McKee and McHenry, 2020).