The availability of large-scale datasets, advanced architectures, and powerful computational resources have led to effective code models that automate diverse software engineering activities. The datasets usually consist of billions of lines of code from both open-source and private repositories. A code model memorizes and produces source code verbatim, which potentially contains vulnerabilities, sensitive information, or code with strict licenses, leading to potential security and privacy issues. This paper investigates an important problem: to what extent do code models memorize their training data? We conduct an empirical study to explore memorization in large pre-trained code models. Our study highlights that simply extracting 20,000 outputs (each having 512 tokens) from a code model can produce over 40,125 code snippets that are memorized from the training data. To provide a better understanding, we build a taxonomy of memorized contents with 3 categories and 14 subcategories. The results show that the prompts sent to the code models affect the distribution of memorized contents. We identify several key factors of memorization. Specifically, given the same architecture, larger models suffer more from memorization problems. A code model produces more memorization when it is allowed to generate longer outputs. We also find a strong positive correlation between the number of an output's occurrences in the training data and that in the generated outputs, which indicates that a potential way to reduce memorization is to remove duplicates in the training data. We then identify effective metrics that infer whether an output contains memorization accurately. We also make suggestions to deal with memorization.
Scrub It Out! Erasing Sensitive Memorization in Code Language Models via Machine Unlearning
Huazhong University of Science and Technology(华中科技大学);Zhejiang University(浙江大学);King Abdullah University of Science and Technology(国王阿卜杜勒阿齐兹大学);University of Alberta(阿尔伯塔大学);Chongqing University(重庆大学);Singapore Management University(新加坡管理学院)
Promise and Peril of Collaborative Code Generation Models: Balancing Effectiveness and Memorization
Centre for Research on Intelligent Software Engineering(智能软件工程研究中心);School of Computing and Information Systems(计算与信息系统学院);Singapore Management University(新加坡管理大学)
Unveiling Code Pre-Trained Models: Investigating Syntax and Semantics Capacities
Nanyang Technological University(南洋理工大学);Ludwig Maximilian University of Munich(慕尼黑大学);Singapore Management University(新加坡管理大学);University of Alberta(阿尔伯塔大学);The University of Tokyo(东京大学);Noah’s Ark Lab, Huawei(华为诺亚方舟实验室)
BigCodeArena: Unveiling More Reliable Human Preferences in Code Generation via Execution
Monash University(墨尔本大学);CSIRO’s Data61(CSIRO的数据61);Purdue University(普渡大学);Independent(独立);HKUST (Guangzhou)(香港科技大学(广州));UCSD(加州大学圣地亚哥分校);UVA(弗吉尼亚大学);CNRS, France(法国国家科学研究中心);IBM;Cisco(思科);Comenius University in Bratislava(布拉提斯拉瓦康门纽斯大学);University of Notre Dame(Notre Dame大学);Uber;Tano Labs(Tano实验室);NUS(国立大学新加坡);Institute of Automation, CAS(中国科学院自动化研究所);Tencent AI Lab(腾讯AI实验室);University of Washington(华盛顿大学);Nevsky Collective(Nevsky集体);ETH Zurich(苏黎世联邦理工学院);Detomo Inc(Detomo公司);University of Oxford(牛津大学);UIUC(伊利诺伊大学香槟分校);Google(谷歌);NVIDIA;Singapore Management University(新加坡管理学院);ServiceNow Research(ServiceNow研究);Hugging Face