NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Enhancing Code Intelligence Tasks with ChatGPT

Kang Yang, Xinjun Mao, Shangwen Wang, Tanghaoran Zhang, Bo Lin, Yanlin Wang, Yihao Qin, Zhang Zhang 0005, Xiaoguang MaoarXiv 2023 · DOI

Introduction

Modern Code Intelligence (CI) models, such as CodeBERT and CodeT5, rely heavily on large-scale datasets of code-comment pairs to learn the mapping between programming logic and natural language. However, the "gold standard" human-written comments in these datasets are frequently noisy, outdated, or semantically inconsistent with the code they describe. This "garbage in, garbage out" phenomenon limits the performance of downstream tasks. This paper explores whether synthetic comments generated by Large Language Models (LLMs) like ChatGPT can serve as a superior alternative to human-written data for pre-training CI models.

Methodology: Reference-Free Evaluation and Dataset Reconstruction

To evaluate comment quality without the bias of traditional n-gram metrics (like BLEU), which penalize deviations from flawed human references, the authors introduced a reference-free evaluation framework. This framework utilizes two key metrics: IncRate (Inconsistency Rate), which uses a classifier to detect logic mismatches, and Semantic Code Search (MRR), which measures a comment's effectiveness as a search query.

Reference-free evaluation framework using IncRate and MRR.

The researchers then reconstructed the CodeSearchNet (CSN) dataset. They replaced over 2 million human comments across six programming languages (Java, Python, PHP, JavaScript, Go, and Ruby) with synthetic summaries generated by gpt-3.5-turbo. This process utilized specific system and task prompts to ensure the LLM acted as an expert programmer providing concise descriptions.

Example prompt structure used to generate synthetic comments from code snippets.

Finally, a CodeT5 model was re-pre-trained on this "ChatGPT-enhanced" dataset to evaluate its performance across various code intelligence benchmarks, including Concode for generation and AVATAR for translation.

Key Insights: The Superiority of Synthetic Data

The study revealed that 15.05% of human-written comments in the TLC benchmark were semantically inconsistent, whereas ChatGPT’s inconsistency rate was significantly lower at 3.65%. Interestingly, while ChatGPT performed worse on traditional BLEU scores, the reference-free metrics confirmed that its descriptions were actually more accurate. The "BLEU trap" occurs because synthetic comments are penalized for failing to replicate the noise and errors present in human "gold standards."

This process demonstrates a successful data distillation pipeline: a large, expensive LLM can be used to "clean" a massive dataset, which in turn trains a smaller, more efficient model that outperforms its predecessors.

Results and Impact

The model pre-trained on ChatGPT-enhanced data showed substantial improvements across multiple tasks:

  • Code Generation: On the Concode benchmark, the model achieved an 8.0% improvement in Exact Match (EM) and an 11.7% boost in BLEU score.
  • Code Summarization: The synthetic-data-trained model consistently achieved higher semantic consistency (measured by USE and MRR) across all six languages.
  • Code Translation: Even for code-to-code tasks like Java-to-Python translation, the improved natural language alignment during pre-training led to a 3.7-point increase in CodeBLEU.

Conclusion

By replacing noisy human references with high-quality synthetic data, researchers can significantly enhance the capabilities of code intelligence models. This work highlights the potential of LLMs as powerful data refiners, paving the way for more robust and accurate AI-assisted software engineering tools.

Summary updated

BibTeX
@misc{yang2023enhancing,
  author = {Kang Yang and Xinjun Mao and Shangwen Wang and Tanghaoran Zhang and Bo Lin and Yanlin Wang and Yihao Qin and Zhang Zhang and Xiaoguang Mao},
  title = {{Enhancing Code Intelligence Tasks with ChatGPT}},
  year = {2023},
  eprint = {2312.15202},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2312.15202},
}
Figure