Skip to content
getcortexlabsPublic

About

ARM-first phylogenetic inference in Rust. Starting with a fast likelihood kernel for morphological data.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Rove logo

Rove

Explore evolutionary paths.

Website · GitHub

Rove is an ARM-first phylogenetic inference project written in Rust, starting with a likelihood kernel for morphological data. The name comes from exploring, wandering, and discovering paths.

The crate computes tree likelihoods and samples trees under partitioned morphological models without depending on BEAST. Broader model support remains future work. BEAST is a reference for validation and benchmarking. Optional BEAST 2 and BEAGLE integration remains a possible compatibility path.

Status

Early. The likelihood core with its direct Mk path and a NEON kernel for it, Mkv and Mkparsinf conditioning, the morphological NEXUS reader, pattern compression, numerical tests and a standalone binary and multistate sampler are implemented. Ordered characters can share an analysis with unordered characters under Mk or Mkv; ordered Mkparsinf is not yet supported. Posterior predictive checks simulate matrices from completed runs and report paired morphology statistics through rove predict. The supplied reference model runs with four gamma categories and a lognormal relaxed clock. Posterior summaries and clade frequencies agree with BEAST 2.7.8 under predeclared criteria in six constructed 20-taxon cases. Optional integrations remain pending. Work is tracked in the issues.

Native Mac preview

Download the latest release: a signed and notarized disk image for Apple silicon Macs on macOS 14 or newer.

The first SwiftUI/AppKit workspace imports matrices through Rust, displays their characters and runs analyses with live progress and cancellation. It uses a glass sidebar, a fossil explorer and the Cortex Labs typography. Settings supports English, Brazilian Portuguese and preferences for reduced motion and transparency. The native beta verifies invited email addresses and offers a separate confirmed waiting list. A first-run tour introduces the workflow; Help keeps the tour and versioned release notes available. Research files stay on the Mac.

The native Rove workspace

scripts/build-macos.sh
open build/macos/Rove.app

The app targets macOS 14+ on Apple silicon. Each release attaches a disk image signed with a Developer ID certificate and notarized by Apple. Building requires Xcode 26.3 or newer and Rust; scripts/package-macos.sh produces the disk image. Review the model and explicit group constraints, start the bundled Rust engine, and inspect trace and tree files. Choose an optional outgroup without removing any terminals; review the applied groups before starting. Saved setups preserve that choice and can be reopened after their matrix fingerprint is checked. History keeps previous runs accessible across launches, with their settings, outcomes and output files, and can prepare a new run from a saved configuration. Completed runs can produce an annotated MCC tree for FigTree, with explicit burn-in and a choice of common ancestor or sampled heights. Open saved summaries in the native tree explorer to inspect nodes, search taxa, rotate or collapse clades and export an SVG figure. Original samples stay unchanged. Completion and node support do not establish convergence. Pause a run and resume it from History, including independent-chain groups. Periodic checkpoints also allow recovery after an interruption, using the same executable, matrix and settings. Diagnostics show recorded parameters, trace plots, ESS and equal-tailed intervals with an adjustable burn-in; calculations stay in Rust. A built-in Mac benchmark measures a fixed synthetic workload offline, keeps previous results and offers optional sharing with Cortex Labs. See the Mac guide and build notes.

People

Rove began with conversations between Rafael Augusto and Thiago J. Silva, the biologist whose questions about phylogenetic analysis set the project in motion. Thiago works alongside Rafael on the project, bringing the biological perspective, testing analyses and discussing what the results mean.

Why

  • Small state spaces and short morphological alignments are worth measuring as their own workload, including the cost of setup and partial updates.
  • Mk has a closed form, P(t) = e*I + (1-e)*pi, which permits an O(k) child update per pattern instead of a full O(k^2) matrix multiplication. Rove's Mk core prunes with it directly.
  • ARM-specific vectorisation and reuse of repeated calculations are candidate optimisations. Their value needs to be established with matched benchmarks.

The first BEAST 2.7.8 reference experiment records the exact model, runtime, sampling diagnostics, and fixed numerical states for a selected 20 x 50 dataset. It used BEAST's Java likelihood core. The expanded benchmark adds 20-, 90- and 500-taxon full-model runs and direct BEAST/BEAGLE kernel comparisons. Runtime and sampling quality are reported separately; shorter wall time does not establish convergence. The larger runs in that short study did not meet the convergence criteria.

The later independent-chain study records a first sustained diagnostic pass at 18M steps per chain for the 90-taxon Mk case. The 500-taxon Mkv case does not meet the criteria within its 5M-per-chain cap. A sampler profile measures phase occupancy on both workloads, including separate continuations from the terminal states. These studies do not time a BEAST comparison.

The Rust baseline on Apple M4 Max measures 11 workloads, separating setup, full evaluations, partial updates and proposal bookkeeping. It includes raw samples and the variation between runs. The direct Mk comparison measures both pruning paths in the same processes: the matrix path took 1.25 times as long as the closed form for a full evaluation of the reference dataset, and 2.66 times as long with eight states. The NEON comparison measures both backends the same way: the portable code took 1.48 times as long as the NEON kernel for a full evaluation of the reference dataset, and sampler runs with the portable code took 1.08 to 1.11 times as long as with NEON.

With the Mkv correction, Rove reproduces the likelihood of both archived BEAST states for the reference dataset, pattern by pattern.

