TLDR: This research paper evaluates FAISS and ScaNN, two state-of-the-art AI-powered vector search libraries, for their ability to perform fast and scalable similarity searches on gene embeddings. It compares their performance against traditional alignment-based methods like MMseqs2 using metagenomic data. The study finds that embedding-based methods, particularly FAISS, significantly outperform traditional tools in both speed and accuracy for short gene fragments, offering a promising alternative for large-scale genomic analysis and novelty detection.
The world of genetics is experiencing an unprecedented surge in DNA sequencing data. This explosion of information, while promising for scientific discovery, presents a significant challenge: how do we efficiently search and compare these vast amounts of genetic material? Traditional methods, like BLAST, which rely on aligning sequences, are struggling to keep up. They are computationally expensive and less effective when dealing with sequences that are very different from each other.
The Rise of Gene Embeddings
Inspired by advancements in natural language processing (NLP), a new approach is emerging: gene embeddings. Just as NLP models learn to represent words as dense vectors that capture their meaning, genomic language models are now learning to transform raw DNA sequences into similar ’embeddings’. These numerical representations capture deeper structural, functional, and evolutionary patterns, allowing for comparisons that go beyond simple sequence alignment. This means we can find similarities even between highly divergent sequences, which is crucial for detecting novel genes or understanding complex biological systems.
FAISS and ScaNN: Powering the Search
To make these embeddings truly useful for large-scale tasks like identifying new genes or classifying organisms, we need fast and scalable search infrastructure. This is where Approximate Nearest Neighbor (ANN) methods come into play. This research paper systematically evaluates two leading state-of-the-art vector search libraries: FAISS (developed by Facebook AI Research) and ScaNN (developed by Google Research).
FAISS offers a variety of indexing structures and supports both CPU and GPU processing, making it highly customizable. It has been successfully used in diverse fields, including image retrieval and immune receptor clustering. ScaNN introduces advanced quantization techniques to improve precision and recall at scale, integrating well with TensorFlow pipelines and supporting high-speed computation. Both systems are designed for efficient nearest-neighbor retrieval across massive databases of embeddings.
Benchmarking Performance in Genomics
The study benchmarked FAISS and ScaNN using gene embeddings derived from microbial gene fragments, specifically from the Scorpio-Gene-Taxa dataset. They used the MetaBERTA-BigBird model to generate 1,024-dimensional embeddings for both ‘in-domain’ (species seen during training) and ‘out-of-domain’ (phyla not seen during training) query sets. The goal was to assess their scalability and effectiveness for fast similarity search, with a focus on how different parameter settings impact performance.
Key Findings: Accuracy, Speed, and Trade-offs
The research revealed important trade-offs between accuracy and performance for both tools:
- FAISS: Configurations that used PCA (dimensionality reduction) combined with a ‘Flat’ index (brute-force exact search) achieved the highest accuracy. However, for the fastest search times, combinations involving IVF (Inverted File Index) and PQ (Product Quantization) were superior, though they came at the cost of higher indexing time and some accuracy reduction. For applications where accuracy is paramount, PCA-enhanced Flat indexing is preferred. For rapid, large-scale retrieval where some accuracy loss is acceptable, OPQ or PQ combined with IVF proved efficient.
- ScaNN: Brute-force search with full-precision vectors yielded the highest accuracy but was significantly slower. Configurations combining partitioning, asymmetric hashing, and reordering offered the best balance of speed and acceptable accuracy, achieving much faster query times. The study found that tuning ScaNN’s parameters was most effective for optimizing runtime and memory efficiency rather than significantly improving accuracy.
Outperforming Traditional Methods
Crucially, the study also compared these embedding-based methods to MMseqs2, a widely used traditional alignment-based tool. For short 400 bp gene fragments, both FAISS and ScaNN consistently and significantly outperformed MMseqs2 in terms of both speed and accuracy. This highlights the growing advantage of learned representations in metagenomic applications, especially for detecting subtle patterns or distant relationships that alignment-based methods might miss.
Also Read:
- Unpacking DNA Language: How Encoding Choices Shape Gene Sequence Models
- Optimizing Text Embeddings for Efficiency with Feature-Specific Thresholds
Conclusion and Future Directions
Overall, the research concludes that FAISS generally outperformed ScaNN across various metrics, including indexing speed, query latency, retrieval accuracy, and its ability to detect novel sequences. FAISS’s distance distributions were also found to be more interpretable for novelty detection. While ScaNN offered faster inference in some setups, its overall accuracy and sensitivity to taxonomic novelty were more limited. The study was conducted on CPUs, and future work will explore the impact of GPU acceleration on performance at larger scales. This work underscores the potential of embedding-based retrieval frameworks like FAISS for scalable and biologically meaningful similarity search in vast genomic datasets. You can read the full paper here.


