Papers › CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code...

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

2 Sep 2021EMNLP 2021 11arXiv:2109.00859archive 2025-07-28

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

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 .

PaperPDFConference PDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2109.00859")

Code

Syntology Ran 1 of 11 code samples harvested from 3 repositories linked to this paper; 10 have no recorded run. Of those that ran: 1 ran with no contract checked.

By repository: official repository: 1 sample from 1 repository, 0 ran; community (archive-listed): 10 samples from 2 repositories, 1 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

salesforce/codet5 officialmentioned in papermentioned on GitHubpytorch report
awsm-research/vulrepair mentioned on GitHubjaxMIT report
fewshotcdcs/cdcs mentioned on GitHubpytorch report
salesforce/coderl mentioned on GitHubjaxBSD-3-Clause report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

11 samples harvested; 1 ran; 0 honoured the contract we drafted; 10 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran
10unverified

Licence: 0 of the 11 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from 3 repositories linked to this paper, official or community; each sample names its own and says which. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: 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. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

Seq2Seq salesforce/CodeT5/CodeT5/models.py official repository unverified BSD-3-Clause (permissive) · fde59ee6f478c51c · report
remove_layers_from_model jetbrains-research/commit_message_generation/src/model/configurations/encoder_decoder_wrapper.py community (archive-listed) ran MIT (permissive) · 2b0bcde4b9bbfad6 · report
BaseModel jetbrains-research/commit_message_generation/src/model/configurations/encoder_decoder_wrapper.py community (archive-listed) unverified MIT (permissive) · 69bd5c80d76febfd · report
Batch jetbrains-research/commit_message_generation/src/model/configurations/encoder_decoder_wrapper.py community (archive-listed) unverified MIT (permissive) · 71f1a07d4d450ff9 · report
BatchTest jetbrains-research/commit_message_generation/src/model/configurations/encoder_decoder_wrapper.py community (archive-listed) unverified MIT (permissive) · a268843ac76f4d5f · report
EncoderDecoderWrapper jetbrains-research/commit_message_generation/src/model/configurations/encoder_decoder_wrapper.py community (archive-listed) unverified MIT (permissive) · 682362de430d8871 · report
clean_tokens awsm-research/vulrepair/M1_VulRepair_PL-NL/vulrepair_main.py community (archive-listed) unverified MIT (permissive) · 843ffc9d31ab0578 · report
clean_tokens awsm-research/vulrepair/M10_T5_no_pretrain_word_level/t5_no_pretraining_wordlevel_main.py community (archive-listed) unverified MIT (permissive) · 4e56b8b8e19724a4 · report
convert_examples_to_features awsm-research/vulrepair/M1_VulRepair_PL-NL/vulrepair_main.py community (archive-listed) unverified MIT (permissive) · f4b7f3287895271c · report
convert_examples_to_features awsm-research/vulrepair/M10_T5_no_pretrain_word_level/t5_no_pretraining_wordlevel_main.py community (archive-listed) unverified MIT (permissive) · ba2859de69445f88 · report
evaluate awsm-research/vulrepair/M1_VulRepair_PL-NL/vulrepair_main.py community (archive-listed) unverified MIT (permissive) · 0b0dc8f9dc8cb6b8 · report

Tasks

Clone DetectionCode GenerationCode SummarizationCode TranslationDecoderDefect DetectionMulti-Task LearningText-to-Code Generation

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Code Generation CONCODE CodeT5 BLEU 41.48 #2 of 2 Archive leaderboard report
Code Generation CONCODE CodeT5 CodeBLEU 44.10 #2 of 2 Archive leaderboard report
Code Generation CONCODE CodeT5 Exact Match 22.70 #2 of 2 Archive leaderboard report
Code Translation CodeXGLUE - CodeTrans CodeT5 Accuracy (C#→Java) 66.90 #1 of 2 Archive leaderboard report
Code Translation CodeXGLUE - CodeTrans CodeT5 Accuracy (Java→C#) 65.90 #1 of 2 Archive leaderboard report
Code Translation CodeXGLUE - CodeTrans CodeT5 BLEU (C#→Java) 79.87 #1 of 2 Archive leaderboard report
Code Translation CodeXGLUE - CodeTrans CodeT5 BLEU (Java→C#) 84.03 #1 of 2 Archive leaderboard report
Text-to-Code Generation CodeXGLUE - CONCODE CodeT5 BLEU 41.48 #1 of 2 Archive leaderboard report
Text-to-Code Generation CodeXGLUE - CONCODE CodeT5 CodeBLEU 44.10 #1 of 2 Archive leaderboard report
Text-to-Code Generation CodeXGLUE - CONCODE CodeT5 EM 22.70 #1 of 2 Archive leaderboard report

Ranks are positions in the archive's leaderboards as they stood at the 2025-07-28 snapshot. Results published since then are not among these rows, so a rank here is not a current standing.

Methods

Introduced by this paper: CodeT5

Absolute Position EncodingsAdafactorAdamAttentionAttention DropoutBERTBPECodeT5Cosine AnnealingDense ConnectionsDiscriminative Fine-TuningDropoutGPTGated Linear UnitInverse Square Root ScheduleLabel SmoothingLayer NormalizationLinear LayerLinear Warmup With Cosine AnnealingLinear Warmup With Linear DecayMulti-Head AttentionPosition-Wise Feed-Forward LayerResidual ConnectionSentencePieceSoftmaxT5TransformerWeight DecayWordPiece

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections