Reactivity of complex communities can be more important than stability

Understanding stability—whether a community will eventually return to its original state after a perturbation—is a major focus in the study of various complex systems, particularly complex ecosystems. Here, we challenge this focus, showing that short-term dynamics can be a better predictor of outcomes for complex ecosystems. Using random matrix theory, we study how complex ecosystems behave immediately after small perturbations. Our analyses show that many communities are expected to be ‘reactive’, whereby some perturbations will be amplified initially and generate a response that is directly opposite to that predicted by typical stability measures. In particular, we find reactivity is prevalent for complex communities of mixed interactions and for structured communities, which are both expected to be common in nature. Finally, we show that reactivity can be a better predictor of extinction risk than stability, particularly when communities face frequent perturbations, as is increasingly common. Our results suggest that, alongside stability, reactivity is a fundamental measure for assessing ecosystem health.

theoretical ecology, the majority of work on reactivity to date has focused on predator-prey systems and small communities containing a few species 34,43,44 .The potential for reactivity in large communities has been demonstrated by Tang and Allesina 31 , who found that complex communities can also become reactive before losing stability.However, complex communities come in many forms, with different interaction types and distributions and, across this diversity, we currently lack theory to predict if and when reactivity will be important.
Based on recent progress in random matrix theory 5,7,9,12,14,[45][46][47] , here we develop theory to predict when reactivity is expected in complex communities and how this relates to their stability.Our theory allows us to vary the types and strengths of complex interactions in the communities and ask, across a vast diversity of community types, where reactivity is expected.We then apply our modelling to structured food webs and show that reactivity is expected, and demonstrate how reactivity can be a better predictor of species extinctions than typical stability metrics under frequent perturbations.

Modelling framework
Typically, an ecosystem composed of S interacting species can be modelled as a continuous-time dynamical system 2,4 d XðtÞ where XðtÞ = X 1 ðtÞ,X 2 ðtÞ, Á Á Á ,X S ðtÞ À Á T 2 R S is an S-dimensional vector with X i t ð Þ representing the abundance of species i at time t.f XðtÞ ð Þ encodes the underlying ecological network and interactions among species.For a specific form of f XðtÞ ð Þ, namely the generalised Lotka-Volterra model, see Fig. 1a.The dynamical behaviour around a feasible equilibrium X * (i.e., all components of X * are positive) can be captured by the following linearised equation: Abundance of species 1 Abundance of species i at time t Intrinsic growth rate of species i

Self-regulation of species i
The effect of species j upon species i

Non-reactive Reactive
Equilibrium

States after perturbations in panel b
Fig. 1 | Reactivity captures immediate responses.a Illustration of a two-species generalised Lotka-Volterra (gLV) community.In this figure, we focus on a case in which species 2 interacts with species 1 unidirectionally (i.e., A 12 ≠ 0 and A 21 = 0).b Changes of species abundance over time after four different external perturbations for the two-species system.Blue lines are the responses of species 1, and red lines are the responses of species 2. When the interaction strength is relatively low (s 1 = s 2 = 1, A 12 = 0.3, left panel) or enlarged (A 12 = 3, right panel), the system can recover from these perturbations, suggesting the system is stable in both cases.c The corresponding responses in the phase plane of species abundance.Black dots represent the equilibrium state, and dots of different colours represent immediate states after different perturbations shown in (b).Grey circles represent the distance between the equilibrium state and perturbed states in the phase plane of species abundance, suggesting that all perturbed states share the same distance.Trajectories with different colours are responses after different perturbations.When the interaction strength is relatively low (left panel), all perturbations decay initially and all trajectories remain in the grey circle.When the interaction strength is enlarged (right panel), some perturbations increase initially (such as the blue trajectory).Given that the system is stable in both cases, stability cannot describe the instantaneous responses after perturbations.This situation is where the concept of system reactivity is important.If all perturbations decay initially, the system is nonreactive (left panel).If some perturbations are amplified initially, the system is reactive (right panel).
where x t ð Þ = X t ð Þ À X * is the deviation from the feasible equilibrium, and M is the so-called 'community matrix' 1,5 whose element M ij captures the effect that species j has on species i near the equilibrium.
Defined as the maximum instantaneous amplification rate of perturbations 30 , reactivity R is given as follows: R max Here x 0 is the external perturbation imposed to the system, and Á j j j j 2 is the 2-norm operator.Mathematically, R is quantitatively calculated as max λ H À Á , where λ H is the eigenvalue of matrix H = ðM + M T Þ=2.If R > 0, the system is reactive, indicating that some perturbations can be amplified initially.If R < 0, the system is non-reactive, suggesting that all perturbations decay initially.Thus, the core of reactivity analysis is to identify max λ H À Á .It is worth noticing that since H is a real symmetric matrix, all eigenvalues are real, meaning that all eigenvalues locate on the real axis of the complex plane.

