Article | Open | Published:

# Collective gradient sensing in fish schools

## Abstract

Throughout the animal kingdom, animals frequently benefit from living in groups. Models of collective behaviour show that simple local interactions are sufficient to generate group morphologies found in nature (swarms, flocks and mills). However, individuals also interact with the complex noisy environment in which they live. In this work, we experimentally investigate the group performance in navigating a noisy light gradient of two unrelated freshwater species: golden shiners (Notemigonuscrysoleucas) and rummy nose tetra (Hemigrammus bleheri). We find that tetras outperform shiners due to their innate individual ability to sense the environmental gradient. Using numerical simulations, we examine how group performance depends on the relative weight of social and environmental information. Our results highlight the importance of balancing of social and environmental information to promote optimal group morphologies and performance.

## Introduction

Collective animal behaviour arises from self-organising social interactions among individuals1,2. While the functional form of these interactions is not trivial to determine from experiments3, models have shown that simple local social interactions consisting of rules such as repulsion, alignment, and attraction are sufficient to generate observed group morphologies, such as swarms, flocks, and mills4,5,6,7,8,9. However, in nature, individuals must balance social information with individually acquired environmental information10,11,12.

Social interactions benefit group members in diverse ways. Living in groups has been shown to increase foraging ability13,14 and reduce predation risk15 through collective vigilance16 or escape waves17. Individuals can also use social information to help navigate noisy environmental gradients18,19,20. In this case where individuals may benefit from pooling information to overcome inaccurate estimates, which is often called ‘wisdom of the crowd’21 or the ‘many wrongs’ principle22,23,24. For each of these benefits, individuals combine social and environmental information which enhances information processing11, possibly leading to emergent collective intelligence20,25,26.

However, social benefits are weighed against possible downsides27,28, such as de-valued individual information27 and decreased sensitivity to changing environments29. Individuals must weigh environmental information gathered from their senses along with social information30 or become isolated and face a greater risk of predation9,31,32.

Despite the large number of studies on collective behaviour, how individuals integrate social and environmental information across ecological contexts remains an open question. Previous work using mixed societies of artificial and natural agents has shown group decisions arise from nonlinear feedback between local interactions between individuals33. Using multi-robotic-fish systems34 and simulations35, studies have explored the evolutionary mechanisms through which individuals use social information to better interpret noisy environmental information.

In a recent study, Berdahl et al. examined how a school of golden shiners (Notemigonus crysoleucas) collectively navigated a noisy environment (a dynamic light field)20. While individual golden shiners could not detect the environmental gradient, the school was able to collectively swim toward darker waters. The emergent sensing arose from social interactions governed by a simple rule: golden shiners swim faster in bright regions and slower in dark regions. However, many animals, even those of microscopic scales such as bacteria36, are able to sense environmental gradients.

In this work, we investigate the interplay of social and environmental information and how it impacts group performance. Building on recent work by Berdahl et al.20, our study combines empirical data with numerical simulations to examine the performance of schools of fish in navigating dynamic light fields. We experimentally examined group gradient sensing ability in two different species of freshwater fish: golden shiners (Notemigonus crysoleucas) and rummy nose tetra (Hemigrammus bleheri). While we find golden shiners are not able to sense the environmental gradient but are able to collectively find darker regions using an emergent sensing as in agreement with previous work20, the tetras out-performed the shiners for all group sizes, which can be attributed to tetra’s ability to sense the light gradient individually. We propose a model based on the light intensity dependent speed-modulation proposed in the Berdahl-Couzin model20. Our model includes an additional gradient sensing term that can be tuned to investigate the interplay of environmental and social information and its effect on group performance.

Our results show that while an individual’s ability to sense gradients generally improves the group’s performance, there are downsides. With greater weight given to environmental information, individuals rely less on social information leading to larger nearest neighbour distance, eventually fragmenting the school. However, by balancing social and environmental information, the nearest neighbour distance can be minimised, decreasing predation risk9,37,38 while keeping group performance near optimal. The relative gradient sensing weight that minimises nearest neighbour distance avoids relying too much on one source of information and produces simulations that agree with our experimental data for rummy nose tetras.

## Results

### Experimental results

We filmed schooling events of two freshwater species, golden shiners (Notemigonus crysoleucas) and rummy nose tetras (Hemigrammus bleheri), in a shallow tank (183 cm × 102 cm, 8 cm water depth). As shown in Fig. 1a, a projector located 226 cm over the experimental arena casts a dynamic light field at 30 Hz onto the bottom of the tank. An IR camera placed 180 cm over the tank records images at 30 Hz as shown in Fig. 1. A cropped sample image of the light is shown in Fig. 1b, with an overlay of the silhouettes of tetras for scale. Each noise image is the sum of a circular dark spot with gaussian decay (with length scale 38.1 cm) to white and a noisy greyscale light field that varies spatiotemporally20,39. The dark spot moves with a constant speed of 5.7 cm/s in random directions. The noise level η = 0.25 was held constant throughout the experiments. See the Supplementary Information and Berdahl et al.20 for further details on the light field.

We investigated the gradient tracking performance of schools of N =  16, 32, 64, and 128 individuals. For each species and group size, we conducted five replicate experiments with different random seeds used to generate the light fields. Each experiment consisted of fish navigating the dynamic light field for 5 minutes. Individual fish were tracked following a similar technique to Rosenthal et al.40 to obtain trajectories of individual’s positions. Velocities and accelerations were computed by convolving the position time-series with the first and second derivatives of a Gaussian, respectively41. More details on our experimental methods and husbandry procedures are given in the Supplemental Information.

