arXiv:2505.14692cs.SEcs.CL2025-05被引 2

对比大模型与传统模型在软件工程情感分析中的表现

Sentiment Analysis in Software Engineering: Evaluating Generative Pre-trained Transformers

  • 用GPT-4o-mini和BERT对比,测试其在代码社区数据上的情感判断能力
  • 在平衡数据上两者表现接近,但面对复杂不平衡数据时大模型默认版本更优
  • 适合关注软件开发情绪分析的工程师和研究者参考

情感分析在理解软件工程中的开发者互动、问题解决和项目动态方面起着关键作用。尽管传统的软件工程专用情感分析工具已取得显著进展,但往往难以捕捉该领域语言的细微差别和上下文依赖性。本研究系统评估了双向Transformer(如BERT)与生成式预训练Transformer(特别是GPT-4o-mini)在软件工程情感分析中的表现。基于GitHub、Stack Overflow和Jira的数据集,对模型进行微调和默认配置下的基准测试。结果显示,在结构化且平衡的数据集(如GitHub和Jira)上,微调后的GPT-4o-mini性能与BERT等双向模型相当,宏平均F1分数分别为0.93和0.98;但在语言复杂且情感分布不均的数据集(如Stack Overflow)上,GPT-4o-mini默认模型表现出更优的泛化能力,准确率达85.3%,而微调模型仅为13.1%。这揭示了微调与直接使用预训练模型之间的权衡。研究强调应根据数据特征选择合适的模型架构以优化性能,并为未来定制化软件工程情感分析工具的研究指明方向。

原文摘要 · Abstract (English)

Sentiment analysis plays a crucial role in understanding developer interactions, issue resolutions, and project dynamics within software engineering (SE). While traditional SE-specific sentiment analysis tools have made significant strides, they often fail to account for the nuanced and context-dependent language inherent to the domain. This study systematically evaluates the performance of bidirectional transformers, such as BERT, against generative pre-trained transformers, specifically GPT-4o-mini, in SE sentiment analysis. Using datasets from GitHub, Stack Overflow, and Jira, we benchmark the models' capabilities with fine-tuned and default configurations. The results reveal that fine-tuned GPT-4o-mini performs comparable to BERT and other bidirectional models on structured and balanced datasets like GitHub and Jira, achieving macro-averaged F1-scores of 0.93 and 0.98, respectively. However, on linguistically complex datasets with imbalanced sentiment distributions, such as Stack Overflow, the default GPT-4o-mini model exhibits superior generalization, achieving an accuracy of 85.3\% compared to the fine-tuned model's 13.1\%. These findings highlight the trade-offs between fine-tuning and leveraging pre-trained models for SE tasks. The study underscores the importance of aligning model architectures with dataset characteristics to optimize performance and proposes directions for future research in refining sentiment analysis tools tailored to the SE domain.

情感分析大模型软件工程

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。