atlas

Research map / Label-efficient and robust learning / Self-supervised and contrastive

CODE REPRESENTATION LEARNING AT SCALE

ICLR 2024 · Label-efficient and robust learning › Self-supervised and contrastive · approach: Representation evaluation and trade-offs · 1 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Proposes CodeSage, a two-stage pretraining scheme for code encoders (DOBF plus full-mask MLM, then bimodal contrastive learning with hard negatives and hard positives) at 130M, 356M, and 1.3B parameters, outperforming prior code encoders on zero-shot code search and classification.

Problem

Existing code representation (embedding) encoders are small (around 125M parameters) and trained on limited corpora, and standard BERT-style MLM masking (80-10-10) is suboptimal for source code.

Approach

Combine identifier deobfuscation with full-mask MLM (no 80-10-10 corruption) in stage I, then contrastive learning on (docstring summary, function body) pairs with distance-based hard negative weighting and hard positives formed by removing the function signature and return statements.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
use Full Mask instead of 80-10-10 masking (ablation)CodeSage pretraining · downstream tasksperformanceHelped
combine DOBF and random masking in parallel rather than sequentially (ablation)CodeSage-base · Code2Code (In)MAP (%): 25.3 -> 29.2Helped
add DOBF to random masking (ablation)CodeSage pretraining · NL2Code search and classificationperformanceHelped
add random masking to DOBF (ablation)CodeSage pretraining · Code2Code in-language and cross-language searchperformanceHelped
add hard negatives (ablation)bimodal contrastive learning · semantic searchperformanceHelped
add hard positives by removing function signatures and return statements (ablation)bimodal contrastive learning · semantic searchperformanceHelped
add hard positives and hard negatives together (ablation)bimodal contrastive learning · semantic searchperformanceHelped
use dropout-based unimodal rather than bimodal contrastive learning (ablation)CodeSage pretraining · semantic search with long trainingperformanceHurt
add Stage-II contrastive learning after Stage-I token-level denoising (ablation)CodeSage · cross-lingual semantic searchperformanceHelped
train with contrastive learning only from scratch, without token-level denoising (ablation)CodeSage · multilingual in-language code searchperformance scaling with model sizeHurt
use 15% masking rather than 7.5%, 30%, or dynamic [10%, 50%] masking (ablation)CodeSage-base with Full Mask · zero-shot Code2Code searchperformanceHelped

Surprising findings

Limitations

Experimental setup

Datasets: The Stack CodeSearchNet CodeNet CoSQA AdvTest CodeXGLUE Defect Code Complexity Python Runtime Errors

Benchmarks: Code2Code search (CodeNet-based, nine languages) CoSQA AdvTest CSN Code Defect Code Complexity RunTime error prediction

Metrics: MAP MRR F1 macro

Baselines: CodeBERT GraphCodeBERT StarEncoder UnixCoder OpenAI-Embedding-Ada-002 CodeGen2.5 (7B) Starcoder (15.5B) CodeT5+ (16B) Encoder

Builds on: BERT SimCLR DOBF SimCSE UnixCoder

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy