Skip to main content
QUICK REVIEW

[Paper Review] Selecting Between BERT and GPT for Text Classification in Political Science Research

Yu Wang, Qu Wen|arXiv (Cornell University)|Nov 7, 2024
Sentiment Analysis and Opinion MiningComputer Science3 citations
TL;DR

This study compares zero-shot and few-shot prompting with GPT models against fine-tuned BERT models for text classification in political science, particularly under data scarcity. While GPT prompting offers ease of use and reasonable performance in low-data settings, especially with few classes, fine-tuned BERT consistently outperforms or matches GPT in accuracy once training data reaches 1,000 samples, and is more cost-effective at scale.

ABSTRACT

Political scientists often grapple with data scarcity in text classification. Recently, fine-tuned BERT models and their variants have gained traction as effective solutions to address this issue. In this study, we investigate the potential of GPT-based models combined with prompt engineering as a viable alternative. We conduct a series of experiments across various classification tasks, differing in the number of classes and complexity, to evaluate the effectiveness of BERT-based versus GPT-based models in low-data scenarios. Our findings indicate that while zero-shot and few-shot learning with GPT models provide reasonable performance and are well-suited for early-stage research exploration, they generally fall short - or, at best, match - the performance of BERT fine-tuning, particularly as the training set reaches a substantial size (e.g., 1,000 samples). We conclude by comparing these approaches in terms of performance, ease of use, and cost, providing practical guidance for researchers facing data limitations. Our results are particularly relevant for those engaged in quantitative text analysis in low-resource settings or with limited labeled data.

Motivation & Objective

  • To evaluate whether GPT-based few-shot prompting can serve as a viable alternative to fine-tuned BERT for text classification in political science.
  • To compare the performance, usability, and cost of GPT prompting versus BERT fine-tuning across varying data sizes and classification complexity.
  • To provide practical guidance for political scientists facing data limitations in quantitative text analysis.
  • To assess the effectiveness of prompt engineering with GPT models in low-resource settings, particularly with binary and multi-class tasks.
  • To analyze the trade-offs between initial sunk costs in fine-tuning and ongoing inference costs in prompting.

Proposed method

  • The study conducts controlled experiments comparing zero-shot and few-shot prompting with GPT-4o against fine-tuned BERT models on multiple text classification tasks.
  • Tasks vary in number of classes (binary and multi-class) and data size (up to 1,000 labeled samples), simulating low-resource political science scenarios.
  • Performance is evaluated using standard classification metrics, with a focus on accuracy and F1-score across different data regimes.
  • Cost analysis compares inference costs of GPT prompting (per-token pricing) against the fixed sunk cost of BERT fine-tuning and subsequent inference.
  • Prompt engineering uses few-shot in-context learning with 2–4 exemplars per class, optimized for clarity and task alignment.
  • Experiments are conducted across diverse political science text types, including news articles, speeches, and policy documents, to ensure generalizability.
Figure 1: Increasing the number of samples enhances model accuracy, whether it’s through fine-tuning BERT models or prompting GPT models. ‘RoBERTa # 200’ refers to fine-tuning RoBERTa-large with 200 samples, while ‘Temp0.2 #0’ indicates zero-shot prompting with a temperature setting of 0.2. The blac
Figure 1: Increasing the number of samples enhances model accuracy, whether it’s through fine-tuning BERT models or prompting GPT models. ‘RoBERTa # 200’ refers to fine-tuning RoBERTa-large with 200 samples, while ‘Temp0.2 #0’ indicates zero-shot prompting with a temperature setting of 0.2. The blac

Experimental results

Research questions

  • RQ1Does few-shot prompting with GPT models achieve comparable or superior performance to fine-tuned BERT in low-data text classification tasks?
  • RQ2How does model performance vary with increasing training data size, particularly beyond 1,000 samples?
  • RQ3In what scenarios does GPT prompting outperform BERT fine-tuning, especially in terms of ease of use and cost efficiency?
  • RQ4How do the cost structures of GPT prompting and BERT fine-tuning compare across different inference volumes?
  • RQ5Can prompt engineering with GPT models effectively handle multi-class classification tasks in political science with minimal labeled data?

Key findings

  • Fine-tuned BERT models consistently outperform or match zero-shot and few-shot GPT prompting, especially as training data increases beyond 1,000 samples.
  • GPT prompting shows reasonable performance in early-stage research with small datasets and few classes, but its accuracy remains below that of fine-tuned BERT in most settings.
  • The cost of zero-shot GPT prompting intersects with the cost of fine-tuned BERT inference after processing 150–200 samples, after which fine-tuning becomes more economical.
  • Two-shot prompting with GPT-4o incurs significantly higher costs than fine-tuning, surpassing it after just a few API calls due to high token consumption per prompt.
  • GPT prompting is easier to deploy and requires no initial model training, but the lack of a sunk cost is offset by higher per-inference expenses.
  • Performance gains from advanced prompting techniques like chain-of-thought or self-consistency are expected to improve GPT’s competitiveness, but were not explored in this study.
Figure 2: Prompting with or without samples lags behind fine-tuning RoBERTa-large models by a sizeable margin in the 8-class manifesto classification.
Figure 2: Prompting with or without samples lags behind fine-tuning RoBERTa-large models by a sizeable margin in the 8-class manifesto classification.

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.