TasksSotADatasetsPapersMethodsSubmitAbout
Papers With Code 2

A community resource for machine learning research: papers, code, benchmarks, and state-of-the-art results.

Explore

Notable BenchmarksAll SotADatasetsPapersMethods

Community

Submit ResultsAbout

Data sourced from the PWC Archive (CC-BY-SA 4.0). Built by the community, for the community.

Papers/CodeT5: Identifier-aware Unified Pre-trained Encoder-Decod...

CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation

Yue Wang, Weishi Wang, Shafiq Joty, Steven C. H. Hoi

2021-09-02EMNLP 2021 11Text-to-Code GenerationCode TranslationDefect DetectionClone DetectionMulti-Task LearningCode SummarizationCode Generation
PaperPDFCodeCode(official)CodeCodeCode

Abstract

Pre-trained models for Natural Languages (NL) like BERT and GPT have been recently shown to transfer well to Programming Languages (PL) and largely benefit a broad set of code-related tasks. Despite their success, most current methods either rely on an encoder-only (or decoder-only) pre-training that is suboptimal for generation (resp. understanding) tasks or process the code snippet in the same way as NL, neglecting the special characteristics of PL such as token types. We present CodeT5, a unified pre-trained encoder-decoder Transformer model that better leverages the code semantics conveyed from the developer-assigned identifiers. Our model employs a unified framework to seamlessly support both code understanding and generation tasks and allows for multi-task learning. Besides, we propose a novel identifier-aware pre-training task that enables the model to distinguish which code tokens are identifiers and to recover them when they are masked. Furthermore, we propose to exploit the user-written code comments with a bimodal dual generation task for better NL-PL alignment. Comprehensive experiments show that CodeT5 significantly outperforms prior methods on understanding tasks such as code defect detection and clone detection, and generation tasks across various directions including PL-NL, NL-PL, and PL-PL. Further analysis reveals that our model can better capture semantic information from code. Our code and pre-trained models are released at https: //github.com/salesforce/CodeT5 .

Results

TaskDatasetMetricValueModel
Code GenerationCONCODEBLEU41.48CodeT5
Code GenerationCONCODECodeBLEU44.1CodeT5
Code GenerationCONCODEExact Match22.7CodeT5
Code GenerationCodeXGLUE - CodeTransAccuracy (C#→Java)66.9CodeT5
Code GenerationCodeXGLUE - CodeTransAccuracy (Java→C#)65.9CodeT5
Code GenerationCodeXGLUE - CodeTransBLEU (C#→Java)79.87CodeT5
Code GenerationCodeXGLUE - CodeTransBLEU (Java→C#)84.03CodeT5
Text-to-Code GenerationCodeXGLUE - CONCODEBLEU41.48CodeT5
Text-to-Code GenerationCodeXGLUE - CONCODECodeBLEU44.1CodeT5
Text-to-Code GenerationCodeXGLUE - CONCODEEM22.7CodeT5

Related Papers

CUDA-L1: Improving CUDA Optimization via Contrastive Reinforcement Learning2025-07-18SGCL: Unifying Self-Supervised and Supervised Learning for Graph Recommendation2025-07-17Towards Formal Verification of LLM-Generated Code from Natural Language Prompts2025-07-17MERA Code: A Unified Framework for Evaluating Code Generation Across Tasks2025-07-16Scaling Up RL: Unlocking Diverse Reasoning in LLMs via Prolonged Training2025-07-16Function-to-Style Guidance of LLMs for Code Translation2025-07-15Robust-Multi-Task Gradient Boosting2025-07-15The Devil behind the mask: An emergent safety vulnerability of Diffusion LLMs2025-07-15