Text Classification via Large Language Models

Xiaofei Sun, Xiaoya Li, Jiwei Li, Fei Wu, Shangwei Guo +2 more
5/15/2023
cs.CL

No official code found. Best implementation: ShannonAI/GPT-CLS-CARP (85 stars, Apache-2.0, last commit 2023-07-13).

Abstract

Despite the remarkable success of large-scale Language Models (LLMs) such as GPT-3, their performances still significantly underperform fine-tuned models in the task of text classification. This is due to (1) the lack of reasoning ability in addressing complex linguistic phenomena (e.g., intensification, contrast, irony etc); (2) limited number of tokens allowed in in-context learning. In this paper, we introduce Clue And Reasoning Prompting (CARP). CARP adopts a progressive reasoning strategy tailored to addressing the complex linguistic phenomena involved in text classification: CARP first prompts LLMs to find superficial clues (e.g., keywords, tones, semantic relations, references, etc), based on which a diagnostic reasoning process is induced for final decisions. To further address the limited-token issue, CARP uses a fine-tuned model on the supervised dataset for $k$NN demonstration search in the in-context learning, allowing the model to take the advantage of both LLM's generalization ability and the task-specific evidence provided by the full labeled dataset. Remarkably, CARP yields new SOTA performances on 4 out of 5 widely-used text-classification benchmarks, 97.39 (+1.24) on SST-2, 96.40 (+0.72) on AGNews, 98.78 (+0.25) on R8 and 96.95 (+0.6) on R52, and a performance comparable to SOTA on MR (92.39 v.s. 93.3). More importantly, we find that CARP delivers impressive abilities on low-resource and domain-adaptation setups. Specifically, using 16 examples per class, CARP achieves comparable performances to supervised models with 1,024 examples per class.

View on arXivView PDF

Code Implementations(1)

Apache-2.0

Code for the paper `Text Classification via Large Language Models`.

859Shell, PythonMay 15, 20233 years agoApache-2.0

Similar Papers

Cite this paper

@article{sun2023text,
  title  = {Text Classification via Large Language Models},
  author = {Xiaofei Sun and Xiaoya Li and Jiwei Li and Fei Wu and Shangwei Guo and Tianwei Zhang and Guoyin Wang},
  year   = {2023},
  eprint = {2305.08377},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2305.08377v3}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2305.08377.svg)](https://codeofpaper.com/paper/2305.08377)

Discussion