To quantify group gradient tracking performance, we calculate the mean gradient tracking performance as, ψ = 〈〈1−Lfish t , which averages the local light level first over all fish in each frame and then over all time20. This raw performance metric is then divided by the null performance, ψ null , which is defined similarly except by averaging over the level of darkness of fish trajectories if they instead experienced the temporal average of the light field. The un-biased gradient tracking performance is then,

$${\rm{\Psi }}=\psi /{\psi }_{{\rm{null}}}\mathrm{.}$$
(1)

The theoretical maximum performance for a single individual is obtained by minimising Ψ null while remaining in the dark patch for the entire trial. Averaging over all five light fields generated with different random seeds, we calculate Ψ max  = 2.32 ± 0.72. While Ψ max gives a hard upper limit on group performance, this inaccurately assumes that fish can minimise Ψ null (fish have no knowledge of the temporal average of the light fields) and more importantly that fish occupy no volume. In Fig. 2a, we show the number density ρ = Agroup/(NBL2) as a function of group size N for both shiners and tetras. In all our experimental statistical analysis, data was analysed with R version 3.4.3 using a generalised linear mixed model (GLMM) approach with gamma errors using the lmer4 package42, where light field random seed and home tank were included as random factors to test for any effects with light field and group identity, respectively. There was no significant effect of group size on the number density ρ for both shiners (χ2 = 0.210, p = 0.647) and tetras (χ2 = 1.768, p = 0.184). The number density was ρ = 0.69 for shiners and 1.28 for tetras, so the tetras are forming schools with roughly twice the number density as shiners.

In all our experiments, the radius of the circular dark spot is constant. Therefore, even if a school can perfectly track the spot, we expect that the group performance Ψ decreases for schools that are sufficiently large as some individuals will be beyond the radius of the dark spot. Note, however, that there are three factors which contribute to the area of the school: the number of fish N, the number density ρ and the size of fish BL. Firstly, the number density ρ for both shiners and tetras is intensive (does not depend on N) as shown in Fig. 2a, so increasing the number of fish N linearly increases the overall area occupied by the school. Secondly, schools with lower number density ρ occupy more area as the distance between each fish is larger. In Fig. 2a, we showed that a school of tetras has roughly twice the number of density ρ compared to shiners, therefore, tetras are forming denser, smaller schools than shiners. Finally, for a given N and ρ increasing the size of the fish increases the overall area of the school. The average body length of our shiners (5.3 ± 0.5 cm) is about 50% longer than the tetras (3.4 ± 0.5 cm). Shiners are larger fish that are forming less dense schools, therefore, we expect the optimal group performance for shiners to be less than tetras for large N.

For both shiners and tetras, the level of performance, Ψ is shown as a function of group size in Fig. 2b. To quantify how school size effects optimal performance for shiners and tetras, we calculate Ψmax,S and Ψmax,T for a circle of area N times the average area occupied by a shiner or tetra, respectively. In Fig. 2b, we show how Ψmax,S and Ψmax,T depend on N given the average area of a school for each respective species. For small schools, Ψ max is large as the area of the school is smaller than the area of the dark spot. However, as N grows, Ψ max decays with N, albeit decaying faster for shiners than tetras due to their larger area schools for a given N.

The group performance of shiners was found to be independent of group size (χ2 = 1.833, p = 0.176), which did not agree with the result found by Berdahl et al.20. Since larger schools occupy greater area, larger group size decreases the optimal group performance of a given size school Ψmax,S. In Fig. 2b, note that the Ψ(N = 128) ≈ Ψmax,S(N = 128) showing that large schools of shiners are performing near optimally. The slightly larger size of our shiners compared to those used in Berdahl et al. (BL = 4.9 cm)20 is likely responsible for the small decrease in performance for large schools of shiners. Therefore, with smaller shiners (or a larger central dark spot), we expect our results to agree with Berdahl et al.

Additionally, we found that group performance for tetras decreased with increasing group size (χ2 = 4.620, p = 0.032). However, we note that the group performance for N = 128 is bounded by the decreasing optimal performance Ψmax,T which is due to the increasing area of the school but constant radius of the dark spot. While larger school area limits the group performance at large N, we found that tetras outperform shiners for small group sizes where the area of the school is small compared to the area of the central dark spot. We examine correlations between individual’s acceleration to uncover the mechanism for the greater performance of tetras over shiners.

We investigated the mechanism for the increase in gradient tracking performance of tetras over shiners by examining the correlation between individual’s acceleration and the social and environmental vectors. We estimate a social vector S which is calculated using neighbours within seven body lengths of the focal individual,

$${{\bf{S}}}_{i}=\sum _{j\in {r}_{s},j\ne i}\frac{{{\bf{x}}}_{j}-{{\bf{x}}}_{i}}{|{{\bf{x}}}_{j}-{{\bf{x}}}_{i}|}\mathrm{.}$$
(2)

The direction of the social vector indicates the direction of social attraction and its length is a proxy for the strength of the attraction. While Fig. 3 uses seven body lengths to find S, our results do not qualitatively change if the interaction range r s is between five and nine body lengths, as shown in Supplemental Figures S4 and S5.

We take the environmental vector G i to be the negative gradient of the light field L evaluated at the position x i of each fish,

$${{\bf{G}}}_{i}=-\nabla L{|}_{{{\bf{x}}}_{i}}$$
(3)

The environmental vector G i points in the direction of steepest descent toward darkness and its length is the rate of change of the light field in that direction. To calculate the response of an individual fish to its social and environmental vectors, we calculate the correlation between the direction of the corresponding vector and the direction of the fish’s acceleration with the following,

$${C}_{{\rm{social}}}=\langle {\widehat{{\bf{S}}}}_{i}\cdot {\widehat{{\bf{a}}}}_{i}\rangle$$
(4)
$${C}_{{\rm{environmental}}}=\langle {\widehat{{\bf{G}}}}_{i}\cdot {\widehat{{\bf{a}}}}_{i}\rangle \mathrm{.}$$
(5)