Reactivity criteria for large complex ecosystems
Our model allows us to calculate the reactivity criteria for different community types.In particular, species can interact in a range of ways in a given community-including mutualistic (+/+), exploitative (+/−) and competitive (−/−) interactions-and we can ask how these interactions influence reactivity by identifying the corresponding eigenvalue distribution of H. Following the canonical framework in studying system stability [1][2][3][4][5][6][7][8][9][10][11][12]14,15,[17][18][19] , our analyses are focussed on the properties of the community matrix, which allows us to provide general results that do not rest on particular assumptions of the population dynamics of species. However, wealso provide examples where we illustrate dynamics based upon the standard Lotka-Volterra model (e.g., Fig. 1a).
Random interaction distribution: The typical community type studied in theoretical ecology is a 'random' community 1,5 -that is, one where two species i and j interact with probability C, and the interaction strengths M ij and M ji take the value of a random variable Z with mean 0 and variance σ 2 respectively and independently.The diagonal terms, representing self-regulation, are all set to −d.For large random systems, the eigenvalues of H are contained in a line segment with length 2σ ffiffiffiffiffiffiffiffi ffi 2SC p centred at Àd,0 ð Þ(Fig.S1, see Supplementary Note 1 for detailed derivation).This brings R = max λ H À Á = Àd + σ ffiffiffiffiffiffiffiffi ffi 2SC p .Reactivity requires that R > 0, which leads to the reactivity criterion: σ ffiffiffiffiffiffiffiffi ffi 2SC p > d (Fig. 2a).Exploitative interactions: In a community with exploitative interactions (e.g., predator-prey, or host-parasite), two species i and j also interact with probability C, but interaction strengths have opposite signs: one interaction strength takes the value of Z j j while the other is sampled from À Z j j.For large exploitative communities, the eigenvalues of H are distributed in a line segment with length .The centre of this line segment is Àd,0 ð Þ(Fig.S1, see Supplementary Note 1 for detailed derivation).Thus, we have ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi ffi 2SCðσ 2 À E 2 ðjZ jÞÞ q and the reactivity criterion becomes: ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi ffi 2SCðσ 2 À E 2 ðjZ jÞÞ q > d (Fig. 2a).
Competition and mutualism: In a competitive (or mutualistic) community, pairwise interaction strengths have the same sign: negative for competition and positive for mutualism.For competitive communities, interaction strengths are sampled from À Z j j, while for mutualistic communities, interaction strengths are sampled from Z j j.In both cases, all λ H except an outlier (which is approximately equal to the row sum of H) are contained in a line segment when the community size is large (Fig. S1, see Supplementary Note 1 for detailed derivation).For large competitive communities, this outlier is on the left side of the line segment and reactivity is thus determined by the right endpoint of the line segment.
We then have and the corresponding reactivity criterion is CE Z For large mutualistic communities, this outlier is on the right side of the line segment and thus determines reactivity: R = Àd + S À 1 ð ÞCE Z j j ð Þ.The reactivity criterion now becomes: S À 1 ð ÞCE Z j j ð Þ> d (Fig. 2a).
These reactivity criteria allow us to compare how interaction types influence the reactivity of a community.This analysis reveals that, as for stability, reactivity is strongly dependent on the nature of the interactions within a community.Focussing on reactivity alone, we observe a strict hierarchy from mutualistic communities, which are the most likely to be reactive, through to exploitative communities, which are the least likely (Fig. 2b).Further extension of our theory to communities in which different interactions are mixed with arbitrary proportions (see Methods and Supplementary Note 1) also validates this finding (Fig. 2c, Fig. S2).This result follows the intuition that exploitative interactions, such as predator-prey interactions, introduce negative feedbacks between pairwise species, which will limit the potential for amplification of a perturbation.By contrast, competitive and mutualistic interactions introduce positive feedbacks, which will tend to amplify perturbations.However, note that these positive feedbacks also tend to destabilise communities.As we discuss further below, this effect means that reactive competitive communities and reactive mutualistic communities also tend to be unstable.

The impact of weak interactions on reactivity
In addition to interaction type, interaction strength is considered central to the behaviour of communities and their stability 1,2,4,5,7,9,48,49 .In particular, previous studies suggest that weak interactions are common in natural ecological networks, where they have been hypothesised to be important for ecosystem persistence because they can help to promote ecological stability in some contexts 5,48 .Next we seek to study the influence of weak interactions on reactivity.Using the criteria derived above, we can systematically assess the influence of weak interactions on reactivity.If weak interactions are common in a community 5 , we would have a relatively small E Z j j ð Þ.In contrast, if weak interactions are rare 5 , we have a relatively large E Z j j ð Þ.As with linear stability 5 , this analysis predicts that weak interactions will make competitive communities and mutualistic communities less reactive, have no influence on random communities, and make exploitative communities more reactive.Importantly, we can confirm these key predictions both theoretically and numerically by generating example communities with interspecies interaction strengths drawn from a Gamma distribution, which allows us to control the prevalence of weak interactions, and explicitly calculating their reactivity (see Supplementary Note 2).Moreover, there is again an intuition to this result: weakening exploitative interactions drives higher reactivity because these interactions are negative feedbacks that tend to help protect against amplification of perturbations.By contrast, weakening mutualistic or competitive interactions lowers reactivity, because these interaction types are reactive.

