Modelling Microbial Communities with Graph Neural Networks

Albane Ruaud, Cansu Sancaktar, Marco Bagatella, Christoph Ratzke, Georg Martius

Microbial communities are essential to everything from human gut health to industrial waste treatment and environmental stability. However, understanding how these communities assemble and interact is a massive "n-body problem." Traditional mathematical models, such as the generalized Lotka-Volterra (gLV) equations, require extensive time-series data (growth curves) for every possible combination of bacteria to estimate interaction parameters. Because the number of required experiments grows exponentially with the number of species, this approach is practically impossible for complex ecosystems.

Furthermore, traditional models are notoriously rigid. If a new bacterium is introduced to the environment, researchers typically have to start their parameter fitting from scratch. To overcome this, there is a pressing need for models that can look at the genetic "blueprint" (the genome) of a set of bacteria and predict how they will coexist at equilibrium.

This paper introduces a novel approach to predicting the steady-state composition of bacterial communities using Graph Neural Networks (GNNs) trained directly on genomic data. By leveraging the inductive biases of GNNs, the authors demonstrate that models can generalize to larger communities and even unseen species, bypassing the need for expensive time-series growth curves.

A Graph-Based Approach to Microbial Dynamics

The authors propose using Graph Neural Networks to model these complex communities. In this framework, each bacterium in a community is represented as a node in a fully connected graph. The node features are binary vectors derived from the bacterium's genome—specifically, the presence or absence of KEGG Orthology (KO) functional groups.

Overview of the GNN pipeline for microbial communities

Instead of trying to solve complex differential equations over time, the GNN performs regression to directly predict the relative abundance of each species at steady state (equilibrium). This "implicit dynamics" approach drastically simplifies the prediction pipeline.

The authors compared Multi-Layer Perceptrons (MLPs) against two GNN variants: GraphSAGE and a Message Passing Neural Network (MPGNN). The critical advantage of GNNs here is permutation invariance. In a microbial community, the arbitrary order in which you list the species shouldn't change the predicted outcome. While standard MLPs struggle with this—often failing completely if the input order is shuffled—GNNs handle it by design.

Datasets and the Custom Simulator

The study utilized two primary real-world datasets:

  1. FRIEDMAN2017: A dataset of synthetic communities containing 2, 3, 7, and 8 bacteria species.
  2. BARANWALCLARK2022: A larger dataset featuring communities ranging from 2 to 26 bacteria.

Because real-world microbial data is often scarce, the authors also built a custom gLV-based simulator to generate synthetic datasets.

Custom simulator pipeline based on Lotka-Volterra dynamics

This simulator allowed them to precisely control variables like interaction strength, community size, and the amount of training data. By generating flexible synthetic data, the researchers could rigorously test where the models succeed and where they break down.

Key Insights and Results

By using functional gene groups as features, the model successfully learns that bacteria with similar metabolic capabilities likely interact with the environment and each other in similar ways. This leads to several impressive results:

  • High In-Distribution Accuracy: On the FRIEDMAN2017 dataset, the best GNN achieved an $R^2$ of 0.81. On the larger BARANWALCLARK2022 dataset, it reached an $R^2$ of 0.77.
  • Permutation Stability: When the input order was shuffled, MLP performance plummeted (often dropping below $R^2 = 0$), while GNNs remained perfectly stable, proving the necessity of the graph architecture for this task.
  • Combinatorial Generalization: One of the most exciting findings is that a GNN trained on small communities (e.g., pairs and trios) can make reasonable predictions about much larger communities (e.g., 8 or 26 species). This suggests the model is successfully learning the underlying "rules of engagement" between species rather than just memorizing specific combinations.
  • Zero-Shot Generalization: The models demonstrated an ability to predict the abundance of entirely unseen bacteria. For some species in the Friedman dataset, they achieved an $R^2$ of 0.55, though this varied depending on how unique the unseen bacterium's genome was compared to the training set.

Through simulation, the authors also discovered that increasing the diversity of species seen during training is far more beneficial for generalizing to unseen bacteria than simply increasing the total number of community samples.

Limitations and Future Directions

While the results are highly promising, the authors note several limitations. First, real-world microbial data remains "small data" compared to typical deep learning tasks, which constrains model training. Second, the current model assumes a controlled environment; in reality, extrinsic factors like pH, temperature, and nutrient availability heavily influence community dynamics.

Additionally, there is a gap between genotype and phenotype—similar genomes do not always result in the exact same behavior, and noise in genomic mapping remains a hurdle. For instance, the model struggled with certain "keystone" species (like Anaerostipes caccae) that have unique metabolic roles that are hard to infer without sufficient representation in the training data.

For future work, the authors suggest integrating genome-scale metabolic models (GEMs) to provide more biological structure to the GNN's internal representations, moving us one step closer to fully predictive microbial ecology.

Summary updated

BibTeX
@inproceedings{ruaud2024modelling,
  author = {Albane Ruaud and Cansu Sancaktar and Marco Bagatella and Christoph Ratzke and Georg Martius},
  title = {{Modelling Microbial Communities with Graph Neural Networks}},
  booktitle = {International Conference on Machine Learning},
  year = {2024},
  url = {https://openreview.net/forum?id=vBJZ93tvoE},
}
Figure