DiffTester: Accelerazione della Generazione di Test Unitari per Modelli Linguistici di Diffusione tramite Pattern Ripetitivi
DiffTester: Accelerating Unit Test Generation for Diffusion LLMs via Repetitive Pattern
September 29, 2025
Autori: Lekang Yang, Yuetong Liu, Yitong Zhang, Jia Li
cs.AI
Abstract
Lo sviluppo del software si basa fortemente su un'estesa fase di test unitari, rendendo particolarmente importante l'efficienza della Generazione Automatica di Test Unitari (UTG). Tuttavia, la maggior parte degli LLM esistenti genera casi di test un token alla volta in ogni passaggio in avanti, portando a una UTG inefficiente. Recentemente, sono emersi i diffusion LLM (dLLM), che offrono promettenti capacità di generazione parallela e mostrano un forte potenziale per una UTG efficiente. Nonostante questo vantaggio, la loro applicazione alla UTG è ancora limitata da un chiaro compromesso tra efficienza e qualità dei test, poiché aumentare il numero di token generati in ogni passaggio spesso causa un drastico calo nella qualità dei casi di test. Per superare questa limitazione, presentiamo DiffTester, un framework di accelerazione specificamente progettato per i dLLM nella UTG. L'idea chiave di DiffTester è che i test unitari che mirano allo stesso metodo focale spesso condividono schemi strutturali ripetitivi. Identificando dinamicamente questi schemi comuni attraverso l'analisi dell'albero sintattico astratto durante la generazione, DiffTester aumenta adattivamente il numero di token prodotti in ogni passaggio senza compromettere la qualità dell'output. Per consentire una valutazione completa, estendiamo il benchmark originale TestEval, limitato a Python, introducendo ulteriori linguaggi di programmazione tra cui Java e C++. Esperimenti estesi su tre benchmark con due modelli rappresentativi dimostrano che DiffTester offre una significativa accelerazione mantenendo la copertura dei test. Inoltre, DiffTester si generalizza bene su diversi dLLM e linguaggi di programmazione, fornendo una soluzione pratica e scalabile per una UTG efficiente nello sviluppo del software. Codice e dati sono pubblicamente disponibili all'indirizzo 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 .