DiffTester: 반복 패턴을 통한 Diffusion LLM용 단위 테스트 생성 가속화
DiffTester: Accelerating Unit Test Generation for Diffusion LLMs via Repetitive Pattern
September 29, 2025
저자: Lekang Yang, Yuetong Liu, Yitong Zhang, Jia Li
cs.AI
초록
소프트웨어 개발은 광범위한 단위 테스트에 크게 의존하며, 이는 자동화된 단위 테스트 생성(UTG)의 효율성을 특히 중요하게 만듭니다. 그러나 대부분의 기존 LLM(Large Language Model)은 각 순방향 패스에서 한 번에 하나의 토큰씩 테스트 케이스를 생성하므로 UTG가 비효율적입니다. 최근에는 병렬 생성 능력을 제공하며 효율적인 UTG에 강력한 잠재력을 보여주는 확산 LLM(dLLM)이 등장했습니다. 이러한 장점에도 불구하고, UTG에의 적용은 효율성과 테스트 품질 사이의 명확한 트레이드오프로 인해 여전히 제한적입니다. 각 단계에서 생성되는 토큰 수를 증가시키면 테스트 케이스의 품질이 급격히 저하되기 때문입니다. 이러한 한계를 극복하기 위해, 우리는 UTG를 위해 특별히 설계된 dLLM 가속화 프레임워크인 DiffTester를 제안합니다. DiffTester의 핵심 아이디어는 동일한 대상 메서드를 목표로 하는 단위 테스트가 종종 반복적인 구조적 패턴을 공유한다는 것입니다. 생성 과정에서 추상 구문 트리 분석을 통해 이러한 공통 패턴을 동적으로 식별함으로써, DiffTester는 출력 품질을 저하시키지 않으면서 각 단계에서 생성되는 토큰 수를 적응적으로 증가시킵니다. 포괄적인 평가를 가능하게 하기 위해, 우리는 Python에 한정되었던 원래의 TestEval 벤치마크를 Java와 C++을 포함한 추가 프로그래밍 언어로 확장했습니다. 두 가지 대표 모델을 사용한 세 가지 벤치마크에 대한 광범위한 실험 결과, DiffTester는 테스트 커버리지를 유지하면서도 상당한 가속화를 제공하는 것으로 나타났습니다. 또한, DiffTester는 다양한 dLLM과 프로그래밍 언어에 걸쳐 잘 일반화되며, 소프트웨어 개발에서 효율적인 UTG를 위한 실용적이고 확장 가능한 솔루션을 제공합니다. 코드와 데이터는 https://github.com/wellbeingyang/DLM4UTG-open 에서 공개적으로 이용 가능합니다.
English
Software development relies heavily on extensive unit testing, which makes
the efficiency of automated Unit Test Generation (UTG) particularly important.
However, most existing LLMs generate test cases one token at a time in each
forward pass, which leads to inefficient UTG. Recently, diffusion LLMs (dLLMs)
have emerged, offering promising parallel generation capabilities and showing
strong potential for efficient UTG. Despite this advantage, their application
to UTG is still constrained by a clear trade-off between efficiency and test
quality, since increasing the number of tokens generated in each step often
causes a sharp decline in the quality of test cases. To overcome this
limitation, we present DiffTester, an acceleration framework specifically
tailored for dLLMs in UTG. The key idea of DiffTester is that unit tests
targeting the same focal method often share repetitive structural patterns. By
dynamically identifying these common patterns through abstract syntax tree
analysis during generation, DiffTester adaptively increases the number of
tokens produced at each step without compromising the quality of the output. To
enable comprehensive evaluation, we extend the original TestEval benchmark,
which was limited to Python, by introducing additional programming languages
including Java and C++. Extensive experiments on three benchmarks with two
representative models show that DiffTester delivers significant acceleration
while preserving test coverage. Moreover, DiffTester generalizes well across
different dLLMs and programming languages, providing a practical and scalable
solution for efficient UTG in software development. Code and data are publicly
available at https://github.com/wellbeingyang/DLM4UTG-open .