On-the-Fly Adapting Code Summarization on Trainable Cost-Effective Language Models

Loading...
Thumbnail Image
File version

Version of Record (VoR)

Author(s)
Cai, Y
Lin, Y
Liu, C
Wu, J
Zhang, Y
Liu, Y
Gong, Y
Dong, JS
Griffith University Author(s)
Primary Supervisor
Other Supervisors
Editor(s)
Date
2023
Size
File type(s)
Location

New Orleans, United States

License
Abstract

Deep learning models are emerging to summarize source code to comment for code documentation and program comprehension. We can achieve good performance by training the model on large training corpus. However, in practice, the code samples from different projects can have contradictory training signal for learning a deep comment generator, making the model struggled to fit all the training samples. In this work, we introduce a novel approach, AdaCom, to improve the performance of comment generators by on-the-fly model adaptation. This research is motivated by the observation that deep comment generators often need to strike a balance as they need to fit all the training samples. Specifically, for one certain target code c, some training samples Sp could have made more contributions while other samples So could have counter effects. However, the traditional fine-tuned models need to fit both Sp and So from a global perspective, leading to compromised performance for one certain target code c. In this context, we design AdaCom to (1) detect whether the model might have a compromised performance on a target code c and (2) retrieve a few helpful training samples Sp that have contradictory samples in the training dataset and, (3) adapt the model on the fly by re-training the Sp to strengthen the helpful samples and unlearn the harmful samples. Our extensive experiments on 7 comment generators and 4 public datasets show that (1) AdaCom can significantly boost the performance of comment generation (BLEU4 score by on average 14.9%, METEOR by 12.2%, and ROUGE-L by 7.4%), (2) the adaptation on one code sample is cost-effective and acceptable as an on-the-fly solution, and (3) AdaCom can adapt well on out-of-distribution code samples.

Journal Title
Conference Title

Advances in Neural Information Processing Systems 36 (NeurIPS 2023)

Book Title
Edition
Volume
Issue
Thesis Type
Degree Program
School
DOI
Patent number
Funder(s)
Grant identifier(s)
Rights Statement
Rights Statement

This work is covered by copyright. You must assume that re-use is limited to personal use and that permission from the copyright owner must be obtained for all other uses. If the document is available under a specified licence, refer to the licence for details of permitted re-use. If you believe that this work infringes copyright please make a copyright takedown request using the form at https://www.griffith.edu.au/copyright-matters.

Item Access Status
Note
Access the data
Related item(s)
Subject
Persistent link to this record
Citation

Cai, Y; Lin, Y; Liu, C; Wu, J; Zhang, Y; Liu, Y; Gong, Y; Dong, JS, On-the-Fly Adapting Code Summarization on Trainable Cost-Effective Language Models, Advances in Neural Information Processing Systems 36 (NeurIPS 2023), 2023, pp. 56660-56672