{"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/unixcoder-unified-cross-modal-pre-training","title":"UniXcoder: Unified Cross-Modal Pre-training for Code Representation","arxiv_id":"2203.03850","date":"2022-03-08","proceeding":"ACL 2022 5","authors":["Daya Guo","Shuai Lu","Nan Duan","Yanlin Wang","Ming Zhou","Jian Yin"],"abstract":"Pre-trained models for programming languages have recently demonstrated great success on code intelligence. To support both code-related understanding and generation tasks, recent works attempt to pre-train unified encoder-decoder models. However, such encoder-decoder framework is sub-optimal for auto-regressive tasks, especially code completion that requires a decoder-only manner for efficient inference. In this paper, we present UniXcoder, a unified cross-modal pre-trained model for programming language. The model utilizes mask attention matrices with prefix adapters to control the behavior of the model and leverages cross-modal contents like AST and code comment to enhance code representation. To encode AST that is represented as a tree in parallel, we propose a one-to-one mapping method to transform AST in a sequence structure that retains all structural information from the tree. Furthermore, we propose to utilize multi-modal contents to learn representation of code fragment with contrastive learning, and then align representations among programming languages using a cross-modal generation task. We evaluate UniXcoder on five code-related tasks over nine datasets. To further evaluate the performance of code fragment representation, we also construct a dataset for a new task, called zero-shot code-to-code search. Results show that our model achieves state-of-the-art performance on most tasks and analysis reveals that comment and AST can both enhance UniXcoder.","url_abs":"https://arxiv.org/abs/2203.03850v1","url_pdf":"https://arxiv.org/pdf/2203.03850v1.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":"unixcoder-unified-cross-modal-pre-training","repo_url":"https://github.com/microsoft/CodeBERT","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"unixcoder-unified-cross-modal-pre-training","repo_url":"https://github.com/celbree/reacc","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"code-completion","task_name":"Code Completion"},{"task_slug":"code-search","task_name":"Code Search"},{"task_slug":"contrastive-learning","task_name":"Contrastive Learning"},{"task_slug":"decoder","task_name":"Decoder"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2203.03850","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2203.03850"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+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/celbree/reacc","reach":null},{"provenance":"deterministic:regex_extraction","url":"https://github.com/microsoft/CodeBERT","reach":null}],"summary":{"ran":2,"unverified":2},"by_repo_kind":{"official":{"samples":2,"ran":1,"repositories":1},"listed":{"samples":2,"ran":1,"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":"2af39b0537b177ac","entry":"Beam","repo":"microsoft/CodeBERT","repo_kind":"official","path":"UniXcoder/unixcoder.py","file_url":"https://github.com/microsoft/CodeBERT/blob/HEAD/UniXcoder/unixcoder.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"2af39b0537b177ac"}},{"code_sha256_prefix":"c12eead558180dcb","entry":"RobertaLMHead","repo":"celbree/reacc","repo_kind":"listed","path":"model.py","file_url":"https://github.com/celbree/reacc/blob/HEAD/model.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"c12eead558180dcb"}},{"code_sha256_prefix":"0722e58fd64d7bcf","entry":"SimpleModel","repo":"celbree/reacc","repo_kind":"listed","path":"model.py","file_url":"https://github.com/celbree/reacc/blob/HEAD/model.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"0722e58fd64d7bcf"}},{"code_sha256_prefix":"01a9fd1ab720469b","entry":"UniXcoder","repo":"microsoft/CodeBERT","repo_kind":"official","path":"UniXcoder/unixcoder.py","file_url":"https://github.com/microsoft/CodeBERT/blob/HEAD/UniXcoder/unixcoder.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"01a9fd1ab720469b"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}