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

Author:

Li Jie1,Tang Chang1,Lei Zhechao2,Zhang Yirui1,Li Xuan1,Yu Yanhua1,Pi Renjie1,Hu Linmei3

Affiliation:

1. School of Computer Science (National Pilot Software Engineering School), Beijing University of Posts and Telecommunications, Beijing 100876, China

2. School of International Chinese Language Education, Beijing Normal University, Beijing 100875, China

3. School of Computer Science & Technology, Beijing Institute of Technology, Beijing 100081, China

Abstract

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.

Funder

National Natural Science Foundation of China

Publisher

MDPI AG

Reference33 articles.

1. A Survey on Text Classification: From Traditional to Deep Learning;Li;ACM Trans. Intell. Syst. Technol.,2022

2. A review on social spam detection: Challenges, open issues, and future directions;Rao;Expert Syst. Appl.,2021

3. A review on sentiment analysis and emotion detection from text;Nandwani;Soc. Netw. Anal. Min.,2021

4. A survey on knowledge graphs: Representation, acquisition, and applications;Ji;IEEE Trans. Neural Netw. Learn. Syst.,2021

5. Liu, P., Qiu, X., and Huang, X. (2016, January 9–15). Recurrent Neural Network for Text Classification with Multi-Task Learning. Proceedings of the Twenty-Fifth International Joint Conference on Artificial Intelligence, New York, NY, USA. IJCAI’16.

同舟云学术

1.学者识别学者识别

2.学术分析学术分析

3.人才评估人才评估

"同舟云学术"是以全球学者为主线,采集、加工和组织学术论文而形成的新型学术文献查询和分析系统,可以对全球学者进行文献检索和人才价值评估。用户可以通过关注某些学科领域的顶尖人物而持续追踪该领域的学科进展和研究前沿。经过近期的数据扩容,当前同舟云学术共收录了国内外主流学术期刊6万余种,收集的期刊论文及会议论文总量共计约1.5亿篇,并以每天添加12000余篇中外论文的速度递增。我们也可以为用户提供个性化、定制化的学者数据。欢迎来电咨询!咨询电话:010-8811{复制后删除}0370

www.globalauthorid.com

TOP

Copyright © 2019-2024 北京同舟云网络信息技术有限公司
京公网安备11010802033243号  京ICP备18003416号-3