Design

  • Pattern-major layout: one contiguous array per state per rate category, so the inner loop vectorises across site patterns, not states. Works for k=2 as well as k=61.
  • Model-aware fast paths. Mk prunes through its closed form; other models can pass full transition matrices.
  • NEON first, AVX2 second. On aarch64 a NEON kernel runs the Mk node update; the portable code runs everywhere else, is its reference and gives the same results. There is no AVX2 path yet.
  • One crate today. Optional BEAGLE C ABI and BEAST 2 JNI adapters are planned; neither is required by the Rust core.

Non-goals

Competing with BEAGLE's CUDA backend on large nucleotide alignments. Use the GPU for that.

Fixtures

fixtures/synthetic/control_20x50.nex is a positive control: 20 taxa, 50 binary characters, no homoplasy, no missing data, known tree. tools/synth_matrix.py regenerates it and produces degraded variants. See fixtures/synthetic/README.md.

The separately supplied reference dataset includes its BEAST 2 XML and provenance. Do not substitute one fixture for the other when reproducing a result.

Independent chains now run in parallel with rove sample --chains 2 or --chains 4. The native app offers 1 to 16 chains, custom sampling plans, progress per chain, saved group history, R-hat, per-chain ESS and clade-frequency comparisons. Each chain keeps its own trace and tree files. Optional scalar diagnostic stopping is off by default; it does not certify topology convergence. See the sampler guide.

Roadmap

  1. Establish the scalar core, tests, CI and BEAST reference. Done.
  2. Read morphological NEXUS and compress observed patterns. Done.
  3. Record the Rust kernel baseline and add the Mkv correction. Done.
  4. Add direct Mk pruning, measuring the change. Done.
  5. Build a minimal standalone MCMC. Done.
  6. Add NEON where profiles of complete runs show kernel time. Done.
  7. Add the relaxed-clock reference model and check its components. Done.
  8. Validate complete inference on known matrices. Done for six 20-taxon cases.
  9. Evaluate relaxed-clock proposals. Done; classical defaults retained.
  10. Run independent chains in parallel and compare them. Done.
  11. Add checkpoints and resume in the engine and native app. Done.
  12. Rescale by powers of two. Done.
  13. Partition characters by number of states and condition on parsimony-informative characters. Done, including ordered Mk and Mkv.
  14. Add posterior predictive simulation and morphology checks. Done in the CLI and native app.
  15. Add fossil tip dating with fixed or estimated FBD process parameters. Done in the CLI and native app; sampled ancestors remain future work. rove marginal estimates marginal likelihoods for model comparison (report).
  16. Evaluate subtree repeats. Done; experimental and off by default.
  17. Consider optional BEAST 2 JNI and BEAGLE C ABI adapters.

Sampling trees

Fossil tip dating is available with --dating settings.json, including fixed ages, age intervals and an explicit clock in time units. See the dating guide for fixed/estimated process choices, output conventions and validation.

cargo run --release --bin rove -- sample fixtures/reference/20x50/matrix.nex \
  --output runs/seed-1 --seed 1 --steps 10000000 --sample-every 1000 \
  --monophyly T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19

The sampler supports binary and multistate characters under partitioned Mk, Mkv or Mkparsinf, a strict clock with rate 1 and the birth–death tree prior, with monophyly constraints. Add --model reference for the supplied XML's four gamma categories and explicit lognormal relaxed clock. Partitions share that tree, clock and gamma shape. Use --conditioning informative only for matrices collected with parsimony-uninformative characters excluded; see character selection. Automatic state-count partitioning is the default; --partitioning declared uses the full declared alphabet. See the partition rules and multistate fixed-state checks. The partition benchmark records binary regression timings and a short 500 × 759 functionality check. Its model guide records every parameter, the numerical checks and the differences from ORC's sampling proposals. The sampling guide describes the model, the output files and the checks. With the strict-clock model, the same moves and fixed steps as BEAST 2.7.8, its posterior means and clade frequencies on the reference matrix met criteria fixed before the runs (report). The full-model comparison covers the supplied matrix, a separate known-tree control and three degradation cases. It records concordance, convergence, runtime and ESS per second with the original ORC proposals in BEAST and the current Rove moves.

The joint-proposal study evaluates optional coupled height/rate and sigma/rate moves against that baseline. All six cases pass the scientific criteria. The combined schedule improves the aggregate posterior/sigma ESS-per-second score, but regressions in gamma shape and Mkv birth–death density keep it opt-in. The default is unchanged; the report includes every parameter, uncertainty intervals and reproduction commands.

Reading a matrix

cargo run --release --example read_nexus -- fixtures/reference/20x50/matrix.nex

The reference matrix produces 23 observed patterns with a total weight of 50. The NEXUS guide defines the supported syntax, gap policy, uncertainty and polymorphism handling, and partition-aware compression.

Website

The documentation site at rove.getcortexlabs.com uses VitePress, in English, Portuguese, Spanish and Chinese. It documents what the crate does today; planned work is on its roadmap page.

npm ci
npm run docs:dev

Build with npm run docs:build; preview the build with npm run docs:preview.

Contributing

New CLI analysis features must include native controls in the same PR. See Contributing and the native capability map. Signed in-app updates use Sparkle; provisioning and the first manual upgrade are covered in the release procedure.

License

MIT or Apache-2.0, at your option.

About

ARM-first phylogenetic inference in Rust. Starting with a fast likelihood kernel for morphological data.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages