Neural Embeddings for kNN Search in Biological Sequence


  • Zhihao Chang The State Key Laboratory of Blockchain and Data Security, Zhejiang University
  • Linzhu Yu Zhejiang University
  • Yanchao Xu Zhejiang University
  • Wentao Hu Zhejiang Police college



APP: Natural Sciences, ML: Representation Learning


Biological sequence nearest neighbor search plays a fundamental role in bioinformatics. To alleviate the pain of quadratic complexity for conventional distance computation, neural distance embeddings, which project sequences into geometric space, have been recognized as a promising paradigm. To maintain the distance order between sequences, these models all deploy triplet loss and use intuitive methods to select a subset of triplets for training from a vast selection space. However, we observed that such training often enables models to distinguish only a fraction of distance orders, leaving others unrecognized. Moreover, naively selecting more triplets for training under the state-of-the-art network not only adds costs but also hampers model performance. In this paper, we introduce Bio-kNN: a kNN search framework for biological sequences. It includes a systematic triplet selection method and a multi-head network, enhancing the discernment of all distance orders without increasing training expenses. Initially, we propose a clustering-based approach to partition all triplets into several clusters with similar properties, and then select triplets from these clusters using an innovative strategy. Meanwhile, we noticed that simultaneously training different types of triplets in the same network cannot achieve the expected performance, thus we propose a multi-head network to tackle this. Our network employs a convolutional neural network(CNN) to extract local features shared by all clusters, and then learns a multi-layer perception(MLP) head for each cluster separately. Besides, we treat CNN as a special head, thereby integrating crucial local features which are neglected in previous models into our model for similarity recognition. Extensive experiments show that our Bio-kNN significantly outperforms the state-of-the-art methods on two large-scale datasets without increasing the training cost.




How to Cite

Chang, Z., Yu, L., Xu, Y., & Hu, W. (2024). Neural Embeddings for kNN Search in Biological Sequence. Proceedings of the AAAI Conference on Artificial Intelligence, 38(1), 38-45.



AAAI Technical Track on Application Domains