Automatic differentiation is no panacea for phylogenetic gradient computation

Mathieu Fourment, Christiaan J. Swanepoel, Jared G. Galloway, Xiang Ji, Karthik Gangavarapu +2 more
11/3/2022
10 citations
q-bio.PE

Official code: 4ment/gradient-benchmark (4 stars, Python, PyTorch, last commit 2023-01-24).

Abstract

Gradients of probabilistic model likelihoods with respect to their parameters are essential for modern computational statistics and machine learning. These calculations are readily available for arbitrary models via automatic differentiation implemented in general-purpose machine-learning libraries such as TensorFlow and PyTorch.

Show full abstract

Although these libraries are highly optimized, it is not clear if their general-purpose nature will limit their algorithmic complexity or implementation speed for the phylogenetic case compared to phylogenetics-specific code. In this paper, we compare six gradient implementations of the phylogenetic likelihood functions, in isolation and also as part of a variational inference procedure. We find that although automatic differentiation can scale approximately linearly in tree size, it is much slower than the carefully-implemented gradient calculation for tree likelihood and ratio transformation operations. We conclude that a mixed approach combining phylogenetic libraries with machine learning libraries will provide the optimal combination of speed and model flexibility moving forward.

View on arXivView PDF

Code Implementations(1)

PyTorch

automatic/analytical differentiation benchmark

42Python, NextflowAug 31, 20203 years ago
bayesian-inferencegradient-computationphylogeneticsphylostanpytorch+4 more

Similar Papers

Cite this paper

@article{fourment2022automatic,
  title  = {Automatic differentiation is no panacea for phylogenetic gradient computation},
  author = {Mathieu Fourment and Christiaan J. Swanepoel and Jared G. Galloway and Xiang Ji and Karthik Gangavarapu and Marc A. Suchard and Frederick A. Matsen},
  year   = {2022},
  eprint = {2211.02168},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2211.02168}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2211.02168.svg)](https://codeofpaper.com/paper/2211.02168)

Discussion