{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/coacor-code-annotation-for-code-retrieval","title":"CoaCor: Code Annotation for Code Retrieval with Reinforcement Learning","arxiv_id":"1904.00720","date":"2019-03-13","proceeding":null,"authors":["Ziyu Yao","Jayavardhan Reddy Peddamail","Huan Sun"],"abstract":"To accelerate software development, much research has been performed to help\npeople understand and reuse the huge amount of available code resources. Two\nimportant tasks have been widely studied: code retrieval, which aims to\nretrieve code snippets relevant to a given natural language query from a code\nbase, and code annotation, where the goal is to annotate a code snippet with a\nnatural language description. Despite their advancement in recent years, the\ntwo tasks are mostly explored separately. In this work, we investigate a novel\nperspective of Code annotation for Code retrieval (hence called `CoaCor'),\nwhere a code annotation model is trained to generate a natural language\nannotation that can represent the semantic meaning of a given code snippet and\ncan be leveraged by a code retrieval model to better distinguish relevant code\nsnippets from others. To this end, we propose an effective framework based on\nreinforcement learning, which explicitly encourages the code annotation model\nto generate annotations that can be used for the retrieval task. Through\nextensive experiments, we show that code annotations generated by our framework\nare much more detailed and more useful for code retrieval, and they can further\nimprove the performance of existing code retrieval models significantly.","url_abs":"http://arxiv.org/abs/1904.00720v1","url_pdf":"http://arxiv.org/pdf/1904.00720v1.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"coacor-code-annotation-for-code-retrieval","repo_url":"https://github.com/LittleYUYU/CoaCor","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[{"task_slug":"reinforcement-learning","task_name":"Reinforcement Learning"},{"task_slug":"reinforcement-learning-1","task_name":"Reinforcement Learning (RL)"},{"task_slug":"retrieval","task_name":"Retrieval"},{"task_slug":"reinforcement-learning-2","task_name":"reinforcement-learning"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/1904.00720","atlas_url":"https://app.syntology.ai/?focus=1904.00720","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"1904.00720"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/LittleYUYU/CoaCor","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"unverified":11},"by_repo_kind":{"official":{"samples":11,"ran":0,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"041969a396e87962","entry":"cos_np","repo":"LittleYUYU/CoaCor","repo_kind":"official","path":"code/CodeRetrieval-Main/code/utils.py","file_url":"https://github.com/LittleYUYU/CoaCor/blob/HEAD/code/CodeRetrieval-Main/code/utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"041969a396e87962"}},{"code_sha256_prefix":"cbe2069a075e6e0c","entry":"dot_np","repo":"LittleYUYU/CoaCor","repo_kind":"official","path":"code/CodeRetrieval-Main/code/utils.py","file_url":"https://github.com/LittleYUYU/CoaCor/blob/HEAD/code/CodeRetrieval-Main/code/utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"cbe2069a075e6e0c"}},{"code_sha256_prefix":"8c405090ea694b22","entry":"get_aligned_embedding","repo":"LittleYUYU/CoaCor","repo_kind":"official","path":"code/code_annotation/a2c-train.py","file_url":"https://github.com/LittleYUYU/CoaCor/blob/HEAD/code/code_annotation/a2c-train.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"8c405090ea694b22"}},{"code_sha256_prefix":"413d087fe8bff822","entry":"get_config","repo":"LittleYUYU/CoaCor","repo_kind":"official","path":"code/CodeRetrieval-Main/code/configs.py","file_url":"https://github.com/LittleYUYU/CoaCor/blob/HEAD/code/CodeRetrieval-Main/code/configs.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"413d087fe8bff822"}},{"code_sha256_prefix":"a9f21950fb827c6d","entry":"get_rank","repo":"LittleYUYU/CoaCor","repo_kind":"official","path":"code/CodeRetrieval-Main/code/ensemble.py","file_url":"https://github.com/LittleYUYU/CoaCor/blob/HEAD/code/CodeRetrieval-Main/code/ensemble.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"a9f21950fb827c6d"}},{"code_sha256_prefix":"a07f7713e1872a63","entry":"limit_vocab","repo":"LittleYUYU/CoaCor","repo_kind":"official","path":"code/CodeRetrieval-Main/code/data.py","file_url":"https://github.com/LittleYUYU/CoaCor/blob/HEAD/code/CodeRetrieval-Main/code/data.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"a07f7713e1872a63"}},{"code_sha256_prefix":"c409ff1142d08d65","entry":"load_dict","repo":"LittleYUYU/CoaCor","repo_kind":"official","path":"code/CodeRetrieval-Main/code/data.py","file_url":"https://github.com/LittleYUYU/CoaCor/blob/HEAD/code/CodeRetrieval-Main/code/data.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"c409ff1142d08d65"}},{"code_sha256_prefix":"33e433978ce44e47","entry":"normalize","repo":"LittleYUYU/CoaCor","repo_kind":"official","path":"code/CodeRetrieval-Main/code/utils.py","file_url":"https://github.com/LittleYUYU/CoaCor/blob/HEAD/code/CodeRetrieval-Main/code/utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"33e433978ce44e47"}},{"code_sha256_prefix":"fd69d94337ac6494","entry":"processed_dataset","repo":"LittleYUYU/CoaCor","repo_kind":"official","path":"code/code_annotation/code_retrieval/CodeRetrievalCritic.py","file_url":"https://github.com/LittleYUYU/CoaCor/blob/HEAD/code/code_annotation/code_retrieval/CodeRetrievalCritic.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"fd69d94337ac6494"}},{"code_sha256_prefix":"e73e640366ffedf6","entry":"weighting_scores_codenn","repo":"LittleYUYU/CoaCor","repo_kind":"official","path":"code/CodeRetrieval-Main/code/ensemble.py","file_url":"https://github.com/LittleYUYU/CoaCor/blob/HEAD/code/CodeRetrieval-Main/code/ensemble.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"e73e640366ffedf6"}},{"code_sha256_prefix":"53857a2d4dcb69b2","entry":"weighting_scores_staqc","repo":"LittleYUYU/CoaCor","repo_kind":"official","path":"code/CodeRetrieval-Main/code/ensemble.py","file_url":"https://github.com/LittleYUYU/CoaCor/blob/HEAD/code/CodeRetrieval-Main/code/ensemble.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"53857a2d4dcb69b2"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}