The importance of stable but reactive communities
Our analyses have so far focused on what promotes reactivity in complex communities.However, the reactivity is not equally important for all communities.If a community is unstable, then reactivity is of less interest, for the simple reason that the community is unlikely to exist at all.In contrast, determining the reactivity of a stable community may be vital, as doing so can reveal communities that are at first sight robust, but in fact may be very vulnerable to future perturbations.A key goal, therefore, is to identify when stable reactive communities will occur.
The fact that reactivity and stability are determined by the same set of parameters allows us to directly relate these two key properties of ecological communities.We find that as diversity (i.e., number of species, S) and complexity (i.e., connectance, C) increase, non-reactive stable communities first become reactive stable and then reactive unstable, indicating that the reactive stable state is an intermediate state between non-reactivity and instability (Fig. 3a).This finding is consistent with previous work 31,50 , but we also find that this intermediate state is not equally likely for all community types.This result can be seen by plotting both stability criteria and reactivity criteria together for different community types (Fig. 3a).While competitive and mutualistic interactions both promote reactivity, they also promote instability in similar measure with the result that there is limited scope for stable reactive communities.In these cases, therefore, reactivity is not expected to play an important role in the dynamics of stable communities.By contrast, exploitative communities and random communities have larger regions of parameter space where communities are both stable and reactive.Here, reactivity has the potential to play a critical role in community dynamics.
We can quantify the importance of reactivity in stable communities by calculating the area ratio of the reactive stable region (Fig. 3a, red region) to the stable region (Fig. 3a, blue region and red region).This area ratio can be interpreted as the normalised distance between the transition to reactivity and the transition to instability (see Methods and Supplementary Note 3).A low area ratio, as seen for competitive and mutualistic communities, means that these two transitions are close.For such communities, the observation of a reactive state suggests that the corresponding community is close to an unstable state, or is even transitioning into an unstable state.From an ecosystem management perspective, therefore, reactivity would be an early warning of the potential loss of stability.By contrast, the high area ratio seen for random and exploitative communities means that the distance between reactivity and instability is relatively large.Here, reactive states can be far away from unstable states, such that there is less threat to ecosystem stability.However, as we show below, even for these relatively stable communities, there is a threat of extinction when perturbations are frequent.
We also calculate this area ratio for communities of any proportion of the different interaction types (Fig. 3c).Consistent with the findings for the four community types, increasing the proportion of mutualistic interactions or competitive interactions reduces the scope for stable reactive systems (Fig. 3c).By contrast, increasing the proportion of exploitative interactions increases the propensity for stable communities that are also reactive.Moreover, for communities with mixed interaction types, which are expected to be common in nature, there is ample potential for a reactive stable state.
In summary, our theory predicts that reactivity is most important for the dynamics of communities with mixed and exploitative interactions, where there are large regions of parameter space where communities are both reactive and stable.It is these types of communities, therefore, where one is most likely to see a stable community that, after perturbation, behaves in a manner not predicted by typical stability measures.This said, if one does observe reactivity in a mutualistic or competitive network of species, this may be an early warning sign that the set of species in question are on the brink of a transition to an unstable state.
Our work suggests that reactivity is common in nature.To evaluate this key prediction, we sought data from microbial communities that allow reactivity to be estimated.We identified seven communities, two found within the mammalian gut 51,52 , four isolated from the soil 53 , and one arbitrarily and artificially assembled in vitro using a mixture of gut and soil-associated microbes 49 (see Supplementary Note 4).We note that these communities are of low diversity (4 or 5 taxa) as compared to those studied with our theory, which is designed for diverse communities.Nevertheless, in line with our key prediction that reactivity is important, we find evidence of reactivity in all of the natural communities (Fig. 3d).Moreover, these natural communities also display a mixture of interaction types, which is associated with stable reactive communities in the theory (Fig. 3d).By contrast, the one artificial community that contains only mutualistic and competitive interactions is non-reactive, which is again consistent with our prediction that these interaction types are less likely to lead to stable reactive systems (Fig. 3d).

