Next-substitution prediction maps protein fitness landscapes
Abstract
Fitness scores from existing protein language models broadly correlate with experimental measurements from deep mutational scanning. Here, we develop next-substitution prediction as a population genetic training objective for protein language models, using substitutions inferred by ancestral state reconstruction on large phylogenies. We implement this as Pinion, a neural mutation-selection model that weights each possible mutation by its rate and by the Kimura fixation probability of its fitness effect. In Pinion, we co-train the next-substitution objective alongside standard masked language modeling, improving on either objective alone for synthetic lattice proteins and empirical proteins. In training to predict substitutions, Pinion estimates the fitness effect of every potential mutation from each parent sequence, mapping the local fitness landscape around it. In the conserved ribosomal protein S9, most mutations are strongly deleterious and lineages walk a nearly neutral contour below the fitness peak. In Rubisco, Pinion identifies a subset of highly adaptive substitutions and maps the shifting fitness landscape over the evolution of green plants, revealing convergence in fitness effects across 36 independent C3 to C4 transitions. This approach could become a general addition to training protein language models, providing a complementary training signal and calibration to evolutionary outcomes.
This page holotype.org/
Introduction
Gould's classic thought experiment of "replaying the tape of life" emphasized the role of historical contingency in shaping evolutionary outcomes [1]. Yet at the molecular scale, adaptation often follows constrained or repeated paths. Experiments on β-lactamase show that natural selection follows a small subset of mutational paths to increased antibiotic resistance [2], and distantly related insects that feed on cardenolide-producing plants have repeatedly evolved the same amino acid changes in ATPα [3]. However, repeated functional adaptation does not always involve the same molecular changes. In high-altitude birds, increases in hemoglobin oxygen affinity evolved repeatedly through different amino acid substitutions with effects dependent on genetic background [4]. These observations suggest that evolutionary change may be predictable, but that predictability depends on the genetic and environmental context in which mutations arise.
Fitness landscapes provide a conceptual basis for evolutionary prediction by describing how genetic variation affects fitness in a given environment [5, 6]. Epistasis makes these effects dependent on genetic background, so the same mutation can be favored in one background and disfavored in another [7]. Under a model of successive fixations, the probability of each substitution is proportional to its mutation rate multiplied by its fixation probability, which depends on its selective effect and effective population size [8, 9]. This defines a concrete forecasting task: given a current sequence, assign probabilities to its possible next substitutions. The challenge is to infer context-dependent fitness effects and translate them into next-substitution probabilities.
Protein language models learn patterns of sequence variation and functional constraints from the diversity of naturally occurring proteins [10, 11, 12]. In masked language modeling, models learn the conditional probability of an amino acid given its surrounding sequence. The log-odds of a variant residue relative to the reference are commonly used to score mutations, and these scores correlate with functional measurements from deep mutational scanning without requiring experimental labels during training [13, 14]. This success suggests that models trained on sequence variation recover information about the constraints imposed by selection. However, correlation with an experimental phenotype does not establish that model scores are calibrated estimates of selective effects in natural populations [15]. Language models also absorb the mutation process itself, conflating mutation accessibility and selective preference [16, 17]. Connecting these scores to evolutionary forecasts requires separating selection from mutation, a population genetic interpretation of the selective effects and evaluation against substitutions that actually occur.
Extending DASM [16], a neural mutation-selection model of antibody evolution trained on reconstructed phylogenies, we develop a framework grounded in population genetics for next-substitution prediction, by analogy with the next-token prediction used to train language models. We connect context-dependent protein-model scores to scaled selective effects and combine these effects with mutation rates and fixation probabilities to define a next-substitution likelihood. This is normalized over the possible mutations of a parent sequence as in antiGen [18], the whichmut objective of the netam software [19] and Haddox et al [20]. This likelihood provides both a forecasting criterion and a training objective, without requiring experimental fitness labels. Because masked language modeling estimates the same scaled selective effects when sequences are sampled at stationarity [21, 22], the two objectives share one fitness scale and can be co-trained.
We call the resulting model Pinion, a neural mutation-selection model named for the small gear in rack-and-pinion steering, as it turns protein language model scores into the direction of the next substitution. Like DASM, and unlike classical mutation-selection models that fit site-specific fitness to a single alignment [21, 23, 24, 25], Pinion learns the fitness effect of every mutation in every genetic background, and it expresses these effects as scaled selection coefficients that can be directly interpreted. Using synthetic lattice proteins, we evaluate recovery of known fitness effects and generalization across evolutionary histories and landscapes. Applications to ribosomal protein S9 and Rubisco demonstrate improved prediction of held-out substitutions and allow us to examine how genetic background shapes selective effects and evolutionary rates.
Model
Our overall goal is to predict substitutions along evolutionary trajectories. We evaluate models by predicting the next substitution from a parent coding sequence , encoding a protein of amino acids, where a model places a probability distribution over the candidate mutations , the single-nucleotide neighbors of the parent sequence (Figure 1). We score the substitution that actually occurred, , using information gain and top-10% recall. Information gain above uniform baseline is defined as in nats for the observed substitution against a uniform null over all possible DNA mutation candidates. A gain of nats means the model placed times more probability on the realized substitution than a uniform guess, so that 0 nats is no better than uniform chance and 2.3 nats is a 10-fold concentration of probability. For nonsynonymous substitutions, is renormalized over the parent's nonsynonymous candidates and compared to a uniform null over that pool. Because is normalized jointly over sites and replacements, information gain scores both where a substitution occurs and which residue it produces. Top-10% recall is the fraction of observed substitutions that fall in the model's top 10% of candidates. We evaluate each metric on unseen clades from training trees.

Figure 1. Next-substitution prediction task. The phylogeny holds evolutionary trajectories of proteins represented by their nucleotide sequences and we consider mutations at the level of codons. For an observed parent → child transition, the model places a distribution over the single-nucleotide candidates of the parent and is scored on the realized substitution .
We introduce Pinion, a neural mutation-selection model designed around this task (Figure 2). Pinion scores amino acid changes with a protein language model . When the mutation changes residue of the parent protein from to , its wildtype-marginal log-odds,
comes from a single forward pass over the unmasked parent [13]. A learned scale turns these into scaled selection coefficients , in the population genetic units of . Each candidate is then weighted by its Kimura fixation probability relative to neutral mutation [8] and by its rate under a learned, parent-specific mutation spectrum [21, 23]. Normalizing across candidates [18, 19] yields the next-substitution distribution
Since each candidate is a mutation of a particular parent , its log-odds , selection coefficient and mutation rate all depend on . A synonymous mutation has and , and it takes the neutral weight , the limit of as . Training minimizes the substitution cross-entropy , averaged over observed transitions (see Supporting Results).

Figure 2. Pinion, a neural mutation-selection model. A protein language model (pLM) is co-trained with masked language modeling on a sequence corpus and a next-substitution objective on observed transitions. The pLM wildtype-marginal log-odds become scaled selection coefficients , weighted by the fixation probability and the mutation spectrum , and normalized into .
Selection manifests in both the distribution of extant sequences and the substitutions along evolutionary trajectories. In Supporting Results, we demonstrate that with calibration the standard masked language modeling objective recovers scaled selection coefficients, but only when sequences are sampled at equilibrium on a fixed fitness landscape. The substitution objective conditions on each parent and needs no such assumption, so we co-train one protein model on both, where gives pure masked language modeling and pure substitution training.
Results
Recovering known fitness landscapes in lattice proteins
We first test Pinion on synthetic lattice proteins [26, 27], where both the fitness landscape and the evolutionary history are known exactly (Figure S1). We simulate DNA-level evolution with selection for ligand binding and evolve lattice proteins against 950 different ligands, each contributing a phylogeny and 100 independent trajectories, to construct a corpus of 17.1 million training substitutions. We train a small 4.9M parameter transformer from scratch and evaluate on increasingly distant held-out data comprising unseen clades, independent trajectories and new ligands (Figure S2). As a baseline, we train the same model by masked language modeling alone with , which is sensitive to how the sequence corpus is thinned (Figure S6). Co-training at on the unthinned corpus raises nonsynonymous information gain over masked language modeling at its best thinning threshold, from 1.2 to 1.9 nats on held-out clades and from 0.7 to 1.1 nats on held-out trajectories (Figure S9). Performance scales with the log of the size of the substitutions corpus (Figure S10) and we recover adaptive dynamics with initial substitutions climbing in fitness and later substitutions circling fitness peaks (Figure S11).
Purifying selection in ribosomal protein S9
We next apply Pinion to empirical protein evolution by adapting the ESMC 600M protein language base model [28]. We first examine ribosomal protein S9, which is a 130–170 amino acid protein of the small ribosomal subunit. We reconstruct large phylogenies from 5 bacterial phyla, comprising 53,594 taxa and 159,620 training substitutions (see Methods). We first co-train on a broad ESMC rehearsal corpus, where an MLM-only objective with stays matched to ESMC base, while adding S9 substitutions improves nonsynonymous information gain on held-out clades (Figure 3A). We then switch to a narrow MLM corpus of just S9 sequences, where co-training with outperforms either pure-MLM or pure-substitution objectives (Figure 3B). Nonsynonymous information gain peaks for held-out clades at 1 epoch of training (dashed line at 10k steps), after which time memorization of the training data degrades generalization. Comparing co-training with between corpus types, we observe improved performance on the narrow S9-specific corpus (Figure 3C). We treat this , one epoch, narrow corpus model as our primary model in subsequent analyses.

