Synthetic Semantic Supervision for Contrastive Code Representation Learning in Small Transformers: An Empirical Study
Not on the map. Why?
Abstract (arXiv)
General-purpose code embeddings power tools for code search, classification, and retrieval. Compact transformer encoders for code typically rely on either human-written docstrings (labor-intensive and inconsistent) or mined structural signals such as execution traces (setting-specific and costly to collect). We empirically study an alternative: contrastive pretraining of small encoders with synthetically generated natural-language descriptions emphasizing code functionality and intent, paired with code in a dual-encoder framework at training and discarded at inference. We benchmark this approach against pretraining-based baselines, generalist LLMs, and embedding-specific models on eight retrieval, classification, and generation tasks across C, C++, and Java. Synthetic semantic supervision yields statistically significant gains over pretraining baselines of the same inference-time size on five of eight tasks, with parity on two more; once fine-tuned, it matches or exceeds zero-shot models two orders of magnitude larger on classification, and it stays on par with execution-aware supervision at matched pretraining data, suggesting a scalable, effective alternative to existing code-representation paradigms.
Key facts. No citing papers in the map yet (data through 14 Oct 2026). Builds on 30 of its 46 references that are in the map. First posted on arXiv 3 Sep 2026.
Builds on
30 of 46 references.
References · 30
- 2021Learning Transferable Visual Models From Natural Language Supervisioncited by 33,744
- 2020A Simple Framework for Contrastive Learning of Visual Representationscited by 12,049
- 2018UMAP: Uniform Manifold Approximation and Projection for Dimension Reductioncited by 2,898
- 2020DeBERTa: Decoding-enhanced BERT with Disentangled Attentioncited by 2,181
- 2021SimCSE: Simple Contrastive Learning of Sentence Embeddingscited by 2,173
- 2020Understanding Contrastive Representation Learning through Alignment and Uniformity on the Hyperspherecited by 1,405
- 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 654
- 2020Contrastive Learning with Hard Negative Samplescited by 628
- 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 609
- 2022UniXcoder: Unified Cross-Modal Pre-training for Code Representationcited by 361
- 2019Devign: Effective Vulnerability Identification by Learning Comprehensive Program Semantics via Graph Neural Networkscited by 272
- 2024Nomic Embed: Training a Reproducible Long Context Text Embeddercited by 265
18 more
- 2021CodeNet: A Large-Scale AI for Code Dataset for Learning a Diversity of Coding Taskscited by 200
- 2018code2seq: Generating Sequences from Structured Representations of Codecited by 179
- 2024A Comprehensive Survey of Small Language Models in the Era of Large Language Models: Techniques, Enhancements, Applications, Collaboration with LLMs, and Trustworthinesscited by 127
- 2018Mapping Language to Code in Programmatic Contextcited by 104
- 2020Contrastive Code Representation Learningcited by 76
- 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
- 2022On the Importance of Building High-quality Training Datasets for Neural Code Searchcited by 30
- 2023TRACED: Execution-aware Pre-training for Source Codecited by 27
- 2023A Comparative Analysis of Large Language Models for Code Documentation Generationcited by 24
- 2022CoCoSoDa: Effective Contrastive Learning for Code Searchcited by 22
- 2024Whodunit: Classifying Code as Human Authored or GPT-4 Generated -- A case study on CodeChef problemscited by 13
- 2024The Fault in our Stars: Quality Assessment of Code Generation Benchmarkscited by 9
- 2023Towards Modeling Human Attention from Eye Movements for Neural Source Code Summarizationcited by 8
- 2019Associating Natural Language Comment and Source Code Entitiescited by 6
- 2023CONCORD: Clone-aware Contrastive Learning for Source Codecited by 5
- 2022Do Pre-trained Language Models Indeed Understand Software Engineering Tasks?cited by 4
- 2025Why Personalizing Deep Learning-Based Code Completion Tools Matterscited by 1
Built on by
Not cited yet.