SelB-k-NN: A Mini-Batch K-Nearest Neighbors Algorithm on AI Processors

被引:0
|
作者
Tang, Yifeng [1 ]
Wang, Cho-li [1 ]
机构
[1] Univ Hong Kong, Dept Comp Sci, Hong Kong, Peoples R China
关键词
AI processors; k-NN algorithm; AI processor optimization;
D O I
10.1109/IPDPS54959.2023.00088
中图分类号
TP3 [计算技术、计算机技术];
学科分类号
0812 ;
摘要
The popularity of Artificial Intelligence (AI) motivates novel domain-specific hardware named AI processors. With a design trade-off, the AI processors feature incredible computation power for matrix multiplications and activations, while some leave other operations less powerful, e.g., scalar operations and vectorized comparisons & selections. For k-nearest neighbors (k-NN) algorithm, consisting of distance computation phase and k-selection phase, while the former is naturally accelerated, the previous efficient k-selection becomes problematic. Moreover, limited memory forces k-NN to adopt a mini-batch manner with tiling technique. As the distance computation's results are the kselection's inputs, the former's tiling shape determines that of the latter. Since the two phases execute on separate hardware units requiring different performance analyses, whether the former's tiling strategies benefit the latter and entire k-NN is doubtful. To address the new challenges brought by the AI processors, this paper proposes SelB-k-NN (Selection-Bitonic-k-NN), a minibatch algorithm inspired by selection sort and bitonic k-selection. SelB-k-NN avoids the expansion of the weakly-supported operations on the huge scale of datasets. To apply SelB-k-NN to various AI processors, we propose two algorithms to reduce the hardware support requirements. Since the matrix multiplication operates data with the specifically-designed memory hierarchy which kselection does not share, the tiling shape of the former cannot guarantee the best execution of the latter and vice versa. By quantifying the runtime workload variations of k-selection, we formulate an optimization problem to search for the optimal tiling shapes of both phases with an offline pruning method, which reduces the search space in the preprocessing stage. Evaluations show that on Huawei Ascend 310 AI processor, SelB-k-NN achieves 2.01x speedup of the bitonic k-selection, 23.93x of the heap approach, 78.52x of the CPU approach. For mini-batch SelB-k-NN, the optimal tiling shapes for two phases respectively achieve 1.48x acceleration compared with the matrix multiplication tiling shapes and 1.14x with the k-selection tiling shapes, with 72.80% of the search space pruned.
引用
收藏
页码:831 / 841
页数:11
相关论文
共 50 条
  • [31] Exploring Target Identification for Drug Design with K-Nearest Neighbors' Algorithm
    Jimenes-Vargas, Karina
    Perez-Castillo, Yunierkis
    Tejera, Eduardo
    Munteanu, Cristian R.
    ARTIFICIAL INTELLIGENCE AND SOFT COMPUTING, ICAISC 2023, PT II, 2023, 14126 : 219 - 227
  • [32] A novel ranked k-nearest neighbors algorithm for missing data imputation
    Khan, Yasir
    Shah, Said Farooq
    Asim, Syed Muhammad
    JOURNAL OF APPLIED STATISTICS, 2024,
  • [33] An efficient clustering algorithm based on the k-nearest neighbors with an indexing ratio
    Qaddoura, Raneem
    Faris, Hossam
    Aljarah, Ibrahim
    INTERNATIONAL JOURNAL OF MACHINE LEARNING AND CYBERNETICS, 2020, 11 (03) : 675 - 714
  • [34] Soft Inference as a Voting Mechanism in k-Nearest Neighbors Clustering Algorithm
    Bury, Tomasz
    Kacprzak, Aleksandra
    Zerdzinski, Piotr
    INFORMATION AND SOFTWARE TECHNOLOGIES, ICIST 2023, 2024, 1979 : 309 - 318
  • [35] PANENE: A Progressive Algorithm for Indexing and Querying Approximate k-Nearest Neighbors
    Jo, Jaemin
    Seo, Jinwook
    Fekete, Jean-Daniel
    IEEE TRANSACTIONS ON VISUALIZATION AND COMPUTER GRAPHICS, 2020, 26 (02) : 1347 - 1360
  • [36] A quantum k-nearest neighbors algorithm based on the Euclidean distance estimation
    Zardini, Enrico
    Blanzieri, Enrico
    Pastorello, Davide
    QUANTUM MACHINE INTELLIGENCE, 2024, 6 (01)
  • [37] Estimation of Missing Values Using a Weighted K-Nearest Neighbors Algorithm
    Ling, Wang
    Mei, Fu Dong
    2009 INTERNATIONAL CONFERENCE ON ENVIRONMENTAL SCIENCE AND INFORMATION APPLICATION TECHNOLOGY, VOL III, PROCEEDINGS,, 2009, : 660 - 663
  • [38] Enhancing the Irish NFI using k-nearest neighbors and a genetic algorithm
    McInerney, Daniel
    Barrett, Frank
    McRoberts, Ronald E.
    Tomppo, Erkki
    CANADIAN JOURNAL OF FOREST RESEARCH, 2018, 48 (12) : 1482 - 1494
  • [39] An adaptive k-nearest neighbors clustering algorithm for complex distribution dataset
    Zhang, Yan
    Jia, Yan
    Huang, Xiaobin
    Zhou, Bin
    Gu, Jian
    ADVANCED INTELLIGENT COMPUTING THEORIES AND APPLICATIONS, PROCEEDINGS: WITH ASPECTS OF ARTIFICIAL INTELLIGENCE, 2007, 4682 : 398 - 407
  • [40] Introduction to machine learning: k-nearest neighbors
    Zhang, Zhongheng
    ANNALS OF TRANSLATIONAL MEDICINE, 2016, 4 (11)