Memorization and Generalization in Neural Code Intelligence Models
Not on the map. Why?
Abstract (arXiv)
Deep Neural Networks (DNNs) are increasingly being used in software engineering and code intelligence tasks. These are powerful tools that are capable of learning highly generalizable patterns from large datasets through millions of parameters. At the same time, their large capacity can render them prone to memorizing data points. Recent work suggests that the memorization risk manifests especially strongly when the training dataset is noisy, involving many ambiguous or questionable samples, and memorization is the only recourse. The goal of this paper is to evaluate and compare the extent of memorization and generalization in neural code intelligence models. It aims to provide insights on how memorization may impact the learning behavior of neural models in code intelligence systems. To observe the extent of memorization in models, we add random noise to the original training dataset and use various metrics to quantify the impact of noise on various aspects of training and testing. We evaluate several state-of-the-art neural code intelligence models and benchmarks based on Java, Python, and Ruby codebases. Our results highlight important risks: millions of trainable parameters allow the neural networks to memorize anything, including noisy data, and provide a false sense of generalization. We observed all models manifest some forms of memorization. This can be potentially troublesome in most code intelligence tasks where they rely on rather noise-prone and repetitive data sources, such as code from GitHub. To the best of our knowledge, we provide the first study to quantify memorization effects in the domain of software engineering and code intelligence systems. This work raises awareness and provides new insights into important issues of training neural models in code intelligence systems that are usually overlooked by software engineering researchers.
Key facts. Cited by 19 papers in the map (data through 14 Oct 2026). Builds on 50 of its 94 references that are in the map. First posted on arXiv 16 Jun 2021.
Builds on
50 of 94 references.
References · 50
- 2017Attention Is All You Needcited by 60,361
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
- 2019RoBERTa: A Robustly Optimized BERT Pretraining Approachcited by 13,372
- 2018GLUE: A Multi-Task Benchmark and Analysis Platform for Natural Language Understandingcited by 4,899
- 2016Identity Mappings in Deep Residual Networkscited by 1,965
- 2016Understanding deep learning requires rethinking generalizationcited by 1,674
- 2018Know What You Don't Know: Unanswerable Questions for SQuADcited by 1,554
- 2019Do ImageNet Classifiers Generalize to ImageNet?cited by 1,515
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,310
- 2017A Closer Look at Memorization in Deep Networkscited by 942
- 2018The Secret Sharer: Evaluating and Testing Unintended Memorization in Neural Networkscited by 864
- 2019Generalization through Memorization: Nearest Neighbor Language Modelscited by 800
38 more
- 2015Gated Graph Sequence Neural Networkscited by 796
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 744
- 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 654
- 2021Pervasive Label Errors in Test Sets Destabilize Machine Learning Benchmarkscited by 395
- 2018Insights on representational similarity in neural networks with canonical correlationcited by 324
- 2018Adversarially Robust Generalization Requires More Datacited by 318
- 2018code2vec: Learning Distributed Representations of Codecited by 250
- 2017A Survey of Machine Learning for Big Code and Naturalnesscited by 221
- 2017Learning to Represent Programs with Graphscited by 220
- 2019Machine Learning Testing: Survey, Landscapes and Horizonscited by 218
- 2019Understanding and Utilizing Deep Neural Networks Trained with Noisy Labelscited by 209
- 2018code2seq: Generating Sequences from Structured Representations of Codecited by 179
- 2017What do Neural Machine Translation Models Learn about Morphology?cited by 166
- 2018Learning to Learn from Noisy Labeled Datacited by 160
- 2018The Adverse Effects of Code Duplication in Machine Learning Models of Codecited by 126
- 2018Improving Automatic Source Code Summarization via Deep Reinforcement Learningcited by 100
- 2016A Convolutional Attention Network for Extreme Summarization of Source Codecited by 91
- 2020Improved Code Summarization via a Graph Neural Networkcited by 79
- 2021Memorization vs. Generalization: Quantifying Data Leakage in NLP Performance Evaluationcited by 70
- 2019Adversarial Examples for Models of Codecited by 63
- 2019Let's Agree to Agree: Neural Networks Share Classification Order on Real Datasetscited by 56
- 2020Deep Learning for Source Code Modeling and Generation: Models, Applications and Challengescited by 55
- 2020Semantic Robustness of Models of Source Codecited by 45
- 2020On the Generalizability of Neural Program Models with respect to Semantic-Preserving Program Transformationscited by 44
- 2016Deep API Learningcited by 41
- 2019Neural Program Repair by Jointly Learning to Localize and Repaircited by 40
- 2020Adversarial Robustness for Codecited by 38
- 2019How Often Do Single-Statement Bugs Occur? The ManySStuBs4J Datasetcited by 36
- 2020Rethinking Generalization of Neural Models: A Named Entity Recognition Case Studycited by 35
- 2019Identity Crisis: Memorization and Generalization under Extreme Overparameterizationcited by 33
- 2021Understanding Neural Code Intelligence Through Program Simplificationcited by 22
- 2020Probing Model Signal-Awareness via Prediction-Preserving Input Minimizationcited by 14
- 2018Studying the Difference Between Natural and Programming Language Corporacited by 13
- 2020Embedding Java Classes with code2vec: Improvements from Variable Obfuscationcited by 12
- 2019COSET: A Benchmark for Evaluating Neural Program Embeddingscited by 10
- 2020Evaluation of Generalizability of Neural Program Analyzers under Semantic-Preserving Transformationscited by 9
- 2020Towards Demystifying Dimensions of Source Code Embeddingscited by 9
- 2020Measuring Memorization Effect in Word-Level Neural Networks Probingcited by 3
Built on by
Citing papers per year: 2021: 1; 2022: 3; 2023: 4; 2024: 6; 2025: 5.
19 papers.
Sort:
By area:
- 2024Vulnerability Detection with Code Language Models: How Far Are We?cited by 139
- 2023Deep Learning for Code Intelligence: Survey, Benchmark and Toolkitcited by 22
- 2024Studying LLM Performance on Closed- and Open-source Datacited by 11
- 2022Syntax-Guided Program Reduction for Understanding Neural Code Intelligence Modelscited by 7
- 2025Enhancing Generalization in Chain of Thought Reasoning for Smaller Modelscited by 5
- 2021Code2Snapshot: Using Code Snapshots for Learning Representations of Source Codecited by 4
- 2024A Critical Study of What Code-LLMs (Do Not) Learncited by 4
- 2024Promise and Peril of Collaborative Code Generation Models: Balancing Effectiveness and Memorizationcited by 4
- 2025ObscuraCoder: Powering Efficient Code LM Pre-Training Via Obfuscation Groundingcited by 4
- 2023Study of Distractors in Neural Models of Codecited by 2
- 2024Trojans in Large Language Models of Code: A Critical Review through a Trigger-Based Taxonomycited by 2
- 2023Redundancy and Concept Analysis for Code-trained Language Modelscited by 1
7 more
- 2024Measuring Impacts of Poisoning on Model Parameters and Neuron Activations: A Case Study of Poisoning CodeBERTcited by 1
- 2025Backdoors in Code Summarizers: How Bad Is It?cited by 1
- 2025Effective Code Membership Inference for Code Completion Models via Adversarial Promptscited by 1
- 2022Testing the Robustness of a BiLSTM-based Structural Story Classifiercited by 0
- 2022Extracting Label-specific Key Input Features for Neural Code Intelligence Modelscited by 0
- 2023Artificial Neuropsychology: Are Large Language Models Developing Executive Functions?cited by 0
- 2025Malicious and Unintentional Disclosure Risks in Large Language Models for Code Generationcited by 0
- 2025Effective Code Membership Inference for Code Completion Models via Adversarial Prompts19 Nov 2025
- 2025Backdoors in Code Summarizers: How Bad Is It?2 Jun 2025
- 2025ObscuraCoder: Powering Efficient Code LM Pre-Training Via Obfuscation Grounding27 Mar 2025
- 2025Malicious and Unintentional Disclosure Risks in Large Language Models for Code Generation27 Mar 2025
- 2025Enhancing Generalization in Chain of Thought Reasoning for Smaller Models16 Jan 2025
- 2024Promise and Peril of Collaborative Code Generation Models: Balancing Effectiveness and Memorization18 Sep 2024
- 2024A Critical Study of What Code-LLMs (Do Not) Learn17 Jun 2024
- 2024Trojans in Large Language Models of Code: A Critical Review through a Trigger-Based Taxonomy5 May 2024
- 2024Vulnerability Detection with Code Language Models: How Far Are We?27 Mar 2024
- 2024Studying LLM Performance on Closed- and Open-source Data23 Feb 2024
- 2024Measuring Impacts of Poisoning on Model Parameters and Neuron Activations: A Case Study of Poisoning CodeBERT20 Feb 2024
- 2023Deep Learning for Code Intelligence: Survey, Benchmark and Toolkit30 Dec 2023
7 more
- 2023Artificial Neuropsychology: Are Large Language Models Developing Executive Functions?6 May 2023
- 2023Redundancy and Concept Analysis for Code-trained Language Models1 May 2023
- 2023Study of Distractors in Neural Models of Code3 Mar 2023
- 2022Syntax-Guided Program Reduction for Understanding Neural Code Intelligence Models28 May 2022
- 2022Extracting Label-specific Key Input Features for Neural Code Intelligence Models14 Feb 2022
- 2022Testing the Robustness of a BiLSTM-based Structural Story Classifier3 Jan 2022
- 2021Code2Snapshot: Using Code Snapshots for Learning Representations of Source Code1 Nov 2021
- 2024Vulnerability Detection with Code Language Models: How Far Are We?cited by 139
- 2023Deep Learning for Code Intelligence: Survey, Benchmark and Toolkitcited by 22
- 2024Studying LLM Performance on Closed- and Open-source Datacited by 11
- 2022Syntax-Guided Program Reduction for Understanding Neural Code Intelligence Modelscited by 7
- 2021Code2Snapshot: Using Code Snapshots for Learning Representations of Source Codecited by 4
- 2024A Critical Study of What Code-LLMs (Do Not) Learncited by 4
- 2024Promise and Peril of Collaborative Code Generation Models: Balancing Effectiveness and Memorizationcited by 4
- 2025ObscuraCoder: Powering Efficient Code LM Pre-Training Via Obfuscation Groundingcited by 4
- 2023Study of Distractors in Neural Models of Codecited by 2
- 2024Trojans in Large Language Models of Code: A Critical Review through a Trigger-Based Taxonomycited by 2
- 2023Redundancy and Concept Analysis for Code-trained Language Modelscited by 1
- 2022Testing the Robustness of a BiLSTM-based Structural Story Classifiercited by 0
12 most cited of 15 All 15 (JSON)
- 2025ObscuraCoder: Powering Efficient Code LM Pre-Training Via Obfuscation Grounding27 Mar 2025
- 2025Malicious and Unintentional Disclosure Risks in Large Language Models for Code Generation27 Mar 2025
- 2024Promise and Peril of Collaborative Code Generation Models: Balancing Effectiveness and Memorization18 Sep 2024
- 2024A Critical Study of What Code-LLMs (Do Not) Learn17 Jun 2024
- 2024Trojans in Large Language Models of Code: A Critical Review through a Trigger-Based Taxonomy5 May 2024
- 2024Vulnerability Detection with Code Language Models: How Far Are We?27 Mar 2024
- 2024Studying LLM Performance on Closed- and Open-source Data23 Feb 2024
- 2023Deep Learning for Code Intelligence: Survey, Benchmark and Toolkit30 Dec 2023
- 2023Artificial Neuropsychology: Are Large Language Models Developing Executive Functions?6 May 2023
- 2023Redundancy and Concept Analysis for Code-trained Language Models1 May 2023
- 2023Study of Distractors in Neural Models of Code3 Mar 2023
- 2022Syntax-Guided Program Reduction for Understanding Neural Code Intelligence Models28 May 2022
12 newest of 15 All 15 (JSON)