Skip to main content
QUICK 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 Science被引用 3
一句话总结

本研究对比了在政治科学文本分类任务中,GPT 模型的零样本与 few-shot 提示方法与微调后的 BERT 模型的表现,尤其关注数据稀缺情境。尽管 GPT 提示在低数据设置下具有使用简便且表现合理的优点,特别是在类别较少时,但当训练数据达到 1,000 个样本后,微调后的 BERT 在准确率上始终优于或匹配 GPT 提示,且在大规模应用中更具成本效益。

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.

研究动机与目标

  • 评估基于 GPT 的 few-shot 提示是否可作为政治科学文本分类中微调 BERT 的可行替代方案。
  • 在不同数据规模和分类复杂度下,比较 GPT 提示与 BERT 微调在性能、可用性和成本方面的表现。
  • 为在定量文本分析中面临数据限制的政治科学家提供实用指导。
  • 评估在低资源设置下,使用 GPT 模型进行提示工程的有效性,特别是针对二分类和多分类任务。
  • 分析微调阶段的初始沉没成本与提示阶段持续推理成本之间的权衡。

提出的方法

  • 本研究通过受控实验,对比了 GPT-4o 在零样本和 few-shot 提示设置下与微调 BERT 模型在多个文本分类任务上的表现。
  • 任务在类别数量(二分类与多分类)和数据规模(最多 1,000 个标注样本)上存在差异,以模拟低资源的政治科学场景。
  • 性能评估采用标准分类指标,重点关注不同数据条件下的准确率和 F1 分数。
  • 成本分析比较了 GPT 提示的推理成本(按 token 计价)与 BERT 微调的固定沉没成本及其后续推理成本。
  • 提示工程采用包含每类 2–4 个范例的 few-shot 上下文学习,优化以提升清晰度与任务一致性。
  • 实验涵盖多样化的政治科学文本类型,包括新闻文章、演讲稿和政策文件,以确保结果的泛化能力。
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

实验结果

研究问题

  • RQ1在低数据文本分类任务中,使用 GPT 模型的 few-shot 提示是否能达到与微调 BERT 相当或更优的性能?
  • RQ2随着训练数据规模的增加,尤其是超过 1,000 个样本后,模型性能如何变化?
  • RQ3在哪些场景下,GPT 提示优于 BERT 微调,尤其是在易用性和成本效率方面?
  • RQ4在不同推理量下,GPT 提示与 BERT 微调的成本结构如何比较?
  • RQ5在仅提供极少标注数据的情况下,GPT 模型的提示工程能否有效处理政治科学中的多分类任务?

主要发现

  • 微调后的 BERT 模型在训练数据超过 1,000 个样本后,始终优于或匹配零样本与 few-shot GPT 提示,表现更优。
  • 在早期研究阶段,使用小规模数据集和较少类别的场景下,GPT 提示表现出合理的性能,但其准确率在大多数设置下仍低于微调后的 BERT。
  • 零样本 GPT 提示的推理成本在处理 150–200 个样本后,与微调 BERT 的推理成本相交,此后微调更具经济性。
  • 使用 GPT-4o 的两样本提示推理成本显著高于微调,由于每条提示的 token 消耗量高,仅需几次 API 调用即超过微调成本。
  • GPT 提示部署更简便,无需初始模型训练,但其无沉没成本的优势被更高的每次推理成本所抵消。
  • 尽管链式思维或自一致性等高级提示技术有望提升 GPT 的竞争力,但本研究未对此类技术进行探索。
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.

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。