Figure 3. S9 recipe sweep over co-train weight and MLM rehearsal corpus. Each column varies one lever of the co-training recipe, and the rows track nonsynonymous information gain (nats) on training substitutions (top) and on held-out clades (bottom) versus training step, where 20,000 steps is equal to 2.0 epochs and the dashed vertical line at 10,000 steps indicates 1.0 epoch. (A) The co-train mixing weight swept over 0, 0.5 and 1 with the broad ESMC-Atlas rehearsal corpus. (B) The same sweep with the narrow S9-specific MLM corpus. (C) The two rehearsal corpora compared directly at , broad in purple and narrow in blue. The blue dot marks the primary recipe of a narrow corpus at after one epoch.
We find co-training on a narrow S9 MLM corpus along with realized S9 substitutions produces a capable model of S9 evolution. We observe mean information gain for nonsynonymous substitutions of 1.53 nats (Figure 4A) and we find that the top 10% of model candidates represents 73% of realized nonsynonymous substitutions (Figure 4B). We estimate that random mutations are highly deleterious showing a median scaled selection coefficient of −7.96, but with a tail of nearly neutral mutations available (Figure 4C). It's primarily these nearly neutral mutations that fix as substitutions, with a median of −0.07. This fits our understanding of S9 as a conserved protein under strong purifying selection, where evolution occurs along a high fitness ridge and there is no systematic increase or decline of fitness over the phylogeny. The ratio of fixed substitutions to available mutations closely follows the Kimura expectation , with an exponential decay in fixation probability of deleterious mutations and a linear increase for advantageous mutations (Figure 4D).

Figure 4. Ribosomal protein S9 substitution forecast and fitness effects. (A) Per-substitution information gain (nats) for all substitutions (brown) and for nonsynonymous substitutions scored against the nonsynonymous candidate pool (blue); zero is the uniform null. (B) Fraction of realized substitutions recovered against the fraction of candidates nominated, versus the random diagonal; the dashed line marks the model's top 10% of candidates. (C) Distribution of fitness effects measured as scaled selection coefficient for available mutations (filled) versus realized substitutions (blue). Vertical dotted lines indicate the nearly neutral threshold. (D) Fixation propensity (fixed substitutions / available mutations) versus the Kimura fixation expectation . Dotted lines indicate the drift barrier of near neutrality.
We use this learned model to interrogate molecular evolution of S9 (Figure 5). S9 evolution in Actinomycetota follows a nearly neutral walk along a consistent fitness contour that lies 25 below its peak (Figure 5A). This 25 reduction is expected from a balance in which selection pulls uphill towards the single genotype at the peak, while drift spreads lineages across the far more numerous genotypes below [22]. The median tip has 115 amino acid sites at peak and 13 off peak, with these off-peak sites on average 1.86 below optimum (Figure 5B, C). Evolution proceeds by flipping one of the 115 peak sites off or one of the 13 off-peak sites back on at roughly equal rates, so that fixed substitutions are as often beneficial as deleterious (Figure 4C). At any given moment roughly 50 amino acid changes are allowed, about half of them reachable by a single nucleotide change, where allowed changes are those with . Each fixation opens an average of 0.95 allowed changes at other sites, but closes 0.92 allowed changes to keep a dynamic equilibrium. These fixation-driven openings and closings are geometrically distributed (Figure 5D). These epistatic shifts tend to be close in 3D distance (Figure 5E), and 20 of the 25 strongest epistatic couplings are structural contacts, compared to 2.8% of site pairs overall (Figure 5F).

Figure 5. Molecular evolution of S9 in Actinomycetota.
(A) Fitness relative to the peak for 13,065 tips in tree order (blue) against the drift-selection expectation (gray).
(B) Share of tips off peak at each site, with residues numbered as in Mycobacterium smegmatis, shaded by the mean gap when off.
(C) Total fitness gap from peak split into the number of sites off peak and their mean gap, for all tips (gray density) and GTDB families with at least 30 tips (blue, sized by tips).
Dashed curves mark equal altitude, the ring the median tip and the cross the drift-selection expectation.
(D) Share of 3129 single-substitution fixations that close (mauve) or open (teal) a given number of allowed changes at other sites, where allowed changes are those with .
This is compared to a geometric distribution (dashed gray).
(E) Allowed changes closed (mauve) and opened (teal) per unchanged site and fixation by 3D distance from the fixed site in 8FR8, against sites placed by a random other site (gray).
(F) Coupling between sites estimated from fixations (upper triangle) against 8FR8 contacts within 5 Å (lower), numbered as in B.
Circles mark the 25 strongest couplings at least six residues apart, black when the pair is in contact.
Context-dependent adaptive evolution in Rubisco
We repeat the primary Pinion analysis on the Rubisco large subunit rbcL, co-training on taxon sequences and reconstructed substitutions across a Viridiplantae phylogeny of 53,934 green plant taxa comprising 155,173 training substitutions. Tested against held-out clades across the Rubisco phylogeny, the co-trained model recovers 2.40 nats of nonsynonymous information gain, assigning realized substitutions about 11 times the probability they would have under a uniform baseline (Figure 6A). Pinion nominates the realized substitution within its top 10% of candidates for 83% of nonsynonymous substitutions (Figure 6B). Most available mutations are deleterious with a median of −5.43 (Figure 6C). However, where S9 walks a contour, Rubisco steps uphill, with fixed substitutions showing a median of 4.55 and 34% of substitutions with 10.
Because synonymous mutations are defined to not change fitness and thus have and , Pinion predicts that a nonsynonymous mutation with scaled selection coefficient substitutes at times the rate of a synonymous mutation. Thus, for mutations at a given , the model predicts a dN/dS ratio of [29]. We test this by binning nonsynonymous candidates based on and comparing the substitutions observed in each bin to the number expected based on mutation rates and neutrality (Figure 6D). We find that dN/dS follows without rescaling, from 0.003 at , to 0.90 at , to 34 at .

Figure 6. Rubisco large subunit rbcL substitution forecast and fitness effects. (A) Per-substitution information gain (nats) for all substitutions (brown) and for nonsynonymous substitutions scored against the nonsynonymous candidate pool (blue); zero is the uniform null. (B) Fraction of realized substitutions recovered against the fraction of candidates nominated, versus the random diagonal; the dashed line marks the model's top 10% of candidates. (C) Distribution of fitness effects measured as scaled selection coefficient for available mutations (filled) versus realized substitutions (blue). (D) dN/dS of nonsynonymous substitutions per unit- class. Blue points are all branches, with 95% family-bootstrap CIs; yellow rings are held-out branches. The dashed curve is the Kimura fixation probability , unscaled. The dotted line at 1 is the synonymous rate. A Model toggle switches all four panels between the context-dependent full model (default) and the context-free additive baseline (see Methods), which keeps the mutation supply and Kimura fixation law but gives each site one fixed fitness profile.
Gene-wide dN/dS then follows by averaging over the distribution of fitness effects [30]. With as the set of nonsynonymous single-nucleotide mutations available from parent ,
This explains how fixed substitutions can have a positive median while dN/dS remains low. Only 2.0% of available nonsynonymous mutations have , but because is large for these mutations, this 2.0% accounts for 67% of realized nonsynonymous substitutions. The model predicts a gene-wide dN/dS of 0.129 against an empirical dN/dS of 0.130. Codon models of rbcL show the same pattern, with gene-wide dN/dS well below 1 alongside a small class of sites under positive selection in most land-plant lineages [31].
This agreement extends across the tree. We cut the phylogeny into 886 disjoint tiles of adjacent branches, each with at least 200 synonymous substitutions, and compare each tile's empirical dN/dS to the model's expectation from at its parent nodes (Figure 7A). We find that empirical and model dN/dS closely correlate across tiles (Spearman = 0.81 with 95% CI 0.76–0.84 from bootstrapping plant families). Pooled within major clades, empirical dN/dS is 0.050 in chlorophytes (model 0.061) and 0.197 in angiosperms (model 0.188).

