Semantic-Preserving Adversarial Code Comprehension

Yiyang Li, Hongqiu Wu, Hai Zhao


Abstract
Based on the tremendous success of pre-trained language models (PrLMs) for source code comprehension tasks, current literature studies either ways to further improve the performance (generalization) of PrLMs, or their robustness against adversarial attacks. However, they have to compromise on the trade-off between the two aspects and none of them consider improving both sides in an effective and practical way. To fill this gap, we propose Semantic-Preserving Adversarial Code Embeddings (SPACE) to find the worst-case semantic-preserving attacks while forcing the model to predict the correct labels under these worst cases. Experiments and analysis demonstrate that SPACE can stay robust against state-of-the-art attacks while boosting the performance of PrLMs for code.
Anthology ID:
2022.coling-1.267
Volume:
Proceedings of the 29th International Conference on Computational Linguistics
Month:
October
Year:
2022
Address:
Gyeongju, Republic of Korea
Venue:
COLING
SIG:
Publisher:
International Committee on Computational Linguistics
Note:
Pages:
3017–3028
Language:
URL:
https://aclanthology.org/2022.coling-1.267
DOI:
Bibkey:
Cite (ACL):
Yiyang Li, Hongqiu Wu, and Hai Zhao. 2022. Semantic-Preserving Adversarial Code Comprehension. In Proceedings of the 29th International Conference on Computational Linguistics, pages 3017–3028, Gyeongju, Republic of Korea. International Committee on Computational Linguistics.
Cite (Informal):
Semantic-Preserving Adversarial Code Comprehension (Li et al., COLING 2022)
Copy Citation:
PDF:
https://aclanthology.org/2022.coling-1.267.pdf
Code
 ericlee8/space
Data
CodeQACodeSearchNet