CoaCor: Code Annotation for Code Retrieval with Reinforcement Learning
arXiv:1904.00720 · doi:10.1145/3308558.3313632
Abstract
To accelerate software development, much research has been performed to help people understand and reuse the huge amount of available code resources. Two important tasks have been widely studied: code retrieval, which aims to retrieve code snippets relevant to a given natural language query from a code base, and code annotation, where the goal is to annotate a code snippet with a natural language description. Despite their advancement in recent years, the two tasks are mostly explored separately. In this work, we investigate a novel perspective of Code annotation for Code retrieval (hence called `CoaCor'), where a code annotation model is trained to generate a natural language annotation that can represent the semantic meaning of a given code snippet and can be leveraged by a code retrieval model to better distinguish relevant code snippets from others. To this end, we propose an effective framework based on reinforcement learning, which explicitly encourages the code annotation model to generate annotations that can be used for the retrieval task. Through extensive experiments, we show that code annotations generated by our framework are much more detailed and more useful for code retrieval, and they can further improve the performance of existing code retrieval models significantly.
10 pages, 2 figures. Accepted by The Web Conference (WWW) 2019
References in corpus (16)
- Adam: A Method for Stochastic Optimization
- Sequence to Sequence Learning with Neural Networks
- Recurrent Neural Network Regularization
- NLTK: The Natural Language Toolkit
- A Deep Reinforced Model for Abstractive Summarization
- Sequence Level Training with Recurrent Neural Networks
- How NOT To Evaluate Your Dialogue System: An Empirical Study of Unsupervised Evaluation Metrics for Dialogue Response Generation
- Dual Learning for Machine Translation
- IRGAN: A Minimax Game for Unifying Generative and Discriminative Information Retrieval Models
- Deep Reinforcement Learning for Dialogue Generation
- An Actor-Critic Algorithm for Sequence Prediction
- Question Answering and Question Generation as Dual Tasks
- A Convolutional Attention Network for Extreme Summarization of Source Code
- Neural Network Models for Paraphrase Identification, Semantic Textual Similarity, Natural Language Inference, and Question Answering
- StaQC: A Systematically Mined Question-Code Dataset from Stack Overflow
- Comment Generation for Source Code: State of the Art, Challenges and Opportunities
Cited by in corpus (22)
- Opportunities and Challenges in Code Search Tools
- Deep Graph Matching and Searching for Semantic Code Retrieval
- Code Search based on Context-aware Code Translation
- A Multi-Perspective Architecture for Semantic Code Search
- Cross-Domain Deep Code Search with Meta Learning
- Precise Learning of Source Code Contextual Semantics via Hierarchical Dependence Structure and Graph Attention Networks
- Survey of Code Search Based on Deep Learning
- TranS^3: A Transformer-based Framework for Unifying Code Summarization and Code Search
- Neural Code Search Revisited: Enhancing Code Snippet Retrieval through Natural Language Intent
- A Survey on Machine Learning Techniques for Source Code Analysis
- OCoR: An Overlapping-Aware Code Retriever
- BERT2Code: Can Pretrained Language Models be Leveraged for Code Search?
- Approaching Code Search for Python as a Translation Retrieval Problem with Dual Encoders
- GraphSearchNet: Enhancing GNNs via Capturing Global Dependencies for Semantic Code Search
- COSEA: Convolutional Code Search with Layer-wise Attention
- CoSQA: 20,000+ Web Queries for Code Search and Question Answering
- Enriching Query Semantics for Code Search with Reinforcement Learning
- PSCS: A Path-based Neural Model for Semantic Code Search
- Exploiting Method Names to Improve Code Summarization: A Deliberation Multi-Task Learning Approach
- Learning to Selectively Learn for Weakly-supervised Paraphrase Generation
- Adversarial Training for Code Retrieval with Question-Description Relevance Regularization
- Evaluation of Siamese Networks for Semantic Code Search