CoCoP: Enhancing Text Classification with LLM through Code Completion Prompt

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Mohajeri, Mohammad Mahdi, Dousti, Mohammad Javad, Ahmadabadi, Majid Nili
Format: Preprint
Published: 2024
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866915019302633472
author Mohajeri, Mohammad Mahdi
Dousti, Mohammad Javad
Ahmadabadi, Majid Nili
author_facet Mohajeri, Mohammad Mahdi
Dousti, Mohammad Javad
Ahmadabadi, Majid Nili
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2411_08979
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle CoCoP: Enhancing Text Classification with LLM through Code Completion Prompt
Mohajeri, Mohammad Mahdi
Dousti, Mohammad Javad
Ahmadabadi, Majid Nili
Computation and Language
Artificial Intelligence
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.
title CoCoP: Enhancing Text Classification with LLM through Code Completion Prompt
topic Computation and Language
Artificial Intelligence
url https://arxiv.org/abs/2411.08979