Using Csocial and Cenvironmental, we determine whether the motion of individuals is more strongly correlated with social or environmental information.

In Fig. 3a, we show Csocial and Cenvironmental for shiners as functions of the magnitude of the social vector S. Since, G is independent of S we use the Cenvironmental as a baseline to check the significance of Csocial. For shiners, we find that Csocial ≈ Cenvironmental when the magnitude of the social vector is less than 3, signifying that an individual’s acceleration is poorly correlated with the social vector. Note that the social vector’s magnitude is determined by the number of individuals in the range and their spatial distribution. The magnitude of the social vector |S| is small when either few neighbouring fish are located within the interaction range or neighboring fish are located uniformly around the focal fish. We do not expect shiners to respond strongly to the social vector in these situations. The magnitude of the social vector |S| is large when several neighbouring fish are located in a consistent direction. In Fig. 3a, when |S| > 3, we find that Csocial > Cenvironmental and Csocial grows linearly with the magnitude of the social vector, signifying that the shiner’s accelerations are correlated with the social vector.

In contrast, as shown in Fig. 3b, Cenvironmental ≤ Csocial for all magnitudes of the environmental vector, suggesting that individual shiners may not be able sense the environmental gradient, in agreement with recently reported results20. When the magnitude of the environmental vector is very large, the uncertainty in Cenvironmental and Csocial grows rapidly as the data is sparse and individual behavior is more variable.

In contrast to the data reported for shiners, we find that the accelerations of tetras are not strongly correlated with the social vector as shown in Fig. 3c, as Csocial < Cenvironmental. However, as shown in Fig. 3d, tetras respond strongly to the light gradient as Cenvironmental > Csocial and Cenvironmental increases with the magnitude of the environmental vector. Note that this does not imply that tetras do not respond to social forces, only that their accelerations are more strongly correlated with the environmental vector.

While our results for shiners show that individuals are more strongly influenced by social information, tetras appear to exhibit the opposite trend and are more strongly influenced by the environmental gradient, as shown by Cenvironmental > Csocial shown in Fig. 3d. This result clarifies the findings in Fig. 2b, where tetras outperformed shiners in navigating the dynamic light field toward darker regions. This stark contrast in performance between tetras and shiners in solving the same problem is due to the different gradient sensing mechanisms. Shiners rely strongly on social cues which leads to an emergent group level gradient sensing20, but tetras can individually sense the environmental gradient.

### Simulation model

As we have seen, different species of fish vary in the degree to which they base their movement on social and environmental information. To investigate this relationship, we explore how group performance depends on the relative weighing of environmental and social information via a tunable weight parameter, w.

We propose a new model, built on the recently proposed agent based Berdahl-Couzin model6,20,43, to which we augment with an environmental gradient sensing for each individual. Individuals interact socially via the canonical Couzin model where motion is determined via repulsive, aligning, and attractive interactions that depend on distance to neighbours. The direction given by social cues is $${\widehat{{\bf{d}}}}_{{\rm{social}}}$$. Explicit details of the calculation of $${\widehat{{\bf{d}}}}_{{\rm{social}}}$$ are outlined in the Supplemental Information. We calculate the gradient of the noisy light field $${{\bf{d}}}_{{\rm{environmental}}}=-\,\nabla L{|}_{{{\bf{x}}}_{i}}$$.

The updated direction of each individual is given by

$${\bf{d}}={\widehat{{\bf{d}}}}_{{\rm{social}}}+w\,{\widehat{{\bf{d}}}}_{{\rm{environmental}}},$$
(6)

where w is the relative weight and $${\widehat{{\bf{d}}}}_{{\rm{social}}}$$ and $${\widehat{{\bf{d}}}}_{{\rm{environmenteal}}}$$ are unit vectors corresponding to the social and environmental vectors, respectively. To determine the velocity of each individual, we then normalise d and multiply by the speed s,

$${\bf{v}}=s\,\widehat{{\bf{d}}}$$
(7)

To determine the speed of individuals, we follow the Berdahl-Couzin model using a light intensity dependent speed-modulation proposed by Berdahl et al.20, where individuals slow down in dark regions and speed up in bright regions. The speed grows linearly with the brightness, given by s = smin + L(smax − smin). Note, the speed modulation is the basis for the shiner’s emergent sensing. Further details and a flowchart for our model algorithm are given in the Supplementary Information.

In the limit that w → 0, social interactions entirely determine individual behaviour and our model reverts to the Berdahl-Couzin model20. In the opposing limit where w → ∞, individuals lose all social information and respond only to their local environmental gradient. We investigate the group performance as a function of group size N = [8, 16, 32, 64, 128, 256], the weight given to gradient information w is 32 log-spaced values between 10−2 and 103, and the noise level of the environment η = [0.10, 0.25, 0.40]. We performed 20 replicate simulations for each weight and noise level. Each simulation was run for 104 time steps and data was recorded every 100th time step. In all our simulations presented in the main text, the parameters used for the Couzin model6 remained fixed throughout the simulations and were: zone of repulsion 0.5; zone of orientation 3.0; zone of attraction 5.5; field of perception 270 degrees; turning rate 100 degrees; social error 0.01 radians; time step increment 0.125. These values correspond to the parameters fit for golden shiners as previously reported by Berdahl et al.20.

### Simulation results

