Abstract
Reconstructing the evolutionary history relating a collection of molecular sequences is the main subject of modern Bayesian phylogenetic inference. However, the commonly used Markov chain Monte Carlo methods can be inefficient due to the complicated space of phylogenetic trees, especially when the number of sequences is large. An alternative approach is variational Bayesian phylogenetic inference (VBPI) which transforms the inference problem into an optimization problem. While effective, the default diagonal lognormal approximation for the branch lengths of the tree used in VBPI is often insufficient to capture the complexity of the exact posterior. In this work, we propose a more flexible family of branch length variational posteriors based on semi-implicit hierarchical distributions using graph neural networks. We show that this semi-implicit construction emits straightforward permutation equivariant distributions, and therefore can handle the non-Euclidean branch length space across different tree topologies with ease. To deal with the intractable marginal probability of semi-implicit variational distributions, we develop several alternative lower bounds for stochastic optimization. We demonstrate the effectiveness of our proposed method over baseline methods on benchmark data examples, in terms of both marginal likelihood estimation and branch length posterior approximation.
Introduction
Phylogenetic inference—reconstructing the "tree of life" from DNA or protein sequences—is a cornerstone of modern biology, essential for tracking virus outbreaks and understanding biodiversity. Traditionally, researchers rely on Markov chain Monte Carlo (MCMC) methods to explore the vast space of tree topologies and branch lengths. While MCMC provides high accuracy, its computational cost becomes prohibitive as the number of sequences grows.
Variational Bayesian Phylogenetic Inference (VBPI) has emerged as a faster alternative by framing inference as an optimization problem. However, standard VBPI often relies on restrictive assumptions, such as diagonal lognormal distributions for branch lengths. These simple models struggle to capture the complex, multimodal relationships between branch lengths and tree shapes, often leading to biased posterior approximations. This paper introduces VBPI-SIBranch, which utilizes semi-implicit distributions and Graph Neural Networks (GNNs) to provide a more flexible and accurate framework for phylogenetic inference.
Methods
The core innovation of VBPI-SIBranch is a hierarchical, semi-implicit construction for branch length distributions. Instead of a fixed parametric form, the branch length $q$ is modeled as a two-step process:
- Latent Sampling: A latent variable $z$ is drawn from a simple base distribution $Q(z|\tau)$.
- Conditional Generation: The actual branch lengths are generated conditioned on the latent variable and the tree topology $\tau$, denoted as $q \sim Q(q|\tau, z)$.
By integrating out the latent variable $z$, the resulting marginal distribution can represent highly complex shapes far beyond the capabilities of standard lognormal models.
To handle the diverse geometry of tree topologies, the authors employ Graph Neural Networks (GNNs). As shown in the architecture above, GNNs process the tree structure to produce edge features. These features are combined with sampled hidden variables to parameterize the final branch length distributions via Multi-Layer Perceptrons (MLPs). This approach ensures the model is permutation equivariant, meaning its logic remains consistent regardless of how edges are ordered. To train the model despite an intractable marginal density, the authors developed the Multi-Sample Semi-Implicit Lower Bound (MSILB) and the Importance-Weighted Lower Bound (MIWLB).
Results and Discussion
The method was evaluated on eight real-world nucleotide sequence benchmark datasets (DS1-DS8), featuring 27 to 64 taxa. VBPI-SIBranch consistently outperformed baseline methods, including standard VBPI and VBPI with Normalizing Flows (VBPI-NF), in terms of Evidence Lower Bounds (ELBO) and marginal likelihood estimates.
Key Insights
- Flexibility through Semi-Implicitness: Breaking the "explicit density" constraint allows the model to capture complex posterior correlations that diagonal models miss.
- GNN Efficiency: GNNs allow for parameter sharing across different topologies, making the model more efficient than treating each tree shape as an independent problem.
- Optimization Objectives: The MIWLB objective proved superior to MSILB, highlighting the importance of learnable importance weighting in high-dimensional phylogenetic spaces.
On the DS1 dataset, visualization of the "Inference Gap" showed that VBPI-SIBranch significantly reduced both the approximation gap (fit to a single tree) and the amortization gap (generalization across trees). Despite the added complexity of GNNs, the vectorized implementation maintains a computational cost per iteration comparable to simpler baselines.
Conclusion
VBPI-SIBranch represents a significant step forward in making variational inference a robust tool for phylogenetics. While currently tested on trees up to 64 taxa using simple substitution models, future work aims to scale the approach to "massive" trees with hundreds of taxa and integrate more complex evolutionary models (e.g., GTR+G). Additionally, making the latent variable $z$ topology-aware could further enhance the model's expressive power.
Summary updated