Figure 7. Rubisco dN/dS across the tree. (A) The empirical dN/dS of 886 disjoint tree tiles against the model's expectation from their nodes' fitness-effect distributions. Each tile closes at 200 or more synonymous changes and dot area is proportional to its synonymous changes. Dots are colored by major clade as in (B), and the dashed line is 1:1. (B) Distribution of scaled selection coefficient for realized nonsynonymous substitutions within each major clade with black ticks marking medians. Alongside are each clade's empirical dN/dS and median . A Model toggle switches both panels between the context-dependent full model (default) and the context-free additive baseline (see Methods).
Adaptive substitution also varies across the tree (Figure 7B). Algal clades show less adaptive evolution, with median of −1.94 and 22% of substitutions adaptive () in chlorophytes and −0.34 and 43% in streptophyte algae. Every land-plant clade has a positive median (1.95 to 5.60) and a majority of adaptive substitutions (54% to 71%), while dN/dS remains well below 1 throughout (0.067 to 0.201). Angiosperms show the largest degree of positive selection with median of 5.60 and 71% of substitutions adaptive. This adaptive signal depends on genetic background. If we compare to a context-free model, median falls to between −2.64 and 0.23 and the adaptive share to between 18% and 38%.
Accounting for genetic background increases nonsynonymous information gain by 0.68 nats compared to a context-free model with fixed per-site preferences (see Methods). The context-free model also fails to capture variation in dN/dS across the tree (Spearman = −0.04). This indicates that context matters and individual substitutions reshape fitness effects at other sites, with A228S as one example (Figure 8A). Across 13,269 confidently reconstructed single-substitution branches, sites within 5 Å of the substitution in the spinach Rubisco structure carry 46% of the shift in fitness effects, compared with 4% when substitutions are permuted across branches (Figure 8B). Much of this comes from immediate sequence neighbors, but non-local structural contacts still carry 11% of the shift, compared with 2% under permutation.

Figure 8. Single substitutions reshape fitness effects at structurally nearby sites.
(A) In an example single substitution, A228S, the shift at its 12 most-reshaped unchanged sites, ordered by their distance to the substitution in 8RUC.
Outlined cells are reachable by a single nucleotide change.
Small black dots mark the reference residue, filled dots later occurrences in the subtree and hollow dots occurrences in the sister lineage.
A selector steps through six prespecified cases.
(B) Mean shift at unchanged sites (RMS ) against the minimum heavy-atom distance to the substitution in spinach Rubisco (PDB 8RUC).
Shown in 2 Å bins over 13,269 confident single-substitution branches, against a permuted-substitution null.
Over many substitutions these shifts accumulate, so the terrain around a lineage changes as it moves. To view this across the whole tree, we represent each node's terrain by its fitness profile, the fitness effect of every amino acid at each of 475 sites. Projecting these profiles onto their first two principal components places nodes with similar terrain close together (Figure 9A). We find that the terrain shifts over the course of green plant evolution, with major clades occupying distinct regions of the landscape. The first two principal components capture 39% of the variance in fitness effects across phylogeny nodes and clade membership accounts for 75% of the variation along these two components.

