人工智能时代,向量搜索算法已经成为了大数据信息检索的核心算法,广泛应用于搜索引擎、推荐系统等场景。在不同的向量搜索算法中,近邻图向量搜索算法是目前最高效的一种向量搜索算法,引起了学术界和工业界的共同关注。为了进一步提高性能,近邻图算法常利用图形处理器(Graphics Processing Unit, GPU)加速搜索过程,但随着大规模场景如辅助大模型检索增强场景的出现,传统的基于图的近似最近邻搜索算法由于生成的图索引过大难以放入有限的GPU显存,最优的基于图的 GPU 最近邻搜索算法(Graph-based GPU Nearest Neighbor Search, GGNN)由于加载图索引异步性差导致搜索延迟高,阻碍了GPU最近邻搜索算法的应用。为此,基于标量压缩和异步加载机制,提出一种适用于大规模场景的高效GPU加速近邻搜索算法GGNN++。首先,针对向量使用低开销的标量压缩编码替代近邻图中的原始高维向量,然后通过异步加载方式有效提高GPU带宽利用率,从而提升搜索效率、降低显存开销。实验表明,相比于当前最优的GGNN算法,该算法在大规模数据集上达到0.9召回率时的延迟从248 μs降低到了81 μs,显存占用降低了15%。
In the era of artificial intelligence, vector search algorithms have become fundamental techniques in domains such as recommendation systems and search engines. Among various vector search algorithms, the approximate nearest neighbor graph search algorithm is currently the most efficient and has attracted significant attention from both academia and industry. To further enhance performance, the nearest neighbor graph algorithms often leverage Graphics Processing Units (GPUs) for acceleration. However, with the emergence of large-scale applications such as enhanced retrieval with large language models, the traditional search on graph algorithm face challenges due to generating graph indices that are too large to fit into the limited GPU memory. The optimal algorithm GGNN (Graph-based GPU Nearest Neighbor Search), on the other hand, suffers from high search latency due to poor asynchronous loading of graph indices, thereby impeding the practical application of GPU nearest neighbor search algorithm. To address these problems, this paper proposes GGNN++, an efficient solution based on scalar compression and asynchronous loading techniques, designed for large-scale scenarios. First, it uses low-overhead scalar compression vector encoding to replace the original high-dimensional vectors in the neighbor graph, and then employs asynchronous loading techniques to improve GPU bandwidth utilization. This approach thereby greatly improves the search efficiency on the neighbor graph and greatly reduces the footprint of GPU memory. Experimental results demonstrate that, compared to the current optimal solution GGNN, it reduces latency from 248 μs to 81 μs at 0.9 recall in large-scale datasets, and decreases GPU memory usage by 15%.
[1]CHEN Q, ZHAO B, WANG H, et al. SPANN: Highly-efficient billion-scale approximate nearest neighborhood search[C]//Advances in Neural Information Processing Systems, December 6-14, 2021.Online.Curran Associates, 2021: 5199-5212.
[2]DINH N T, LE T M, VAN T T. An Improvement Method of KD-Tree Using K-Means and K-NN for Semantic-Based Image Retrieval System[M]//Information Systems and Technologies. Cham: Springer, 2022.
[3]NARASIMHULU Y, SUTHAR A K, PASUNURI R, et al. CKD-Tree: An improved kd-tree construction algorithm[C]//Proceedings of the International Semantic Intelligence Conference 2021 (ISIC 2021). February 25-27, 2021. New Delhi, India. CEUR-WS.org, 2021: 211-218.
[4]JAFARI O, NAGARKAR P. Experimental analysis of locality sensitive hashing techniques for high-dimensional approximate nearest neighbor searches[C]//Databases Theory and Applications: ADC 2021. January 29-February 5, 2021. Dunedin, New Zealand. Cham: Springer, 2021: 62-73.
[5]ZHAO X, TIAN Y, HUANG K, et al. Towards efficient index construction and approximate nearest neighbor search in high-dimensional spaces[J]. Proceedings of the VLDB Endowment, 2023, 16(8): 1979-1991.
[6]NIU L S, XU Z, ZHAO L Y, et al. Residual vector product quantization for approximate nearest neighbor search[J]. Expert Systems with Applications, 2023, 232: 120832.
[7]PAPARRIZOS J, EDIAN I, LIU C W, et al. Fast adaptive similarity search through variance-aware quantization[C]//2022 IEEE 38th International Conference on Data Engineering (ICDE). May 9-12, 2022. Kuala Lumpur, Malaysia. IEEE, 2022: 2969-2983.
[8]FU C, XIANG C, WANG C X, et al. Fast approximate nearest neighbor search with the navigating spreading-out graph[J]. Proceedings of the VLDB Endowment, 2019, 12(5): 461-474.
[9]MALKOV Y A, YASHUNIN D A. Efficient and robust approximate nearest neighbor search using hierarchical navigable small world graphs[J]. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2020, 42(4): 824-836.
[10]FU C, WANG C X, CAI D. High dimensional similarity search with satellite system graph: Efficiency, scalability, and unindexed query compatibility[J]. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2022, 44(8): 4139-4150.
[11]WANG M Z, XU X L, YUE Q,et al. A comprehensive survey and experimental comparison of graph-based approximate nearest neighbor search[J]. Proceedings of the VLDB Endowment, 2021, 14(11): 1964-1978.
[12]ZHANG J J, LIU Z, HAN W H, et al. Uni-retriever: Towards learning the unified embedding based retriever in Bing sponsored search[C]//Proceedings of the 28th ACM SIGKDD Conference on Knowledge Discovery and Data Mining Washington DC USA August 14-18, 2022. Washington DC, USA. ACM, 2022: 4493-4501.
[13]WANG J G, YI X M, GUO R T, et al. Milvus: A purpose-built vector data management system[C]//Proceedings of the 2021 International Conference on Management of Data. June 20-25, 2021. Online. ACM, 2021: 2614-2627.
[14]ZHAO W J, TAN S L, LI P. SONG: Approximate nearest neighbor search on GPU[C]//2020 IEEE 36th International Conference on Data Engineering (ICDE). April 20-24, 2020. Dallas, TX, USA. IEEE, 2020: 1033-1044.
[15]YU Y H, WEN D, ZHANG Y, et al. GPU-accelerated proximity graph approximate nearest neighbor search and construction[C]//2022 IEEE 38th International Conference on Data Engineering (ICDE). May 9-12, 2022. Kuala Lumpur, Malaysia. IEEE, 2022: 552-564.
[16]GROH F, RUPPERT L, WIESCHOLLEK P, et al. GGNN: Graph-based GPU nearest neighbor search[J]. IEEE Transactions on Big Data, 2023, 9(1): 267-279.
[17]FRANK W, YVONNE L, MAGGIE X. Datasets for approximate nearest neighbor search[EB/OL]. (2010-07-01)[2023-10-08]. http://corpus-texmex.irisa.fr/.
[18]DONG W, MOSES C, LI K. Efficient k-nearest neighbor graph construction for generic similarity measures[C]//Proceedings of the 20th International Conference on World Wide Web. March 28-April 1, 2011. Hyderabad, India. ACM, 2011: 577-586.
[19]BOLLOBÁS B. The evolution of random graphs[J]. Transactions of the American Mathematical Society, 1984, 286(1): 257-274.
[20]JÉGOU H, DOUZE M, Schmid C. Product quantization for nearest neighbor search[J]. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2011, 33(1): 117-128.
[21]YANDEX A B, LEMPITSKY V. Efficient indexing of billion-scale datasets of deep descriptors[C]//2016 IEEE Conference on Computer Vision and Pattern Recognition(CVPR). June 27-30, 2016. Las Vegas, NV, USA. IEEE, 2016: 2055-2063.
[22]SZEGEDY C, LIU W, JIA Y Q, et al. Going deeper with convolutions[C]//2015 IEEE Conference on Computer Vision and Pattern Recognition(CVPR). June 7-12, 2015. Boston, MA, USA. IEEE, 2015: 1-9.
[23]DENG J, DONG W, SOCHER R, et al. ImageNet: A large-scale hierarchical image database[C]//2009 IEEE Conference on Computer Vision and Pattern Recognition. June 20-25,2009. Miami, FL. IEEE, 2009: 248-255.
[24]ZHANG H F, SONG X, XIONG C Y, et al. Generic intent representation in web search[C]//Proceedings of the 42nd International ACM SIGIR Conference on Research and Development in Information Retrieval.July 21-25, 2019, Paris, France. ACM, 2019: 65-74.
[25]LI W, ZHANG Y, SUN Y F, et al. Approximate nearest neighbor search on high dimensional data: experiments, analyses, and improvement[J]. IEEE Transactions on Knowledge and Data Engineering, 2020, 32(8): 1475-1488.