A variety of simple models has been proposed to understand the collective motion of animals. These models can be insightful but lack important elements necessary to predict the motion of each individual in the collective. Adding more detail increases predictability but can make models too complex to be insightful. Here we report that deep attention networks can obtain in a data-driven way a model of collective behavior that is simultaneously predictive and insightful thanks to an organization in modules. The model obtains that interactions between two zebrafish, Danio rerio, in a large groups of 60-100, can be approximately be described as repulsive, attractive or as alignment, but only when moving slowly. At high velocities, interactions correspond only to alignment or alignment mixed with repulsion at close distances. The model also shows that each zebrafish decides where to move by aggregating information from the group as a weighted average over neighbours. Weights are higher for neighbours that are close, in a collision path or moving faster in frontal and lateral locations. These weights effectively select 5 relevant neighbours on average, but this number is dynamical, changing between a single neighbour to up to 12, often in less than a second. Our results suggest that each animal in a group decides by dynamically selecting information from the group.
Highlights• At 30 days postfertilization, zebrafish, Danio rerio, can move in very cohesive and predictable large groups• Deep attention networks obtain a predictive and understadable model of collective motion• When moving slowly, interations between pairs of zebrafish have clear components of repulsion, attraction and alignment• When moving fast, interactions correspond to alignment and a mixture of alignment and repulsion at close distances • Zebrafish turn left or right depending on a weighted average of interaction information with other fish, with weights higher for close fish, those in a collision path or those moving fast in front or to the sides • Aggregation is dynamical, oscillating between 1 and 12 neighbouring fish, with 5 on average