Probing Semantic Grounding in Language Models of Code with Representational Similarity Analysis
Not on the map. Why?
Abstract (arXiv)
Representational Similarity Analysis is a method from cognitive neuroscience, which helps in comparing representations from two different sources of data. In this paper, we propose using Representational Similarity Analysis to probe the semantic grounding in language models of code. We probe representations from the CodeBERT model for semantic grounding by using the data from the IBM CodeNet dataset. Through our experiments, we show that current pre-training methods do not induce semantic grounding in language models of code, and instead focus on optimizing form-based patterns. We also show that even a little amount of fine-tuning on semantically relevant tasks increases the semantic grounding in CodeBERT significantly. Our ablations with the input modality to the CodeBERT model show that using bimodal inputs (code and natural language) over unimodal inputs (only code) gives better semantic grounding and sample efficiency during semantic fine-tuning. Finally, our experiments with semantic perturbations in code reveal that CodeBERT is able to robustly distinguish between semantically correct and incorrect code.
Key facts. Cited by 3 papers in the map (data through 7 Oct 2026). Builds on 16 of its 19 references that are in the map. First posted on arXiv 15 Jul 2022.
Builds on
16 of 19 references.
References · 16
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2021Program Synthesis with Large Language Modelscited by 3,509
- 2020The Pile: An 800GB Dataset of Diverse Text for Language Modelingcited by 2,346
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
- 2018Spider: A Large-Scale Human-Labeled Dataset for Complex and Cross-Domain Semantic Parsing and Text-to-SQL Taskcited by 1,120
- 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 890
- 2020A Primer in BERTology: What we know about how BERT workscited by 807
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 732
- 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 638
- 2021Unified Pre-training for Program Understanding and Generationcited by 361
- 2022Black-Box Tuning for Language-Model-as-a-Servicecited by 254
- 2021CodeNet: A Large-Scale AI for Code Dataset for Learning a Diversity of Coding Taskscited by 199
4 more
- 2020What Happens To BERT Embeddings During Fine-tuning?cited by 113
- 2019Blackbox meets blackbox: Representational Similarity and Stability Analysis of Neural Language Models and Brainscited by 37
- 2019Linking artificial and human neural representations of languagecited by 37
- 2020Picking BERT's Brain: Probing for Linguistic Dependencies in Contextualized Embeddings Using Representational Similarity Analysiscited by 18
Built on by
Citing papers per year: 2023: 1; 2024: 1; 2025: 1.
3 papers.
- 2023Decoding In-Context Learning: Neuroscience-inspired Analysis of Representations in Large Language Modelscited by 7
- 2024On the Limitations of Embedding Based Methods for Measuring Functional Correctness for Code Generationcited by 6
- 2025ObscuraCoder: Powering Efficient Code LM Pre-Training Via Obfuscation Groundingcited by 4
- 2025ObscuraCoder: Powering Efficient Code LM Pre-Training Via Obfuscation Grounding27 Mar 2025
- 2024On the Limitations of Embedding Based Methods for Measuring Functional Correctness for Code Generation26 Apr 2024
- 2023Decoding In-Context Learning: Neuroscience-inspired Analysis of Representations in Large Language Models30 Sep 2023