KRA: K-Nearest Neighbor Retrieval Augmented Model for Text Classification

被引:0
|
作者
Li, Jie [1 ]
Tang, Chang [1 ]
Lei, Zhechao [2 ]
Zhang, Yirui [1 ]
Li, Xuan [1 ]
Yu, Yanhua [1 ]
Pi, Renjie [1 ]
Hu, Linmei [3 ]
机构
[1] Beijing Univ Posts & Telecommun, Natl Pilot Software Engn Sch, Sch Comp Sci, Beijing 100876, Peoples R China
[2] Beijing Normal Univ, Sch Int Chinese Language Educ, Beijing 100875, Peoples R China
[3] Beijing Inst Technol, Sch Comp Sci Technol, Beijing 100081, Peoples R China
基金
中国国家自然科学基金;
关键词
k-nearest neighbors; text augmentation; text classification;
D O I
10.3390/electronics13163237
中图分类号
TP [自动化技术、计算机技术];
学科分类号
0812 ;
摘要
Text classification is a fundamental task in natural language processing (NLP). Deep-learning-based text classification methods usually have two stages: training and inference. However, the training dataset is only used in the training stage. To make full use of the training dataset in the inference stage in order to improve model performance, we propose a k-nearest neighbors retrieval augmented method (KRA) for deep-learning-based text classification models. KRA works by first constructing a storage system that stores the embeddings of the training samples during the training stage. During the inference stage, the model retrieves the top k-nearest neighbors of the testing text from the storage. Then, we use text augmentation methods to expand the retrieved neighbors, including traditional augmentation methods and a large language model (LLM)-based method. Next, the method weights the augmented neighbors based on their distances from the target text and incorporates their labels into the inference of the final results accordingly. We evaluate our KRA method on six benchmark datasets using four commonly used deep learning models: CNN, LSTM, BERT, and RoBERTa. The results demonstrate that KRA significantly improves the classification performance of these models, with an average accuracy improvement of 0.3% for BERT and up to 0.4% for RoBERTa. These improvements highlight the effectiveness and generalizability of KRA across different models and datasets, making it a valuable enhancement for a wide range of text classification tasks.
引用
收藏
页数:16
相关论文
共 50 条
  • [1] Novel text classification based on K-nearest neighbor
    Yu, Xiao-Peng
    Yu, Xiao-Gao
    PROCEEDINGS OF 2007 INTERNATIONAL CONFERENCE ON MACHINE LEARNING AND CYBERNETICS, VOLS 1-7, 2007, : 3425 - +
  • [2] Feature Extraction based Text Classification using K-Nearest Neighbor Algorithm
    Azam, Muhammad
    Ahmed, Tanvir
    Sabah, Fahad
    Hussain, Muhammad Iftikhar
    INTERNATIONAL JOURNAL OF COMPUTER SCIENCE AND NETWORK SECURITY, 2018, 18 (12): : 95 - 101
  • [3] Neighbor-weighted K-nearest neighbor for unbalanced text corpus
    Tan, SB
    EXPERT SYSTEMS WITH APPLICATIONS, 2005, 28 (04) : 667 - 671
  • [4] IMPROVING K-NEAREST NEIGHBOR EFFICIENCY FOR TEXT CATEGORIZATION
    Barigou, F.
    NEURAL NETWORK WORLD, 2016, 26 (01) : 45 - 65
  • [5] Improving K-Nearest Neighbor Efficacy for FarsiText Classification
    Elahimanesh, Mohammad Hossein
    BehrouzMinaei-Bidgoli
    Malekinezhad, Hossein
    LREC 2012 - EIGHTH INTERNATIONAL CONFERENCE ON LANGUAGE RESOURCES AND EVALUATION, 2012, : 1618 - 1621
  • [6] Towards enriching the quality of k-nearest neighbor rule for document classification
    Basu, Tanmay
    Murthy, C. A.
    INTERNATIONAL JOURNAL OF MACHINE LEARNING AND CYBERNETICS, 2014, 5 (06) : 897 - 905
  • [7] Towards enriching the quality of k-nearest neighbor rule for document classification
    Tanmay Basu
    C. A. Murthy
    International Journal of Machine Learning and Cybernetics, 2014, 5 : 897 - 905
  • [8] Locally Adaptive Text Classification based k-nearest Neighbors
    Yu, Xiao-gao
    Yu, Xiao-peng
    2007 INTERNATIONAL CONFERENCE ON WIRELESS COMMUNICATIONS, NETWORKING AND MOBILE COMPUTING, VOLS 1-15, 2007, : 5651 - +
  • [9] Asymptotics of k-nearest Neighbor Riesz Energies
    Hardin, Douglas P.
    Saff, Edward B.
    Vlasiuk, Oleksandr
    CONSTRUCTIVE APPROXIMATION, 2024, 59 (02) : 333 - 383
  • [10] Kinetic Reverse k-Nearest Neighbor Problem
    Rahmati, Zahed
    King, Valerie
    Whitesides, Sue
    COMBINATORIAL ALGORITHMS, IWOCA 2014, 2015, 8986 : 307 - 317