• 中国计算机学会会刊
  • 中国科技核心期刊
  • 中文核心期刊

计算机工程与科学 ›› 2026, Vol. 48 ›› Issue (2): 353-362.

• 人工智能与数据挖掘 • 上一篇    下一篇

基于提示学习的少样本情感分类研究

王德兴,周闯,袁红春   

  1. (上海海洋大学信息学院,上海 201306)

  • 收稿日期:2024-10-23 修回日期:2025-03-25 出版日期:2026-02-25 发布日期:2026-03-10
  • 基金资助:
    国家自然科学基金(41776142)

Few-shot sentiment classification  based on prompt learning

WANG Dexing,ZHOU Chuang,YUAN Hongchun   

  1. (College of Information Technology,Shanghai Ocean University,Shanghai 201306,China)
  • Received:2024-10-23 Revised:2025-03-25 Online:2026-02-25 Published:2026-03-10

摘要: 针对预训练语言模型基于微调的方法在少样本学习场景下进行情感分类效果不好的问题,提出了一种基于改进提示学习和原型标签映射的少样本情感分类方法。在采用提示学习构建提示模板时,融入原始文本的关键词信息,提高文本中关键信息对标签结果影响的权重;然后在标签映射过程中引入原型网络,学习不同类别的原型向量,根据学习到的原型向量将模型预测结果映射到具体的标签上。在EPRSTMT和SST-2这2个数据集上的实验结果表明,所提方法的模型在少样本场景下的平均准确率指标达到了88.7%和91.9%,相比于微调方法,所提方法的模型的准确率分别提升了15.5%和14.0%;相比于P-Tuning方法,也提升了2.1%和0.7%。实验结果验证了所提方法的模型在少样本场景下的情感分类的有效性。

关键词: 预训练语言模型, 情感分类, 提示学习, 关键词抽取

Abstract: Addressing the problem where fine-tuning-based methods for pre-trained language models perform poorly in few-shot learning scenarios for sentiment classification, this paper proposes a few-shot sentiment classification method based on improved prompt learning and prototype label mapping. When constructing prompt templates using prompt learning, keywords from the original text are integrated to increase the weight of key information’s impact on the label results. Subsequently, during the label mapping process, prototype networks are introduced to learn prototype vectors of different categories. The model’s prediction results are then mapped to the specific labels based on these learned prototype vectors. Experimental results on the EPRSTMT and SST-2 datasets show that the  model of the proposed method achieves average accuracy rates of 88.7% and 91.9% in few-shot scenarios. Compared to fine-tuning methods, the model of the proposed method improves the accuracy by 15.5% and 14.0%, respectively. Compared to the P-Tuning method, our method improves the accuracy by 2.1% and 0.7%. The experimental results validate the effectiveness of the proposed method for sentiment classification in few-shot scenarios.


Key words: pre-trained language model, sentiment classification, prompt learning, keyword extraction