Introduction

Organisms ranging from bacteria to insects, fish, birds, and mammals, including humans, often behave collectively, producing spectacular, cohesive global patterns1,2. Physics-based self-propelled particle models3,4,5,6,7 in which agents obey simple local interaction rules can generate similar group behaviour, including the emergence of ordered motion at high density8,9,10,11. It is thus often tacitly assumed that these rules are fixed for a given species. Recently, however, researchers have begun to observe that group properties such as size, density, and polarization can vary with external conditions12,13,14,15,16,17, and that heterogeneity among group members can influence group dynamics18,19,20,21,22. These findings suggest that the interaction rules themselves may show plasticity. To date, empirical data to test this hypothesis has been very limited, as the vast majority of studies23,24,25,26,27,28,29,30,31,32,33 have been performed in a single ecological context. Some support comes from laboratory experiments13,15 showing that fish in small groups may modulate rule parameters, such as the size of their repulsion zone13 or the tendency to initiate or follow movements15 based on food availability and predation risk. Nevertheless, it remains unknown whether animals can switch between fundamentally different types of rules1, such as between metric3 and topological interactions7 (interacting with all neighbours within a fixed distance or with a fixed number of individuals regardless of physical distance, respectively). Moreover, the potential for plasticity in interaction rules has seldom been tested for large groups of animals in the wild facing ecologically relevant challenges34,35,36.

Bird flocks are one of the most extensively studied examples of collective animal behaviour. Our current understanding of local interactions in birds is based largely on flocks of species like starlings28,30, pigeons31,35,36,37,38, jackdaws18,32, and chimney swifts23. Starlings in murmurations28 and jackdaws in transit flights18 have been found to interact topologically. In contrast, chimney swifts circling and landing on chimney roost sites23 were reported to follow metric interactions. Different types of interaction rules are expected to have significant implications for the structure and function of flocks. For instance, numerical models3,7 have argued that groups of birds interacting metrically would be expected to transition from disordered motion at low density to ordered flocking at higher densities. Such a density-dependent ordering transition has been experimentally confirmed in marching locusts8 and migrating cells9, but not in flocking birds. In contrast, models7 find that topologically interacting groups should always display order regardless of density, thus enhancing group cohesion and response to external perturbations such as predators28. It remains unknown, however, whether interaction type is species-specific or whether a single species may switch between metric and topological interactions in different ecological contexts to optimize group function. Here, by measuring the three-dimensional (3D) movements of flocking jackdaws (Corvus monedula), we demonstrate that the local interaction rules and group-level properties can indeed change in different contexts.

Results

Local interactions in jackdaw flocks

Here, using a high-speed 3D imaging system39 (see Methods), we compare local interactions in wild flocks of jackdaws in two different ecological contexts. During the winter, jackdaws form large transit flocks as they return to their roosting sites in the evening. We recorded 6 transit flocks containing between 25 and 330 individuals (Supplementary Table 1; Supplementary Movie 1); an example is shown in Fig. 1a. Like many other species, jackdaws also commonly come together to inspect and drive away predators, typically in response to anti-predator recruitment calls known as “scolding” calls40. We mimicked such events experimentally by using playbacks of scolding calls to induce groups to gather around a terrestrial model predator (see Methods for more information). We recorded 10 such “mobbing flocks” containing between 4 and 120 individuals (Supplementary Table 1; Supplementary Movies 2 to 3); an example is shown in Fig. 1b.

Fig. 1
figure 1

Metric interactions in transit flocks and topological interactions in mobbing flocks. a Jackdaw trajectories in a sample transit flock. b Jackdaw trajectories in a sample mobbing flock. c Alignment angle between a focal bird and its neighbours. d, e Anisotropy factor γ for the distributions of neighbours relative to a focal bird for d mobbing and e transit flocks. r is the distance between the focal bird and its neighbour, and n is the topological rank. In a, b coloured lines show the jackdaws’ three-dimensional (3D) trajectories, and the black dots show their positions in flocks at the final time step. The grey planes are arbitrary horizontal planes (that is, perpendicular to the direction of gravity). Data in c, d are calculated from 10 mobbing flocks and 6 transit flocks. Standard errors are smaller than the symbol size

