Skip to main content
QUICK REVIEW

[Paper Review] Large Language Models For Text Classification: Case Study And Comprehensive Review

Arina Kostina, Marios D. Dikaiakos|ArXiv.org|Jan 14, 2025
Text and Document Classification TechnologiesComputer Science3 citations
TL;DR

This study compares diverse large language models (LLMs) with traditional ML and RoBERTa on two text classification tasks (fake news detection and employee location classification), analyzes prompting techniques, and examines performance-time trade-offs.

ABSTRACT

Unlocking the potential of Large Language Models (LLMs) in data classification represents a promising frontier in natural language processing. In this work, we evaluate the performance of different LLMs in comparison with state-of-the-art deep-learning and machine-learning models, in two different classification scenarios: i) the classification of employees' working locations based on job reviews posted online (multiclass classification), and 2) the classification of news articles as fake or not (binary classification). Our analysis encompasses a diverse range of language models differentiating in size, quantization, and architecture. We explore the impact of alternative prompting techniques and evaluate the models based on the weighted F1-score. Also, we examine the trade-off between performance (F1-score) and time (inference response time) for each language model to provide a more nuanced understanding of each model's practical applicability. Our work reveals significant variations in model responses based on the prompting strategies. We find that LLMs, particularly Llama3 and GPT-4, can outperform traditional methods in complex classification tasks, such as multiclass classification, though at the cost of longer inference times. In contrast, simpler ML models offer better performance-to-time trade-offs in simpler binary classification tasks.

Motivation & Objective

  • Evaluate the performance of multiple LLMs against traditional ML and RoBERTa on two real-world classification tasks (binary and multiclass).
  • Investigate how prompting techniques affect LLM performance in text classification.
  • Assess the trade-off between accuracy (weighted F1-score) and inference time across models.
  • Analyze model scaling, quantization effects, and practical applicability for different task complexities.

Proposed method

  • Compare decoder-only, encoder-only, and encoder-decoder LLMs (including quantized and API-based variants) with RoBERTa, NB, and SVM on two datasets.
  • Use weighted F1-score as the primary metric with 5-fold cross-validation for RoBERTa and ML models.
  • Evaluate prompting techniques: Zero-shot, Few-shot, Chain-of-Thought, Emotional Prompting, Role-playing, Naming the Assistant, and combinations thereof.
  • Measure inference time to analyze performance-time trade-offs (Pareto analysis).
  • Employ prompt engineering to study robustness and variability across models and tasks.

Experimental results

Research questions

  • RQ1Do LLMs outperform traditional ML and RoBERTa on binary (FakeNewsNet) and multiclass (Employee Reviews) text classification tasks?
  • RQ2How do prompting techniques (ZS, FS, CoT, RP, NA, EM) influence LLM performance across models and tasks?
  • RQ3What is the performance-time trade-off for large vs. small LLMs and for quantized models in these tasks?
  • RQ4To what extent does model size, architecture, and quantization affect classification accuracy and stability across prompts?

Key findings

  • Llama3 70B often delivers top-tier F1 scores but with longer inference times, while RoBERTa provides strong, time-efficient performance (e.g., RoBERTa ~93% F1 on FakeNewsNet and ~84% on Employee Reviews with fast inference).
  • Prompting strategy significantly impacts results; CoT and FS can substantially boost performance, though effects vary by model and task.
  • On FakeNewsNet (binary), Llama3 70B achieves up to about 94.4% F1 under certain prompts, whereas traditional NB/SVM exceed 88% with very fast inference; RoBERTa attains 93.0% in some settings.
  • On Employee Reviews (multiclass), GPT-4-turbo reaches about 87.6% F1 in the best case, with larger gains from CoT and FS prompts; smaller models (e.g., Llama3 8B, Mistral OO) show competitive but lower performance.
  • Quantized Mistral models can match or exceed non-quantized variants (e.g., Mistral-OO outperforms Mistral by 4.5%), indicating quantization can preserve or enhance performance.
  • Overall, larger LLMs offer higher accuracy at the cost of longer inference times; traditional models (NB/SVM) offer strong baselines with minimal latency.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.