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] A Review of a Text Classification Technique: K-Nearest Neighbor
    Zhou, R. S.
    Wang, Z. J.
    PROCEEDINGS OF THE INTERNATIONAL CONFERENCE ON COMPUTER INFORMATION SYSTEMS AND INDUSTRIAL APPLICATIONS (CISIA 2015), 2015, 18 : 453 - 455
  • [3] Improved k-nearest neighbor classification
    Wu, YQ
    Ianakiev, K
    Govindaraju, V
    PATTERN RECOGNITION, 2002, 35 (10) : 2311 - 2318
  • [4] Analysis of the k-nearest neighbor classification
    Li, Jing
    Cheng, Ming
    INFORMATION SCIENCE AND MANAGEMENT ENGINEERING, VOLS 1-3, 2014, 46 : 1911 - 1917
  • [5] Combining multiple k-nearest neighbor classifiers for text classification by reducts
    Bao, YG
    Ishii, N
    DISCOVERY SCIENCE, PROCEEDINGS, 2002, 2534 : 340 - 347
  • [6] Comparative Analysis of K-Nearest Neighbor and Modified K-Nearest Neighbor Algorithm for Data Classification
    Okfalisa
    Mustakim
    Gazalba, Ikbal
    Reza, Nurul Gayatri Indah
    2017 2ND INTERNATIONAL CONFERENCES ON INFORMATION TECHNOLOGY, INFORMATION SYSTEMS AND ELECTRICAL ENGINEERING (ICITISEE): OPPORTUNITIES AND CHALLENGES ON BIG DATA FUTURE INNOVATION, 2017, : 294 - 298
  • [7] Text Categorization with K-Nearest Neighbor Approach
    Manne, Suneetha
    Kotha, Sita Kumari
    Fatima, S. Sameen
    PROCEEDINGS OF THE INTERNATIONAL CONFERENCE ON INFORMATION SYSTEMS DESIGN AND INTELLIGENT APPLICATIONS 2012 (INDIA 2012), 2012, 132 : 413 - +
  • [8] Binary k-nearest neighbor for text categorization
    Tan, SB
    ONLINE INFORMATION REVIEW, 2005, 29 (04) : 391 - 399
  • [9] 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
  • [10] Joint Evidential K-Nearest Neighbor Classification
    Gong, Chaoyu
    Li, Yongbin
    Liu, Yong
    Wang, Pei-hong
    You, Yang
    2022 IEEE 38TH INTERNATIONAL CONFERENCE ON DATA ENGINEERING (ICDE 2022), 2022, : 2113 - 2126