We find that the local interactions in the two types of flocks vary drastically: jackdaws use topological interactions in transit flocks, but metric interactions in mobbing flocks. To demonstrate this difference, we first consider the alignment angle θ between a focal bird and its neighbours as a function of topological rank n and physical distance r, θ=g(n, r). For flocks with topological interactions, θ=g(n, r) = g(n), while for flocks with metric interactions, θ=g(n, r) = g(r). Thus, one way to test whether flocks use topological or metric interactions is by fixing n and calculating the dependence of θ on r alone, and vice versa.

In mobbing flocks, we find that θ increases considerably with r, and profiles with different n nearly overlap (Fig. 1c). Thus, θ is primarily a function of r alone. One may imagine that birds in mobbing flocks might fly in circles centred above the model predator, and that the increase of alignment angle with r is simply due to geometric effects or external influences. We find, however, that this is not the case: birds in mobbing flocks are most likely to be found directly above the model predator, arguing against circling flight (Supplementary Fig. 1c). Moreover, the velocity component in the direction towards or away from the predator is of the same order of magnitude as the full velocity (Supplementary Fig. 1d), and the magnitude of the alignment angle is independent of the distance between the focal bird and the model predator (Supplementary Fig. 1e). Therefore, the alignment at small r is due to local interactions between birds, and the increase of θ with r indicates that these local interactions weaken as the separation distance increases.

In contrast to mobbing flocks, neighbours in transit flocks remain well aligned regardless of r and n, since θ has little dependence on either n or r (Fig. 1c). Although the curves also have weakly positive slopes, the magnitudes of θ are much smaller than those in mobbing flocks. Since the transit flocks as a whole move towards the roost sites with high polarization (Supplementary Table 1), all the birds in the flocks share a common external influence. Nevertheless, transit flocks do exhibit large velocity fluctuations that are spatially correlated (Supplementary Fig. 2), indicating that they are distinct from the simple case of many birds flying in straight lines and instead have complex dynamics arising from local interactions between neighbours4. Thus, the strong alignment regardless of r and n is likely due to the combined effect of local interactions and external factors. It is difficult to separate the effects of local interactions and external factors on alignment angles. Thus, to more clearly discriminate between the interaction rules in mobbing and transit flocks, we consider the spatial distribution of neighbours relative to a given focal bird.

Analyses of the anisotropy of these distributions (that is, the extent to which the position of a neighbour relative to a focal bird is non-random (see Methods)) provide a critical test of whether interaction rules differ across contexts. Given that both mobbing and transit flocks show similar side-by-side neighbour distributions despite differing external factors, local anisotropy is expected to result from local interactions rather than external influences. We characterised the anisotropy by computing an anisotropy factor γ = f(n, r) of the distribution of neighbours relative to a focal bird (see Methods). Here, a larger value of γ indicates that the locations of the neighbouring birds relative to the focal bird are less random (i.e., more anisotropic). Previous studies18,28 have shown that γ reduces with increasing distance from the focal bird, and have defined the interaction range as the distance where γ reduces to its isotropic value, indicating that neighbours are distributed at random. We find that for mobbing flocks, γ decreases significantly for larger values of r, while the profiles for different n nearly collapse (Fig. 1d), indicating that γ is primarily a function of r. In contrast, for transit flocks, γ changes more rapidly with n than with r, indicating that γ depends primarily on n rather than on r. These results provide strong evidence that jackdaws in mobbing flocks use metric interactions but switch to topological interaction in transit flocks. Jackdaws in mobbing flocks have a metric interaction range of about r = 5 m (roughly 14 body sizes), and in transit flocks typically interact with 7 to 8 neighbours, as shown in our previous study18. Thus, our observations provide strong empirical support for the plasticity of local interactions under different ecological contexts.

A final way to confirm that the interactions in transit flocks are topological is to show consistent behaviour of γ = f(n) for flocks with different group densities, similar to the results shown in Ballerini et al. 28. We thus measured γ = f(n) for transit flocks #01, #03 and #04 where the group sizes are the largest among the six transit flocks. Although the three flocks have different densities (Supplementary Fig. 3b), profiles of γ = f(n) for n < 5 nearly overlap (Supplementary Fig. 3a), confirming topological interactions. The γ profiles for n > 5 do not overlap as well, likely due to edge effects as the sizes of these transit flocks are relatively small.

Relationship between group density and group order

