用代码补全思路提升大模型文本分类效果
CoCoP: Enhancing Text Classification with LLM through Code Completion Prompt
- 把文本分类转为代码补全任务,利用大模型代码能力
- SST2数据集准确率提升超20%,仅用十分之一模型规模
- 适合追求高效低资源文本分类的研究者
文本分类是自然语言处理中的基础任务,大语言模型在多个领域已展现出强大性能。然而其表现高度依赖输入提示质量。近期研究发现大模型在代码任务中表现优异。为此,本文提出代码补全提示(CoCoP)方法,将文本分类问题转化为代码补全任务,充分调动大模型的代码生成能力。实验表明,CoCoP在多个数据集上显著提升分类性能,如在SST2数据集上准确率提升超过20%。当与专用于代码任务的大模型(如CodeLLaMA)结合时,该方法仅需十分之一的模型规模即可达到或超越少样本学习效果。论文接受后将公开源代码。
原文摘要 · Abstract (English)
Text classification is a fundamental task in natural language processing (NLP), and large language models (LLMs) have demonstrated their capability to perform this task across various domains. However, the performance of LLMs heavily depends on the quality of their input prompts. Recent studies have also shown that LLMs exhibit remarkable results in code-related tasks. To leverage the capabilities of LLMs in text classification, we propose the Code Completion Prompt (CoCoP) method, which transforms the text classification problem into a code completion task. CoCoP significantly improves text classification performance across diverse datasets by utilizing LLMs' code-completion capability. For instance, CoCoP enhances the accuracy of the SST2 dataset by more than 20%. Moreover, when CoCoP integrated with LLMs specifically designed for code-related tasks (code models), such as CodeLLaMA, this method demonstrates better or comparable performance to few-shot learning techniques while using only one-tenth of the model size. The source code of our proposed method will be available to the public upon the acceptance of the paper.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。