You Augment Me: Exploring ChatGPT-based Data Augmentation for Semantic Code Search

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Wang, Yanlin, Guo, Lianghong, Shi, Ensheng, Chen, Wenqing, Chen, Jiachi, Zhong, Wanjun, Wang, Menghan, Li, Hui, Zhang, Hongyu, Lyu, Ziyu, Zheng, Zibin
Format: Preprint
Published: 2024
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866913470783422464
author Wang, Yanlin
Guo, Lianghong
Shi, Ensheng
Chen, Wenqing
Chen, Jiachi
Zhong, Wanjun
Wang, Menghan
Li, Hui
Zhang, Hongyu
Lyu, Ziyu
Zheng, Zibin
author_facet Wang, Yanlin
Guo, Lianghong
Shi, Ensheng
Chen, Wenqing
Chen, Jiachi
Zhong, Wanjun
Wang, Menghan
Li, Hui
Zhang, Hongyu
Lyu, Ziyu
Zheng, Zibin
contents Code search plays a crucial role in software development, enabling developers to retrieve and reuse code using natural language queries. While the performance of code search models improves with an increase in high-quality data, obtaining such data can be challenging and expensive. Recently, large language models (LLMs) such as ChatGPT have made remarkable progress in both natural and programming language understanding and generation, offering user-friendly interaction via simple prompts. Inspired by these advancements, we propose a novel approach ChatDANCE, which utilizes high-quality and diverse augmented data generated by a large language model and leverages a filtering mechanism to eliminate low-quality augmentations. Specifically, we first propose a set of ChatGPT prompting rules that are specifically designed for source code and queries. Then, we leverage ChatGPT to rewrite code and queries based on the according prompts and then propose a filtering mechanism which trains a cross-encoder from the backbone model UniXcoder to filter out code and query pairs with low matching scores. Finally, we re-train the backbone model using the obtained high-quality augmented data. Experimental results show that ChatDANCE achieves state-of-the-art performance, improving the best baseline by 13.2% (R@1) and 7% (MRR). Surprisingly, we find that this augment-filter-retrain strategy enables the backbone model (UniXcoder) to self-grow. Moreover, extensive experiments show the effectiveness of each component and ChatDANCE has stable performance under different hyperparameter settings. In addition, we conduct qualitative and quantitative analyses to investigate why ChatDANCE works well and find that it learns a more uniform distribution of representations and effectively aligns the code and query spaces.
format Preprint
id arxiv_https___arxiv_org_abs_2408_05542
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle You Augment Me: Exploring ChatGPT-based Data Augmentation for Semantic Code Search
Wang, Yanlin
Guo, Lianghong
Shi, Ensheng
Chen, Wenqing
Chen, Jiachi
Zhong, Wanjun
Wang, Menghan
Li, Hui
Zhang, Hongyu
Lyu, Ziyu
Zheng, Zibin
Software Engineering
Code search plays a crucial role in software development, enabling developers to retrieve and reuse code using natural language queries. While the performance of code search models improves with an increase in high-quality data, obtaining such data can be challenging and expensive. Recently, large language models (LLMs) such as ChatGPT have made remarkable progress in both natural and programming language understanding and generation, offering user-friendly interaction via simple prompts. Inspired by these advancements, we propose a novel approach ChatDANCE, which utilizes high-quality and diverse augmented data generated by a large language model and leverages a filtering mechanism to eliminate low-quality augmentations. Specifically, we first propose a set of ChatGPT prompting rules that are specifically designed for source code and queries. Then, we leverage ChatGPT to rewrite code and queries based on the according prompts and then propose a filtering mechanism which trains a cross-encoder from the backbone model UniXcoder to filter out code and query pairs with low matching scores. Finally, we re-train the backbone model using the obtained high-quality augmented data. Experimental results show that ChatDANCE achieves state-of-the-art performance, improving the best baseline by 13.2% (R@1) and 7% (MRR). Surprisingly, we find that this augment-filter-retrain strategy enables the backbone model (UniXcoder) to self-grow. Moreover, extensive experiments show the effectiveness of each component and ChatDANCE has stable performance under different hyperparameter settings. In addition, we conduct qualitative and quantitative analyses to investigate why ChatDANCE works well and find that it learns a more uniform distribution of representations and effectively aligns the code and query spaces.
title You Augment Me: Exploring ChatGPT-based Data Augmentation for Semantic Code Search
topic Software Engineering
url https://arxiv.org/abs/2408.05542