NEAR: Neural Embeddings for Amino acid Relationships

Daniel R. Olson, Thomas Colligan, Daphne Demekas, Jack W. Roddy, Ken Youens‐Clark, Travis J. WheelerbioRxiv 2024

Abstract

Protein language models (PLMs) have recently demonstrated potential to supplant classical protein database search methods based on sequence alignment, but are slower than common alignment-based tools and appear to be prone to a high rate of false labeling. Here, we present NEAR, a method based on neural representation learning that is designed to improve both speed and accuracy of search for likely homologs in a large protein sequence database. NEAR’s ResNet embedding model is trained using contrastive learning guided by trusted sequence alignments. It computes per-residue embeddings for target and query protein sequences, and identifies alignment candidates with a pipeline consisting of residue-level k-NN search and a simple neighbor aggregation scheme. Tests on a benchmark consisting of trusted remote homologs and randomly shuffled decoy sequences reveal that NEAR substantially improves accuracy relative to state-of-the-art PLMs, with lower memory requirements and faster embedding and search speed. While these results suggest that the NEAR model may be useful for standalone homology detection with increased sensitivity over standard alignment-based methods, in this manuscript we focus on a more straightforward analysis of the model’s value as a high-speed pre-filter for sensitive annotation. In that context, NEAR is at least 5x faster than the pre-filter currently used in the widely-used profile hidden Markov model (pHMM) search tool HMMER3, and also outperforms the pre-filter used in our fast pHMM tool, nail.

Introduction

The "genomic data deluge" has created a critical bottleneck in bioinformatics. Rapid DNA sequencing has produced a vast number of protein sequences whose functions remain unknown. Traditional homology search tools, such as HMMER3, identify evolutionary relatives to infer function but face scaling challenges. HMMER3 employs a fast "pre-filter" (MSV) to discard ~98% of non-matching sequences, yet even this stage is becoming a bottleneck for terabase-scale databases.

While modern Protein Language Models (PLMs) like ESM2 offer promise in detecting distant homology, they are often computationally intensive and prone to high false-positive rates. NEAR (Neural Embeddings for Amino acid Relationships) addresses these challenges by introducing a high-speed, residue-level neural pre-filter that outperforms both classical tools and existing PLMs in speed and sensitivity.

Methods: The NEAR Architecture

NEAR utilizes a 1D Residual Convolutional Neural Network (ResNet) to generate high-dimensional embeddings for every amino acid in a protein sequence. Unlike global sequence embedding methods, NEAR focuses on residue-level relationships, mapping each residue into a 256-dimensional space.

The NEAR pipeline: HMMER-guided training of residue embeddings using a ResNet architecture.

The core innovation lies in Alignment-Guided Learning. The model is trained to replicate the behavior of trusted alignment tools like HMMER3. If HMMER determines that two residues from different proteins should align, NEAR is trained to minimize the distance between their corresponding embedding vectors. This contrastive approach ensures that the learned representation is optimized specifically for the task of sequence alignment.

Contrastive Training and Loss

The model is optimized using an N-pairs loss function. For a pair of aligned sequences, a vector product matrix $D$ is computed where $D_{ij} = \vec{a}_i \cdot \vec{b}_j$. The loss function $L$ encourages high similarity for aligned residues ($T_{ij}=1$) and low similarity otherwise.

Visualization of the loss matrix $L$ and its gradient with respect to the vector product matrix $D$.

By incorporating a receptive field through the ResNet architecture, each residue's embedding captures local sequence context. This allows the model to distinguish between identical amino acids located in different structural or evolutionary environments.

Experimental Setup

To evaluate NEAR, the authors used a subset of UniRef90 containing 1 million sequences. To ensure rigorous testing, sequences were clustered at 30% identity using UCLUST, preventing the model from simply memorizing training data.

A "decoy" strategy was employed to test specificity: false-positive candidates were generated by reversing real protein sequences. This preserves amino acid composition while destroying biological homology. "Ground truth" positives were defined by high-confidence alignments (E-value ≤ 10) generated by HMMER3’s phmmer.

Results

NEAR demonstrates significant improvements over state-of-the-art PLMs and traditional filters:

  • Superior Sensitivity: NEAR outperformed ProtTransT5, ESM2, and ProteinBERT in identifying true homologs across various E-value thresholds, showing a much lower false-positive rate on decoy sequences.
  • 10x Speedup: On a standard GPU (RTX 3080 Ti), NEAR processed queries approximately 10 times faster than HMMER3’s MSV filter.
  • Computational Efficiency: With 256-dimensional embeddings, NEAR requires significantly less memory than the 1024+ dimensional vectors typical of large PLMs, facilitating faster k-NN searches using libraries like FAISS.
  • Generalization: The model, though trained on 128-residue fragments, generalized effectively to sequences of at least 512 residues.

Discussion and Future Work

NEAR represents a shift from string-matching to vector-space search in protein bioinformatics. By expanding sequence data into high-dimensional embeddings, it leverages optimized k-NN search algorithms to achieve unprecedented speeds.

However, challenges remain for petabase-scale deployment. The current approach generates massive indices; future work will explore quantization and sparse representations to reduce the memory footprint. Additionally, while NEAR is a powerful pre-filter, it is intended to complement, not replace, full alignment pipelines that provide detailed biological context. Integrating NEAR into a seamless, end-to-end tool remains a primary goal for future development.

Summary updated

BibTeX
@misc{olson2024near,
  author = {Daniel R. Olson and Thomas Colligan and Daphne Demekas and Jack W. Roddy and Ken Youens‐Clark and Travis J. Wheeler},
  title = {{NEAR: Neural Embeddings for Amino acid Relationships}},
  year = {2024},
  doi = {10.1101/2024.01.25.577287},
  howpublished = {bioRxiv},
}
Figure