The two types of local interactions produce distinct group behaviour: the metric interactions in mobbing flocks imply that order within groups depends on the group density, while the topological interactions in transit flocks generate highly ordered motion regardless of density. To characterize the emergence of order in mobbing flocks, we analysed the order parameter ϕ and the density ρ for a total of 154 sub-groups (Supplementary Data 1) taken from the 10 mobbing flocking events recorded. Since birds frequently entered and left the measurement volume while recording during mobbing events, each recording contains multiple distinguished groups separated in time (group selection criteria are given in the Methods). For each group at a given time t, we calculated the instantaneous order parameter ϕt = < vi/|vi| > and density ρt = 6 N/(π < di > 3), where vi is the velocity of bird i, N is the group size (i.e., the number of birds in the group), di is the metric distance from bird i to its most distant neighbour, and < > denotes an average over all birds. ϕ and ρ are obtained by averaging ϕt and ρt, respectively, over all frames. At low density, the groups resemble disordered swarms (Fig. 2a) and ϕt fluctuates significantly (Fig. 2d). At moderate density, the flocks exhibit some degree of coherence (Fig. 2b); but at high density, all the jackdaws move and turn as a single cohesive unit (Fig. 2c) and ϕt remains close to 1 (Fig. 2d). Moreover, we find that ϕ increases monotonically with ρ following the power law ϕ ~ ρ0.37 (Fig. 3), consistent with the classical self-propelled particle model of Vicsek et al.3. This agreement indicates that mobbing flocks are self-organized and that ϕ is an emergent property stemming from the local interactions—but that, in this case, those interactions are metric. In contrast, for transit flocks, sub-groups are nearly perfectly polarized regardless of the density (Fig. 3; Supplementary Fig. 4), likely due to the combined effect of topological interactions and environmental influences. Functionally speaking, topological interactions in transit flocks are very effective for maintaining group cohesion and enhancing awareness of and responsiveness to potential predators during long-distance travel28. Metric interactions in mobbing flocks, in contrast, may enable individuals to behave more independently, allowing them to focus more attention on the predator than on tracking distant flockmates.

Fig. 2
figure 2

Three representative mobbing flocks showing increasing group order with group density. a Flock at low density (ρ = 0.002 m−3). b Flock at moderate density (ρ = 0.008 m−3). c Flock at high density (ρ = 0.014 m−3). d Instantaneous group order ϕt for the flocks shown in (ac). For a, c the meanings of the coloured lines, black dots, and grey planes are same as those shown Fig. 1

Fig. 3
figure 3

Relationship between group density and group order. For the mobbing flocks, results are calculated by averaging the results from 154 groups of jackdaws over a total of 36,960 time frames. Error bars represent standard errors. Distributions of group density ρ and group order ϕ for the 154 groups can be found in Supplementary Fig. 6. For the transit flocks, results are calculated by averaging 30,498 samples, where each sample represents a local subgroup of one focal bird and four nearest neighbours embedded in a larger flock. Data for subgroups with sizes of 10 and 20 for transit flocks are shown in Supplementary Fig. 6

Self-propelled particle model

Estimating the critical density for the transition to ordered motion is a key parameter for predicting the collective properties of the group8,9,10. We find that the critical density in mobbing flocks is close to 0 (Fig. 3), and show that this result can be mimicked by a self-propelled particle model (a modified Vicsek model3; see Methods) in the limit of vanishing noise η, a parameter that accounts for imperfect sensing. We ran the model for N ranging from 5 to 200 while keeping a fixed simulation volume. Thus, N is proportional to the group density. The effects of N and η on the particle trajectories and group order are shown in Fig. 4. For small N, ϕt fluctuates significantly and the particle trajectories are qualitatively similar to our mobbing flocks at low density (Fig. 4a–c). For large N, ϕ is very close to 1 and the particle trajectories are similar to mobbing flocks at high density (Fig. 4b, c). ϕ increases smoothly with increasing N (Fig. 4d), and both ϕ and N−Nc obey power-law relations similar to our observations (Fig. 4e). Here, Nc denotes the critical group size for the ordering transition (determined by the best-fit power law). In the limit of vanishing η, no disordered state exists (Fig. 4d) and Nc approaches zero (Fig. 4f). Therefore, the nearly zero critical density we observed for our mobbing flocks can be explained by a model where the alignment error is very low.

