Auto-SPT: Automated Code Semantic-Preserving Transformations
Auto-SPT: Automating Semantic Preserving Transformations for Code
Researchers propose the Auto-SPT framework, which uses LLMs to automatically generate semantic-preserving code transformations; experiments show that such transformations can significantly degrade the performance of state-of-the-art code clone detectors. Code clone detection determines whether two code segments are semantically equivalent and is a foundational component of security tasks such as vulnerability and malware detection, but existing models are mostly trained on clean, structured code, whereas real code often undergoes semantic-preserving transformations such as refactoring, minification, automatic formatting, and compiler optimization. Auto-SPT is built on LLMs, having the model design diverse semantic-preserving transformations, generate implementations, and compose them; formal analysis shows that transformation diversity affects composition strength. Experiments also show that transformations generated by Auto-SPT are more diverse than existing methods, and adding such transformations to training data can train clone detection models that are more robust to real and adversarial code transformations.