arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2503.03609cs.SE
收藏

通过小模型增强的提示工程提升架构战术检测的准确性与可理解性

Enhancing the Accuracy and Comprehensibility in Architectural Tactics Detection via Small Model-Augmented Prompt Engineering

Lingli Cao, He Zhang, Shanshan Li, Danyang Li, Yanjing Yang, Chenxing Zhong, Xin Zhou, Yue Xie

AI总结:

针对架构战术检测中黑盒模型缺乏可解释性的问题,提出小模型增强的提示框架Prmt4TD,结合微调小模型与上下文学习,在提升检测准确率13%-23%的同时增强了结果的可理解性。

摘要:

架构战术(Architectural Tactics,ATs)作为架构决策在代码中的具体实现,解决了软件系统的非功能性需求。由于代码实现中架构知识的隐含性,开发者在修改或优化代码时,可能面临无意中改变或移除这些战术的风险。这种无意的改变会引发架构侵蚀,逐渐破坏系统原有的设计。尽管许多研究者提出了基于机器学习的方法来提高代码中ATs检测的准确性,但黑盒性质和所需的架构领域知识给开发者验证结果带来了重大挑战。有效的验证不仅需要准确的检测结果,还需要能增强其可理解性的可解释说明。然而,这是当前研究中的一个关键空白。大型语言模型(LLMs)如果具备领域知识,就能生成易于解释的ATs检测注释。微调LLMs以获取领域知识面临灾难性遗忘和硬件限制等挑战。因此,我们提出了Prmt4TD,一个小模型增强的提示框架,以提升ATs检测的准确性和可理解性。将微调的小模型与上下文学习相结合,还能降低微调成本,同时为LLM配备额外的领域知识。Prmt4TD能够利用LLMs卓越的处理和推理能力,生成易于解释的ATs检测结果。我们的评估结果表明,Prmt4TD在ATs平衡数据集上实现了13%-23%的准确率(F1-score)提升,并增强了检测结果的可理解性。

英文摘要:

Architectural tactics (ATs), as the concrete implementation of architectural decisions in code, address non-functional requirements of software systems. Due to the implicit nature of architectural knowledge in code implementation, developers may risk inadvertently altering or removing these tactics during code modifications or optimizations. Such unintended changes can trigger architectural erosion, gradually undermining the system's original design. While many researchers have proposed machine learning-based methods to improve the accuracy of detecting ATs in code, the black-box nature and the required architectural domain knowledge pose significant challenges for developers in verifying the results. Effective verification requires not only accurate detection results but also interpretable explanations that enhance their comprehensibility. However, this is a critical gap in current research. Large language models (LLMs) can generate easily interpretable ATs detection comments if they have domain knowledge. Fine-tuning LLMs to acquire domain knowledge faces challenges such as catastrophic forgetting and hardware constraints. Thus, we propose Prmt4TD, a small model-augmented prompting framework to enhance the accuracy and comprehensibility of ATs detection. Combining fine-tuned small models with In-Context Learning can also reduce fine-tuning costs while equipping the LLM with additional domain knowledge. Prmt4TD can leverage the remarkable processing and reasoning capabilities of LLMs to generate easily interpretable ATs detection results. Our evaluation results demonstrate that Prmt4TD achieves accuracy (\emph{F1-score}) improvement of 13\%-23\% on the ATs balanced dataset and enhances the comprehensibility of the detection results.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