In Fig. 4a, we show the group performance Ψ of our simulation as a function of the weight w with a noise level η = 0.25. The shape of Ψ(w) is sigmoidal. We find that increasing w (the gradient sensing weight) greatly increases Ψ of the group. In this limit, individuals follow the gradient eventually finding the moving dark region. However, inside the dark region denvironmental = 0, since the gradient is zero, and the motion of individuals is determined by social interactions. Increasing group size N decreases the maximum Ψ, which is due to the increasing size of the school. Therefore, larger group sizes do not benefit from large gradient sensing weight as much as smaller groups. To quantify this effect, we calculate the max gain in group performance ΔΨ = max(Ψ) − Ψ(w = 0). In Fig. 4b, we show ΔΨ as a function of group size, N for three different noise levels η = 0.10,0.25, and 0.40. We find that ΔΨ decreases monotonically with increasing N and decreases with increasing η, showing that larger groups benefit less from an individual’s ability to sense the gradient regardless of the noise level of the environment.

The group performance decreases with increasing noise level η at large w, as shown in Fig. 4c. In more noisy environments, individuals who strongly rely on gradient sensing benefit less, as they respond to local variations in light level instead of large scale features.

Another trend of increasing η is the shifting of the sigmoidal Ψ(w) toward smaller w. The sigmoid reaches half the max, $${{\rm{\Psi }}}_{\mathrm{1/2}}={\rm{\Psi }}(w=0)+\frac{1}{2}{\rm{\Delta }}{\rm{\Psi }}$$, at w0 as shown in Fig. 4c. In Fig. 4d, we show the shifting of the group performance Ψ toward smaller w by showing w0 as a function of N and η. The weight at half-max, w0, decreases with increasing environmental noise level η. We also find a maximum of w0 for groups of N = 32, demonstrating that small (and large) group benefit more from smaller weights w than intermediate group sizes.

Up to this point, our study did not account for the ubiquitous presence of error in individual environmental gradient sensing. To introduce this effect, we include a gaussian random error with standard deviation σ w which is added at each timestep to the local gradient direction. As shown in Fig. 5, for small w, the amount of error added to the gradient direction is nullified as individuals base their direction on social interactions. For large weights, w > 100, increasing the amount of error σ w destroys the individual ability to sense the gradient and turns the simulation into non-interacting random walkers.

While increasing w increases the group performance Ψ, large w destroys social information. To quantify this effect, we calculate the nearest neighbour distance d nn . For all group sizes N, nearest neighbour distance decreases with increasing w to a minimum $${\rm{\min }}({d}_{nn}^{N})$$. We find that d nn decreases for increasing group size N, corresponding to the increasing density of the group near the dark spot. Note that d nn  < 0.5BL for N ≥ 128 which is due to overcrowding in the dark spot and low time resolution. With shorter Δt for the simulation, the repulsive social interaction would prohibit such overcrowding and should yield a minimum d nn  ≥ 0.5BL. For large w, we find that d nn increases, as long range attractive social interactions weaken and individuals follow local transient gradients away from the school.

We propose that nature selects the weight w which balances individually acquired gradient information with social information such that nearest neighbour distance d nn is minimised for all group sizes. Smaller nearest neighbour distance reduces predation risk9,37,38. We find the weight which minimises the sum of the squared difference of d nn for group sizes N = 16, 32, 64 and 128 to be $${\tilde{w}}_{{\rm{\min }}}=31.6$$, and is shown in Fig. 6a. Therefore, by weighing their individually acquired gradient information around thirty times stronger than social interaction, individuals can optimise both Ψ and d nn . However, we emphasise the granularity of w due to computational cost. Using $$w={\tilde{w}}_{{\rm{\min }}}$$, we show the group performance Ψ as a function of N in Fig. 6b. We find good agreement between our model and experimental data for the rummy nose tetras. In Fig. 6b, the shaded region represents the Ψ for the range of w that minimise d nn in simulations for each group size N, w = 14.7 to 68.1. Therefore, to further improve the model’s ability to match the tetra’s behaviour, one could optimise r o , r a and w to better replicate the behaviour of the tetra, however, given the large error bars on the simulated group performance and the good agreement with experimental data, parameterising the data for the tetras may be of limited value. We find that the weight which minimises d nn also minimises the root mean square error (RMSE) in group performance for experimental data of the tetras. For groups N = 128, the group performance for Ψ for the tetras falls below the range predicted by our simulation. attribute this disagreement largely to distraction of individual fish with the edge of the tank.

Note that the simulations are not parametrised to fit the schools of tetra. In all the numerical results, we fixed the repulsion, orientation and attraction zonal distances to match those reported for golden shiners previously reported20. We use the simulations to display a generic behaviour of self-propelled particle models which supports our experimental observations that tetras have some innate environmental gradient sensing ability. In the Supplemental Information Fig. S8, we show that the minimum of the RMSE between the tetras and the performance for our model using w = 0 (Berdahl-Couzin) gives a smaller interaction range (r o ,r a ), but the RMSE is several times larger than that reported for the shiners20. Furthermore, using this r o and r a , we conduct a parallel analysis as in the main text and find that the agreement with the experimental data was not as good as results reported in the main text in Fig. 6b. We refer the reader to the Supplemental Information for further discussion.

## Discussion

This work presents experimental and numerical studies on group performance of fish schools navigating a spatiotemporally varying light field. First, we experimentally investigated the collective gradient tracking performance of two freshwater species: golden shiners (N. crysoleucas) and rummy nose tetras (H. bleheri). Our results agree with previous findings that the motion of shiners is based strongly on social interactions and is not correlated with the light gradient20. However, our results show that tetras outperform shiners at this task for all group sizes, which is due to the individual ability for tetras to sense the gradient of the light field. The emergent collective sensing (shiners) and collective enhanced individual sensing (tetras) are distinct gradient sensing mechanisms.

