Modeling Protein Evolution via Generative Inference From Monte Carlo Chains to Population Genetics Leonardo Di Bari, Thierry Mora, Andrea Pagnani, Aleksandra M. Walczak, Francesco Zamponi, Saverio Rossi Abstract Generative models derived from large protein sequence alignments define complex fitness landscapes, but their utility for accurately modeling non-equilibrium evolutionary dynamics remains unclear. In this work, we perform a rigorous comparative analysis of three simulation schemes, designed to mimic evolution in silico by local sampling of the probability distribution defined by a generative model. We compare standard independent Markov Chain Monte Carlo, Monte Carlo on a phylogenetic tree, and a population genetics dynamics, benchmarking their outputs against deep sequencing data from four distinct in vitro evolution experiments. We find that standard Monte Carlo fails to reproduce the correct phylogenetic structure and generates unrealistic, gradual mutational sweeps. Performing Monte Carlo on a tree inferred from data improves phylogenetic fidelity and historical accuracy. The population genetics scheme successfully captures phylogenetic correlations, mutational abundances, and selective sweeps as emergent properties, without the need to infer additional information from data. However, the latter choice come at the price of not sampling the proper generative model distribution at long times. Our findings highlight the crucial role of phylogenetic correlations and finite-population effects in shaping evolutionary trajectories on fitness landscapes. These models therefore provide powerful tools for predicting complex adaptive paths and for reliably extrapolating evolutionary dynamics beyond current experimental limitations. I Introduction Proteins are fundamental building blocks of life, performing a vast array of essential biological functions. Over evolutionary timescales, mutations in the genetic code can alter the amino acid sequence of a protein, potentially affecting its stability, structure, or function. Accurately modeling protein evolution is therefore of both theoretical and practical importance. From a theoretical perspective, realistic models are crucial for phylogenetic inference and for understanding the constraints that shape and structure evolutionary landscapes. From a practical standpoint, such models are essential for predicting the evolutionary trajectories of pathogens and for informing the design of effective drug therapies. The modeling of molecular evolution fundamentally relies on statistical frameworks to describe how protein or nucleic acid sequences change over time. Historically, this effort has been motivated by the need to understand the forces of natural selection and to infer evolutionary relationships, leading to the development of sequence substitution models 56 . These models provide the core mathematical framework for comparative genomics and phylogenetic inference. They treat the evolution of a sequence as a continuous-time Markov process, where a transition rate matrix governs the rate of change from one nucleotide (or amino acid) to another. The complexity of these models ranges widely: the simplest, like the Jukes–Cantor (JC69) model for nucleotides 38 , assumes that all substitutions occur at the same rate. More sophisticated models, such as HKY85 and GTR for DNA 39 ; 68 , and WAG 72 , JTT 37 and LG 42 for proteins, account for biases like transition/transversion rates and unequal stationary frequencies. While these substitution models have been very successful, they mostly operate under a severe simplification: the mutation rate of each site does not depend on the rest of the sequence. This is equivalent to assuming that sites evolve independently. In order to reproduce statistical properties of evolving sequences, such as the distribution of substitution rates among sites or the time-dependent mutability constraints at different residues, one then needs to add empirical observations explicitly. More generally, these standard models are inherently unable to capture epistatic interactions—where the functional effect of one mutation depends on the context in which it occurs—that are crucial for maintaining protein structure and function, and strongly influence evolutionary trajectories 70 ; 45 ; 66 ; 51 ; 51 ; 21 ; 53 ; 4 ; 11 ; 36 . Considering site interactions makes the algorithm more computationally expensive and prevents the use of transition matrices, but it also makes it more accurate. One attempt at including epistasis into evolutionary modeling was done with structural substitution models 3 ; 10 , in which an interaction between sites mediated by the structure is taken into consideration. Here, we consider an alternative approach in which first a fitness landscape is inferred from natural sequence data using generative sequence modeling, and then the evolutionary dynamics is simulated on that landscape. The advantage of working directly in sequence space, without explicitly incorporating structural information, is that the resulting models are computationally very simple and efficient. We employ a powerful energy-based generative modeling framework known as Direct Coupling Analysis (DCA) 15 . DCA is trained on a dataset of natural sequences, from which it infers a probability distribution with parameters representing site-specific constraints and, critically, the long-range epistatic interactions that stabilize protein structure and dictate function 24 ; 28 ; 44 ; 16 ; 69 . DCA-based models have already proven useful in various tasks, including contact prediction 48 ; 46 , the in silico generation of functional proteins 62 ; 12 ; 41 , the study of specificity-switching pathways 57 and the inference of mutational fitness landscapes from experiments 28 ; 26 ; 64 ; 13 ; 63 ; 43 . Similar approaches have also been used in the context of HIV/HCV 5 ; 29 ; 33 ; 14 ; 8 and SARS-CoV-2 35 ; 34 . Hence, sequence fitness landscapes inferred by DCA contain information about structure, and are able to capture the main ingredients needed to make a sequence functional, as well as the epistatic effect of mutations. While alternative generative modeling approaches to fitness landscapes exits, e.g. based on Large Language Models, to our knowledge DCA is not outperformed by them on the modeling tasks listed above, hence we stick to it due to its simplicity of implementation and computational efficiency 60 ; 6 ; 25 . While DCA has traditionally been applied at equilibrium—generating novel protein sequences by sampling the inferred probability distribution via independent Markov chains, for times much larger than the mixing time of the model—its use has increasingly expanded to forward evolutionary simulations, where its energy is interpreted as a fitness function 9 ; 17 ; 7 ; 1 ; 2 ; 8 ; 20 ; 61 . Previous implementations are limited in realism because they assume independence among individual trajectories, thereby neglecting phylogenetic correlations and population size effects. In addition, these models often work in discrete time, limiting the possibility of including them in standard pipelines for phylogenetic inference. Nevertheless, it has been recently shown that it is possible to inform and refine ancestral sequence reconstruction 18 through a DCA-inferred landscape, and that the sampling of such landscape can also be performed through a phylogenetically-suited continuous time model 52 . This validates the use of DCA-inferred fitness landscapes as the basis for modern, interpretable and epistasis-aware evolutionary models. At the same time, the experimental study of protein evolution has seen substantial advances. Over the past two decades, high-throughput experimental techniques have emerged, dramatically enhancing our ability to directly probe functional fitness landscapes. Techniques like deep mutational scanning (DMS) 30 ; 59 ; 31 systematically measure the mutational effect of a vast number of mutations across a protein domain, one by one. The effect of multiple mutations is also under study in combinatorial landscapes, in which all possible variants between two proteins are tested 11 ; 54 ; 71 . These quantitative, high-resolution functional maps reveal that epistatic interactions are not just present, but are a pervasive feature of molecular fitness. In vitro evolution 19 ; 47 ; 40 ; 23 ; 67 ; 22 ; 58 experiments, performed through rounds of mutagenesis, selection and amplification, provide a glance at the trajectories resulting from the exploration of fitness landscapes starting from a specific wild-type. The availability of this rich, detailed experimental data now makes it possible to rigorously assess the ability of evolutionary models to reproduce real-world biological results, especially those involving complex epistasis. Building upon these advances in both experimental techniques and modeling approaches, in this work we seek to rigorously evaluate the performance and inherent limitations of DCA-informed simulation approaches used to model high-throughput evolution experiments. Specifically, we investigate and compare three distinct computational schemes to quantitatively reproduce experimental data. This comparative study addresses a critical theoretical gap: understanding the performance differences between simple, independent-chains Markov Chain Monte Carlo (MCMC) approaches and more detailed, computationally intensive population genetics models. By identifying the specific conditions under which the minimal Monte Carlo framework proves sufficient, and what population-level dynamics it neglects, we aim to provide clarity for future computational studies. Furthermore, developing highly predictive and reliable in silico simulation tools is of significant practical value for prioritizing experimental efforts and advancing protein engineering. The study is structured as follows: we first describe the integration of DCA-derived fitness landscapes with four time-resolved experimental datasets. We then introduce three simulation frameworks operating on the inferred fitness landscapes, presented in order of increasing complexity: standard MCMC, phylogenetically constrained MCMC, and a discrete-generation population genetics model. We evaluate how well the models reproduce empirical sequence diversity and compare them to observed phylogenetic structure and site frequency spectra to assess historical fidelity. Finally, we show the individual mutational trajectories to determine which framework best captures the non-equilibrium dynamics of selective sweeps, concluding with a discussion on the long-term predictive power of these models beyond current experimental limitations. Figure 1: Schematic of the experimental and simulation pipeline. In vitro evolution data are used to benchmark three evolutionary simulation schemes (MCMC, treeMCMC, PopGen) over four different evolution experiments realized through rounds of mutagenesis, selection and amplification. Simulated and experimental sequences are compared through divergence, diversity, phylogeny, and mutational spectra. II Materials and Methods The graphical abstract in Fig. 1 outlines the workflow used to compare synthetic evolutionary schemes with experimental evolution ones. Evolution experiments begin from a wild-type protein and proceed through iterative cycles of mutagenesis, selection, and amplification, generating time-resolved sequence populations measured by deep sequencing. These experiments can be carried on in different evolutionary regimes. Here we focus on experiments that performed evolution under a moderate selection strength, such that the initial wild type would survive. Hence, they performed neutral space exploration, instead of directed evolution that aims at maximizing fitness under very strong selection pressure. For the training of our generative model, we start by gathering natural homologs of the wild-type protein into a curated Multiple Sequence Alignment (MSA). This MSA is then used to infer a pairwise Potts model, providing an energy-based description of the fitness landscape, through standard DCA techniques. We exploit the inferred landscape by running three simulation schemes: independent MCMC, MCMC along a phylogenetic tree, and a population-genetics scheme incorporating mutation, selection, and finite-population sampling. Each framework produces synthetic evolutionary trajectories. Simulated and experimental populations are then compared through their sequence diversity, inferred phylogenetic structure, and DCA energy statistics, allowing us to assess how closely each model captures the dynamics observed in experimental evolution. II.1 Experimental Datasets Our comparative analysis draws on four time-resolved deep-sequencing datasets generated through multi-round in vitro evolution experiments. These protocols mimic natural selection by iterating cycles of mutagenesis, functional selection, and amplification, thereby enabling the monitoring of how the statistical properties of sequences change across rounds. In each experiment, a diversified mutant library derived from a wild-type gene seeds the first round. Variants are then subjected to mutations through error-prone PCR, and selection through growth of bacterial cultures containing the plasmid libraries under fixed concentration of antibiotics. Finally, surviving sequences are amplified to initiate the next cycle. Deep sequencing of populations provides a quantitative picture of the evolutionary process at different experimental rounds. The first two analyzed datasets 23 ; 67 correspond to the \beta -lactamase family and include the well-characterized TEM1 and PSE1 enzymes, both evolved under antibiotic selection (ampicillin in this case). For TEM1, sequences containing more than six gaps were discarded during quality control, resulting in a curated MSA of sequences sampled from the last generation (round 12 ) of the experiment. The PSE1 dataset was curated using the same filtering procedure and collected after round 20 . A third dataset derives from the AAC6 67 acetyltransferase, evolved under functional selection (kanamycin) linked to its enzymatic activity and sequenced at final round 8 . Finally, we include a directed-evolution experiment performed on dihydrofolate reductase (DHFR) 22 , in which repeated mutagenesis and selection rounds (under trimethoprim) yielded large libraries of functional variants sequenced at round 15 . Intermediate rounds of experiments where also sequenced in some cases (round 10 for PSE1, round 6 for TEM1 and rounds \left(1,2,3,4,5\right) for DHFR). In this work we will focus mainly on studying the final rounds of such experiments, as they show a larger sequence variability, but the same approach can be carried out with each sequenced round of choice. Aligned amino-acid sequences and raw reads are publicly available from the authors’ repository and were curated following the same procedure applied to the other families. II.2 DCA-derived fitness landscape For all protein families, natural MSAs were constructed by running hmmsearch from the HMMer suite against UniProt. Insertions were removed, sequences with more than 20% of gapped positions and duplicates were filtered out, as well as those exceeding a predefined 80\% similarity threshold to the corresponding wild-type. Alignments were then restricted to Pfam-annotated positions: the PF13354 \beta -lactamase2 family for the wild types TEM1 and PSE1, the PF00583 Acetyltransf1 family for the wild type AAC6, and the PF00186 Dihydrofolate reductase family for the wild type mDHFR. Wild-type and evolved sequences were aligned to the MSA using hmmalign , and columns corresponding to unmatched states in the wild-type alignment were removed from all experimental MSAs. All simulations reported in this work take place on a fitness landscape defined by the statistical energy E(\boldsymbol{a}) of a pairwise Potts model inferred from the MSA of the natural sequences, where \boldsymbol{a} represents the evolving sequence. Following the standard DCA formulation, sequences are assigned a probability P(\boldsymbol{a})=\frac{1}{Z}\exp\big[-\beta E(\boldsymbol{a})\big], (1) with E(\boldsymbol{a})=-\sum_{i}h_{i}(a_{i})-\sum_{i