Figure 9. Shifts in fitness profiles across the Rubisco tree and at C3→C4 transitions. (A) Fitness profiles across the tree embedded by PCA. Each node's fitness profile over 475 confident sites 20 amino acids is projected onto the first two principal components, for a clade- and pathway-balanced sample of nodes colored by clade (see Methods). The plane is rotated 135° so the tree fits the panel, with both axes on one scale, and the compass shows the PC1 and PC2 directions with the variance each captures. Lines join each node to its nearest sampled ancestor. (B) Fitness profiles for angiosperms alone. The same plane is colored by photosynthetic pathway, so C3→C4 transitions show as changes in branch color. A toggle draws each of the 36 C3→C4 origins as an arrow from its last non-C4 ancestor to the mean of its internal C4 descendants. (C) Convergence of C3→C4 shifts. Each point is one of 36 independent origins in 10 families, placed at the cosine between its shift in fitness profile (from the last non-C4 ancestor to its internal C4 nodes) and the mean shift of origins in other families. Blue bands show matched C3 placebo branches (light, 5–95%; dark, 25–75%), and the top row gives the mean over origins against the placebo sets. (D) Sites with the largest mean shift across C4 origins. Points show the RMS shift over amino acids at each site, averaged across origins with each family weighted equally. Bars run to the 95th percentile of the same statistic for matched placebo branches.
A clear pattern in these shifts is convergence after transitions from C3 to C4 photosynthesis (Figure 9B). Across 36 independent C4 origins in 10 families, the profile shift at each origin points in the same direction as the mean shift across families with mean cosine similarity of 0.57 (95% CI 0.35–0.70) compared with 0.09 for matched C3 placebo branches (Figure 9C). We observe positive cosine alignment for 34 of 36 origins. Convergence holds at sites that kept their ancestral residue (mean cosine similarity 0.54), so it does not simply reflect shared substitutions. The mean shift across C4 origins is largest at the known C4 substitutions A281S and A328S [32, 33], which arose in 29 and 21 of the 36 origins respectively (Figure 9D). Across C4 origins, fitness effects at site 281 shift by about 4 units of per amino acid in a consistent direction, compared with 0.5 for the 95th percentile of placebo branches.
Model performance comparison
We compare the primary Pinion models for S9 and Rubisco with a context-free baseline, ablated models and antiGen [18] in Table 1. The antiGen transformer model directly predicts logits of next amino acid substitutions based on parent sequence rather than operating through fitness comparisons. Because antiGen operates purely with amino acids we convert our predictions to AA-space and predict the probability of observing each of the amino acid mutations on top of a parent amino acid sequence . We compare to antiGen trained at the published 32 epochs as well as 64 epochs as we saw continued improvement in performance on held-out clades with longer training. Pinion outperforms antiGen by 0.51 nats of information gain for S9 and 0.21 nats for Rubisco. We also compare directly on SARS-CoV-2 spike S1 with a large phylogeny of ~2.2 million taxa and 154,268 substitutions to train both Pinion and antiGen, finding equivalent performance in the two models.
Table 1. Next-substitution prediction in amino acid space. Each realized substitution is scored against all single amino acid changes available from its parent amino acid sequence evaluated on held-out clades. Information gain is measured relative to the uniform null and recall@10% is the fraction of substitutions ranked within the top 10% of candidates. Parentheses give 95% confidence intervals.
| Protein | Model | AA-space info gain | AA-space recall@10% |
|---|---|---|---|
| S9 | Context-free model | 2.09 (1.95–2.21) | 90% (87%–92%) |
| Pinion at 1 epoch | 2.72 (2.55–2.88) | 94% (91%–96%) | |
| Pinion pure subst | 2.57 (2.41–2.72) | 93% (90%–95%) | |
| Pinion AA-space training | 2.51 (2.32–2.67) | 91% (87%–94%) | |
| antiGen at 32 epochs | 2.13 (1.97–2.27) | 85% (82%–88%) | |
| antiGen at 64 epochs | 2.21 (2.04–2.38) | 87% (83%–90%) | |
| Rubisco | Context-free model | 2.91 (2.78–3.03) | 92% (90%–94%) |
| Pinion at 1 epoch | 3.59 (3.41–3.76) | 92% (91%–94%) | |
| Pinion pure subst | 3.52 (3.33–3.69) | 92% (90%–94%) | |
| Pinion AA-space training | 3.52 (3.33–3.69) | 91% (90%–93%) | |
| antiGen at 32 epochs | 3.28 (3.07–3.46) | 91% (88%–93%) | |
| antiGen at 64 epochs | 3.38 (3.17–3.56) | 91% (89%–93%) | |
| Spike | Context-free model | 2.48 (2.37–2.59) | 91% (90%–92%) |
| Pinion at 1 epoch | 2.82 (2.67–2.97) | 93% (92%–94%) | |
| Pinion pure subst | 2.79 (2.65–2.93) | 93% (91%–94%) | |
| Pinion AA-space training | 2.90 (2.75–3.05) | 94% (92%–95%) | |
| antiGen at 32 epochs | 2.76 (2.55–2.95) | 93% (90%–94%) | |
| antiGen at 64 epochs | 2.82 (2.61–3.02) | 93% (92%–95%) |
The context-free model of per-site preferences (see Methods) comes close to Pinion and matches or exceeds antiGen on top-10% recall, but trails both on information gain. It is a site-wise mutation-selection model in the classical form [21, 25], with one amino acid fitness profile per site shared across the tree. Across models, recall varies much less than information gain, where for Rubisco, every model ranks 91–92% of realized substitutions in its top 10%, while information gain ranges from 2.91 to 3.59 nats. The 0.68-nat gap between the context-free model and Pinion means Pinion assigns the realized substitution about twice the probability. Per-site preferences are thus enough to place most realized substitutions among a site's tolerated changes, and what separates the models is how much probability they concentrate on the substitution that actually occurs.
Beyond model size and pretraining, Pinion differs from antiGen in three ways. First, it co-trains with the objective rather than solely training under a substitution-based objective. Moving the primary Pinion model to a pure substitution objective changes AA-space information gain by −0.15 nats for S9, −0.07 nats for Rubisco and −0.03 nats for SARS-CoV-2 spike. This suggests an effect from the degree of adaptation and non-equilibrium dynamics where including MLM signal is more beneficial for proteins under more purifying selection. Second, Pinion is formulated in DNA-space, which constrains single-step mutations by the genetic code and allows estimation of nucleotide mutation rate differences. We find that an ablated model trained in amino acid space has lower AA-space information gain for S9 (−0.21 nats) and Rubisco (−0.07 nats), but higher information gain for SARS-CoV-2 spike (+0.08 nats).
Third, Pinion weights each mutation by its Kimura fixation probability, which suits long timescales, where a substitution on a reconstructed phylogeny must both arise and fix. antiGen omits a fixation law, a reasonable choice for densely sampled viral phylogenies in which many branches carry mutations that have not yet fixed, and DASM likewise uses a non-Kimura selection factor (Table 2). In an ablation replacing the Kimura fixation law with log-linear selection, , AA-space information gain matched or slightly exceeded the primary model's (+0.03 nats for S9 and +0.02 nats for Rubisco). The fixation law therefore matters for interpreting in units of rather than for prediction.
Beyond performance comparisons, our direct representation of fitness allows for biological investigation of fitness landscapes (as seen with S9 and Rubisco above) whereas antiGen predicts next substitutions without allowing interrogation of fitness effects.
Discussion
Here, we present an approach to training protein language models on substitutions occurring over evolutionary time. Like DASM [16, 20], Pinion is a mutation-selection model of codon substitution [21, 23, 24, 25] in which a neural network supplies the selective effects. In Pinion, the selective effects are the scaled log-odds of a co-trained protein language model. Like the classical models, it weights each mutation by its rate and its Kimura fixation probability, and so assumes weak mutation, in which each substitution fixes before the next arises [9]. This assumption may fail in large, rapidly adapting populations where beneficial mutations compete [34]. Classical mutation-selection models give each site a fixed amino acid fitness profile that is shared across the whole tree, and their extensions couple sites only through protein structure or pairwise potentials [35, 36]. Neural mutation-selection models such as DASM and Pinion instead learn a function that maps sequence to landscape, so a single network scores every possible mutation in any genetic background, including backgrounds never seen in training, such as held-out clades.
DASM [16, 20] and antiGen [18] also learn from reconstructed evolutionary histories of antibodies and viruses, but Pinion differs in expressing selection in population genetic units through the fixation probability and in co-training with masked language modeling. As such models multiply, we recommend comparing them by information gain on held-out substitutions. Information gain is the log probability of the realized substitution relative to a uniform null, or . This is a strictly proper scoring rule whose expected value is highest only when predicted probabilities match the true distribution [37]. It is the held-out counterpart of the training loss, much as perplexity is for language models, and rewards proper model calibration. Rank-based metrics such as top-10% recall ignore calibration and saturate quickly. Once most realized substitutions fall within a model's top 10% of candidates (Table 1), recall cannot reward concentrating probability on the substitution that actually occurs. Looking forwards, a shared set of held-out substitutions could serve evolutionary prediction as ProteinGym serves deep mutational scanning [14].
Next-substitution prediction gives protein language models a training signal that complements masked language modeling, and co-training outperformed either objective alone in both lattice proteins and S9 (Figure S8, Figure 3). Interpreting masked language model scores as fitness assumes that sequences are sampled from the stationary distribution on a fixed fitness landscape (see Supporting Results and [15]). By conditioning on each parent sequence, the substitution objective doesn't require stationarity and permits training on sequences actively climbing in fitness (Figure S11). Unlike masked language modeling, substitution training also does not require thinning, as closely related sequences add short, well-resolved branches rather than redundant samples (Figure S9). However, substitution training depends on accurate phylogenetic reconstruction, and long branches with multiple hits will necessarily be an imperfect proxy. Phylogenies can be built from existing collections of coding sequences, so substitution training draws additional signal from data already in hand. We expect that protein and genome foundation models could benefit from adding it alongside their standard language modeling objectives.
Training on substitutions calibrates protein language model scores, yielding scaled fitness effects in the natural population genetic units of for every available mutation and every realized substitution. In Rubisco, substitution rates within each class follow the Kimura expectation without rescaling and the model's expected dN/dS tracks empirical dN/dS across the tree (Figure 6, Figure 7). The dN/dS metric has long been a simple measure of natural selection during molecular evolution. However, dN/dS below 1 can easily conceal a mixture of purifying and positive selection where most available mutations are deleterious but many fixations are advantageous [38]. From any Rubisco sequence most directions lead downhill, yet most steps taken are among the few that lead uphill. Rubisco's dN/dS is 0.13, but the 2.0% of available nonsynonymous mutations with account for 67% of realized nonsynonymous substitutions (Figure 6, Figure 7). Pinion resolves this mixture, giving a site-specific and context-specific measure of fitness effects where dN/dS gives a single average.
These calibrated fitness effects in turn allow evolutionary prediction, with Pinion predicting next substitutions in held-out clades (Figure 4, Figure 6, Table 1). However, because our trees are sampled at a single time point, substitutions occurring repeatedly between training and held-out test clades can inform predictions across the split, so this evaluation tests generalization across contemporaneous lineages rather than forecasting forward in time. Future work should test forward-in-time prediction in application areas including pathogen surveillance of viruses such as seasonal influenza and SARS-CoV-2, antibiotic resistance evolution and antibody affinity maturation.
Pinion also serves as an evolutionary microscope, showing how fitness effects change across a phylogeny. On a fixed landscape at equilibrium, uphill and downhill substitutions balance [39], and a context-free model with one fitness profile per site finds little adaptive evolution in Rubisco. With genetic background included, most fixed substitutions in land plants are adaptive, consistent with lineages tracking a landscape that shifts beneath them. These shifts bear on the question of predictability and contingency raised at the outset [1]. Across 36 independent C3 to C4 origins in 10 families, Rubisco landscapes shifted in a shared direction, including at sites that kept their ancestral residue (Figure 9). Predictability may therefore extend beyond repeated substitutions to repeated changes in the landscape that selects them. Because Pinion sees only sequence, it cannot separate shifts caused by genetic background from those caused by environment, such as the move to C4 photosynthesis. Future variants could condition fitness on environment directly, for example on photosynthetic pathway, temperature or host.
More broadly, evolution has tested mutations across countless genetic backgrounds and environments for billions of years, leaving a record only of those that fixed. Models trained on this record at scale and conditioned on environment could chart the space that life has explored, and predict how fitness landscapes shift with each new mutation and each change in environment.
Methods
Ribosomal protein S9 phylogenies
We downloaded all NCBI RefSeq [40] genome assemblies from five bacterial phyla (Actinomycetota, Bacillota, Bacteroidota, Cyanobacteriota and Pseudomonadota) using the NCBI Datasets command-line tool [41].
The 120 bacterial marker genes of GTDB (bac120) were identified using GTDB-Tk [42] version 2.6.1, subcommand identify, reference data r226 [43], which runs Prodigal version 2.6.3 [44] internally.
In total 450,770 assemblies had at least one bac120 marker.
We retained the nucleotide coding sequences of ribosomal protein S9 (Pfam PF00380.20 [45]), keeping one copy per genome.
When several copies were found, the one closest in length to the median single-copy length was kept.
This yielded 2475 sequences for Cyanobacteriota, 22,574 for Bacteroidota, 53,232 for Actinomycetota, 122,009 for Bacillota and 248,781 for Pseudomonadota.
Sequences were translated and aligned to the PF00380.20 profile HMM using hmmalign from HMMER version 3.4 [46].
A tree was then inferred using VeryFastTree version 4.0.5 [47] with parameter -lg.
Full-length proteins were aligned using FAMSA version 2.4.1 [48] and back-translated into a codon alignment.
Columns occupied by fewer than 2% of sequences were removed.
Ancestral sequences were inferred using TreeTime version 0.12.1 [49], and each tree was exported using Augur version 34.1.4 [50] in the Auspice JSON format of Nextstrain [51] with its root sequence and per-branch nucleotide mutations.
We capped each internal node at four leaf children, so that large polytomies (nodes with many children) do not dominate the training data. Subtrees of at most 20 tips were pruned when their stem branch had a divergence greater than 1.0 expected amino acid substitutions per site, or carried point substitutions in more than 20% of gene positions. Since VeryFastTree leaves an arbitrary root, each tree was rerooted on the edge that best separates the basal lineages of its phylum from the crown lineages in the GTDB r226 species tree, with tips mapped to GTDB species representatives by genome accession. The final S9 trees contain 53,594 tips (1112 to 21,818 per phylum).
Rubisco large subunit phylogeny
The Rubisco rbcL dataset follows the S9 procedure above, with the following differences.
Sequences were retrieved from NCBI Nucleotide [52] (query rbcL[Gene Name] AND txid33090[Organism:exp], 2026-10-09, 332,600 records) and the annotated rbcL CDS was extracted from each record (326,483 candidates).
We kept complete and near-complete sequences (≥ 90% coverage of spinach rbcL NP_054944.1), masked 1902 codons with reviewed frame-shifting read errors, collapsed identical sequences within a species and manually excluded 222 misplaced, chimeric, misidentified or contaminated sequences, which yielded 61,193 sequences.
Codon alignment (FAMSA version 2.4.1) was performed as for S9, but with a 0.1% occupancy floor instead of 2%, to retain more insertions. The tree was inferred from the 492-codon alignment rather than from proteins, as rbcL is much less divergent than S9. Furthermore, as rbcL alone misplaces parts of the Panicoideae, Chenopodiaceae and Cyperaceae backbones, the tree was constrained to 36 splits from published phylogenies.
IQ-TREE version 3.1.4 [53] was used with parameters -m GTR+F+G4 -fast from a VeryFastTree starting tree, then the tree was rooted between Chlorophyta and Streptophyta.
In TreeTime version 0.12.1, terminal gaps were treated as missing data at ends annotated as partial, and as gaps elsewhere.
Finally, each tip was labeled C3, C4, C3-C4 or CAM from published rule tables [54, 55, 56, 57], and pathways at internal nodes were reconstructed with the discrete traits model of TreeTime via Augur.
As with S9, we capped each internal node at four leaf children. The rbcL tree contains 53,934 tips.
SARS-CoV-2 spike phylogeny
We used the Viridian curated SARS-CoV-2 phylogeny [58], a mutation-annotated tree of 4,471,579 SARS-CoV-2 genomes collected between 2020 and 2024, restricted to the spike S1 region of 685 amino acids. Node sequences were reconstructed from the tree's mutations using matUtils version 0.6.6 [59]. As with S9 and rbcL, we capped each internal node at four leaf children, which left 2,245,309 tips.
Substitutions
We converted each tree into substitution records, each record pairing a parent node's coding sequence with one observed single-nucleotide substitution on the branch to one of its children. Because the order of substitutions along a branch is unknown, a branch with several substitutions yields one record per substitution, each scored against the same parent. We dropped insertions and deletions, observed nonsense substitutions, and branches whose parent contains an internal stop codon. We also dropped every branch with more than 10 substitutions, where the parent is a poor stand-in for the background each substitution arose on. Dropping substitutions on long branches removes 80% and 50% of potential training substitutions from S9 and rbcL respectively. Synonymous substitutions were kept as targets, since they inform the mutation spectrum and the balance between synonymous and nonsynonymous change. The S9 training set has 127,671 synonymous and 31,949 nonsynonymous substitutions, the rbcL training set has 96,137 synonymous and 59,036 nonsynonymous substitutions, and the spike training set has 60,302 synonymous and 93,966 nonsynonymous substitutions.
Held-out clades
We evaluated models on held-out clades, whole subtrees whose branches and sequences were kept out of training. To demarcate each clade, we walked from a randomly chosen tip back toward the root until the branches traversed at least five nucleotide substitutions, and held out the node reached together with all of its descendants. Clades containing more than 1% of a tree's tips were skipped, and seed tips were drawn until 10% of tips were held out. Each branch takes the label of its child, so the stem branch leading into a held-out clade is held out with it. We split each of the five S9 trees, the rbcL tree and the spike tree separately, which gave 778 held-out S9 clades, 273 rbcL clades and 81 spike clades. After applying the long branch threshold described above, these clades hold 13,975 S9 substitutions, 10,833 rbcL substitutions and 34,710 spike substitutions.
Held-out nodes, both tips and reconstructed ancestors, were excluded from the masked language modeling corpus as well as from the training substitutions. The trees and ancestral sequences themselves were inferred once from all sequences, before the split. We did not set aside a separate validation set. In the S9 training sweep, held-out clades were used to choose , the masked language modeling corpus and the training length. The rbcL and spike models used the S9 recipe unchanged, so their held-out clades were not used to choose any setting.
Model architecture
Pinion's protein language model is fine-tuned from ESMC 600M [28], a 36-layer transformer of width 1152. Both objectives read ESMC's own output head: masked language modeling at masked positions, and the log-odds at every position of the unmasked parent, so the two objectives share every parameter of the language model. The model receives only the parent sequence, with no label for phylum, clade or position in the tree. The scale parameter is a single positive scalar per protein with learned for S9, for rbcL and for spike.
The mutation spectrum comes from a separate mutation head that reads the parent's nucleotide coding sequence, since the language model sees only amino acids and cannot distinguish synonymous codons. The head is a two-layer transformer (width 128, four attention heads, learned positional embeddings) whose output is averaged over positions and projected to 12 logits, one for each type of nucleotide change. Each candidate's mutation rate is the exponentiated logit for its type of change. The spectrum can therefore differ between parents, but not between positions within a parent. The mutation head adds 0.6 million parameters to ESMC.
Model training
We trained each model in a single stage from the pretrained ESMC weights, minimizing . Each step drew a batch of 16 substitution records and a separate batch of 16 sequences for masked language modeling. The masked language modeling corpus contains the amino acid sequences of all training nodes, tips and reconstructed ancestors, with duplicates removed. In each sequence we masked 15% of residues, chosen independently, and replaced every masked residue with the mask token.
We used AdamW with a learning rate of for the ESMC parameters and for and the mutation head, weight decay of 0.05 on all parameters, 100 warmup steps followed by cosine decay to zero and gradients clipped at norm 1. Training used bf16 mixed precision and no dropout. Each model trained for 10,000 steps, which is 1.0 epoch of the S9 substitution records, 1.03 epochs of the rbcL records and 1.04 epochs of the spike records, and we used the final checkpoint of a single run. A run took about 1 hr for S9 and 2 hr for rbcL on one H100 80 GB GPU.
Context-free baseline
As a baseline without epistasis, we fit a classical site-wise mutation-selection model [21, 23, 25]. Each alignment column has one amino acid fitness profile , shared across the whole tree, so a mutation from to at column has in any genetic background. Because is fit directly in units of , the baseline needs no . Candidates are weighted by and normalized as in Pinion, with taken from Pinion's trained mutation head and held fixed. The two models therefore share the mutation spectrum and the fixation law, and differ only in whether selection depends on the sequence background. The profiles, centered within each column, minimize on the training substitutions plus an L2 penalty, and were fit by L-BFGS. We chose the L2 penalty of 0.01 based on the likelihood of about 15% of training substitutions held out by taxonomic group, and then refit on all training substitutions. rbcL and spike each have one set of profiles and S9 has one per phylum, since each S9 phylum has its own alignment. This baseline supplies the context-free row of Table 1 and the context-free views of Figure 6 and Figure 7.
Related modeling approaches
Pinion builds on recent models that learn protein evolution from phylogenetic data (Table 2). DASM [16] combines a neutral nucleotide mutation model with learned amino acid selection factors to predict a child antibody sequence, given its parent and a fitted branch length. A DASM-style model trained with the whichmut objective of the netam implementation of DASM [19] instead normalizes mutation-selection weights over the parent's single-nucleotide neighbors, as Pinion does. Haddox et al [20] uses this objective to extend DASM to SARS-CoV-2 evolution. antiGen [18], trained on viral phylogenies, normalizes scores jointly over positions and amino acid replacements, without an explicit mutation model. PEINT [60] predicts a related protein sequence conditional on an input sequence and evolutionary distance, using pairs of observed sequences from phylogenetic trees. MutaGAN [61] likewise generates descendant sequences, using a sequence-to-sequence generative adversarial network trained on parent-child pairs from an influenza hemagglutinin phylogeny.
Table 2. Neural models trained on phylogenetic data. The + whichmut column describes a DASM-style selection model trained with netam's whichmut objective. A dash indicates that a component is not used or not represented separately. The 'wiggle' selection factor is when and when .
| Pinion | DASM | + whichmut | antiGen | PEINT | |
|---|---|---|---|---|---|
| Training examples | Substitutions | Parent-child pairs | Substitutions | Substitutions | Sequence pairs |
| Prediction target | Next nucleotide substitution | Child codons, including unchanged | Next nucleotide substitution | Next amino acid change, including gaps | Full protein sequence |
| Evolutionary distance | — | Fitted per pair | — | — | Model input |
| Mutation component | Jointly learned spectrum | Separately fit; held fixed | Separately fit; held fixed | — | — |
| Selection component | Kimura | 'Wiggle' | 'Wiggle' | — | — |
| MLM co-training | Yes | — | — | — | Yes |
The mutation-selection factorization shared by Pinion and DASM follows classical codon models [21, 23]. DASM extends DNSM [62], which learns one selection factor per site, to one selection factor per site and amino acid. Related work in antibodies combines nucleotide mutation models with selection scores derived from protein language models [63].
DASM uses Thrifty [64] to estimate mutation probabilities from out-of-frame antibody sequences and holds this mutation model fixed during selection training. We instead learn a parent-specific spectrum of relative nucleotide mutation rates jointly with selection. Synonymous changes have and , so their weights depend on the mutation spectrum alone and give the joint fit a neutral reference.
Evaluation metrics
Information gain and top-10% recall are defined in the Model section, and we report both over held-out substitutions, with information gain averaged across them. The uniform null over the candidates includes nonsense candidates. Nonsynonymous information gain averages over nonsynonymous substitutions only, so that it gives no credit for predicting synonymous changes, and nonsynonymous recall likewise ranks within the parent's nonsynonymous candidates. Tied candidates, such as a parent's synonymous candidates of one mutation type, share their average rank. Intervals are 95% percentile intervals from 2000 bootstrap draws of held-out clades, where each draw resamples whole clades with replacement and keeps all of their substitutions. These intervals reflect which clades were held out, not variation between training runs.
To compare with models that operate only in amino acids (Table 1), we also scored held-out nonsynonymous substitutions over the single amino acid changes of the parent protein, against a uniform null of . For Pinion, its codon-level ablations and the context-free model, the probability of an amino acid change is the sum of over the nonsynonymous candidates that produce it, renormalized over the nonsynonymous pool, so a change that no single-nucleotide mutation reaches receives zero probability. antiGen and the amino-acid-space ablation of Pinion score the changes directly. Recall in this space ranks the observed change among all .
Distribution of fitness effects
For Figure 4 and Figure 6, we estimated for every nonsynonymous candidate of every unique parent sequence in the corpus, from a single forward pass over the unmasked parent. The distribution of available mutations pools these candidates, counting each once per parent and without weighting by the mutation spectrum , and is summarized by a random sample of 200,000. The distribution of realized substitutions takes each observed nonsynonymous substitution's under its parent, and pools training and held-out substitutions, about 93% of which are training substitutions for both proteins. For S9 we also compared the two distributions as a fixation propensity, the ratio of the realized density to the available density in bins of width 0.25.
Drift-selection balance in S9
For Figure 5, we analyzed the Actinomycetota tree, computing for all 19 alternative amino acids at every site of every node from one forward pass over the node's own sequence. We restricted the analysis to the 128 alignment columns occupied in at least 99% of nodes and to the 22,696 nodes that carry a residue at 95% or more of these sites. At each site, a node's deficit is the largest among the 20 amino acids, which is zero when the node already carries the best one, and the site is off peak when its deficit is positive. A node's peak is the genotype with the best amino acid at every site, which treats its landscape as additive, and its altitude is the sum of its deficits, in units of below the peak. For the drift-selection expectation [22], Kimura fixation probability gives , so that at stationarity on a fixed landscape each site carries amino acid with probability proportional to . We took as the neutral amino acid frequencies of a codon model at the GC content of S9 sequences, and summed over sites on each tip's own fitness profile to give its expected altitude, the variance of that altitude and its expected number of sites off peak.
An amino acid change is demarcated as 'allowed' when its exceeds −1, counting all 19 alternative amino acids at a site whether or not a single nucleotide change reaches them.
A median of 24 of a tip's 52 allowed changes are one nucleotide change away.
We took as fixations the 3129 branches between eligible nodes that change exactly one amino acid, with no change in gaps.
At each site that a fixation leaves unchanged, a change closes when it is allowed in the parent but not in the child, and opens in the reverse case, and we compared the numbers closed and opened per fixation with a geometric distribution at their pooled mean.
For 3D distance we used the minimum heavy-atom distance between residues of S9 in the M. smegmatis 70S ribosome structure (PDB 8FR8) [65], mapped onto alignment columns through the strain MC2 155 sequence.
We compared closings and openings by distance from the fixed site with the same counts by distance from a randomly chosen other site.
For coupling, a site's shift is the root-mean-square change in over its 19 alternatives, and we averaged the shift that fixations at site cause at site , over sites with at least 3 fixations and pairs with at least 3 fixations.
We symmetrized this matrix and applied the average product correction used in contact prediction [66], then measured precision against contacts within 5 Å over pairs at least six residues apart in sequence.
dN/dS in Rubisco
For Figure 6D and Figure 7 we examine dN/dS across the rbcL tree. Because synonymous candidates have and , the model implies a dN/dS for each parent, , which we tested against substitutions on the rbcL tree. These comparisons use every branch of the tree, including those above the 10-substitution cap, with computed from each unmasked parent and from the mutation head. A branch's synonymous changes set the expectation for its number of nonsynonymous changes. With synonymous changes off parent , the expected number of nonsynonymous changes, were they neutral, is times the ratio of nonsynonymous to synonymous mutation supply at , each the sum of over the mutations of that kind available from . Empirical dN/dS is the observed number of nonsynonymous changes divided by this neutral expectation, each summed over branches. Weighting each nonsynonymous by gives the model's expectation instead, so the model's dN/dS over a set of branches is the average of at their parents, weighted by each branch's neutral expectation.
For each unit-wide class of , we restricted both the observed changes and the neutral expectation to nonsynonymous candidates in that class, and compared the resulting dN/dS with the unscaled , over all branches and over held-out branches. To compare across the tree, we cut it from the tips toward the root into 886 disjoint tiles of adjacent branches, each holding at least 200 synonymous changes, and compared empirical with model dN/dS across tiles by Spearman correlation. For each major clade, we pooled dN/dS over its branches, compared observed with model-expected changes at , and summarized the of its realized nonsynonymous substitutions, as defined above, by their median and the share above 1. We repeated each comparison with the context-free baseline, and 95% intervals come from resampling plant families.
Context dependence in Rubisco
These analyses use for every amino acid at each of the 475 alignment columns present in at least 99% of nodes, computed for every node of the rbcL tree from one forward pass over its sequence.
For Figure 8, we measured how a substitution changes fitness effects elsewhere.
We took branches that change exactly one amino acid and computed the shift for each alternative amino acid at every site that kept its residue, summarizing each site by the root-mean-square shift over its 19 alternatives.
Under an additive landscape, every such shift would be zero.
We kept the 13,666 of 21,110 such branches that are confidently reconstructed, where at least 80% of descendant tips carry the derived residue, at least 80% of sister tips carry the ancestral one and branch support is at least 0.8.
Distance is the minimum heavy-atom distance between residues in activated spinach Rubisco (PDB 8RUC) [67], taken over all pairs of large subunits so that contacts across subunit interfaces count.
The distance analyses use the 13,269 of these branches whose substituted site is resolved in the structure.
For each branch we computed the share of its total squared shift at sites within 5 Å of the substituted site, and at such contacts more than three positions away in sequence, and compared both with a null that measures each branch's shifts from another branch's substituted site.
To compare fitness profiles across the tree in Figure 9, we represented each node by its within-site-centered profile , the effect of each amino acid at site relative to the site's mean over all 20. We fit a principal component analysis, without scaling the features, to up to 400 nodes from each major clade so that no clade dominates the components, and projected every node onto it. The variation explained by clade is the between-clade share of variance in the first two components. Figure 9A shows up to 600 nodes from each combination of major clade and photosynthetic pathway (6411 of 88,332 nodes). To draw the tree through them, we added the common ancestors of the sampled nodes and joined each node to its nearest retained ancestor, so branching order is exact and runs of unsampled nodes along a lineage are drawn as one segment.
We identified C3→C4 origins as C4 nodes whose parent is C3 or C3-C4, with pathway confidence of at least 0.9 at both and at least two C4 tips, which gave 36 origins in 10 families, assigning each origin the majority family of its C4 tips. An origin's profile shift is the mean profile of its internal C4 descendants minus that of its parent. Its convergence is the cosine between this shift and the mean shift of origins in other families, with each family weighted equally, so that history shared within a family cannot count as convergence. We repeated this at sites where descendants still carry the ancestral residue. Placebos are pure-C3 internal branches matched to each origin by taxonomy, size and depth, and intervals come from a hierarchical bootstrap over families and then origins.
Reproducible research
Data
Code for lattice protein generation is available at github.com/
Analysis
All data, analysis workflows and figure generation code are available in the GitHub repo github.com/s3://holotypebio-pinion as detailed in the Pinion repo.
Acknowledgements
We thank Garyk Brixi, Brian Hie, Erick Matsen and Ivan Specht for feedback on this work. This research was supported by Starfish Neuroscience, Triggerfish Inc and Maracot Inc.
Competing Interests
TB is founder and director of Maracot Inc and holds equity in the company, which funded this work. RC, ZL and SS consult for Maracot Inc. No patent applications related to this work have been filed.
Author Contributions
Trevor Bedford: synthetic lattice protein data generation, model architecture, analysis of lattice proteins, S9 and Rubisco, primary manuscript writing. Rayan Chikhi: empirical data ingest and bioinformatics for S9 and Rubisco, manuscript methods. Zehui Li: model implementation and trainer. Sanjay Srivatsan: broader contextual guidance.
Supporting Information
The Supporting Information has Figures S1–S11 and these sections:
References
- Gould SJ (1989) Wonderful life: the Burgess Shale and the nature of history. W. W. Norton & Co.
- Weinreich DM, Delaney NF, DePristo MA, Hartl DL (2006) Darwinian evolution can follow only very few mutational paths to fitter proteins. Science 312: 111–114.
- Zhen Y, Aardema ML, Medina EM, Schumer M, Andolfatto P (2012) Parallel molecular evolution in an herbivore community. Science 337: 1634–1637.
- Natarajan C, Hoffmann FG, Weber RE, Fago A, Witt CC, et al. (2016) Predictable convergence in hemoglobin function has unpredictable molecular underpinnings. Science 354: 336–339.
- Wright S (1932) The roles of mutation, inbreeding, crossbreeding and selection in evolution. Proc Sixth Int Congr Genet 1: 356–366.
- De Visser JAG, Krug J (2014) Empirical fitness landscapes and the predictability of evolution. Nat Rev Genet 15: 480–490.
- Starr TN, Thornton JW (2016) Epistasis in protein evolution. Protein Sci 25: 1204–1218.
- Kimura M (1962) On the probability of fixation of mutant genes in a population. Genetics 47: 713.
- McCandlish DM, Stoltzfus A (2014) Modeling evolution using the probability of fixation: history and implications. Q Rev Biol 89: 225–252.
- Rives A, Meier J, Sercu T, Goyal S, Lin Z, et al. (2021) Biological structure and function emerge from scaling unsupervised learning to 250 million protein sequences. Proc Natl Acad Sci USA 118: e2016239118.
- Elnaggar A, Heinzinger M, Dallago C, Rehawi G, Wang Y, et al. (2021) ProtTrans: toward understanding the language of life through self-supervised learning. IEEE Trans Pattern Anal Mach Intell 44: 7112–7127.
- Madani A, Krause B, Greene ER, Subramanian S, Mohr BP, et al. (2023) Large language models generate functional protein sequences across diverse families. Nat Biotechnol 41: 1099–1106.
- Meier J, Rao R, Verkuil R, Liu J, Sercu T, et al. (2021) Language models enable zero-shot prediction of the effects of mutations on protein function. NeurIPS 34: 29287–29303.
- Notin P, Kollasch A, Ritter D, Van Niekerk L, Paul S, et al. (2023) ProteinGym: Large-scale benchmarks for protein fitness prediction and design. NeurIPS 36: 64331–64379.
- Weinstein EN, Amin AN, Frazer J, Marks DS (2022) Non-identifiability and the blessings of misspecification in models of molecular fitness. NeurIPS 35: 5484–5497.
- Matsen FA IV, Dumm W, Sung K, Johnson MM, Rich DH, et al. (2026) Separating selection from mutation in antibody language models. eLife 15: RP109644.
- MacLean OA, Lamb K, Lytras S, Mojsiejczuk L, Yuan K, et al. (2026) Protein language models learn underlying mutation biases alongside fitness landscapes. bioRxiv: 2026.07.06.736753.
- Specht I, Park S, Chithrananda S, Driscoll CL, Brixi G, et al. (2026) Forecasting viral evolution from phylogenetic trees. bioRxiv 2026.08.27.741102.
- Matsen FA IV, Dumm W, Galloway J, Harel N, Sung K (2025) netam: neural networks to model BCR affinity maturation. Zenodo. Software, version 0.2.4.
- Haddox HK, Galloway JG, Dumm W, Baghbanzadeh M, Bloom JD, et al. (2026) Using deep learning to estimate the shifting mutational fitness landscape of SARS-CoV-2 spike along a phylogeny. bioRxiv 2026.11.27.768997.
- Halpern AL, Bruno WJ (1998) Evolutionary distances for protein-coding sequences: modeling site-specific residue frequencies. Mol Biol Evol 15: 910–917.
- Sella G, Hirsh AE (2005) The application of statistical physics to evolutionary biology. Proc Natl Acad Sci USA 102: 9541–9546.
- Yang Z, Nielsen R (2008) Mutation-selection models of codon substitution and their use to estimate selective strengths on codon usage. Mol Biol Evol 25: 568–579.
- Rodrigue N, Philippe H, Lartillot N (2010) Mutation-selection models of coding sequence evolution with site-heterogeneous amino acid fitness profiles. Proc Natl Acad Sci USA 107: 4629–4634.
- Tamuri AU, dos Reis M, Goldstein RA (2012) Estimating the distribution of selection coefficients from phylogenetic data using sitewise mutation-selection models. Genetics 190: 1101–1115.
- Lau KF, Dill KA (1989) A lattice statistical mechanics model of the conformational and sequence spaces of proteins. Macromolecules 22: 3986–3997.
- Bloom JD, Wilke CO, Arnold FH, Adami C (2004) Stability and the evolvability of function in a model protein. Biophys J 86: 2758–2764.
- Candido S, Hayes T, Derry A, Rao R, Lin Z, et al. (2026) Language modeling materializes a world model of protein biology. bioRxiv 2026.06.03.729735.
- Kryazhimskiy S, Plotkin JB (2008) The population genetics of dN/dS. PLoS Genet 4: e1000304.
- Spielman SJ, Wilke CO (2015) The relationship between dN/dS and scaled selection coefficients. Mol Biol Evol 32: 1097–1108.
- Kapralov MV, Filatov DA (2007) Widespread positive selection in the photosynthetic Rubisco enzyme. BMC Evol Biol 7: 73.
- Studer RA, Christin PA, Williams MA, Orengo CA (2014) Stability-activity tradeoffs constrain the adaptive evolution of RubisCO. Proc Natl Acad Sci USA 111: 2223–2228.
- Parto S, Lartillot N (2018) Molecular adaptation in Rubisco: Discriminating between convergent evolution and positive selection using mechanistic and classical codon models. PLoS One 13: e0192697.
- Desai MM, Fisher DS (2007) Beneficial mutation–selection balance and the effect of linkage on positive selection. Genetics 176: 1759–1798.
- Robinson DM, Jones DT, Kishino H, Goldman N, Thorne JL (2003) Protein evolution with dependence among codons due to tertiary structure. Mol Biol Evol 20: 1692–1704.
- Kleinman CL, Rodrigue N, Lartillot N, Philippe H (2010) Statistical potentials for improved structurally constrained evolutionary models. Mol Biol Evol 27: 1546–1560.
- Gneiting T, Raftery AE (2007) Strictly proper scoring rules, prediction, and estimation. J Am Stat Assoc 102: 359–378.
- Eyre-Walker A (2006) The genomic rate of adaptive evolution. Trends Ecol Evol 21: 569–575.
- Mustonen V, Lässig M (2010) Fitness flux and ubiquity of adaptive evolution. Proc Natl Acad Sci USA 107: 4248–4253.
- O'Leary NA, Wright MW, Brister JR, Ciufo S, Haddad D, et al. (2015) Reference sequence (RefSeq) database at NCBI: current status, taxonomic expansion, and functional annotation. Nucleic Acids Res 44: D733–D745.
- O'Leary NA, Cox E, Holmes JB, Anderson WR, Falk R, et al. (2024) Exploring and retrieving sequence and metadata for species across the tree of life with NCBI Datasets. Sci Data 11.
- Chaumeil PA, Mussig AJ, Hugenholtz P, Parks DH (2022) GTDB-Tk v2: memory friendly classification with the genome taxonomy database. Bioinformatics 38: 5315–5316.
- Parks DH, Chaumeil PA, Mussig AJ, Rinke C, Chuvochina M, et al. (2025) GTDB release 10: a complete and systematic taxonomy for 715 230 bacterial and 17 245 archaeal genomes. Nucleic Acids Res 54: D743–D754.
- Hyatt D, Chen GL, LoCascio PF, Land ML, Larimer FW, et al. (2010) Prodigal: prokaryotic gene recognition and translation initiation site identification. BMC Bioinformatics 11.
- Mistry J, Chuguransky S, Williams L, Qureshi M, Salazar GA, et al. (2020) Pfam: The protein families database in 2021. Nucleic Acids Res 49: D412–D419.
- Eddy SR (2011) Accelerated profile HMM searches. PLoS Comput Biol 7: e1002195.
- Piñeiro C, Pichel JC (2024) Efficient phylogenetic tree inference for massive taxonomic datasets: harnessing the power of a server to analyze 1 million taxa. Gigascience 13.
- Deorowicz S, Debudaj-Grabysz A, Gudyś A (2016) FAMSA: Fast and accurate multiple sequence alignment of huge protein families. Sci Rep 6.
- Sagulenko P, Puller V, Neher RA (2018) TreeTime: Maximum-likelihood phylodynamic analysis. Virus Evol 4.
- Huddleston J, Hadfield J, Sibley T, Lee J, Fay K, et al. (2021) Augur: a bioinformatics toolkit for phylogenetic analyses of human pathogens. J Open Source Softw 6: 2906.
- Hadfield J, Megill C, Bell SM, Huddleston J, Potter B, et al. (2018) Nextstrain: real-time tracking of pathogen evolution. Bioinformatics 34: 4121–4123.
- Sayers EW, Cavanaugh M, Frisse L, Pruitt KD, Schneider VA, et al. (2024) GenBank 2025 update. Nucleic Acids Res 53: D56–D61.
- Wong TKF, Ly-Trong N, Ren H, Demotte P, Baños H, et al. (2026) IQ-TREE 3: phylogenomic inference software using complex evolutionary models. Mol Biol Evol 43.
- Sage RF (2016) A portrait of the C₄ photosynthetic family on the 50th anniversary of its discovery: species number, evolutionary lineages, and Hall of Fame. J Exp Bot 67: 4039–4056.
- Osborne CP, Salomaa A, Kluyver TA, Visser V, Kellogg EA, et al. (2014) A global database of C₄ photosynthesis in grasses. New Phytol 204: 441–446.
- Lundgren MR, Christin PA (2016) Despite phylogenetic effects, C₃–C₄ lineages bridge the ecological gap to C₄ photosynthesis. J Exp Bot 68: 241–254.
- Gilman IS, Smith JAC, Holtum JAM, Sage RF, Silvera K, et al. (2023) The CAM lineages of planet Earth. Ann Bot 132: 627–654.
- Hunt M, Hinrichs AS, Anderson D, Karim L, Dearlove BL, et al. (2026) Addressing pandemic-wide systematic errors in the SARS-CoV-2 phylogeny. Nat Methods 23: 653–662.
- McBroome J, Thornlow B, Hinrichs AS, Kramer A, De Maio N, et al. (2021) A daily-updated database and tools for comprehensive SARS-CoV-2 mutation-annotated trees. Mol Biol Evol 38: 5819–5824.
- Koehl A, Prillo S, Song YS, et al. (2026) Deep models of protein evolution in time generate realistic evolutionary trajectories and functional proteins. bioRxiv 2026.02.19.706898.
- Berman DS, Howser C, Mehoke T, Ernlund AW, Evans JD (2023) MutaGAN: A sequence-to-sequence GAN framework to predict mutations of evolving protein populations. Virus Evol 9: vead022.
- Matsen FA IV, Sung K, Johnson MM, Dumm W, Rich DH, et al. (2025) A sitewise model of natural selection on individual antibodies via a transformer-encoder. Mol Biol Evol 42: msaf186.
- Johnson MM, Sung K, Haddox HK, Vora AA, Araki T, et al. (2025) Nucleotide context models outperform protein language models for predicting antibody affinity maturation. PLoS Comput Biol 21: e1013758.
- Sung K, Johnson MM, Dumm W, Simon N, Haddox HK, et al. (2025) Thrifty wide-context models of B cell receptor somatic hypermutation. eLife 14: RP105471.
- Li Y, Majumdar S, Treen R, Sharma MR, Corro J, et al. (2023) Starvation sensing by mycobacterial RelA/SpoT homologue through constitutive surveillance of translation. Proc Natl Acad Sci USA 120: e2302006120.
- Dunn SD, Wahl LM, Gloor GB (2008) Mutual information without the influence of phylogeny or entropy dramatically improves residue contact prediction. Bioinformatics 24: 333–340.
- Andersson I (1996) Large structures at high resolution: the 1.6 Å crystal structure of spinach ribulose-1,5-bisphosphate carboxylase/oxygenase complexed with 2-carboxyarabinitol bisphosphate. J Mol Biol 259: 160–174.