iCoRe: 一种迭代相关性感知的Bug重现测试生成检索器
iCoRe: An Iterative Correlation-Aware Retriever for Bug Reproduction Test Generation
AI总结:
本文提出iCoRe,一种迭代相关性感知的Bug重现测试生成检索器,通过区分源代码与测试用例的检索需求、结合文本语义与函数调用结构、以及实现检索与生成阶段的反馈循环,提升Bug重现测试生成的准确性。
摘要:
自动从问题描述生成Bug重现测试(BRT)对软件维护至关重要。基于大语言模型(LLM)的方法在该任务中展现出巨大潜力。其有效性严重依赖于从代码库中检索高质量上下文。现有方法的检索阶段依赖于传统方法如BM25或LLM驱动策略。基于LLM的检索策略通常为LLM提供工具,使其能够自主探索仓库或从提供的列表中选择最相关的文件和代码片段作为上下文。然而,这些检索方法存在三个关键限制:1)它们通常采用统一策略检索源代码和测试用例,忽视了它们不同的检索需求;2)它们仅关注语义相似性而忽略函数调用关系,导致无关上下文;3)检索缺乏来自生成阶段的反馈循环,无法根据执行结果优化上下文。这些限制共同导致了低质量的上下文,从而阻碍了Bug重现的准确性。为了解决这些挑战,我们提出了iCoRe,一种迭代、相关性感知的上下文检索方法,明确考虑了三个关键相关性:1)源代码与测试用例之间的相关性,需要区分的检索;2)文本语义与函数调用结构之间的相关性,以准确评估相关性;3)检索与生成阶段之间的相关性,使能够实现迭代反馈和优化。为了评估iCoRe,我们将其与基于LLM的BRT生成器结合,并在SWT-bench Lite和TDD-bench Verified基准上进行了全面评估。实验结果表明,我们的方法在SWT-bench Lite和TDD-bench Verified基准上分别达到了42.0%和52.8%的Fail-to-Pass率,分别比现有检索方法提高了19.7%-31.7%。
英文摘要:
Automatically generating bug reproduction tests (BRT) from issue descriptions is crucial for software maintenance. LLM-based approaches have shown great potential for this task. Their effectiveness heavily relies on retrieving high-quality context from the codebase. The retrieval phase of existing approaches relies on either traditional methods like BM25 or LLM-driven strategies. LLM-based retrieval strategies typically equip an LLM with tools to autonomously explore the repository or select the most relevant files and code snippets from a provided list as context. However, these retrieval methods suffer from three key limitations: 1) They often employ a unified strategy for retrieving both source code and test cases, overlooking their distinct retrieval requirements. 2) They focus solely on semantic similarity while ignoring function call relationships, leading to irrelevant context. 3) The retrieval lacks a feedback loop from the generation phase, preventing it from refining the context based on execution results. These limitations collectively result in low-quality context, thereby hindering the accuracy of bug reproduction. To address these challenges, we propose iCoRe, an iterative, correlation-aware context retrieval approach explicitly aware of three key correlations: 1) between source code and test cases, which requires differentiated retrieval, 2) between textual semantics and function call structures for accurate relevance assessment, and 3) between the retrieval and generation phases, which enables iterative feedback and refinement. To evaluate iCoRe, we integrate it with an LLM-based BRT generator and conduct a comprehensive evaluation on the SWT-bench Lite and TDD-bench Verified benchmarks. Experimental results show that our method achieves a Fail-to-Pass rate of 42.0% and 52.8% respectively, representing 19.7%-31.7% relative improvements over existing retrieval methods.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。