mlsanityData to 7 Oct 2026

ContraBERT: Enhancing Code Pre-trained Models via Contrastive Learning

arXiv 2301.09072 ↗First posted 22 Jan 2023cs.SEcited by 16

Not on the map. Why?

Abstract (arXiv)

Large-scale pre-trained models such as CodeBERT, GraphCodeBERT have earned widespread attention from both academia and industry. Attributed to the superior ability in code representation, they have been further applied in multiple downstream tasks such as clone detection, code search and code translation. However, it is also observed that these state-of-the-art pre-trained models are susceptible to adversarial attacks. The performance of these pre-trained models drops significantly with simple perturbations such as renaming variable names. This weakness may be inherited by their downstream models and thereby amplified at an unprecedented scale. To this end, we propose an approach namely ContraBERT that aims to improve the robustness of pre-trained models via contrastive learning. Specifically, we design nine kinds of simple and complex data augmentation operators on the programming language (PL) and natural language (NL) data to construct different variants. Furthermore, we continue to train the existing pre-trained models by masked language modeling (MLM) and contrastive pre-training task on the original samples with their augmented variants to enhance the robustness of the model. The extensive experiments demonstrate that ContraBERT can effectively improve the robustness of the existing pre-trained models. Further study also confirms that these robustness-enhanced models provide improvements as compared to original models over four popular downstream tasks.

Key facts. Cited by 16 papers in the map (data through 7 Oct 2026). First posted on arXiv 22 Jan 2023.

Builds on

No reference list yet.

Built on by

Cited by year

Citing papers per year: 2023: 8; 2024: 3; 2025: 5.

16 papers.

Sort:

By area:

  1. 2024Finetuning Large Language Models for Vulnerability Detectioncited by 39
  2. 2023Multi-target Backdoor Attacks for Code Pre-trained Modelscited by 19
  3. 2023Understanding Programs by Exploiting (Fuzzing) Test Casescited by 13
  4. 2023Pitfalls in Language Models for Code Intelligence: A Taxonomy and Surveycited by 9
  5. 2023Code Representation Pre-training with Complements from Program Executionscited by 8
  6. 2023Neuro Symbolic Reasoning for Planning: Counterexample Guided Inductive Synthesis using Large Language Models and Satisfiability Solvingcited by 6
  7. 2023The EarlyBIRD Catches the Bug: On Exploiting Early Layers of Encoder Models for More Efficient Code Classificationcited by 5
  8. 2025Functional Consistency of LLM Code Embeddings: A Self-Evolving Data Synthesis Framework for Benchmarkingcited by 4
  9. 2023A Black-Box Attack on Code Models via Representation Nearest Neighbor Searchcited by 3
  10. 2024Solution-oriented Agent-based Models Generation with Verifier-assisted Iterative In-context Learningcited by 2
  11. 2025Semantic-Preserving Transformations as Mutation Operators: A Study on Their Effectiveness in Defect Detectioncited by 2
  12. 2025Variational Prefix Tuning for Diverse and Accurate Code Summarization Using Pre-trained Language Modelscited by 1
4 more
  1. 2023Source Code is a Graph, Not a Sequence: A Cross-Lingual Perspective on Code Clone Detectioncited by 0
  2. 2024CLNX: Bridging Code and Natural Language for C/C++ Vulnerability-Contributing Commits Identificationcited by 0
  3. 2025LoRACode: LoRA Adapters for Code Embeddingscited by 0
  4. 2025SoK: Understanding (New) Security Issues Across AI4Code Use Casescited by 0