Second, we used these observations to propose an agent-based model based on the Berdahl-Couzin model6,20, where we included a gradient sensing ability which is weighted against social information for each individual. In our simulations, we find that group performance increases with increasing dependence (weight) on gradient sensing information, which is robust to group size N and noise scale η as shown in Fig. 4a,c. However, when individuals rely too much on their individual information, social information is lost, nearest neighbour distance increases and the school fragments.

To balance the benefits of social information and group living9,31 with individually acquired environmental information, we proposed that individuals adjust the relative weight attributed to environmental (gradient) or social information to minimise the average nearest neighbour distance d nn . This adaptation is important, as decreasing nearest neighbour distance reduces risk of predation9,37,38. Using the gradient sensing weight which minimises the nearest neighbour distance, we found good agreement with our experimental data for tetras. Furthermore, we found that the minima in the d nn depends on N, which suggests that it may be advantageous for individuals to dynamically adjust the weight based on group size. A dynamic tuning based on the situation would allow individuals to optimise their performance based on the situation or quality of information. For example, a dynamic tuning would allow individuals to favour individually acquired environmental information, when the environment is less noisy or the magnitude of the environmental vector is large. By contrast, if the magnitude of the social vector is large or the environment is noisy44, individuals can benefit from decreasing the weight and relying more on social information.

Dynamic and adaptive behavioural rules have been experimentally investigated in groups of fish exposed to alarm or food cues. Under predatory cues, x-ray tetras slow down and increase in density45 and bluegill sunfish form more highly polarised schools46. Fish swim faster and decrease in density when exposed to food45,47,48. While individual differences in physical ability and sensing can have large implications on decision making49 and the fitness of the group50, social benefits may pressure individuals to ignore private information and conform51. In these situations, individuals adjust their social interactions via rapid feedback loops in order to conform to the group50,52,53.

For rummy nose tetras, we found group performance decreases with group size, which is due to geometrical constraints as size of the school exceeds the size of the dark spot. Our results show that tetras can maximise their benefit in smaller groups. In some contexts, larger groups may improve the group performance20 and facilitate fast and accurate decisions where there are predatory cues49, though larger groups can increase confidence without increasing decision accuracy54,55 and in some cases deteriorate obstacle avoidance capabilities56. As often seen in nature2,31, individuals may maximise their benefit in small to intermediate sized groups with increased decision accuracy from inherent noise and less detrimental feedback from correlated information (present in larger groups)55. In P. longicornis ants where the food is collectively transported, the collective response is maximised for intermediate group sizes where criticality facilitates the flow of new information56. In a similar experiment to the one in the text and Berdahl et al.20, however using humans, collective sensing was maximised in smaller groups, where collective sensing strategies were learned in minutes57.

In summary, our model shows the disadvantages of extreme behavioural rules, where either relying too strongly on either social information (w = 0) produces in poor group performance or relying too strongly on individually acquired environmental gradient information (w → ∞) destroys valuable social information and fragments groups. Our results show that individuals can balance their individually acquired environmental information with social information, which promotes group performance and strong cohesion. Our experimental results show two freshwater species using distinct gradient sensing mechanisms: emergent collective sensing (shiners) and collective enhanced individual sensing (tetras). These interaction rules evolved under distinct ecological and social conditions35. In new environments, individuals value social information more than their individually acquired environmental information (w < 1) which is due the need to conform49. Therefore, it is likely that individuals also adjust their weighing of social and environmental information w. An extension of this work would explore the extent to which individuals tune w to conform with the group or if w depends on the environmental noise level.

## Methods

### Husbandry

We studied the gradient sensing performance of schools of golden shiners (Notemigonus crysoleucas) and rummy nose tetras (Hemigrammus bleheri) in a laboratory. While both are freshwater fish that prefer to school in dark shallow water, shiners (a cyprinid found in cool waters of eastern North America) and tetras (a characin found in the tropical waters of Amazon Basin of Brazil and Peru) require different water chemistry.

The golden shiners N. crysoleucas were acquired from Anderson Minnows. We kept approximately 500 juvenile shiners in three 30 gallon home tanks (≈150 in each tank) using de-chlorinated, aerated, and filtered tap-water kept at 21 °C. Water changes of 30% were done twice weekly. Shiners were 5.3 ± 0.5 cm in length.

The rummy nose tetras, H. bleheri, were acquired from Cichlid Exchange. We kept approximately 200 tetras in two 40 gallon home tanks (100 in each) at a constant temperature of 27.0 ± 0.5 °C in a 1:3 de-chlorinated tap water to reverse osmosis water that was aerated and filtered. The RO water diluted the pH and gH of the tap water to 6.8 ± 0.2 and 100 ± 20 ppm, respectively. Water changes of 20% were done once a week. Tetras were 3.4 ± 0.5 cm in length.

The home tanks for both species were illuminated with 12 h of light and 12 h of darkness per day. Both were fed a mix of crushed TetraMin flakes, Hikari brine shrimp, micro pellets, and freeze-dried blood worms four times a day. Before each experimental trial, fish were gently netted from their home tanks an hour after their first feeding and transferred to the experimental tank. We ensured that fish were not used in experiments on consecutive days by using a rotating schedule to select which home tank to gather fish. Fish were appropriately acclimatised to the water in the experimental tank before experiments took place. Further husbandry details are outlined in the Supplementary information.

### Ethics

All experiments were conducted in accordance with federal and state regulations and were approved by the Gettysburg College Institutional Animal Care and Use Committee.

### Experimental setup

