Clear Sky Science · en

Predicting missing links in food webs using stacked models and species traits

· Back to index

Why guessing hidden food chains matters

Ecologists often sketch nature as a web of “who eats whom,” from tiny microbes in the soil to predators in the sea. But even the best food webs are full of holes: many real feeding relationships are never observed. This paper shows how a modern machine-learning approach, called model stacking, can use the patterns of known interactions together with simple facts about species—such as body size and lifestyle—to predict which missing connections are most likely real. Better guesses about hidden links can sharpen our understanding of ecosystem stability and help focus scarce fieldwork on the most informative interactions.

From messy nature to network diagrams

Food webs turn ecosystems into networks: species are nodes, and arrows show who eats whom. In practice, collecting every feeding link is nearly impossible. Observations are laborious, rare events are easy to miss, and the number of possible links grows far faster than the number of species. Traditional link-prediction tools from social networks work reasonably well, but they typically ignore key features of food webs: feeding arrows have a direction (from food to feeder), species traits restrict which interactions are ecologically plausible, and most food webs have a strong hierarchy from plants up to top predators. The authors therefore adapt stacking—a technique that learns how to combine many simple prediction rules—specifically to the realities of food webs.

Figure 1
Figure 1.

Teaching algorithms ecological common sense

The stacked model blends dozens of structural predictors, which rely only on the pattern of who eats whom, with trait-based predictors that use species properties such as body mass, movement type, and metabolic type. Structural rules include, for example, whether two species share many neighbors in the web or how central they are. The authors revise these rules to respect the flow of energy up the food chain: instead of closing undirected triangles, their “ecologically relevant common neighbors” pattern focuses on motifs that resemble realistic feeding chains. Trait-based rules capture both similarity and contrast. Some traits, like habitat, favor interactions among similar species, while others, like trophic level, favor links between dissimilar partners. Distance measures between trait profiles, and especially ratios of body masses, allow the model to exploit both assortative and disassortative patterns.

Putting the method through its paces

To see whether stacking really learns how to use structure and traits, the team first built artificial food webs with known rules. They mixed networks where links depend only on hidden group structure with networks where links are fully determined by species traits. In these controlled tests, a structure-only model excelled when traits were irrelevant, and a trait-only model excelled when traits dominated. Crucially, the full stacked model performed as well as the best specialized model in each extreme, and did better than either one in mixed cases. This shows that, without being told the true rules, stacking can discover how much weight to give to structure versus traits for each network.

How real food webs reveal their secrets

The authors then applied the method to a global collection of 290 empirical food webs from lakes, streams, oceans, and terrestrial habitats above and below ground, each annotated with a small set of traits. Across this diverse corpus, all three model types—structure-only, trait-only, and full—performed far better than chance at distinguishing true missing links from true absences. On average, the full model reached near-perfect discrimination, slightly outperforming the structure-only model and clearly beating the trait-only model. Yet in about one in ten webs, a simpler model using only traits or only structure did best, underscoring that different ecosystems encode their interaction rules differently. The stacked model’s internal feature rankings highlight a handful of especially informative predictors: measures related to generalist consumers and resources, nearest-neighbor style rules that borrow partners from similar species, low-rank summaries of the network, and body-mass ratios between consumer and prey.

Figure 2
Figure 2.

When and where prediction works best

Because the dataset spans many ecosystems, the authors could ask what makes a food web easier to predict. Larger, more densely connected webs with better taxonomic resolution and lower compartmentalization tended to yield higher accuracy, likely because they give the model more structural signal to learn from. Terrestrial belowground webs, such as soil communities, were the easiest to predict, while marine and terrestrial aboveground webs were somewhat harder. The relative usefulness of traits versus structure also varied by ecosystem type, with body size playing an especially strong role in marine systems. These differences hint at deeper ecological contrasts in how interactions are organized across environments.

What this means for understanding ecosystems

For non-specialists, the key message is that even with partial and noisy data, it is now possible to reconstruct unseen pieces of ecological networks with high confidence. By smartly combining many simple structural cues with a few widely measured traits, the stacked model can not only fill in likely missing feeding links but also reveal which features—such as body size or generalist behavior—most strongly shape who eats whom. This opens the door to more efficient field surveys, sharper tests of ecological theory, and, in the long run, better forecasts of how ecosystems might respond when species are lost or environments change.

Citation: Van Kleunen, L.B., Dee, L.E., Wootton, K.L. et al. Predicting missing links in food webs using stacked models and species traits. Nat Commun 17, 2298 (2026). https://doi.org/10.1038/s41467-026-68769-7

Keywords: food webs, species traits, link prediction, ecological networks, machine learning