Reactivity in structured food webs
So far we have considered the reactivity of communities with a random interaction network structure (i.e., unstructured interaction network).However, interaction networks of real ecological communities often contain structures, including trophic levels and the potential for groupings of species within a community that interact more strongly than average [5][6][7][8]11,12,43,[54][55][56][57][58] . We, therefore,want to explore how such structuring influences the potential for reactivity.
To study the impacts of network structure, we implement two widely-used community structure models in our framework: the cascade food web 5,8,12,43,57,58 and the niche food web 5,8,56,57 (see Methods).In the cascade model, species are assumed to form a strict hierarchy, and to stable and non-reactive communities, the red region leads to stable and reactive communities, and the grey region leads to unstable and reactive communities.b A general view of the distance between reactivity and instability.Here we define the area ratio of the reactive stable region (red region in (a)) to the whole stable region (red and blue regions in (a)) as the normalised distance between reactivity and instability.Yellow bars are theoretical results, while green dots are numerical results.Each green dot is obtained by measuring the corresponding area ratio in a simulated phase transition diagram (i.e., simulated version of (a)).c Distance between reactivity and instability for communities with mixed types of interaction (i.e., exploitative interactions, mutualistic interactions, and competitive interactions).When the connectance (or community size) is fixed, the distance is measured by the critical ratio of the number of species (or the ratio of connectance) based on that in (a).One can calculate the distance metric, therefore, by either varying community size or connectance to move from the stable non-reactive region, blue line in (a), to the unstable reactive region, red line in (a).Here we plot this distance for three cases, two of these have fixed community size (left panel and middle panel) while the other one has fixed connectance (right panel).As the proportion of exploitative interactions (P +/− ) increases, the distance increases.As the proportion of mutualistic interactions (P +/+ ) or competitive interactions (P −/− ) increases, the distance decreases.And these are consistent with the results given in (b).d Reactivity analysis of empirical microbial communities.Left part shows the reactivity calculated directly from experimental data, and right part shows proportions of different types of interactions in these communities.Here communities 1 and 2 are mouse microbial communities 51,52 , communities 3 to 6 are soil microbial communities 53 , and community 7 is an artificially assembled community 49 .In (a)-(c), we set d = 1, σ = 0.2.
species with higher rank predate species with lower rank with a fixed probability (Fig. 4a).In the niche model, species predate all species within their predation range (Fig. 4a).Importantly, despite the introduction of network structure, we still observe large regions of parameter space where communities are stable and reactive (Fig. 4b).Indeed, the introduction of structure in the niche model even makes communities more reactive, i.e., reactive communities occur for weaker levels of interspecies interaction than in the equivalent unstructured communities (recall that these communities are based on exploitative interactions which tend to limit reactivity, above).Put another way, it takes lower interspecies interaction strengths to render a community reactive with niche structuring than without.
Our work shows that, as compared with an unstructured equivalent, cascade food webs do not influence system reactivity, while a niche food web structure makes the system more reactive (Fig. 4b).We find that this difference between the two food web types is explained by the different structural features introduced by each.The cascade model introduces trophic levels, which only influence the arrangement of pairwise positive and negative elements in the community matrix M (the non-zero negative elements are in the upper-triangular part, while the non-zero positive elements are in the lower-triangular part, Fig. 4a).This single feature is mitigated in H = M + M T =2, and, as a result, the cascade model and its unstructured counterpart yield the same H, and therefore the same reactivity.The niche model is different in that it introduces intervality (that is, each predator consumes preys that are adjacent in the hierarchy) and a broader degree distribution (Fig. 4c, degree of a species is the number of its interacting species) alongside introducing trophic levels 8 .These properties not only change the arrangement of pairwise positive and negative elements in the community matrix but also the topological structure of the underlying interaction network.This change of topological structure influences matrix H. Thus, H niche is different from H unstructured , which leads to a more reactive community.Further analysis of some variants of cascade model (interval cascade model, cascade model with broad degree distribution, and interval cascade model with broad degree distribution, see Supplementary Note 5 and Figs.S5-S7) suggests that the In the cascade model, trophic levels are introduced, i.e., species with higher ranks predate species with lower ranks with a fixed probability.
In the niche model, species predate a subset of species within a defined range or niche (shaded circles with different colours).The corresponding community matrices are presented with positive (blue) and negative (red) interactions.The construction methods for these two food web models are provided in Methods.
b Phase transitions of cascade and niche food webs.The blue region marks stable and non-reactive communities, red region marks stable and reactive communities, and grey region marks unstable and reactive communities.Red (blue) hollow dots are the percentage of reactive (stable) communities from numerical simulations, obtained from 50 randomly constructed communities for each point in parameter space.For comparison, the vertical red (blue) dashed lines show the critical average interspecies interaction strength (i.e., σ) for the transition to instability (reactivity) of the corresponding unstructured food webs.As σ increases, these two food webs also experience two phase transitions: one is from stable non-reactive state to stable reactive state, the other is from stable reactive state to unstable state.The cascade model shares the same critical σ with the unstructured case to move into a stable reactive state, while niche model requires a lower average strength of interspecies interaction to move into a stable reactive state.c Degree distribution for these three types of food webs.In (b) and (c), community parameters are: broader degree distribution is the key structural feature that drives increased reactivity.

Self-regulation and reactivity of complex ecosystems
A key factor known to influence community stability is the strength of density dependent regulation exhibited by the populations of each species in a community 4,5,12 , also known as self-regulation (i.e., M ii ).
Broadly speaking, increased self-regulation is stabilising and, therefore, is predicted to shift communities to a more stable state 5,9 .As might be expected, therefore, it is also the case that increasing selfregulation can lead to a less reactive community (since it is clear from the theoretical expressions that more negative M ii , i.e., larger selfregulation strength, can bring a smaller reactivity value).However, our model assumes that all species have identical levels of self-regulation.
In practice, the expectation 12,59,60 is that there will be variability in selfregulation between species with the possibility of some species that have very limited self-regulation, which are instead regulated by their interactions with the wider community.We, therefore, sought to understand the potential impacts of such self-regulation heterogeneity on system reactivity, and whether a system can remain non-reactive when some species do not self-regulate.Here again, we were able to leverage developments in random matrix theory 12,[45][46][47] in order to incorporate heterogeneous self-regulation strengths and non-selfregulating species into our theoretical framework of system reactivity (Methods and Supplementary Note 6).With this method in place, we can vary the heterogeneity of selfregulation in unstructured networks as the standard deviation of self-regulation strength σ d , which reveals that increasing self-regulation heterogeneity makes the system more reactive (Fig. 5a and Fig. S10, see Supplementary Note 6 for theoretical analysis).We next ask whether the introduction of network structure alters this prediction, using the case of a cascade food web.Specifically, here we consider three cases.In the first, the strengths of self-regulation have no relation to trophic levels (disorganised case).The second assumes that species at higher trophic levels possess higher self-regulation strengths (positive case).In the third, species at higher trophic levels possess lower selfregulation strengths (negative case).We find that all these three cases yield the same results as unstructured food webs (Fig. 5b).Our findings on the importance of heterogeneity in self-regulation for reactivity, therefore, are robust to these changes in network structure.
Similarly, we can explore the influence of non-self-regulating species on system reactivity in communities of otherwise homogeneous self-regulation strengths.Strikingly, we find that even a single species without self-regulation can make a non-reactive system reactive, regardless of the self-regulation strength of other community members (Fig. 5c, Fig. S10, see Supplementary Note 6 for theoretical analysis).For most community types, this removal of self-regulation typically also renders communities unstable.However, interestingly, we find that exploitative systems are able to remain stable even when multiple species no longer self-regulate, yet become increasingly reactive as the number of non-self-regulating species increases.This finding holds in the presence of trophic levels (Fig. S10), and when those species that do self-regulate do so in a heterogeneous manner (Fig. S10).Together, these analyses suggest that all species must self- regulate with relatively high strengths in order to prevent community reactivity.

