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

基于小型语言模型的提示驱动测试脚本生成的实证研究

An Empirical Study of Sustainability in Prompt-driven Test Script Generation Using Small Language Models

University Of Calgary(卡尔加里大学)

Pragati Kumari, Novarun Deb

AI总结:

本文通过HumanEval基准和适应性提示变体,实证分析小型语言模型在测试脚本生成中的环境与性能权衡,揭示提示结构与模型选择对环境和性能的影响。

摘要:

随着语言模型在自动化测试脚本生成中的广泛应用,其环境影响引发了关注,但现有可持续性分析主要集中在大语言模型。为此,本文通过HumanEval基准和基于Anthropic模板的适应性提示变体,实证研究小型语言模型(参数范围为2B-8B)在提示驱动单元测试脚本生成中的环境与性能权衡。分析使用CodeCarbon量化在受控条件下能量消耗和碳排放,并以单元测试脚本覆盖率作为生成测试质量的初始代理。研究结果表明,不同小型语言模型表现出不同的可持续性特征——一些模型更倾向于低能耗和快速执行,而另一些模型在同等条件下保持更高的稳定性或覆盖率。整体而言,本文为基于小型语言模型的可持续测试脚本生成提供了聚焦的实证证据,阐明了提示结构和模型选择如何共同塑造环境和性能结果。

英文摘要:

The increasing use of language models in automated test script generation raises concerns about their environmental impact, yet existing sustainability analyses focus predominantly on large language models. As a result, the energy and carbon characteristics of small language models (SLMs) during prompt-driven unit-test script generation remain largely unexplored. To address this gap, this study empirically examines the environmental and performance tradeoffs of SLMs (in the 2B-8B parameter range) using the HumanEval benchmark and adaptive prompt variants (based on the Anthropic template). The analysis uses CodeCarbon to characterize energy consumption carbon emissions and duration under controlled conditions, with unit-test script coverage serving as an initial proxy for generated test quality. Our results show that different SLMs exhibit distinct sustainability profiles - some favor lower energy use and faster execution, while others maintain higher stability or coverage under comparable conditions. Overall, this work provides focused empirical evidence on sustainable SLM-based test script generation, clarifying how prompt structure and model selection jointly shape environmental and performance outcomes.

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

↑