arXiv:2610.19053cs.LGOct 2026

Manuscript Offprint

arXiv:2610.19053

Deep Generative Models for Phylogenetic Inference with Complex Evolutionary Processes

Ethan Baron, Alan N. Amin, Andrew Gordon Wilson

Abstract

Inference of phylogenetic trees from sequences plays a central role in understanding evolutionary relationships, with applications ranging from tracking pathogen spread to reconstructing the history of life. Conventionally, practitioners obtain posteriors over trees using likelihood-based methods like MCMC. However, likelihoods are only available for simple evolutionary models with restrictive assumptions. For realistic evolutionary models, inference using conventional methods is prohibitively expensive, inaccurate, or even impossible. In practice, practitioners settle for using as flexible a conventional method as possible, even though they expect it is misspecified. In principle, we could use simulation-based inference: simulate tree and sequence data from an evolutionary model and train a neural network to predict the posterior over trees given sequences. However it is a mathematical challenge to represent and train complex posterior distributions over trees. Here we present a flexible family of conditional generative models over trees. Our models iteratively build trees using three natural paradigms — top-down, middle-out, or bottom-up — and are trained using a discrete diffusion framework. For real and synthetic datasets of up to 65 taxa and >105>10^{5} tokens, our models recover MCMC posteriors much more accurately than the previous state-of-the-art simulation-based method Phyloformer 2. Finally, we compare to IQ-Tree, a popular flexible-but-misspecified conventional method. Our models match its tree estimates on simple data, but on more realistic data, our method is reliably more accurate.

1 Introduction

To understand ancient evolution [95], the origins of pathogens [13], and the function of the immune system [22], biologists collect DNA or protein sequences and try to infer a phylogenetic tree [31]. In addition to the topology of the tree, biologists wish to infer scalar parameters that describe, for example, when a most recent common ancestor has occurred [87], whether there is selective pressure [36], or how fast a pathogen is growing [26]. Just as important as inferring the tree is representing our uncertainty [44]. Bayesian inference provides a natural framework: the posterior represents our belief in the tree, including our uncertainty [31, Ch. 18].

To sample from the posterior, in principle we can use MCMC [43, 84]. However, Bayesian inference tools like MCMC require access to a likelihood, which is only easy to calculate for the

∗^{*}Equal contribution. Correspondence to: alan.nawzad.a@gmail.com simplest models of evolution. More complex models of evolution either (A) have tractable but expensive likelihoods or (B) completely intractable likelihoods.

In models with expensive likelihoods, (A), inference with MCMC is prone to errors [94] and time consuming, in some cases taking weeks to infer a tree with a hundred species [85]. These models include those accounting for different mutation processes at different sites [7, 53], changes of mutation processes over time [90, 19], and different mutation rates at different sites [102] and their correlation between nearby sites [30]. In practice, practitioners speed up inference with strategies like taking the values of evolutionary parameters from previously fit models [56, 57], alternate fitting evolutionary parameters and the tree [72], or relying on simpler models. Unfortunately, these strategies are the sources of many errors in the literature [70, 85, 103].

Other models, (B), have intractable likelihoods despite describing ubiquitous biological processes. These include models of sequence insertions and deletions [32], selection-dependence between sites [103], and context-dependent mutation rates [78]. Such models are often dealt with by making strong assumptions [41, 61], discarding data [80, 88], or, more often, ignoring these phenomena entirely.

Unlike likelihood calculation, simulation is simple in nearly all models of evolution, including those with intractable likelihoods. Ideally we could learn to perform inference by training a model on data simulated from the prior [68], a framework known as simulation-based inference. Indeed, this framework has been extremely successful for Bayesian inference in astronomy [21], neuroscience [37], and on tabular data [40]. The main challenge in applying simulation-based inference to this problem is representing a posterior distribution over the combinatorial space of tree topologies, a space of size (2N−3)!!(2N - 3)!!. Indeed, inference for scalar evolutionary parameters is mature [34], so here we focus on the hard problem of inferring posteriors over trees.

Previous models use a single forward pass to produce a parametric distribution over trees, limiting expressivity [12]. In this paper, to build flexible models that can support rich posterior distributions, we design iterative generative models that perform multiple forward passes to sample a tree topology from the posterior. In Sec. 4, we describe three natural paradigms for parameterizing iterative generative models for trees: bottom-up, middle-out, and top-down. Since phylogenetic trees can be represented as graphs, we parameterize our models as graph neural networks, leveraging methods from the graph foundation model community [92]; we also introduce new architectural ideas to condition on a tree and avoid representation collapse on huge data. In Sec. 5, we show we can train large-scale models for each paradigm using a discrete diffusion objective. After training on only 100 GPU hours, our models accurately fit posteriors of trees for data with up to 65 DNA or protein sequences of length > 2500, mapping >105> 10^{5} input tokens to a posterior over >10100> 10^{100} topologies.

We show in Sec. 7 that our generative models learn to represent an accurate and calibrated posterior on real and synthetic data in cases where Bayesian inference is tractable, substantially outperforming previous simulation-based models. Moreover, we show that our models successfully learn posteriors under complex evolutionary models where Bayesian inference is intractable, significantly outperforming the conventional strategy of using misspecified models.

Our code is available at https://github.com/AlanNawzadAmin/DeepPhylo.

References (89)