Reactivity can be a better predictor of species extinctions than stability under frequent perturbations
Finally, to investigate the potential importance of reactivity, we study the impacts of different perturbation regimes on the structured and unstructured networks (Fig. 6 and Figs.S11-S14).For single perturbations, as expected, the effects of reactivity are that the return time after perturbation is increased relative to networks that are non-reactive.This increase in return time is seen across the three types of networksunstructured, cascade and niche-and the result is that the systems return to their original abundances much more slowly than in the nonreactive case (Fig. 6a, top).Nevertheless, they do all return in line with the notion of a reactive but stable state.The introduction of frequent perturbations, however, results in a qualitative shift in predictions.Now, the effects of reactivity dominate the dynamics that are observed and, importantly, reactive communities are more likely to experience species extinctions than non-reactive ones (Fig. 6a, bottom and Fig. 6b).Modelling other types of frequent perturbations further supports this claim (Figs.S11-S14).Under such conditions, therefore, reactivity becomes more important than stability in predicting the persistence of species over time.
Frequent perturbations can also be modelled through the theoretical framework for modelling ecological variability of Arnoldi et al. 61 .This modelling framework is a linearised model and is thus valid for systems operating near equilibrium.As a result, it is not suited for studying extinctions directly, as these tend to occur when a system is far from equilibrium.Nevertheless, one can use variability in abundances over time to capture transient responses to perturbations, where the magnitude reflects the tendency of a community to change in time.In this way, variability can be a good indicator of the risk that an ecosystem will experience species loss and system collapse 35,61 .Inspired by this approach 61 , we constructed a perturbed community Green regions indicate that the community recovers to its equilibrium, and red regions suggest that the community suffers species loss.Although both nonreactive stable and reactive stable communities can recover from a single perturbation (upper row of (a)), reactive stable communities can experience species loss following frequent perturbations (bottom row of (a)).b Overall view of species loss in typical food webs under frequent perturbations with different strengths and frequencies.Colours represent the percentage of communities suffering species loss from numerical simulations.To obtain the corresponding percentage, we randomly construct 20 communities and count how many communities can persist under frequent perturbations.In each analysis, community dynamics are simulated using the gLV model, with a species regarding as extinct if its abundance falls below 1% of its equilibrium abundance, and community parameters are: S = 50, C = 0.2, σ = 0.05.Per capita self-regulation strength s = 1 for non-reactive stable communities, and s = 0.1 for reactive stable communities.Frequent perturbations are imposed by increasing the abundances of 30 randomly picked species with a fixed frequency but the same pattern is seen for other perturbation types, see Figs.S11-S14.For communities in (a), equilibrium abundance is 2 for each species, in (b), equilibrium abundance is 1 for each species and simulation time is 500 units.
model and explored the relationship between variability and reactivity (Supplementary Note 7).This reveals that, as compared with nonreactive communities, the variability of a stable reactive community is high, which is consistent with our finding that stable reactive communities are more vulnerable to species loss and system collapse under frequent perturbations (Figs.S15-S18).

