Abstract
Metagenomic studies have increasingly utilized sequencing technologies in order to analyze DNA fragments found in environmental samples. One important step in this analysis is the taxonomic classification of the DNA fragments. Conventional read classification methods require large databases and vast amounts of memory to run, with recent deep learning methods suffering from very large model sizes. We therefore aim to develop a more memory-efficient technique for taxonomic classification. A task of particular interest is abundance estimation in metagenomic samples. Current attempts rely on classifying single DNA reads independently from each other and are therefore agnostic to co-occurrence patterns between taxa. In this work, we also attempt to take these patterns into account. We develop a novel memory-efficient read classification technique, combining deep learning and locality-sensitive hashing. We show that this approach outperforms conventional mapping-based and other deep learning methods for single-read taxonomic classification when restricting all methods to a fixed memory footprint. Moreover, we formulate the task of abundance estimation as a Multiple Instance Learning (MIL) problem and we extend current deep learning architectures with two different types of permutation-invariant MIL pooling layers: a) deepsets and b) attention-based pooling. We illustrate that our architectures can exploit the co-occurrence of species in metagenomic read sets and outperform the single-read architectures in predicting the distribution over taxa at higher taxonomic ranks.
Introduction
Metagenomics involves sequencing DNA directly from environmental samples to identify organisms and their relative quantities. This field faces two primary technical hurdles. First, the "Memory Wall": conventional tools like Kraken 2 or Centrifuge require massive databases (tens of gigabytes) to map DNA reads. While deep learning models offer an alternative, they often suffer from "embedding bloat," where internal lookup tables for DNA sequences ($k$-mers) exceed standard GPU memory. Second, "Independence Bias": most methods classify DNA fragments independently, ignoring the biological reality that microbes exist in communities with predictable co-occurrence patterns.
Methods
To address these challenges, the authors introduce two primary innovations: memory-efficient embeddings and a Multiple Instance Learning (MIL) framework for abundance estimation.
Memory-Efficient Embeddings (LSH-EmbedPool)
To shrink model size, the framework utilizes Locality-Sensitive Hashing (LSH). Instead of assigning a unique vector to every possible DNA $k$-mer, LSH groups similar $k$-mers into the same "bucket." Since similar sequences often originate from related organisms, they can share embeddings without significant loss of biological information. The authors also developed Hash-EmbedPool, which employs multiple hash functions to create a weighted representation of a sequence.
Abundance Estimation via Multiple Instance Learning (MIL)
Rather than predicting labels for individual reads, the authors treat a set of reads as a "bag" in a Multiple Instance Learning (MIL) context. By using permutation-invariant pooling layers—specifically DeepSets and Attention-based pooling—the model aggregates information across thousands of reads simultaneously. This allows the architecture to capture community structures and directly predict the relative abundance distribution across various taxonomic ranks.
Experimental Setup and Datasets
The study utilized synthetic datasets to ensure ground-truth labels were available for rigorous evaluation:
- Source Material: 3,332 bacterial genomes from NCBI RefSeq, covering 1,862 distinct species.
- Training Set: 430 million error-free synthetic reads (151 bp).
- Evaluation Set: Over 5.2 million reads simulated with Illumina NovaSeq-type noise to mimic real-world sequencing errors.
- Benchmarks: Comparisons were made against industry standards (Kraken 2, Centrifuge) and deep learning baselines (GeNet, DeepMicrobes).
Key Results
- Superior Accuracy under Constraints: When restricted to a memory footprint of less than 600 MB, LSH-EmbedPool achieved 73.9% accuracy, significantly outperforming Kraken 2, which dropped to 37.1%–64.6% when its database was downsampled to a similar size.
- Massive Memory Savings: LSH-EmbedPool reduced model size by a factor of 29x compared to standard embedding methods while simultaneously improving accuracy.
- Enhanced Abundance Estimation: MIL-based models (GeNet + Deepset) outperformed single-read architectures at higher taxonomic ranks. For Phylum-level estimation, the MIL approach reduced error (measured by JS-divergence) by nearly 8x compared to the baseline GeNet.
Conclusion
META$^2$ demonstrates that similarity-based hashing (LSH) can effectively exploit redundancy in genetic code to overcome memory limitations. Furthermore, by treating metagenomic samples as collections of co-occurring entities through MIL, the model achieves more accurate community-level predictions. While the MIL approach currently excels at higher taxonomic ranks, future work will focus on improving resolution at the species level and incorporating uncertainty estimates via Gaussian processes.
Summary updated