[论文解读] How Effective are Large Language Models in Generating Software Specifications?
本研究通过少量示例学习和不同提示,实证评估15种LLM从文档生成软件规格,结果显示开源的 StarCoder 常常与传统方法相比甚至超越,提示设计和失败分析将为未来工作提供指引。
Software specifications are essential for many Software Engineering (SE) tasks such as bug detection and test generation. Many existing approaches are proposed to extract the specifications defined in natural language form (e.g., comments) into formal machine readable form (e.g., first order logic). However, existing approaches suffer from limited generalizability and require manual efforts. The recent emergence of Large Language Models (LLMs), which have been successfully applied to numerous SE tasks, offers a promising avenue for automating this process. In this paper, we conduct the first empirical study to evaluate the capabilities of LLMs for generating software specifications from software comments or documentation. We evaluate LLMs performance with Few Shot Learning (FSL) and compare the performance of 13 state of the art LLMs with traditional approaches on three public datasets. In addition, we conduct a comparative diagnosis of the failure cases from both LLMs and traditional methods, identifying their unique strengths and weaknesses. Our study offers valuable insights for future research to improve specification generation.
研究动机与目标
- 评估LLMs在少量示例学习下,是否能够从注释或文档生成软件规格。
- 在标准规格数据集上,将LLM的性能与传统基于规则的方法进行比较。
- 研究提示构造策略与模型选择如何影响结果和成本。
- 诊断失败模式,以识别优点、局限性与改进方向。
- 为未来研究和实际的规格生成模型选择提供指导。
提出的方法
- 收集带有真实规格的软件文档数据集(Jdoctor-data 和 DocTer-data)。
- 通过用少量上下文示例构造提示来应用少样本学习(留一交叉验证)。
- 测试两种提示构造策略:随机检索和基于语义的检索(通过 RoBERTa 的语义相似性)。
- 在不同数据集上评估多种LLM(15个模型),重点关注准确性、精确率、召回率和F1(如适用);必要时对 Jdoctor-data 进行人工后处理。
- 将LLM的表现与 Jdoctor 和 DocTer 的基线方法进行比较。
- 分析失败案例,以对比LLM与传统方法的优劣。
实验结果
研究问题
- RQ1RQ1:在少样本学习下,LLMs 与传统基于规则的方法在提取软件规格方面的比较?
- RQ2RQ2:不同的提示构造策略如何影响 LLM 的性能?
- RQ3RQ3:基于失败分析,LLMs 相对于传统方法有哪些独特的优点和缺点?
- RQ4RQ4:不同的LLM在生成软件规格方面的性能和成本如何比较?
主要发现
- 在随机选取的10–60个示例下,LLMs(StarCoder)取得与传统方法相当或更好的结果(DocTer 高出 2.2%,Jdoctor 高出 5.6%)。
- 更高级的提示构造进一步扩大了对LLMs的性能差距(5.1–10.0%)。
- LLMs与传统方法的失败原因不同;传统方法常产生空规格,而LLMs产生格式不正确或不完整的规格(53–60%的独立LLM失败来自于无效的提示和缺失的领域知识)。
- 开源的 StarCoder 具有高度竞争力,提供强劲的性能、开放访问和长提示支持;由于规模和成本,GPT-3 Davinci 不太理想。
- 在15个LLM中,大多数模型与传统方法相比不相上下或更优;StarCoder整体上最具竞争力。
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。