We conducted experiments with golden shiners and rummy nose tetra in a quasi two-dimensional acrylic tank (183 × 102 cm, 8 cm water depth). Videos of schooling events were captured via a USB3 Point Grey camera mounted 180 cm above the tank which was back-lit by 850 nm infrared LEDs positioned beneath the tank. The videos were captured in 2048 × 1280 px at 30 frames per second by the camera which was hardware triggered to synchronise with the projected light field. The dynamic light field of 940 × 540 px were generated by a projector positioned 226 cm above the experimental tank at 30 frames per second. As shown in Supplemental Figure S2 and zoomed in Fig. 1, the projected field consisted of a single dark spot which moved randomly around the tank at a constant speed and was overlaid on a noisy background which varied both spatially and temporally, identical to the method detailed in a previous work20. Measured light levels at the surface of the tank ranged from 10 lux (approximately twilight) to 500 lux (sunrise on a clear day), corresponding to the natural environment of the fish in the morning or evening.

For each species (tetra and shiner) and group size N = 16, 32, 64 and 128, we recorded five replicate experiments for 5 minutes. We used four different seeds to generate each projected video at a medium level of environmental noise (η = 0.25), and added a 50 pixel white border to the light field to discourage fish from interacting with the sides of the arena. Each experimental run was followed by a 10 minute rest period under neutral lighting (0.5 lux, deep twilight). See Supplementary information for further experimental details.

### Fish Tracking

Our algorithm was implemented in Python using the OpenCV library, and followed a similar approach to SchoolTracker40. Individual fish are located using detected line-segments in background subtracted frames of video. We then track fish from frame to frame by linking their two-dimensional positions over time using a Kalman filter. Due to the large number of fish, occlusions are frequent and the detection/tracking algorithm can fail to locate and track a fish over multiple frames. The tracks are spliced together by linking tracks in a four-dimensional position-velocity space58. Our tracking algorithm recovers 90% of trajectories for N = 128 and 92% for N = 16. Since our focus in this paper does not rely on us maintaining identities for long periods of time, we have sufficient data to calculate velocities and accelerations.

Once the time-resolved trajectories are known, we compute velocities and accelerations by convolving the trajectories with a Gaussian smoothing and differentiating kernel41,59. Derivatives computed using this convolution method are less noisy than what would be obtained from a simple finite difference scheme. For the data presented here, the convolution kernel was chosen to have a standard deviation of 1.5 frames, and the position information from 11 frames was used to calculate each derivative.

Publisher's note: Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

## References

1. 1.

Couzin, I. D. & Krause, J. Self-organization and collective behavior in vertebrates. Advances in the Study of Behavior 32, 1–75, https://doi.org/10.1016/S0065-3454(03)01001-5 (2003).

2. 2.

Sumpter, D. J. Collective animal behavior (Princeton University Press, Princeton, NJ, 2010).

3. 3.

Puckett, J. G., Kelley, D. H. & Ouellette, N. T. Searching for effective forces in laboratory insect swarms. Scientific reports 4, 4766, https://doi.org/10.1038/srep04766 (2014).

4. 4.

Reynolds, C. W. Flocks, herds and schools: A distributed behavioral model. ACM SIGGRAPH Computer Graphics 21, 25–34, https://doi.org/10.1145/37402.37406 (1987).

5. 5.

Huth, A. & Wissel, C. The simulation of fish schools in comparison with experimental data. Ecological modelling 76, 135–145 (1994).

6. 6.

Couzin, I. D., Krause, J., James, R., Ruxton, G. D. & Franks, N. R. Collective memory and spatial sorting in animal groups. Journal of Theoretical Biology 218, 1–11, https://doi.org/10.1006/yjtbi.3065 (2002).

7. 7.

Gautrais, J., Jost, C. & Theraulaz, G. Key Behavioural Factors in a Self-Organised Fish School Model. Annales Zoologici Fennici 45, 415–428, https://doi.org/10.5735/086.045.0505 (2008).

8. 8.

Herbert-Read, J. E. et al. Inferring the rules of interaction of shoaling fish. Proceedings of the National Academy of Sciences of the United States of America 108, 18726–31, https://doi.org/10.1073/pnas.1109355108 (2011).

9. 9.

Ward, A. & Webster, M. Sociality: The Behaviour of Group-Living Animals (Springer International Publishing, Cham 2016).

10. 10.

Ward, A. J. W., Sumpter, D. J. T., Couzin, I. D., Hart, P. J. B. & Krause, J. Quorum decision-making facilitates information transfer in fish shoals. Proceedings of the National Academy of Sciences of the United States of America 105, 6948–53, https://doi.org/10.1073/pnas.0710344105 (2008).

11. 11.

Couzin, I. D. Collective cognition in animal groups. Trends in cognitive sciences 13, 36–43, https://doi.org/10.1016/j.tics.2008.10.002 (2009).

12. 12.

Miller, N., Garnier, S., Hartnett, A. T. & Couzin, I. D. Both information and social cohesion determine collective decisions in animal groups. Proceedings of the National Academy of Sciences of the United States of America 110, 5263–8, https://doi.org/10.1073/pnas.1217513110 (2013).

13. 13.

Pitcher, T. J., Magurran, A. E. & Winfield, I. J. Fish in larger shoals find food faster. Behavioral Ecology and Sociobiology 10, 149–151, https://doi.org/10.1007/BF00300175 (1982).

14. 14.

Bazazi, S., Pfennig, K. S., Handegard, N. O. & Couzin, I. D. Vortex formation and foraging in polyphenic spadefoot toad tadpoles. Behavioral Ecology and Sociobiology 66, 879–889, https://doi.org/10.1007/s00265-012-1336-1 (2012).

15. 15.

Partridge, B. L. The Structure and Function of Fish Schools https://doi.org/10.1038/scientificamerican0682-114 (1982).

16. 16.

