Computing how likely a set of DNA or protein sequences is under an evolutionary tree requires, on every branch, multiplying a vector of per-state probabilities by a transition matrix. That matrix says how likely each state, such as a codon or a pair of amino acids, is to turn into every other state over the branch's length. Current GPU libraries treat this matrix as dense. For 61 codon states that works well. For richer models, such as the 400-state amino-acid-pair models used to study residues that evolve together, the per-branch matrices become the memory and compute bottleneck. The generator behind every transition matrix, called the rate matrix, is in fact very sparse, because evolution changes one site at a time. In a single-change pair model, each of the 400 states can reach only 38 others directly, so the rate matrix is about 90% zeros. General-purpose sparse kernels usually lose to dense ones at that level of sparsity. This sparsity is different, though. It comes from the genetic code and from the rule that sites change one at a time, so a fixed, biologically defined reordering of the states turns it into a union of dense blocks that map exactly onto GPU matrix tiles. The reordering depends only on the model, never on the tree, so it survives the constant topology changes of tree search at no cost.
We propose to replace dense per-branch transition matrices with uniformization, a truncated series of repeated sparse rate-matrix applications. Each application is executed as batched dense block products in the biologically derived state order. The method pays off most on short branches, and short branches are exactly what gene family trees are full of. Tandem duplicates, recent segmental copies, and whole-genome duplication paralogs create many shallow splits, and those splits are where analysts test whether one copy has been freed to acquire a new function. Gene family expansion is therefore the application regime, phylogenetic likelihood is the computation, and the overhead of unstructured sparsity is the obstacle we remove by showing that the sparsity was never unstructured.
Core Claim
For state spaces built from several sites, where each state has a small number of direct neighbours, the rate-matrix application can be permuted into a small number of block-diagonal dense operators. For the amino-acid pair model this means two batches of twenty 20×20 blocks, one per site. Applying it costs roughly $2 \cdot 20 \cdot 400$ multiply-adds per state vector instead of $400^2$, which is a tenfold reduction. Transition probabilities follow from uniformization:
$$ P(t)\,v \;=\; \sum_{k=0}^{K} e^{-\lambda t}\frac{(\lambda t)^k}{k!}\, R^k v, \qquad R = I + Q/\lambda, $$
Here $Q$ is the rate matrix, $\lambda$ is its largest exit rate, $t$ is the branch length, $v$ is the partial likelihood vector, and $K$ is chosen so that the truncated Poisson tail falls below a fixed tolerance. The Poisson tail bounds the error because $R$ is a stochastic matrix. The number of terms $K$ grows roughly like $\lambda t + c\sqrt{\lambda t}$, so short branches need only a handful. The gradient with respect to $t$ is $Q\,P(t)v$, which costs one extra sparse application. No per-branch $S\times S$ matrix, where $S$ is the number of states, is ever stored. Our claim is that on duplication-rich gene family trees under 400-state and larger models, this approach beats both dense precomputed matrices and eigendecomposition in wall-clock time and memory, with log-likelihood error below $10^{-6}$ per site. We also claim that the biologically defined ordering beats generic sparse reordering.
Relation to Prior Work
The GPU likelihood work in Many-core algorithms for high-dimensional gradients on phylogenetic trees supplies the method we build on. It runs the post-order and pre-order traversals and gradients inside BEAGLE on dense per-branch matrices and reports over 128-fold speedups for 61-state codon models. We keep its traversal structure and replace its dense matrix step. CherryML motivates the proposal: it made 400×400 coevolution rate matrices estimable, in 14 minutes on 8 CPU cores versus an estimated 35 CPU-years for expectation-maximization, by reducing trees to leaf pairs. Once such a model is estimated, however, it still has to be used on full trees for branch-length, topology, and selection inference, and CherryML does not address that step.
The sparsity literature constrains the design. High Performance Unstructured SpMM Computation Using Tensor Cores shows that cuSPARSE loses to dense cuBLAS at moderate sparsity. Its SMaT kernel beats cuBLAS only above 78% sparsity, and only after a Jaccard row reordering that is too costly to redo repeatedly, a point echoed by Accelerating Sparse Neural Networks on Dense Hardware. We borrow SMaT's insight that non-zeros must be packed into dense tiles, but we obtain the packing analytically, once per model. Fixed-pattern formats like 2:4 from Learning N:M Fine-grained Structured Sparse Neural Networks From Scratch do not fit this problem. They enforce 50% sparsity, while the rate matrix is about 90% sparse with its own natural block structure.
On the biology side, the castor bean aquaporin study, the wheat SBP-box study, and the bdelloid alpha-tubulin study supply the target trees. They document tandem, segmental, and whole-genome duplicates with recent splits, and they document functional sites, such as the aquaporin selectivity filter, where paired-residue models are natural. These studies relied on standard maximum-likelihood tree building and did not use rich multi-site models.
Research Program
We will first derive the block structure for three model classes. The amino-acid pair model yields two block-diagonal terms of twenty 20×20 blocks. The 61-state codon model yields three terms with blocks of at most four states, after removing stop codons, and non-synonymous rate scaling changes only the values within the blocks. The 3,721-state codon-pair model yields two terms of 61×61 blocks, which fill Tensor Core tiles well.
One risk must be measured before anything else. Some pair models allow simultaneous double substitutions, which fall outside the blocks. We will quantify the fraction of rate mass on double changes in fitted pair matrices. If that fraction is not negligible, we will handle it as a separate sparse or low-rank remainder term and report its cost honestly.
We will then implement a GPU kernel that treats the likelihood vectors for all alignment columns and rate categories as a matrix. Each block application therefore becomes a batched GEMM with small inner dimensions and a large column dimension, which is the shape where the BEAGLE paper saw speedups saturate at around 1,024 columns. Each branch chooses between uniformization and on-the-fly eigendecomposition according to a measured cost crossover in $\lambda t$. This hybrid is part of the method, because long branches would otherwise erase the advantage.
Baselines
The do-nothing reference is CPU likelihood evaluation with dense precomputed transition matrices, as used in the BEAGLE study's CPU comparison.
The strongest existing method is BEAGLE-style GPU evaluation with a dense $P(t)$ precomputed for every branch and rate category, as in Many-core algorithms for high-dimensional gradients on phylogenetic trees. Its reported figure is an "over 128-fold speedup" over CPU for 61-state codon models on the Dengue, carnivore, and yeast datasets. There is no reported result found on Lacuna for GPU tree likelihood under 400-state pair models, so we will establish that baseline ourselves. We will run it on the same GPU, at the same precision, on the same trees, with the same traversal code, changing only the transition step. Beating it means lower time per likelihood-plus-gradient evaluation and lower peak memory at matched accuracy. For 61 states, we expect at best parity with this baseline.
A second strong competitor applies the eigendecomposition on the fly, computing $V e^{\Lambda t} V^{-1} v$ from the matrix's eigenvectors $V$ and eigenvalues $\Lambda$. It also avoids storing a matrix per branch. We will give it the same batched-GEMM kernel quality.
A generic-sparse baseline runs the identical uniformization series through cuSPARSE. A reordering ablation runs the same series with SMaT-style Jaccard reordering in place of our analytic permutation. That ablation isolates the key ingredient, since it tests whether biological structure beats structure discovered after the fact.
A truncation ablation compares results at fixed $K$ against exact evaluation, to show that accuracy is not being traded for speed.
Why not just…?
Why not just use dense GPU kernels, as BEAGLE does? For 61 states this is a real threat, and we expect dense kernels to match or beat us there, because the blocks are tiny. The argument rests on larger state spaces. At 400 or 3,721 states, per-branch matrices cost $S^2$ memory each across thousands of branches and rate categories, and the BEAGLE paper itself notes that large state spaces exhaust GPU memory. Our experiments sweep $S$ across 61, 400, and 3,721 to locate where, if anywhere, dense stops winning.
Why not just use eigendecomposition? This is the most serious alternative, because it also needs no per-branch storage. Its cost is two dense $S^2$ products per vector regardless of branch length. Uniformization costs about $K \cdot 16{,}000$ multiply-adds per vector for pairs, versus 320,000, so it wins only while $K$ stays below about 20. If gene family trees do not have most of their branches in that regime, the claim fails. The branch-length census described below settles this question directly, and the hybrid scheme ensures we never do worse than eigendecomposition.
Why not just call cuSPARSE or SMaT on the rate matrix? cuSPARSE is tuned for sparsity above 99% and loses to dense kernels at 90% (SMaT paper). SMaT's reordering might rediscover our blocks, which would make our contribution only a convenience. The reordering ablation tests exactly this, measuring both kernel time and how close Jaccard's tiles come to the analytic blocks.
Why not just use CherryML's cherry decomposition? It estimates rate matrices, not branch-level or topology quantities. Tests of selection on post-duplication branches, and tree search itself, require full traversals, as CherryML leaves open.
Proposed Experiments
The first decisive check is a branch-length census. We will reconstruct gene trees for the wheat SBP-box family (48 genes plus nine reference species), the castor bean aquaporin family (37 genes with Arabidopsis and poplar), and the rotifer alpha-tubulin family. We will compare their distribution of $\lambda t$ against the species-level Dengue (997 genomes), carnivore (62), and yeast (49) datasets from the BEAGLE study. The prediction is that a larger share of gene family branches falls below the measured crossover. If it does not, the application argument collapses.
Second, on Pfam and QMaker alignments with CherryML-style 400-state models, and on codon-pair extensions of the Dengue and yeast alignments, we will measure time per likelihood-plus-gradient evaluation, peak memory, and per-site log-likelihood error against all baselines. We will also measure effective samples per second in Hamiltonian Monte Carlo over branch lengths.
Third, as an end-to-end check, we will estimate lineage-specific ratios of non-synonymous to synonymous change on post-duplication branches of the wheat and aquaporin trees. The estimates must agree with exact evaluation to within Monte Carlo error. We will also run topology search with rearrangement moves, confirming that no reprocessing is incurred per move.
The idea is falsified if eigendecomposition or dense kernels match our speed at 400 or more states on gene family trees, or if SMaT's generic reordering recovers the same performance.
References
- Many-core algorithms for high-dimensional gradients on phylogenetic trees
- CherryML: scalable maximum likelihood estimation of phylogenetic models
- High Performance Unstructured SpMM Computation Using Tensor Cores
- Parameter efficient training of deep convolutional neural networks by dynamic sparse reparameterization
- Learning N: M Fine-grained Structured Sparse Neural Networks From Scratch
- Gene Structures, Evolution, Classification and Expression Profiles of the Aquaporin Gene Family in Castor Bean (Ricinus communis L.)
- Genome-wide identification, characterization, and expression patterns analysis of the SBP-box gene family in wheat (Triticum aestivum L.)
- Multiple functionally divergent and conserved copies of alpha tubulin in bdelloid rotifers