Year
Month
(Preprint) CLSEBERT: Contrastive Learning for Syntax Enhanced Code Pre-Trained Model
Xin Wang ¹, Yasheng Wang ², Pingyi Zhou ², Meng Xiao ², Yadao Wang ², Li Li ³, Xiao Liu ⁴, Hao Wu 武浩 ⁵, Jin Liu 刘进 ¹, Xin Jiang ²
¹ School of Computer Science, Wuhan University 武汉大学 计算机学院
² Noah's Ark Lab, Huawei 华为 诺亚方舟实验室
³ Faculty of Information Technology, Monash University
⁴ School of Information Technology, Deakin University
⁵ School of Information Science and Engineering, Yunnan University 云南大学 信息学院
arXiv, 2021-08-10
Abstract

Pre-trained models for programming languages have proven their significant values in various code-related tasks, such as code search, code clone detection, and code translation. Currently, most pre-trained models treat a code snippet as a sequence of tokens or only focus on the data flow between code identifiers.

However, rich code syntax and hierarchy are ignored which can provide important structure information and semantic rules of codes to help enhance code representations. In addition, although the BERT-based code pre-trained models achieve high performance on many downstream tasks, the native derived sequence representations of BERT are proven to be of low-quality, it performs poorly on code matching and similarity tasks.

To address these problems, we propose CLSEBERT, a Constrastive Learning Framework for Syntax Enhanced Code Pre-Trained Model, to deal with various code intelligence tasks. In the pre-training stage, we consider the code syntax and hierarchy contained in the Abstract Syntax Tree (AST) and leverage the constrastive learning to learn noise-invariant code representations. Besides the masked language modeling (MLM), we also introduce two novel pre-training objectives. One is to predict the edges between nodes in the abstract syntax tree, and the other is to predict the types of code tokens. Through extensive experiments on four code intelligence tasks, we successfully show the effectiveness of our proposed model.
CLSEBERT: Contrastive Learning for Syntax Enhanced Code Pre-Trained Model_1
CLSEBERT: Contrastive Learning for Syntax Enhanced Code Pre-Trained Model_2
CLSEBERT: Contrastive Learning for Syntax Enhanced Code Pre-Trained Model_3
CLSEBERT: Contrastive Learning for Syntax Enhanced Code Pre-Trained Model_4
  • Tunable compound eyes with coaxial lens-on-lens ommatidia for cooperative bi-focal imaging
  • Zhi-Juan Sun, Wei-Jian Zhong, Qing Cai, Yi-Fan Lu, Chang-Xu Li, Dong-Dong Han, Yong-Lai Zhang
  • Opto-Electronic Advances
  • 2026-02-09
  • High-efficiency infrared upconversion imaging with nonlinear silicon metasurfaces empowered by quasi-bound states in the continuum
  • Tingting Liu, Jumin Qiu, Meibao Qin, Xu Tu Huifu Qiu, Feng Wu, Tianbao Yu, Qiegen Liu, Shuyuan Xiao
  • Opto-Electronic Advances
  • 2026-01-29
  • Timeshare surface-enhanced Raman scattering platform with sensitive and quantitative mode
  • Qianqian Ding, Xueyan Chen, Yunlu Jia, Hong Liu, Xiaochen Zhang, Ningtao Cheng, Shikuan Yang
  • Opto-Electronic Advances
  • 2026-01-27
  • Electric-field-induced second-harmonic generation
  • Hangkai Fan, Alexey Proskurin, Mingzhao Song, Andrey Bogdanov
  • Opto-Electronic Advances
  • 2026-01-27
  • Fiber-optic microstructured sensors based on abrupt field patterns: theory, fabrication, and applications
  • Yuxuan Yi, Wanlai Zhu, Zao Yi, Zigang Zhou, Shubo Cheng, Majid Niaz Akhtar, Sohail Ahmad
  • Opto-Electronic Science
  • 2026-01-23
  • Integrated metasurface-freeform system enabled multi-focal planes augmented reality display
  • Shifei Zhang, Lina Gao, Yidan Zhao, Yongdong Wang, Bo Wang, Junjie Li, Jiaxi Duan, Dewen Cheng, Cheng-Wei Qiu, Yongtian Wang, Tong Yang, Lingling Huang
  • Opto-Electronic Science
  • 2026-01-23
  • Decoding subject-invariant emotional information from cardiac signals detected by photonic sensing system
  • Yukun Long, Rui Min Kun Xiao, Zhuo Wang, Lanfang Liu, Yifan Sun, Xiaoli Li, Zhaohui Li, Zeev Zalevsky
  • Opto-Electronic Technology
  • 2025-12-25
  • Integrated photonic synapses, neurons, memristors, and neural networks for photonic neuromorphic computing
  • Shufei Han, Weihong Shen, Min Gu, Qiming Zhang
  • Opto-Electronic Technology
  • 2025-12-25
  • Photoacoustic spectroscopy and light-induced thermoelastic spectroscopy based on inverted-triangular lithium niobate tuning fork
  • Junjie Mu, Guowei Han, Runqiu Wang, Shunda Qiao, Ying He Yufei Ma
  • Opto-Electronic Science
  • 2025-12-25
  • Thin-film lithium niobate-based detector: recent advances and perspectives
  • Xiaoli Sun, Yuechen Jia, Feng Chen
  • Opto-Electronic Science
  • 2025-12-25
  • In-situ and ex-situ twisted bilayer liquid crystal computing platform for reconfigurable image processing
  • Kang Zeng, Yougang Ke, Zhangming Hong, Linzhou Zeng, Xinxing Zhou
  • Opto-Electronic Advances
  • 2025-12-25
  • Highly textured single-crystal-like perovskite films for large-area, high-performance photodiodes
  • Runkai Liu, Feng Li, Rongkun Zheng
  • Opto-Electronic Advances
  • 2025-12-25



  • Grassland: A Rapid Algebraic Modeling System for Million-variable Optimization                                China's Technology Cooperation with Russia: Geopolitics, Economics, and Regime Security
    About
    |
    Contact
    |
    Copyright © PubCard