CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation
Yue WangWeishi WangShafiq JotySteven C. H. Hoi
Presents CodeT5, a unified encoder-decoder Transformer that leverages identifier-aware pre-training and bimodal generation tasks to achieve state-of-the-art performance across both code understanding and synthesis benchmarks.
The article addresses challenges in applying pre-trained language models to programming tasks, where existing approaches often use encoder-only or decoder-only architectures that underperform on generation or understanding tasks respectively, and overlook code-specific features such as developer-assigned identifiers that carry semantic information.
The article set out to develop and evaluate a unified encoder-decoder model that supports both code understanding and generation while incorporating token-type information from code.
The authors built CodeT5 on the T5 architecture and pre-trained it on approximately 8.35 million instances from CodeSearchNet and additional GitHub data across eight programming languages. They introduced identifier-aware denoising tasks alongside standard span masking and a bimodal dual generation task using code-comment pairs, then fine-tuned the model on CodeXGLUE benchmark tasks with both task-specific and multi-task learning.
CodeT5 achieved state-of-the-art results on fourteen sub-tasks, including code summarization across six languages, code generation, translation, refinement, defect detection, and clone detection. The base model improved overall summarization scores by more than 1.2 BLEU points over the prior best encoder-decoder model and delivered gains of roughly 4.7 CodeBLEU points on code generation. Identifier-aware pre-training proved especially effective for semantic understanding, while bimodal training particularly benefited natural language to code and code to natural language tasks.
These results indicate that explicitly modeling identifier information and bidirectional natural language-code alignment can produce more capable models for a wide range of software engineering applications, potentially increasing developer productivity and code quality.
The authors recommend adopting the released CodeT5 models and code for downstream applications, while practitioners should treat generated code as drafts requiring expert review. Further work could explore larger-scale training and mitigation of data biases.
Main limitations include the computational resources required for pre-training, possible encoding of social biases from training data, and risks of over-reliance on model outputs or generation of insecure code. Results are supported by extensive experiments across multiple tasks and languages, providing reasonable confidence for the reported performance gains.
- Paper: Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer, Colin Raffel et al. (2020). T5 introduces the unified text-to-text encoder-decoder framework and span-denoising pre-training objectives that directly form the architectural backbone of CodeT5.
- Paper: CodeBERT: A Pre-Trained Model for Programming and Natural Languages, Zhangyin Feng et al. (2020). CodeBERT pioneered bimodal pre-training across programming and natural languages, establishing foundational paradigms and datasets that CodeT5 builds upon.
- Paper: BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension, Mike Lewis et al. (2020). BART establishes sequence-to-sequence denoising autoencoder pre-training that underpins modern unified encoder-decoder models for both generation and understanding.
- Paper: mT5: A Massively Multilingual Pre-trained Text-to-Text Transformer, Linting Xue et al. (2020). mT5 extends the T5 architecture to multi-lingual sequence-to-sequence settings, providing foundational insights for multilingual and multi-task transfer learning.
- Paper: RoBERTa: A Robustly Optimized BERT Pretraining Approach, Yinhan Liu et al. (2019). RoBERTa presents rigorous pre-training methodologies and masking strategies that inform representation learning in code models.
- Paper: BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding, Jacob Devlin et al. (2019). BERT introduces deep bidirectional Transformer pre-training via masked language modeling, establishing the pre-train and fine-tune paradigm utilized across NLP and code understanding.
- Paper: Competition-level code generation with AlphaCode, Yujia Li et al. (2022). AlphaCode advances sequence-to-sequence code generation from function-level synthesis to solving complex, competition-level algorithmic programming problems.
- Paper: Code Llama: Open Foundation Models for Code, Baptiste Rozière et al. (2023). Code Llama scales foundational code models to larger open architectures supporting infilling, repository context, and instruction-following.
- Paper: Textbooks Are All You Need, Suriya Gunasekar et al. (2023). Textbooks Are All You Need demonstrates how curated, high-quality synthetic and educational data can dramatically enhance code synthesis beyond standard web-scraped code corpora.
- Paper: LiveCodeBench: Holistic and Contamination Free Evaluation of Large Language Models for Code, Naman Jain et al. (2025). LiveCodeBench introduces continuous, contamination-free evaluation protocols that address the limitations of static code benchmarks used in evaluating models like CodeT5.
- Paper: BigCodeBench: Benchmarking Code Generation with Diverse Function Calls and Complex Instructions, Terry Yue Zhuo et al. (2025). BigCodeBench expands code evaluation from isolated algorithmic tasks to complex, multi-library function calling and practical software engineering scenarios.
- Paper: Reinforcement Learning for Code Optimization, Pierre Chambon et al.. This work explores reinforcement learning techniques with execution feedback to optimize code runtime efficiency rather than just basic functional correctness.