Fig. 4
figure 4

Self-propelled particle model captures the phase transition in mobbing jackdaw flocks. a A sample modelling result at low density. b A sample modelling result at high density. c Time variation of the instantaneous group order ϕt for the cases shown in (a, b). d Group order ϕ as a function of group size N at three different noise levels. e ϕ as a function of NNc. f Nc as a function of noise. Here, Nc denotes the critical group size for the ordering transition. For a, b the meanings of the coloured lines, black dots, and grey planes are the same as those shown Fig. 1

To test whether the ordering transition observed in our simulation is driven by metric-based local interactions and not by the introduction of a model predator, we ran the same simulations but with topological interactions rather than metric interactions. Results for a topological interaction range of eight neighbours show that the flocks remain highly order regardless of group size and density (Supplementary Fig. 5). Thus, we confirm that the ordering transition in the metric-based model is not due to the interaction with the predator.

Discussion

Our results demonstrate that local interactions—and consequently group dynamics and morphology—vary considerably even within the same species in different ecological contexts. This behavioural plasticity may have major adaptive significance: rather than being limited to fixed interaction rules, animals may adjust their response to neighbours in different contexts to robustly optimize their group function and maximise fitness benefits34. Thus, it is crucial for future studies to consider ecological context when modelling and predicting animal movements in new and variable environments, as well as to understand the sensory and cognitive mechanisms underpinning behavioural plasticity. Our results may also find application in designing autonomous robotic swarms to respond to environmental cues by changing their interaction rules to perform different tasks41,42. Nevertheless, fully understanding and predicting the effect of ecological context on group movement and function will require additional study to separate the distinct effects of local interactions and external factors.

Methods

Study system

Jackdaws (Corvus monedula) are a highly social, colony-breeding corvid found throughout much of the Western Palaearctic. At our study sites in Cornwall, more than 2000 jackdaws are fitted with unique colour ring combinations for individual identification. During the winter months, in the early evenings jackdaws form large polarized ‘transit’ flocks while travelling from their foraging grounds towards their roosts (often with staging stops at pre-roost trees) where they spend the night43. Jackdaws also form ‘mobbing’ flocks in response to distinctive scolding calls40; coming together to inspect and drive away aerial and terrestrial predators, such as raptors and foxes. Comparing the transit and mobbing flocks allows us to study whether local interactions are fixed or flexible in different ecological contexts.

Three-dimensional imaging system

To measure the movements of birds in 3D space, we used a high-speed 3D imaging system developed in our previous study39. The system included four hardware synchronized, high-speed USB-3 cameras (Basler ace acA2040-90 um, pixel size of 5.5 µm, sensor resolution of 2048 by 2048 pixels) with overlapping fields of view. The cameras were seated on the ground, pointed toward the sky, and were separated by a maximal distance of about 50 m. The imaging lenses (Tamron, M111FM08) had a focal length of 8 mm and an angle of view of 71°. At a height of 50 m, the imaging area was 60 by 60 m2 and the imaging uncertainty was 0.04 m, which allowed the precise detection of bird positions. Two laptops (ThinkPad P51 Mobile Workstation) were used for data storage and allowed continuous imaging at 60 frames per second for up to 200 s.

The camera calibration followed a similar procedure to that developed by Theriault et al. 44. We imaged two balls of distinguishably different sizes (10 and 12 cm) carried by a drone that was flown through the measurement volume. The 2D positions of the balls identified on each camera provided calibration points. About 300 calibration points were used to determine the camera parameters. The distance between the two balls (fixed at 1.0 m) provided a physical scale for the calibration. The calibration error (defined as the root-mean-square distance between the originally detected 2D coordinates and those generated by re-projecting 3D points onto the 2D image planes of the cameras) was less than 0.5 pixels.

After recording the image data, we reconstructed the trajectories of individual birds in 3D space. First, we calculated birds’ 2D locations on the images based on intensity-weighted centroids (noting that these 2D locations may not represent body centres due to the flapping wings). We matched the 2D coordinates across different views by searching within a small tolerance around the projected epipolar lines from other cameras. 3D locations were then calculated using a least-squares solution of the line-of-sight equations45. In addition, we solved the optical occlusion problem by associating every detected 2D coordinate with a 3D position39. Finally, 3D locations of the same object in multiple time frames were linked together based on a three-frame predictive particle tracking algorithm46. We applied a Gaussian smoothing and differentiating kernel47 to the 3D trajectories to obtain accurate velocities and accelerations.