Discussion
The study of community stability is central to ecology.Stability is considered to be so important because most natural communities will face frequent perturbations, and it is the stable communities that are expected to maintain species diversity in the face of these perturbations.However, this view neglects the potential for reactivity in stable communities, which can amplify perturbations and dominate the short-term responses to perturbations.Here, we have explored the conditions that lead to reactivity in diverse communities as a function of the sign and strength of the complex interactions among their constituent species.By deriving analytical reactivity criteria, we show that interaction types can be critical for community reactivity.Mutualistic and competitive communities are typically only reactive when they are unstable and here, the observation of reactivity is likely to indicate the potential for community collapse.However, for exploitative and mixed interaction types, we find large regions where communities are predicted to be both stable and reactive.This prediction is robust to the introduction of community structure, where implementing a cascade or niche model leads again to large regions of reactivity within stable communities.The link between reactivity and short-term dynamics can be lessened in some contexts.The initial amplification rate strongly depends on perturbation direction, and thus being reactive does not imply that all perturbations are amplified initially 37 .Another context in which reactivity can be decoupled from short-term dynamics is when there is a wide distribution of species abundances.Arnoldi et al. studied the influence of rare species and found that rare species tend to influence the measure of system stability even though they do not greatly affect system dynamics in practice 37 .In the same vein, we explored the influence of rare species on our measure of system reactivity within a range of different community types (see Supplementary Note 8 and Fig. S19).This work shows that regardless of community type, rare species can again influence system reactivity values, even though again these species would not in practice have a large impact on system dynamics (Fig. S20).To analyse such cases and gain a comprehensive view on short-term system dynamics after perturbations, one should consider other measures, such as median return rate proposed by Arnoldi et al., along with system reactivity and stability 37 .However, because our main analyses did not include such rare species, the measure of reactivity we have employed here should map well to shortterm dynamics.
Rather than focussing on the case of rare (low abundance) species, one can instead ask more generally how differences in species abundances influence community ecology.Recent work by Gibbs et al. extending classic work on system stability revealed that species abundances do not qualitatively affect stability in a Lotka-Volterra framework 14 .That is, as long as an interaction matrix A is stable, the community matrix M = diag X * A will also be stable for any feasible equilibrium X * .This result led us to wonder whether similar rules might apply to reactivity.To investigate the potential role of species abundances on reactivity, we conducted additional theoretical analyses and numerical calculations (Supplementary Note 8, Figs.S21-S23).While our theory is only an approximation (Supplementary Note 8), it fits well with our numerics (Figs.S21, S22) and suggests that the reactivity of A implies the reactivity of corresponding M but the non-reactivity of A cannot guarantee the nonreactivity of corresponding M (Supplementary Note 8, Fig.S23).This result is important in that it implies that accounting for variability in species abundances will only increase the scope for reactivity beyond that which we have predicted here.
We also find that the degree of self-regulation by individual species in a community can be important for system reactivity.Selfregulation has long been known to have the potential to promote system stability, with some studies suggesting that the majority of species need to have strong self-regulation strengths to maintain stability 12 .Our work suggests that to prevent reactivity the requirements for self-regulation are even stricter, with a requirement that all species must self-regulate with relatively high strengths.Given we also find conditions where reactivity drives species extinctions, this finding suggests that self-regulation may play a more important role in ecosystem health than previously appreciated.
Our work shows that communities with mixed interactions and trophic structure have ample potential for reactivity, suggesting that reactive states can exist in many naturally-occurring systems.In support of this conclusion, previous work has highlighted the potential for reactivity through analysis of ecological data, including in planktonic lake communities 62 and insect populations 63 .When perturbations are rare, these dynamics are transient and stability becomes a reasonable predictor of the state of a given community.In other cases, however, the observation of reactivity will be an early warning sign of extinction risk, one that can potentially be assessed more quickly than stability property in ecological data.Indeed, for many ecosystems, the expectation is that perturbations will be frequent, something that may increase with the impacts of climate change and other anthropogenic factors [64][65][66][67] .Here, short-term responses can dominate and it is reactivity, rather than stability, that is the key to both ecological dynamics and extinction risk.Our work suggests that reactivity and stability need to be considered side-by-side if we are to understand, and predict, complex systems.

Constructing community matrices for communities with mixed interaction types
For communities with mixed interaction types, two species still interact with probability C. With probability P +/+ , two species interact in mutualistic manner, and the interaction strengths M ij and M ji take the value of Z j j respectively and independently.With probability P −/− , two species interact in competitive manner, and the interaction strengths M ij and M ji take the value of À Z j j respectively and independently.With probability P +/− , two species interact in exploitative manner, and the interaction strengths M ij and M ji have opposite signs: one takes the value of Z j j while the other takes the value of À Z j j.The diagonal terms M ii are all set to −d.Note that P +/+ = 1 leads to a mutualistic community, P −/− = 1 leads to a competitive community, and P +/− = 1 leads to an exploitative community.The statistics of the community matrix for communities with mixed interaction types can be extracted as Reactivity criterion for communities with mixed interaction types For simplicity, we denote Based on these statistics, we have . According to random matrix theory and low-rank perturbation theorem 5,7,12,45,46 , the eigenvalues of H are contained in a line segment with length 2 q .In this case, reactivity is q , all but one eigenvalues are still distributed in this line segment, and the outlier is approximated as λ H,outlier = Àd + S À 1 ð ÞE.In this case, reactivity is See Supplementary Note 1 for detailed derivation.
Measuring the distance between the transition to reactivity and the transition to instability As stated in the manuscript, the normalised distance (henceforth, ND) between the transition to reactivity and the transition to instability can be defined as the area ratio of the reactive stable region to stable region.For random communities, the stability criterion is σ ffiffiffiffiffiffi SC p < d, leading to the function describing the critical S − C curve for instability The area of the stable region in S − C plane is obtained as The normalised distance between the transition to reactivity and the transition to instability (i.e., the area ratio of reactive stable region to stable region) is then ND random = 1 − A non−reactive,random /A stable,random = 1/2 (Fig. 3b).When mutualistic interactions are preponderant, the stability criterion and reactivity criterion are S À 1 ð ÞE < d and S À 1 ð ÞE > d, respectively.Thus, the critical S − C curves for instability and reactivity are the same, meaning that a reactive mutualistic community is always unstable (Fig. 3b).Otherwise, the stability criterion and reactivity criterion are and S = ðd + EÞ 2 =ð2ðV + ρ À E 2 ÞÞ respectively, leading to the distance between the transition to reactivity and the transition to instability that here the distance is obtained by fixing system connectance).Clearly, a positive rðM ij ,M ji Þ i≠j (i.e., competitive and mutualistic interactions are preponderant) leads to a relatively low distance (lower than 1/2, Fig. 3b,  c), and a negative rðM ij ,M ji Þ i≠j (i.e., exploitative interactions are preponderant) leads to a relatively large distance (larger than 1/2, Fig. 3b, c).
For detailed derivation and analysis, see Supplementary Note 4.
In simulations, critical values for phase transitions (e.g., the boundaries between regions with different colours in Fig. 4b) are determined as follows, taking the transition from a non-reactive state to a reactive state as an example.First, we identify the average interspecies interaction strength value σ 1 , at which all simulated communities are non-reactive, such that when σ > σ 1 , not all simulated communities are non-reactive.Next, we identify the average interspecies interactions strength value σ 2 , at which all simulated communities are reactive, such that when σ < σ 2 , not all simulated communities are reactive.The critical σ r is then estimated as σ r = σ 1 + σ 2 À Á =2.Similarly, we can estimate the critical σ for transition from a stable state to an unstable state.