Taraborelli, P., Gregorio, P., Moreno, P., Novaro, A. & Carmanchahi, P. Cooperative vigilance: The guanaco’s (Lama guanicoe) key antipredator mechanism. Behavioural Processes 91, 82–89, https://doi.org/10.1016/j.beproc.2012.06.002 (2012).

17. 17.

Herbert-Read, J. E. Understanding how animal groups achieve coordinated movement. The Journal of Experimental Biology 219, 2971–2983, https://doi.org/10.1242/jeb.129411 (2016).

18. 18.

Larkin, P. A. & Walton, A. Fish School Size and Migration. Journal of the Fisheries Research Board of Canada 26, 1372–1374, https://doi.org/10.1139/f69-121 (1969).

19. 19.

Grünbaum, D. Schooling as a strategy for taxis in a noisy environment. Evolutionary Ecology 12, 503–522, https://doi.org/10.1023/A:1006574607845 (1998).

20. 20.

Berdahl, A., Torney, C. J., Ioannou, C. C., Faria, J. J. & Couzin, I. D. Emergent sensing of complex environments by mobile animal groups. Science (New York, N.Y.) 339, 574–6, https://doi.org/10.1126/science.1225883 (2013).

21. 21.

Krause, J., Ruxton, G. D. & Krause, S. Swarm intelligence in animals and humans. Trends in Ecology and Evolution 25, 28–34, https://doi.org/10.1016/j.tree.2009.06.016 (2010).

22. 22.

Simons, A. M. Many wrongs: the advantage of goup navigation. Trends in Ecology & Evolution 19, 453–455, https://doi.org/10.1016/j.tree.2004.07.001 (2004).

23. 23.

Codling, A. E. A., Pitchford, J. W. & Simpson, S. D. Group Navigation and The “Many-Wrongs Principle” in Models of Animal Movement. Ecology 88, 1864–1870 (2007).

24. 24.

Torney, C. J., Levin, Sa & Couzin, I. D. Decision Accuracy and the Role of Spatial Interaction in Opinion Dynamics. Journal of Statistical Physics 151, 203–217, https://doi.org/10.1007/s10955-013-0700-5 (2013).

25. 25.

Woolley, A. W., Chabris, C. F., Pentland, A., Hashmi, N. & Malone, T. W. Evidence for a Collective Intelligence Factor in the Performance of Human Groups. Science 330, 686–688, https://doi.org/10.1126/science.1193147 (2010).

26. 26.

Ioannou, C. C. Swarm intelligence in fish? The difficulty in demonstrating distributed and self-organised collective intelligence in (some) animal groups. Behavioural Processes https://doi.org/10.1016/j.beproc.2016.10.005 (2016).

27. 27.

Banerjee, A. V. A simple model of herd behavior. The Quarterly Journal of Economics 107, 797–817, https://doi.org/10.2307/2118364 (1992).

28. 28.

Lux, T. Herd Behaviour, Bubbles and Crashes. The Economic Journal 105, 881–896 (1995).

29. 29.

Feldman, M. W., Aoki, K. & Kumm, J. Individual Versus Social Learning: Evolutionary Analysis in a Fluctuating Environment. Anthropological Science 104, 209–231, https://doi.org/10.1537/ase.104.209 (1996).

30. 30.

Couzin, I. D. et al. Uninformed individuals promote democratic consensus in animal groups. Science (New York, N.Y.) 334, 1578–80, https://doi.org/10.1126/science.1210280 (2011).

31. 31.

Krause, J. & Ruxton, G. D. Living in groups (Oxford University Press, Oxford, 2002).

32. 32.

Handegard, N. O. et al. The dynamics of coordinated group hunting and collective information transfer among schooling prey. Current biology: CB 22, 1213–7, https://doi.org/10.1016/j.cub.2012.04.050 (2012).

33. 33.

Halloy, J. et al. Social integration of robots into groups of cockroaches to control self-organized choices. Science 318, 1155–1158, https://doi.org/10.1126/science.1144259 (2007).

34. 34.

Wang, C., Chen, X., Xie, G. & Cao, M. Emergence of leadership in a robotic fish group under diverging individual personality traits. Royal Society Open science 4, 161015, https://doi.org/10.1098/rsos.161015 (2017).

35. 35.

Hein, A. M. et al. The evolution of distributed sensing and collective computation in animal populations. eLife 4, 1–43, https://doi.org/10.7554/eLife.10955 (2015).

36. 36.

Thar, R. & Kuhl, M. Bacteria are not too small for spatial sensing of chemical gradients: an experimental evidence. Proceedings of the National Academy of Sciences of the United States of America 100, 5748–53, https://doi.org/10.1073/pnas.1030795100 (2003).

37. 37.