Since we initially calculated the birds’ 2D positions based on the intensity-weight centroids, the resulting 3D trajectories included a high frequency component caused by wing motions. To remove this high frequency signal, we applied a low-pass filter to the measured acceleration and then integrated the filtered acceleration to obtain the motions corresponding to bird’s centre of mass. Along each bird’s trajectory, we measured the position, velocity, and acceleration in a Cartesian coordinate system. In our previous study39, the wing motion and wingbeat frequency were also calculated. Here, we only report statistics related to a bird’s centre of mass.

Data collection and event selection criteria

Jackdaws often fly together with rooks (Corvus frugilegus)43, forming mixed-species flocks. To avoid any effects caused by species differences, we only selected flocking events in which all the birds were jackdaws (identified by vocalisations and morphological characteristics) for both transit and mobbing flocks. We also required flock images to be captured by all four cameras.

First, we recorded 6 transit flocks over the period from December 2017 to March 2018. To capture the transit flocks, we set up the imaging system along the typical flight paths of flocks such that the birds flew directly over the camera array. The imaging locations were in the vicinity of winter roosts near Mabe and Gwennap, Cornwall, UK. We required the flocks to be moving primarily in one direction without making large-scale turns and the time durations to be longer than the time scale for birds to exchange neighbours, so that our tracking results represented typical flock movement. This neighbour exchange time scale was less than 2 s18. Statistics for the 6 flocks including time duration, group size, nearest neighbour distance, and flight speed are given in Supplementary Table 1. Videos of the flocks are provided in Supplementary Movie 1.

We recorded 10 mobbing flocks at our nest-box colonies near Stithians, Cornwall, UK, during the 2018 breeding season (May to July) when the jackdaws in our study colonies remained in the vicinity of their nest-boxes (these individuals are known to join winter flocks flying to the Gwennap roost). To induce collective anti-predator responses, we used a taxidermy fox (Vulpes vulpes) holding a remote-controlled, flapping bird resembling a jackdaw in its mouth. The fox was initially hidden under a sheet in an open field, in the centre of the camera array. Once the fox was uncovered and the experimenter had returned to their hide, we broadcast pre-recorded scolding calls through a remote-controlled FoxPro loudspeaker placed in a hidden position on the ground beside the fox [for details of recording protocols, see Woods et al. 40]. Playback tracks consisted of three bouts of 8 calls, each separated by 10 s. This mimicks naturally occurring calling bouts, and the amplitude was normalised across all tracks. As the magnitude of collective responses is influenced by the characteristics of the caller40, we used only calls produced by colony members, which would be familiar to the birds in the vicinity. Statistics for the 10 mobbing flocks including time duration, group size, nearest neighbour distance, and flight speed are also given in Supplementary Table 1. Videos of the flocks are provided in Supplementary Movies 2 and 3. Since birds frequently left and entered the measurement volume in mobbing flocks, we manually selected distinguishable groups of birds from each event that satisfied the criteria that (i) the group size was larger than 3; (ii) the time duration was longer than 1.5 s; (iii) the jackdaws did not leave the measurement volume during the selected time period; and (iv) there were no transitions from disordered to ordered states or from ordered to disordered states caused by, e.g. group fusion or fission. Based on these criteria, we selected 154 groups of birds (Supplementary Data 1). The statistics including time duration, group size, group density, and group order for the 154 groups are shown in Supplementary Fig. 6.

In a previous study18, we showed that transit flocks recorded in the winter contain pairwise substructure that arises from the life-long monogamous pair bonds in jackdaw societies. Such pairwise structures are also present in all 6 transit flocks in the current study. For the transit flocks, we calculated the joint probability density functions (PDFs) of the distance to nearest neighbour (Dn=1) and the distance to the second nearest neighbour (Dn=2). These joint PDFs show two distinct regions of high probability (Supplementary Fig. 7), with one region where Dn=1 is nearly constant regardless of Dn=2 indicating the presence of paired birds. However, for the mobbing flocks recorded during the summer, the joint PDFs of Dn=1 and Dn=2 only show one region of high probability (Supplementary Fig. 8) where Dn=1 increases linearly with Dn=2. This indicates that the mobbing flocks contain no pairs. The likely explanation for this difference is that the mobbing experiments were conducted during the breeding season, when both members of the pair are foraging independently so as to maximise the rate at which their young are provisioned.

