You will be presented with the abstract, introduction, and discussion section from a biomedical research article. Your task is to create a summary that a layperson can understand, capturing the essence of the research article. Keep essential scientific terms, but ensure that the language remains clear and the concepts are explained in an uncomplicated manner.

Title: Deep attention networks reveal the rules of collective motion in zebrafish}
Article:
Abstract:
A variety of simple models has been proposed to understand the collective motion of animals. These models can be insightful but may 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 a model of collective behavior that is simultaneously predictive and insightful thanks to an organization in modules. When using simulated trajectories, the model recovers the ground-truth interaction rule used to generate them, as well as the number of interacting neighbours. For experimental trajectories of large groups of 60-100 zebrafish, Danio rerio, the model obtains that interactions between pairs can 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. The network also extracts that the number of interacting individuals is dynamical and typically in the range 8–22, with 1–10 more important ones. Our results suggest that each animal decides by dynamically selecting information from the collective.
Introduction:
There is a wide range of models of collective behavior. A useful way to understand the relative merits of these models is to classify them by their accuracy and their complexity( e. g.[1, 2]). Some of the classical models of collective behavior, like interaction models[3–7], many-eyes or weighted averages[8–11], Condorcet[12] or others[13–17] are of very low complexity. Low complexity can be formally characterised[18], but in practical terms we can define it as the number of parameters in the model. If a model has a low parameter-complexity, we can write down the mathematical description and study it in detail, leading to an intuitive grasp of the problem and therefore a better design of new experiments. In general, however, this simplicity likely misses important biological components. For this reason, these low-parameter-complexity models are not typically tested in their detailed quantitative predictions, using simpler global parameters instead( but see[19, 20]). New techniques allow to individually track each animal in large collectives with high precision[21], and can provide enough data to build accurate models of collective behaviour. However, it is difficult to increase accuracy without increasing complexity. For example, we can use the trajectories to train a very precise model based on deep neural networks, because they contain thousands or millions of parameters that can be adjusted to approximate any possible function[22]. Unfortunately, this parameter-complexity typically makes deep neural networks black boxes difficult to analyse. However, a function that is parameter-rich but has few inputs and outputs( i. e. low variable-complexity) can in principle be understood through graphical plotting. Here we propose to use deep attention networks[23–25], because they express the social interaction as a combination of two deep-network modules of few inputs and outputs each, and thus they allow to simultaneously achieve insight and predictive accuracy. We can illustrate the reduction of variables in a modular model by comparing it against an equivalent non-modular model. Without a modular approach, a case with, say, 25 neighbours, and with each animal being sensitive to the 2D position, speed and orientation of each, would need to be modelled using 25 × 6 = 150 variables for each individual. Studying a problem in 150 dimensions is impractical as insight is very difficult to extract. However, deep attention networks are organized in modules, and for some problems each module might depend only on a small number of variables, of the order of 4–6 in our problem. This reduction from 150 variables to modules of 4–6 variables allows for insight into the rules by analysis of these modules, while still achieving high prediction accuracy. In addition to requiring high prediction accuracy and insight into the underlying interaction rule, we also require that the network model recovers the interaction rule and number of interacting neighbours in ground-truth data generated by agents following some mathematical rules. We found deep attention networks to be well suited for this recovery, as tested for a variety of interaction rules and different number of interacting neighbours.
Discussion:
We developed a model of collective motion that( i) accurately predicts future behaviour( like e. g.[20, 25, 34, 35])( ii) is insightful,( iii) works for data not used to obtain the model, a standard requirement in machine learning, and( iv) it recovers the interaction rule and number of neighbours in groundtruth data. We divided the interaction rule into two functions, a pair-wise interaction function and a second function giving the weight of each neighbour in the aggregation. Instead of fitting a simple functional expression( e. g.[30]) or a shallow network[36], we used a deep neural network, specifically a deep attention network. After training, we found that we could extract attraction, repulsion and alignment as approximate notions[4, 6, 31] from the trained pairwise interaction. Usually, these interaction classes are defined only in terms of relative position of neighbour. However, we found them to exist in a 6-dimensional space. This translates into these classes also depending on speeds of focal and neighbour, focal acceleration and relative orientation between the two fish. This implies that experiments testing for the relevance of one variable, say speed, may give contradictory results depending on the analysis strategy. Our results imply that analysis needs to take into account that the interactions take place in a space with more dimensions. Also note that the three classes are not cleanly separated as alignment regions are mixed with attraction or repulsion, as found in[30]. To calculate the weight in the aggregation we also chose a neural network instead of a simple rule. The neural network architecture we chose has enough flexibility to approximate many previously proposed weighting rules. This includes the angle subtended by the neighbour fish[29], the inverse of the distance to the neighbour[28], and a decreasing function of the topological rank[27]. Other previously proposed rules are binary weights based on thresholds of simulated visual motion cues[37, 38], first Voronoi neighbourhood[7] and topological ranges[39]. A simple aggregation rule would be to average the outputs of the pairwise-interaction network. Compatible with previous studies( e. g.[40]), we found that this simple rule gives a lower accuracy( S4 Table). Providing it is large enough to be flexible and small enough not to seriously suffer from overfitting, the exact architecture of the two neural subnetworks does not have a strong effect in the obtained maps( S20 and S21 Figs). An aggregation rule obtained by weighting using functions of dynamical variables can explain data that seem to be generated by a fixed number of neighbours in the interaction, as shown by using a simpler alternative[28]. Our aggregation may be seen as allowing a smooth transition from average type models[3–7, 20, 41] and models in which one or very few animals influence the rest as in the many-eyes model for predator detection[8–11, 42] and others[17]. Note that this ability to shift from many to few can allow a collective to match the changing knowledge distribution in the group[43]. We believe our methodology could open the door to the experimental study of the properties of this matching. In addition to the attention network, we developed a more precise deep interaction network that taught us which are the relevant variables to consider and gave us a reference accuracy. The interaction network is a smooth interpolation of the raw data, and it may also be used to complement data analysis studies of experimental data. This is particularly true in high-dimensional systems, where data-analysis runs into many practical difficulties. Having an interpolating function that can be queried simplifies the exploration of the space of inputs. Important input variables can be identified, and their effects readily tested for a few different combinations of the other variables. Intuitions obtained from exploring the interpolating function can then be used to produce a model or to guide data analysis. The deep interaction network can also be used for problems requiring prediction of the future location of an animal, for example the optogenetic brain stimulation[44] or microscopic imaging[45] of free-swimming animals. The variables selected as input to the models can be enriched at the cost of increasing the model dimensionality. For example, one can add more information about behavioral history, possible internal variables( parametrized, for example, by time of day or more direct internal measurements), explicit dynamics and posture[46–49]. For instance, a longer history of previous locations allows the attention network to increase its predicting accuracy, albeit with diminishing returns( S12 Fig). Also, the existence of higher-order interactions not captured by the deep attention network is evidenced by its lower accuracy compared to the interaction network,( S5 Table). Our results illustrate how modular deep networks enable flexible data-driven modelling without losing insight. Each module is flexible, with tens of thousands of parameters, but implements a function with low dimensionality in the number of inputs and outputs. Combinations of modules[50, 51], two in the attention network we used, can achieve higher compositional complexity that adds flexibility without losing insight.
Simple models have traditionally been very successful , because they usually provide more insight than complicated models . This is particularly true in physics , where simple models can often give highly precise quantitative predictions . However , biology is fundamentally complex and thus it is difficult to find simple models that give precise predictions . To create models that are both precise and insightful , we propose to harness the power of deep neural networks but to confine them into modules with a low number of inputs and outputs . We trained one such model to predict the future turning side of a fish in a collective . By plotting the different modules we obtain insight about how fish interact and how they aggregate information from different neighbours . This aggregation is dynamical and shows that fish can interact with approximately 20 neighbours but can also focus on fewer neighbours , down to 1-2 , when some move at higher speed in front or to the sides , are very close or are in a collision path .