Pitcher, T. J. & Parrish, J. K. Functions of shoaling behaviour in teleosts. In Pitcher, T. J. (ed.) Behaviour of Teleost Fishes, January 1993, 363–439 (Springer Netherlands, Dordrecht, https://doi.org/10.1007/978-94-011-1578-0_12 1993).

38. 38.

Tien, J., Levin, S. & Rubenstein, D. Dynamics of fish shoals: identifying key decision rules. Evolutionary Ecology Research 555–565 (2004).

39. 39.

García-Ojalvo, J., Sancho, J. M. & Ramírez-Piscina, L. Generation of spatiotemporal colored noise. Physical Review A 46, 4670–4675, https://doi.org/10.1103/PhysRevA.46.4670 (1992).

40. 40.

Rosenthal, S. B., Twomey, C. R., Hartnett, A. T., Wu, H. S. & Couzin, I. D. Revealing the hidden networks of interaction in mobile animal groups allows prediction of complex behavioral contagion. Proceedings of the National Academy of Sciences of the United States of America 112, 4690–5, https://doi.org/10.1073/pnas.1420068112 (2015).

41. 41.

Mordant, N., Crawford, A. & Bodenschatz, E. Experimental Lagrangian acceleration probability density function measurement. Physica D: Nonlinear Phenomena 193, 245–251, https://doi.org/10.1016/j.physd.2004.01.041 (2004).

42. 42.

Bates, D., Mächler, M., Bolker, B. & Walker, S. Fitting Linear Mixed-Effects Models Using lme4. Journal of Statistical Software 67, https://doi.org/10.18637/jss.v067.i01 (2015).

43. 43.

Couzin, I. D., Krause, J., Franks, N. R. & Levin, Sa Effective leadership and decision-making in animal groups on the move. Nature 433, 513–6, https://doi.org/10.1038/nature03236 (2005).

44. 44.

Lihoreau, M. et al. Collective foraging in spatially complex nutritional environments. Philosophical Transactions of the Royal Society B: Biological Sciences 372, 20160238, https://doi.org/10.1098/rstb.2016.0238 (2017).

45. 45.

Schaerf, T. M., Dillingham, P. W. & Ward, A. J. W. The effects of external cues on individual and collective behavior of shoaling fish. Science Advances 3, e1603201, https://doi.org/10.1126/sciadv.1603201 (2017).

46. 46.

Ioannou, C. C., Guttal, V. & Couzin, I. D. Predatory fish select for coordinated collective motion in virtual prey. Science (New York, N.Y.) 337, 1212–5, https://doi.org/10.1126/science.1218919 (2012).

47. 47.

Hoare, D. J., Couzin, I. D., Godin, J. G. J. & Krause, J. Context-dependent group size choice in fish. Animal Behaviour 67, 155–164, https://doi.org/10.1016/j.anbehav.2003.04.004 (2004).

48. 48.

Miller, N. & Gerlai, R. Quantification of shoaling behaviour in zebrafish (Danio rerio). Behavioural Brain Research 184, 157–166, https://doi.org/10.1016/j.bbr.2007.07.007 (2007).

49. 49.

Ward, A. J. W. et al. Fast and accurate decisions through collective vigilance in fish shoals. Proceedings of the National Academy of Sciences of the United States of America 108, 2312–5, https://doi.org/10.1073/pnas.1007102108 (2011).

50. 50.

Jolles, J. W., Boogert, N. J., Sridhar, V. H., Couzin, I. D. & Manica, A. Consistent Individual Differences Drive Collective Behavior and Group Functioning of Schooling Fish. Current Biology 27, 2862–2868.e7, https://doi.org/10.1016/j.cub.2017.08.004 (2017).

51. 51.

Herbert-Read, J. E. et al. The role of individuality in collective group movement. Proceedings. Biological sciences/The Royal Society 280, 20122564, https://doi.org/10.1098/rspb.2012.2564 (2013).

52. 52.

Harcourt, J. L., Ang, T. Z., Sweetman, G., Johnstone, R. A. & Manica, A. Social Feedback and the Emergence of Leaders and Followers. Current Biology 19, 248–252, https://doi.org/10.1016/j.cub.2008.12.051 (2009).

53. 53.

Farine, D. R., Montiglio, P. O. & Spiegel, O. From Individuals to Groups and Back: The Evolutionary Implications of Group Phenotypic Composition. Trends in Ecology and Evolution 30, 609–621, https://doi.org/10.1016/j.tree.2015.07.005 (2015).

54. 54.

Lorenz, J., Rauhut, H., Schweitzer, F. & Helbing, D. How social influence can undermine the wisdom of crowd effect. Proceedings of the National Academy of Sciences 108, 9020–9025, https://doi.org/10.1073/pnas.1008636108 (2011).

55. 55.

Kao, A. B. & Couzin, I. D. Decision accuracy in complex environments is often maximized by small group sizes. Proceedings of the Royal Society B: Biological Sciences 281, 20133305–20133305, https://doi.org/10.1098/rspb.2013.3305 (2014).

56. 56.

Gelblum, A. Ant groups optimally amplify the effect of transiently informed individuals. Nature Communications 6, 9, https://doi.org/10.1038/ncomms8729 (2015).

57. 57.

Krafft, P. M., Hawkins, R. X. D., Pentland, A. S., Goodman, N. D. & Tenenbaum, J. B. Emergent Collective Sensing in Human Groups. CogSci 1201–1206 (2015).

58. 58.

Xu, H. Tracking Lagrangian trajectories in position?velocity space. Measurement Science and Technology 19, 075105, https://doi.org/10.1088/0957-0233/19/7/075105 (2008).

59. 59.

Ouellette, N. & Gollub, J. Curvature Fields, Topology, and the Dynamics of Spatiotemporal Chaos. Physical Review Letters 99, 1–4, https://doi.org/10.1103/PhysRevLett.99.194502 (2007).

## Acknowledgements

We want to thank the two anonymous reviewers whose suggestions greatly improved this manuscript. We gratefully acknowledge the support of NVIDIA Corporation with the donation of the Titan Xp GPU used for this research. This work is also supported by Gettysburg College and by the Cross-Disciplinary Science Institute at Gettysburg College (X-SIG).

## Author information

### Affiliations

1. #### Department of Physics, Gettysburg College, Gettysburg, Pennsylvania, 17325, USA

• James G. Puckett
• , Aawaz R. Pokhrel
•  & Julia A. Giannini

### Contributions

J.P. devised the study. A.P., J.G., and J.P. authors conducted the experiments. A.P. and J.P. wrote the simulation code and performed the simulations. All authors analysed the data, interpreted the results and wrote the manuscript.

### Competing Interests

The authors declare no competing interests.

### Corresponding author

Correspondence to James G. Puckett.

## Electronic supplementary material

### DOI

https://doi.org/10.1038/s41598-018-26037-9