Soft-Labeled Contrastive Pre-training for Function-level Code Representation
Not on the map. Why?
Abstract (arXiv)
Code contrastive pre-training has recently achieved significant progress on code-related tasks. In this paper, we present SCodeR, a Soft-labeled contrastive pre-training framework with two positive sample construction methods to learn functional-level Code Representation. Considering the relevance between codes in a large-scale code corpus, the soft-labeled contrastive pre-training can obtain fine-grained soft-labels through an iterative adversarial manner and use them to learn better code representation. The positive sample construction is another key for contrastive pre-training. Previous works use transformation-based methods like variable renaming to generate semantically equal positive codes. However, they usually result in the generated code with a highly similar surface form, and thus mislead the model to focus on superficial code structure instead of code semantics. To encourage SCodeR to capture semantic information from the code, we utilize code comments and abstract syntax sub-trees of the code to build positive samples. We conduct experiments on four code-related tasks over seven datasets. Extensive experimental results show that SCodeR achieves new state-of-the-art performance on all of them, which illustrates the effectiveness of the proposed pre-training method.
Key facts. Cited by 7 papers in the map (data through 7 Oct 2026). Builds on 30 of its 43 references that are in the map. First posted on arXiv 18 Oct 2022.
Builds on
30 of 43 references.
References · 30
- 2017Attention Is All You Needcited by 59,932
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,491
- 2019RoBERTa: A Robustly Optimized BERT Pretraining Approachcited by 13,266
- 2015Distilling the Knowledge in a Neural Networkcited by 10,076
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2019BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehensioncited by 5,874
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
- 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 890
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 732
- 2019Latent Retrieval for Weakly Supervised Open Domain Question Answeringcited by 691
18 more
- 2019Unified Language Model Pre-training for Natural Language Understanding and Generationcited by 668
- 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 638
- 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 600
- 2021Unified Pre-training for Program Understanding and Generationcited by 361
- 2022UniXcoder: Unified Cross-Modal Pre-training for Code Representationcited by 355
- 2018code2vec: Learning Distributed Representations of Codecited by 249
- 2020IntelliCode Compose: Code Generation Using Transformercited by 225
- 2018The Adverse Effects of Code Duplication in Machine Learning Models of Codecited by 123
- 2020Boosting Contrastive Self-Supervised Learning with False Negative Cancellationcited by 119
- 2021Adversarial Retriever-Ranker for dense text retrievalcited by 82
- 2020Contrastive Code Representation Learningcited by 76
- 2021CoSQA: 20,000+ Web Queries for Code Search and Question Answeringcited by 74
- 2021SynCoBERT: Syntax-Guided Multi-Modal Contrastive Pre-Training for Code Representationcited by 63
- 2020Self-Supervised Contrastive Learning for Code Retrieval and Summarization via Semantic-Preserving Transformationscited by 49
- 2021Incremental False Negative Detection for Contrastive Learningcited by 48
- 2019Learning and Evaluating Contextual Embedding of Source Codecited by 33
- 2021Towards Learning (Dis)-Similarity of Source Code from Program Contrastscited by 17
- 2022CODE-MVP: Learning to Represent Source Code from Multiple Views with Contrastive Pre-Trainingcited by 15
Built on by
Citing papers per year: 2023: 2; 2024: 3; 2025: 2.
7 papers.
- 2024Rewriting the Code: A Simple Method for Large Language Model Augmented Code Searchcited by 17
- 2023Rethinking Negative Pairs in Code Searchcited by 14
- 2024Uncovering LLM-Generated Code: A Zero-Shot Synthetic Code Detector via Code Rewritingcited by 11
- 2023Code Representation Pre-training with Complements from Program Executionscited by 8
- 2024CodeArt: Better Code Models by Attention Regularization When Symbols Are Lackingcited by 7
- 2025On The Role of Pretrained Language Models in General-Purpose Text Embeddings: A Surveycited by 3
- 2025OASIS: Order-Augmented Strategy for Improved Code Searchcited by 2
- 2025On The Role of Pretrained Language Models in General-Purpose Text Embeddings: A Survey28 Jul 2025
- 2025OASIS: Order-Augmented Strategy for Improved Code Search11 Mar 2025
- 2024Uncovering LLM-Generated Code: A Zero-Shot Synthetic Code Detector via Code Rewriting25 May 2024
- 2024CodeArt: Better Code Models by Attention Regularization When Symbols Are Lacking19 Feb 2024
- 2024Rewriting the Code: A Simple Method for Large Language Model Augmented Code Search9 Jan 2024
- 2023Rethinking Negative Pairs in Code Search12 Oct 2023
- 2023Code Representation Pre-training with Complements from Program Executions4 Sep 2023