Hostname: page-component-74656f9884-7drmj Total loading time: 0 Render date: 2026-11-05T03:39:00.428Z Has data issue: false hasContentIssue false

Topic Classification for Political Texts with Pretrained Language Models

Published online by Cambridge University Press:  08 March 2023

Yu Wang*
Affiliation:
University of Rochester, Rochester, NY, USA. E-mail: w.y@alum.urmc.rochester.edu
*
Corresponding author Yu Wang
Rights & Permissions [Opens in a new window]

Abstract

Supervised topic classification requires labeled data. This often becomes a bottleneck as high-quality labeled data are expensive to acquire. To overcome the data scarcity problem, scholars have recently proposed to use cross-domain topic classification to take advantage of preexisting labeled datasets. Cross-domain topic classification only requires limited annotation in the target domain to verify its cross-domain accuracy. In this letter, we propose supervised topic classification with pretrained language models as an alternative. We show that language models fine-tuned with 70% of the small annotated dataset in the target corpus could outperform models trained using large cross-domain datasets by 27% and that models fine-tuned with 10% of the annotated dataset could already outperform the cross-domain classifiers. Our models are competitive in terms of training time and inference time. Researchers interested in supervised learning with limited labeled data should find our results useful. Our code and data are publicly available.1

Information

Type
Letter
Copyright
© The Author(s), 2023. Published by Cambridge University Press on behalf of the Society for Political Methodology
Figure 0

Table 1 Fine-tuning a RoBERTa-base model with 70% of labeled in-domain data can outperform cross-domain topic classification in both 44-topic and 8-topic tasks by a large margin. Cross-domain classifiers are from Osnabrügge et al. (2021). Test set is the same for both models. Mean of five random runs is reported, with standard deviation in the brackets. Better results are in bold.

Figure 1

Table 2 Accuracy (recall) comparison by topic. Cross-domain classifiers are from Osnabrügge et al. (2021). Test set is the same for both models. N indicates sample size. Random seed is set to 11. Better results are in bold.

Figure 2

Figure 1 Model performance increases as the training size increases. With 300 training examples, the fine-tuned RoBERTa model outperforms the cross-domain classifier (the dashed green line) on the 44-topic classification task (left) and on the 8-topic classification task (right).

Supplementary material: PDF

Wang supplementary material

Online Appendix

Download Wang supplementary material(PDF)
PDF 142.9 KB
Supplementary material: Link
Link