Ethical note

All field protocols were approved by the Biosciences Ethics Panel of the University of Exeter (ref 2017/2080) and adhered to the Association for the Study of Animal Behaviour Guidelines for the Treatment of Animals in Behavioural Research and Teaching.

Anisotropy factor of neighbour structure

Following a method developed in our previous study18, we calculated the anisotropy factor γ of the first nearest neighbour distribution relative to a focal bird. We first determined the position of a neighbouring bird relative to a focal bird as dx = xneighbourxfocal, where the superscripts ‘focal’ and ‘neighbour’ denote quantities for the focal and neighbour birds, respectively. We then translated the two components of dx located in the horizontal plane to a new coordinate system (ξ, ζ) where +ξ was aligned with the flight direction of the focal bird. Here, we ignored the velocity component in the gravity direction, since it is typically much smaller than the horizontal components (Supplementary Fig. 9). Then, we normalized the vector (ξ, ζ) to create a unit vector, denoted as (, ). The anisotropy factor was defined as γ=  < dζdζdξdξ > , where < > denotes an average over all birds within the group. The value of γ ranges from –1 to 1 by construction. γ> 0 indicates that the neighbouring bird is more likely to be next to the focal bird, γ<0 indicates that the neighbouring bird is more likely to be in front or back, and γ=0 indicates an isotropic structure.

Self-propelled particle model

To mimic the phase transition observed in the jackdaw flocks, we used a self-propelled particle model where particles followed simple local interaction rules based on that of Vicsek et al. 3. In this model, all particles move at a constant speed U0 and align their directions of motion to the average velocity of all neighbours located within a metric distance, r0, with some noise added. The Vicsek model was originally developed in two dimensions, and later extended to 3D48. Here, we used the 3D version of this model. We also added a repulsion zone49 with radius rrep to prevent particles from forming locally dense clusters. To simulate the effect of the external stimulus that kept the mobbing flocks within a certain area, we introduced an additional potential well (here, a harmonic force) felt by every particle. This procedure followed that used by Attanasi et al. 24 who simulated swarms of midges that were stationary with respect to a ground marker. With such a potential well, particles are guaranteed to be confined within a certain volume without the need for periodic boundary conditions or long-range attraction forces.

Specifically, the velocity of each particle i at the next time step was given by

$${\mathbf{v}}_i(t + \Delta t) = U_0 \cdot {\mathbf{\Omega }}_\eta \{ \Theta [{\sum} {_{j \in Si}{\mathbf{v}}_j\left( t \right){\mathrm{ }}-\beta {\mathbf{x}}_{\mathrm{i}}\left( t \right)]\} }$$
(1)

where Si is the spherical volume centred on particle i with a radius of r0, the operator Θ normalizes the argument to be a unit vector, and the operator Ωη rotates the argument vector by a random angle chosen from a uniform distribution with maximum amplitude of 4πη. Note that the term –βxi is the harmonic force that pushes particle i back towards the origin. The strength of this harmonic force is controlled by β. The position of particle i at the next time step is then given by xi(t + Δt) = xi(t) + vi(t + ΔtΔt.

We ran this model in a 3D sphere with a radius of R and open boundary conditions. Initially, particles were randomly distributed within the sphere and moved in random directions. The parameters used in our models were R = 50 m, U0 = 10 m/s, r0 = 4 m, Δt = 0.05 s, rrep = 0.5 m, and β = 0.04. The values of these parameters are selected according to the observation of real bird flocks. For example, birds in mobbing flocks have flight speed close to 10 m/s (Supplementary Table 1), a repulsion zone of their body size, and an interaction range of about 5 m (Fig. 1d). Increasing β causes birds to flying closer to the predator. We selected β = 0.04 such that the trajectories of birds cover the simulated domain size. We varied the number of particles N from 5 to 200 and the noise level η from 0.05 to 0.15 to study their effects on the group order. At each given N and η, we ran the model 50 times, and selected 100 time frames between 104Δt to 106Δt with an interval of 102Δt for analysis. Thus, the group order at a given N and η was calculated by averaging 5000 samples.