Towards Privacy-Preserving Code Generation: Differentially Private Code Language Models
Not on the map. Why?
Abstract (arXiv)
Large language models specialized for code (CodeLLMs) have demonstrated remarkable capabilities in generating code snippets, documentation, and test cases. However, despite their promising capabilities, CodeLLMs can inadvertently memorize and reproduce snippets from their training data, which poses risks of privacy breaches and intellectual property violations. These risks restrict the deployment of CodeLLMs in sensitive domains and limit their training datasets to publicly available sources. To mitigate the memorization risk without compromising their task performance, we apply Differential Privacy (DP) to CodeLLMs. To the best of our knowledge, this is the first comprehensive study that systematically evaluates the effectiveness of DP in CodeLLMs. DP adds calibrated noise to the training process to protect individual data points while still allowing the model to learn useful patterns. To this end, we first identify and understand the driving reasons of the memorization behaviour of the CodeLLMs during their fine-tuning. Then, to address this issue, we empirically evaluate the effect of DP on mitigating memorization while preserving code generation capabilities. Our findings show that DP substantially reduces memorization in CodeLLMs across all the tested snippet types. The snippet types most prone to memorization are also the most effectively mitigated by DP. Furthermore, we observe that DP slightly increases perplexity but preserves, and can even enhance, the code generation capabilities of CodeLLMs, which makes it feasible to apply DP in practice without significantly compromising model utility. Finally, we analyze the impact of DP on training efficiency and energy consumption, finding that DP does not significantly affect training time or energy usage, making it a practical choice for privacy-preserving CodeLLMs training.
Key facts. No citing papers in the map yet (data through 7 Oct 2026). Builds on 25 of its 37 references that are in the map. First posted on arXiv 12 Dec 2025.
Builds on
25 of 37 references.
References · 25
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2016Communication-Efficient Learning of Deep Networks from Decentralized Datacited by 7,592
- 2016Deep Learning with Differential Privacycited by 2,682
- 2020Extracting Training Data from Large Language Modelscited by 2,144
- 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,154
- 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 876
- 2018The Secret Sharer: Evaluating and Testing Unintended Memorization in Neural Networkscited by 847
- 2021Membership Inference Attacks From First Principlescited by 839
- 2021Large Language Models Can Be Strong Differentially Private Learnerscited by 405
- 2021Differentially Private Fine-tuning of Language Modelscited by 392
- 2018Subsampled R'enyi Differential Privacy and Analytical Moments Accountantcited by 234
- 2020Differentially Private Learning Needs Better Features (or Much More Data)cited by 233
13 more
- 2024Measuring memorization in language models via probabilistic extractioncited by 40
- 2024A Survey of Useful LLM Evaluationcited by 28
- 2025Extracting memorized pieces of (copyrighted) books from open-weight language modelscited by 27
- 2023Traces of Memorisation in Large Language Models for Codecited by 26
- 2023Your Code Secret Belongs to Me: Neural Code Completion Tools Can Memorize Hard-Coded Credentialscited by 17
- 2024LiCoEval: Evaluating LLMs on License Compliance in Code Generationcited by 13
- 2023Gotcha! This Model Uses My Code! Evaluating Membership Leakage Risks in Code Modelscited by 11
- 2024Does Your Neural Code Completion Model Use My Code? A Membership Inference Approachcited by 9
- 2024Trained Without My Consent: Detecting Code Inclusion In Language Models Trained on Codecited by 8
- 2023Targeted Attack on GPT-Neo for the SATML Language Model Data Extraction Challengecited by 7
- 2024Open-Source AI-based SE Tools: Opportunities and Challenges of Collaborative Software Learningcited by 4
- 2025On the Possibility of Breaking Copyleft Licenses When Reusing Code Generated by ChatGPTcited by 3
- 2024Developer Perspectives on Licensing and Copyright Issues Arising from Generative AI for Software Developmentcited by 2
Built on by
Not cited yet.