mlsanityData to 14 Oct 2026

Memorization and Generalization in Neural Code Intelligence Models

arXiv 2106.08704 ↗First posted 16 Jun 2021cs.LG cs.PL cs.SEcited by 19

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

  1. 2017Attention Is All You Needcited by 60,361
  2. 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
  3. 2019RoBERTa: A Robustly Optimized BERT Pretraining Approachcited by 13,372
  4. 2018GLUE: A Multi-Task Benchmark and Analysis Platform for Natural Language Understandingcited by 4,899
  5. 2016Identity Mappings in Deep Residual Networkscited by 1,965
  6. 2016Understanding deep learning requires rethinking generalizationcited by 1,674
  7. 2018Know What You Don't Know: Unanswerable Questions for SQuADcited by 1,554
  8. 2019Do ImageNet Classifiers Generalize to ImageNet?cited by 1,515
  9. 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,310
  10. 2017A Closer Look at Memorization in Deep Networkscited by 942
  11. 2018The Secret Sharer: Evaluating and Testing Unintended Memorization in Neural Networkscited by 864
  12. 2019Generalization through Memorization: Nearest Neighbor Language Modelscited by 800
38 more
  1. 2015Gated Graph Sequence Neural Networkscited by 796
  2. 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 744
  3. 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 654
  4. 2021Pervasive Label Errors in Test Sets Destabilize Machine Learning Benchmarkscited by 395
  5. 2018Insights on representational similarity in neural networks with canonical correlationcited by 324
  6. 2018Adversarially Robust Generalization Requires More Datacited by 318
  7. 2018code2vec: Learning Distributed Representations of Codecited by 250
  8. 2017A Survey of Machine Learning for Big Code and Naturalnesscited by 221
  9. 2017Learning to Represent Programs with Graphscited by 220
  10. 2019Machine Learning Testing: Survey, Landscapes and Horizonscited by 218
  11. 2019Understanding and Utilizing Deep Neural Networks Trained with Noisy Labelscited by 209
  12. 2018code2seq: Generating Sequences from Structured Representations of Codecited by 179
  13. 2017What do Neural Machine Translation Models Learn about Morphology?cited by 166
  14. 2018Learning to Learn from Noisy Labeled Datacited by 160
  15. 2018The Adverse Effects of Code Duplication in Machine Learning Models of Codecited by 126
  16. 2018Improving Automatic Source Code Summarization via Deep Reinforcement Learningcited by 100
  17. 2016A Convolutional Attention Network for Extreme Summarization of Source Codecited by 91
  18. 2020Improved Code Summarization via a Graph Neural Networkcited by 79
  19. 2021Memorization vs. Generalization: Quantifying Data Leakage in NLP Performance Evaluationcited by 70
  20. 2019Adversarial Examples for Models of Codecited by 63
  21. 2019Let's Agree to Agree: Neural Networks Share Classification Order on Real Datasetscited by 56
  22. 2020Deep Learning for Source Code Modeling and Generation: Models, Applications and Challengescited by 55
  23. 2020Semantic Robustness of Models of Source Codecited by 45
  24. 2020On the Generalizability of Neural Program Models with respect to Semantic-Preserving Program Transformationscited by 44
  25. 2016Deep API Learningcited by 41
  26. 2019Neural Program Repair by Jointly Learning to Localize and Repaircited by 40
  27. 2020Adversarial Robustness for Codecited by 38
  28. 2019How Often Do Single-Statement Bugs Occur? The ManySStuBs4J Datasetcited by 36
  29. 2020Rethinking Generalization of Neural Models: A Named Entity Recognition Case Studycited by 35
  30. 2019Identity Crisis: Memorization and Generalization under Extreme Overparameterizationcited by 33
  31. 2021Understanding Neural Code Intelligence Through Program Simplificationcited by 22
  32. 2020Probing Model Signal-Awareness via Prediction-Preserving Input Minimizationcited by 14
  33. 2018Studying the Difference Between Natural and Programming Language Corporacited by 13
  34. 2020Embedding Java Classes with code2vec: Improvements from Variable Obfuscationcited by 12
  35. 2019COSET: A Benchmark for Evaluating Neural Program Embeddingscited by 10
  36. 2020Evaluation of Generalizability of Neural Program Analyzers under Semantic-Preserving Transformationscited by 9
  37. 2020Towards Demystifying Dimensions of Source Code Embeddingscited by 9
  38. 2020Measuring Memorization Effect in Word-Level Neural Networks Probingcited by 3

Built on by

Cited by year

Citing papers per year: 2021: 1; 2022: 3; 2023: 4; 2024: 6; 2025: 5.

19 papers.

Sort:

By area:

  1. 2024Vulnerability Detection with Code Language Models: How Far Are We?cited by 139
  2. 2023Deep Learning for Code Intelligence: Survey, Benchmark and Toolkitcited by 22
  3. 2024Studying LLM Performance on Closed- and Open-source Datacited by 11
  4. 2022Syntax-Guided Program Reduction for Understanding Neural Code Intelligence Modelscited by 7
  5. 2025Enhancing Generalization in Chain of Thought Reasoning for Smaller Modelscited by 5
  6. 2021Code2Snapshot: Using Code Snapshots for Learning Representations of Source Codecited by 4
  7. 2024A Critical Study of What Code-LLMs (Do Not) Learncited by 4
  8. 2024Promise and Peril of Collaborative Code Generation Models: Balancing Effectiveness and Memorizationcited by 4
  9. 2025ObscuraCoder: Powering Efficient Code LM Pre-Training Via Obfuscation Groundingcited by 4
  10. 2023Study of Distractors in Neural Models of Codecited by 2
  11. 2024Trojans in Large Language Models of Code: A Critical Review through a Trigger-Based Taxonomycited by 2
  12. 2023Redundancy and Concept Analysis for Code-trained Language Modelscited by 1
7 more
  1. 2024Measuring Impacts of Poisoning on Model Parameters and Neuron Activations: A Case Study of Poisoning CodeBERTcited by 1
  2. 2025Backdoors in Code Summarizers: How Bad Is It?cited by 1
  3. 2025Effective Code Membership Inference for Code Completion Models via Adversarial Promptscited by 1
  4. 2022Testing the Robustness of a BiLSTM-based Structural Story Classifiercited by 0
  5. 2022Extracting Label-specific Key Input Features for Neural Code Intelligence Modelscited by 0
  6. 2023Artificial Neuropsychology: Are Large Language Models Developing Executive Functions?cited by 0
  7. 2025Malicious and Unintentional Disclosure Risks in Large Language Models for Code Generationcited by 0