Learning from Connected Ecosystems: Graph Neural Networks for Trophic Dynamics
Applying inductive GraphSAGE and Graph Attention Networks (GAT) to model non-Euclidean ecological food webs, supported by an automated multi-LLM scientific literature extraction pipeline.
1. The Research Question
Can graph-based machine learning represent directed predator-prey interactions and biomass transfer in ecological food webs more effectively than Euclidean architectures, and can inductive graph representations generalize across distinct, unseen ecosystems?
2. Scientific Background: Why Food Webs are Non-Euclidean
In computational ecology and systems biology, a food web represents a complex directed graph $G = (V, E)$, where vertices $V$ denote biological taxa (species or functional guilds) and directed edges $E$ represent trophic interactions (predation, parasitism, herbivory).
Traditional machine learning and Convolutional Neural Networks (CNNs) rely on Euclidean geometric assumptions—fixed grid layouts, spatial locality, and coordinate ordering. Ecological networks violate all of these assumptions:
- Permutation Invariance: Re-indexing the nodes does not change the underlying ecosystem dynamics.
- Variable Node Degrees: Keystone species and apex predators have high connectivity, while specialist parasites have sparse connections.
- Topological Cascades: When an apex consumer suffers biomass loss, energetic disruption propagates along multi-hop topological pathways that linear models cannot capture.
3. Technical Approach & GNN Architectures
To capture these dependencies, we investigated two principal Graph Neural Network architectures implemented in PyTorch Geometric (PyG):
A. GraphSAGE (Sample and Aggregate)
Rather than computing full graph Laplacians (which scale quadratically and require transductive retraining), GraphSAGE learns inductive neighborhood aggregation functions:
h_v^(k) = σ(W · Concat(h_v^(k-1), AGGREGATE({h_u^(k-1), ∀u ∈ N(v)})))By sampling a bounded set of 1-hop and 2-hop ecological neighbors, GraphSAGE generalizes inductively to previously unseen marine sub-ecosystems without re-evaluating the full global adjacency matrix.
B. Graph Attention Networks (GAT)
Not all biological interactions carry equivalent energetic weight. GAT introduces multi-head self-attention coefficientsα_ij to learn the relative importance of connected prey and predator nodes:
α_ij = softmax_j(LeakyReLU(a^T [W h_i || W h_j]))This allows the neural network to differentiate primary energy pipelines (such as major grazing flows) from opportunistic or secondary predation links.
4. Research Architecture & Workflow
The implemented workflow bridges unstructured empirical biological literature and relational graph modeling:
5. The Data Extraction Bottleneck & Multi-LLM Consensus
A major obstacle in biological network modeling is data sparsity: decades of field observations are trapped inside unstructured PDF monographs. Manual entry takes weeks per ecosystem.
To solve this, we engineered an automated multi-LLM consensus pipeline:
6. Findings & Known Limitations
What Was Demonstrated
Inductive GNNs (GraphSAGE) successfully generalize learned neighborhood representations across disconnected subgraphs without retraining, while GAT attention weights reflect meaningful differences in energetic importance.
Methodological Limitations
The model evaluates topological potential and static trophic structure. It does not replace dynamic differential-equation population models (such as Lotka-Volterra) and depends heavily on the completeness of the extracted interaction records.