ACL 2024findings8 citations

Code Needs Comments: Enhancing Code LLMs with Comment Augmentation

Demin Song, Honglin Guo, Yunhua Zhou, Shuhao Xing, Yudong Wang, Zifan Song, Wenwei Zhang, Qipeng Guo

Abstract

The programming skill is one crucial ability for Large Language Models (LLMs), necessitating a deep understanding of programming languages (PLs) and their correlation with natural languages (NLs). We examine the impact of pre-training data on code-focused LLMs’ performance by assessing the comment density as a measure of PL-NL alignment. Given the scarcity of code-comment aligned data in pre-training corpora, we introduce a novel data augmentation method that generates comments for existing code, coupled with a data filtering strategy that filters out code data poorly correlated with natural language. We conducted experiments on three code-focused LLMs and observed consistent improvements in performance on two widely-used programming skill benchmarks. Notably, the model trained on the augmented data outperformed both the model used for generating comments and the model further trained on the data without augmentation.

BibTeX
@inproceedings{song-etal-2024-code,
    title = "Code Needs Comments: Enhancing Code {LLM}s with Comment Augmentation",
    author = "Song, Demin  and
      Guo, Honglin  and
      Zhou, Yunhua  and
      Xing, Shuhao  and
      Wang, Yudong  and
      Song, Zifan  and
      Zhang, Wenwei  and
      Guo, Qipeng  and
      Yan, Hang  and
      Qiu, Xipeng  and
      Lin, Dahua",
    editor = "Ku, Lun-Wei  and
      Martins, Andre  and
      Srikumar, Vivek",
    booktitle = "Findings of the Association for Computational Linguistics: ACL 2024",
    month = aug,
    year = "2024",
    address = "Bangkok, Thailand",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2024.findings-acl.809/",
    doi = "10.18653/v1/2024.findings-acl.809",
    pages = "13640--13656"
}
Code Needs Comments: Enhancing Code LLMs with Comment Augmentation · ACL 2024