Reactivity analysis of empirical microbial communities
We analyse the reactivity of seven different microbial communities 49,[51][52][53] from previous empirical studies.For these communities, the researchers have already inferred the true interaction networks (A ij ) and intrinsic growth rates (r i ).For a given community, we then perform the following steps: 1) Using the empirically derived A ij and r i parameters, we identify the underlying equilibrium abundances of each species within the community, then determine the empirical community matrix M e .2) The true reactivity can be drawn directly from M e , via calculating the eigenvalues of H e = ðM e + M T e Þ=2 (blue bars, left part of Fig. 3d).For detailed information, please see Supplementary Note 4.

Constructing community matrices for cascade food web and niche food web
The construction algorithm 5 for a cascade food web is: i) For each entry in the lower-triangular part of M (i.e., M ij,i>j ), we draw a random value p from a unfirom distribution U 0,1 ½ .ii) If p ≤ C, we draw M ij,i>j from an half-normal distribution N 0,σ 2 À Á and M ji,i>j from a negative half- C is the desired level of connectance.
iii) If p > C, we set 0 to both M ij,i>j and M ji,i>j .iv) Set all diagonal terms to − d (i.e., M ii = − d).The construction algorithm 5 for a niche food web is: i) Set a niche value η i for each species and order species according to an increasing niche value order.η i is drawn from a uniform distribution U 0,1 ½ .ii) Set a niche radius r i = η i B for each species.B is sampled from a beta distribution Be 1,1=C À 1 À Á .C is the desired level of connectivity.iii) Set a niche centre c i for each species.c i is sampled from a uniform distribution U r i =2, min η See Supplementary Note 5 for additional information.

Constructing community matrices for communities with heterogeneous self-regulation strengths
The differences between the community matrices of communities with homogeneous self-regulation strengths and communities with heterogeneous self-regulation strengths are the diagonal terms (i.e., M ii ), and the sampling of off-diagonal terms is the same as presented previously.Thus, here we focus solely on the sampling of diagonal terms.When self-regulation strengths and trophic levels are not related, all diagonal terms are sampled from a uniform distribution with mean d mean and variance σ 2 d respectively and independently.Here d mean is the average self-regulation strength.When self-regulation strengths and trophic levels are related, we first generate S random values d 1 , ⋯ , d S from the uniform distribution U½d mean À ffiffiffi 3 p σ d ,d mean + ffiffiffi 3 p σ d respectively and independently.When species at higher trophic levels possess higher self-regulation strengths, sort d i in an ascending order and set M ii = − d i (note that here i indicates the trophic level).When species at higher trophic levels posses lower self-regulation strengths, sort d i in a descending order and set M ii = − d i .Note that this construction method can be adapted to cases where self-regulation strengths are sampled from other distributions.

Constructing community matrices for communities with nonself-regulating species
Here we still focus on the sampling of M ii .When self-regulation strengths and trophic levels are not related, we first generate S n distinct positive integers less than or equal to S randomly: Q = fq 1 , Á Á Á ,q S n g.For each i ∈ Q, set M ii = 0.For each i ∉ Q, set M ii = − d.When species at higher trophic levels self-regulate, we set M ii = 0 for i ≤ S n and M ii = − d for i > S n (note that i indicates the trophic level).When species at higher trophic levels do not self-regulate, we set M ii = − d for i ≤ S − S n and M ii = 0 for i > S n .
Incorporating heterogeneous self-regulation strengths and nonself-regulating species into reactivity analysis For convenience, we still denote EðM ij Þ i≠j = E, Var ðM ij Þ i≠j = V , and EðM ij M ji Þ i≠j = ρ, which leads to the statistics of matrix H: First, we discuss cases of heterogeneous self-regulation strengths.For the simplicity of theoretical derivation, here we focus on the case where self-regulation strengths are sampled from a uniform distribution ½Àd mean À ffiffiffi 3 p σ d , À d mean + ffiffiffi 3 p σ d .For the classic random community, we have E = 0, V = Cσ 2 and ρ = 0. We can then identify the rightmost eigenvalue of H (see Supplementary Note 6 for detailed derivation), which leads to the expression of reactivity For communities with mixed interaction types, when , we can approximate the rightmost eigenvalue of H (see Supplementary Note 6 for detailed derivation), which leads to the expression of reactivity where r , the expression of reactivity can be approximated as follows (see Supplementary Note 6 for detailed derivation) where

