We study compositional generalization, which aims to generalize on unseen combinations of seen structural elements, for code search. Unlike existing approaches of partially pursuing this goal, we study how to extract structural elements, which we name a template that directly targets compositional generalization. Thus we propose CTBERT, or Code Template BERT, representing codes using automatically extracted templates as building blocks. We empirically validate CTBERT on two public code search benchmarks, AdvTest and CSN. Further, we show that templates are complementary to data flow graphs in GraphCodeBERT, by enhancing structural context around variables.
CITATION STYLE
Han, H., Hwang, S. W., Lu, S., Duan, N., & Choi, S. (2022). Towards Compositional Generalization in Code Search. In Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing, EMNLP 2022 (pp. 10743–10750). Association for Computational Linguistics (ACL). https://doi.org/10.18653/v1/2022.emnlp-main.737
Mendeley helps you to discover research relevant for your work.