HyphAeon: Attention on Evolution Across Deep Time Transforms Comparative Genomics
Detecting Darwinian natural selection is fundamental to evolutionary biology and functional genomics, yet standard methods based on phylogenetic models that estimate the ratio of non-synonymous to synonymous substitution rates (dN/dS) fail to scale with modern genomic volumes. Fitting continuous-time Markov substitution matrices across dense trees with hundreds of species requires extensive compute, forcing comparative genomics to rely on aggressive taxon subsampling or static whole-tree summaries that dilute transient adaptive bursts. Here we present HyphAeon, a lightweight (~1.91M parameter backbone, 2.46M across the full multi-task suite) phylogeny-informed foundation transformer trained to amortize the detection of episodic diversifying selection across 742-species mammalian coding alignments (17,186 genes, 9.77 x 10^6 codons). HyphAeon approaches the discriminative accuracy of numerical maximum-likelihood selection tests (MEME) across episodic burst regimes (ROC-AUC up to 0.942, mean 0.659; empirical Precision-Recall lift up to 25.8x, mean 7.7x; rank concordance up to rho = 0.983) while executing >1,000x faster per locus (averaging <1 ms per site across genome-wide scans) and >10,000x faster at proteome scale, generalizing outside its mammalian training distribution without retraining. Beyond accelerating classical tests, embedding molecular evolution into a differentiable geometric latent space enables analytical capabilities inaccessible to static dN/dS models: (1) targeted alignment artifact correction via counterfactual attribution; (2) macromolecular contact recovery and multi-site epistatic sectors (CESI); (3) directional phenotype-to-genotype attribution in lineage space (PARS); and (4) continuous temporal surveillance regression that tracks positive sweep velocities across longitudinal cohorts (evaluated across 12,167 timestamped genomes and benchmarked against external frequencies from >9.34 million genomes), rescuing adaptive substitutions obscured by post-fixation dilution. By bridging statistical phylogenetics with geometric representation learning, HyphAeon establishes comparative genomics as an interactive, high-throughput computational framework for evolutionary discovery.