Fig. 2 |
Fig. 2 | Reactivity criteria for large complex ecosystems.a Predicting the eigenvalue distribution of H and corresponding reactivity profiles.In the first row, the maximum (grey circles) and minimum eigenvalues (grey diamonds) of 50 randomly generated communities are plotted.Blue and red lines are theoretical predictions of maximum and minimum eigenvalues, respectively.In the second row, we systematically vary C to obtain σ ffiffiffiffiffiffi SC p spanning 0,1:5 ½ .Orange dots represent the percentage of reactive communities out of 100 samples from numerical simulations.Blue lines are the corresponding theoretical predictions for the numerical percentage.Grey regions show unstable communities.In all cases, phase transitions from non-reactivity to reactivity are well predicted by our theory.b Reactivity criteria for different types of communities.Curves with different colours are critical C-S curves for different communities, and combinations of S and C below each curve lead to non-reactive communities.Different types of communities form a strict hierarchy from exploitative communities (most likely to be non-reactive) to mutualistic communities (most likely to be reactive).c Extension of our theory to communities with mixed interaction types.Left part of this panel gives theoretical predictions and right part of this panel shows results from numerical simulations.Each data point in the right part is an average of 50 randomly generated communities with the same set of parameters.In this figure, we have d = 1.In the first row of (a), we have S = 150, C = 0.25, σ = 0.25.In the second row of (a), we have S = 250, σ = 0.1.In (b), we have σ = 0.1.In (c), we have S = 150, C = 0.1, σ = 0.05.

Fig. 3 |
Fig.3| Measuring the distance between reactivity and instability.a Comparison of the critical C-S curves of reactivity and stability for communities with different interaction types.The introduction of reactivity criteria (blue lines) and stability criteria (red lines) can divide the C-S plane into 3 parts, where the blue region leads to stable and non-reactive communities, the red region leads to stable and reactive communities, and the grey region leads to unstable and reactive communities.b A general view of the distance between reactivity and instability.Here we define the area ratio of the reactive stable region (red region in (a)) to the whole stable region (red and blue regions in (a)) as the normalised distance between reactivity and instability.Yellow bars are theoretical results, while green dots are numerical results.Each green dot is obtained by measuring the corresponding area ratio in a simulated phase transition diagram (i.e., simulated version of (a)).c Distance between reactivity and instability for communities with mixed types of interaction (i.e., exploitative interactions, mutualistic interactions, and competitive interactions).When the connectance (or community size) is fixed, the distance is

Fig. 4 |
Fig.4| Structured food webs display reactivity.a Schematic illustration of cascade and niche food webs.In the cascade model, trophic levels are introduced, i.e., species with higher ranks predate species with lower ranks with a fixed probability.In the niche model, species predate a subset of species within a defined range or niche (shaded circles with different colours).The corresponding community matrices are presented with positive (blue) and negative (red) interactions.The construction methods for these two food web models are provided in Methods.b Phase transitions of cascade and niche food webs.The blue region marks stable and non-reactive communities, red region marks stable and reactive communities, and grey region marks unstable and reactive communities.Red (blue) hollow dots are the percentage of reactive (stable) communities from numerical simulations,

Fig. 5 |
Fig.5| Influence of self-regulation on system reactivity.a, b Influence of selfregulation heterogeneity on system reactivity.Self-regulation heterogeneity is quantified by the standard deviation of self-regulation strengths.Solid lines are theoretical predictions, symbols (dots, circles, diamonds, and crosses) are results from numerical simulations.'Disorganised' refers to the case where self-regulation strengths have no relation to trophic levels, 'positive' refers to the case where species at higher trophic levels have higher self-regulation strengths, and 'negative' refers to the case where species at higher trophic levels have lower self-regulation strengths.Note that in these two panels, all communities concerned are stable.c Influence of non-self-regulating species on system reactivity.Upper panels show average community state, with the blue region indicating communities are on average stable and non-reactive, the red region indicating stable and reactive, and the grey region indicating unstable and reactive.Lower panel shows the average reactivity values for each parameter combination.In (a) and (b), the average selfregulation strength is d mean = 6, and self-regulation strengths are sampled from a uniform distribution.Other community parameters in this figure are S = 200, C = 0.3, σ = 0.1.Each simulation data point is the average of 50 randomly constructed communities for the specific parameter combination.

Fig. 6 |
Fig. 6 | Reactivity predicts species persistence better than stability under frequent perturbations.a Responses of different food webs to perturbations.Each line in (a) captures the change in abundance of each species after the perturbations.Green regions indicate that the community recovers to its equilibrium, and red regions suggest that the community suffers species loss.Although both nonreactive stable and reactive stable communities can recover from a single perturbation (upper row of (a)), reactive stable communities can experience species loss following frequent perturbations (bottom row of (a)).b Overall view of species loss in typical food webs under frequent perturbations with different strengths and frequencies.Colours represent the percentage of communities suffering species loss from numerical simulations.To obtain the corresponding percentage, we we can derive the function depicting the critical S − C curve for reactivity S = d 2 =ð2Cσ 2 Þ,