Abstract
The gut microbiome plays a crucial role in human health, but machine learning applications in this field face significant challenges, including limited labeled data availability, high dimensionality, and batch effects across different cohorts. To address these limitations, we developed representation learning models for gut microbiome metagenomic data, drawing inspiration from foundation models approaches based on self-supervised and transfer learning principles. By leveraging a large collection of 85,364 metagenomic samples, we implemented multiple self-supervised learning methods, including masked autoencoders with varying masking rates and adapted single-cell RNA sequencing models (scVI and scGPT), to generate embeddings from bacterial abundance profiles. These learned representations demonstrated significant advantages over raw bacterial abundances in two key scenarios: first, when training predictive models with very limited labeled data, improving prediction performance for age (r = 0.14 vs. 0.06), BMI (r = 0.16 vs. 0.11), visceral fat mass (r = 0.25 vs. 0.18), and drug usage classification (PR-AUC = 0.81 vs. 0.73); and second, when generalizing predictions across different cohorts, consistently outperforming models based on raw abundances in cross-dataset evaluation. Our approach provides a valuable framework for leveraging self-supervised representation learning to overcome the data limitations inherent in microbiome research, potentially enabling more robust and generalizable machine learning applications in this field.
Introduction
Machine learning in microbiome research often encounters a "small data, big dimensions" paradox. While modern sequencing can identify thousands of microbial species, clinical studies frequently involve only a few hundred participants. This imbalance often leads to overfitting, where models memorize study-specific quirks rather than universal biological patterns. Furthermore, technical "batch effects" between different research centers make it difficult for models to generalize across global populations.
To address these challenges, we propose a "foundation model" approach for the gut microbiome. By using self-supervised learning (SSL) on a massive dataset of over 85,000 samples, we can create compressed data representations, or embeddings, that capture the essential ecological relationships of the microbiome while filtering out technical noise.
Methods
We utilized a collection of 85,364 metagenomic samples from diverse geographies to pre-train several model architectures:
- Masked Autoencoders (MAE): These models learn by reconstructing microbiome profiles where a portion of the species (e.g., 30%) has been hidden. This forces the model to understand how different bacteria coexist and compensate for one another.
- Cross-Domain Adaptation: We adapted models from the single-cell RNA sequencing field, specifically scVI and scGPT, leveraging the mathematical similarities between sparse transcriptomic and metagenomic data.
- Embeddings: The pre-trained models act as feature extractors, converting raw species counts into dense, 1024-dimensional vectors that serve as the input for downstream clinical prediction tasks.
Results
Performance on Large Datasets
When evaluated on large, well-phenotyped cohorts, the SSL-based embeddings consistently matched or slightly exceeded the performance of models trained on raw bacterial abundances. The MAE-30% model emerged as a robust choice across various clinical markers.
The Advantage in Data-Limited Settings
The most significant gains were observed in scenarios with very limited labeled data. In simulations using only 100 training samples, the SSL models dramatically outperformed the standard approach. For example, age prediction accuracy (Pearson correlation) improved from 0.06 using raw counts to 0.14 with scVI embeddings. Similarly, visceral fat mass prediction improved from 0.18 to 0.25 using the MAE-30% model.
Cross-Cohort Generalization
The learned embeddings also facilitated better generalization across different cohorts. By focusing on fundamental ecological patterns, the models became less sensitive to study-specific technical noise. In cross-dataset evaluations, the learned representations improved prediction accuracy in 82% of comparisons, with some instances showing improvements of over 80% compared to raw-abundance models.
Discussion
Our results demonstrate that pre-training on large-scale unlabeled data provides a powerful biological prior that is especially beneficial when labeled data is scarce. The success of architectures like scVI and scGPT suggests a deep mathematical synergy between different "omics" data types.
While these embeddings offer superior performance and robustness, they are less directly interpretable than raw species counts. Future research will focus on improving the explainability of these models. We have made our best-performing model (MAE-30%) publicly available to help researchers overcome the data limitations inherent in microbiome studies and build more reliable predictive tools.
Summary updated