CodeCipher: Learning to Obfuscate Source Code Against LLMs
Not on the map. Why?
Abstract (arXiv)
While large code language models have made significant strides in AI-assisted coding tasks, there are growing concerns about privacy challenges. The user code is transparent to the cloud LLM service provider, inducing risks of unauthorized training, reading, and execution of the user code. In this paper, we propose CodeCipher, a novel method that perturbs privacy from code while preserving the original response from LLMs. CodeCipher transforms the LLM's embedding matrix so that each row corresponds to a different word in the original matrix, forming a token-to-token confusion mapping for obfuscating source code. The new embedding matrix is optimized by minimizing the task-specific loss function. To tackle the challenge of the discrete and sparse nature of word vector spaces, CodeCipher adopts a discrete optimization strategy that aligns the updated vector to the nearest valid token in the vocabulary before each gradient update. We demonstrate the effectiveness of our approach on three AI-assisted coding tasks including code completion, summarization, and translation. Results show that our model successfully confuses the privacy in source code while preserving the original LLM's performance.
Key facts. Cited by 3 papers in the map (data through 14 Oct 2026). Builds on 20 of its 41 references that are in the map. First posted on arXiv 8 Oct 2024.
Builds on
20 of 41 references.
References · 20
- 2021Evaluating Large Language Models Trained on Codecited by 8,320
- 2021Program Synthesis with Large Language Modelscited by 3,637
- 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,181
- 2023StarCoder: may the source be with you!cited by 799
- 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 654
- 2023Scalable Extraction of Training Data from (Production) Language Modelscited by 434
- 2023A Survey on Large Language Model (LLM) Security and Privacy: The Good, the Bad, and the Uglycited by 387
- 2023CodeGeeX: A Pre-Trained Model for Code Generation with Multilingual Benchmarking on HumanEval-Xcited by 300
- 2024On Protecting the Data Privacy of Large Language Models (LLMs): A Surveycited by 96
- 2020Contrastive Code Representation Learningcited by 76
- 2023FATE-LLM: A Industrial Grade Federated Learning Framework for Large Language Modelscited by 63
- 2023Locally Differentially Private Document Generation Using Zero Shot Promptingcited by 63
8 more
- 2022NatGen: Generative pre-training by "Naturalizing" source codecited by 54
- 2023CodeMark: Imperceptible Watermarking for Code Datasets against Neural Code Completion Modelscited by 34
- 2023Traces of Memorisation in Large Language Models for Codecited by 29
- 2021Bridge the Gap Between CV and NLP! A Gradient-based Textual Adversarial Attack Frameworkcited by 28
- 2024Robustness, Security, Privacy, Explainability, Efficiency, and Usability of Large Language Models for Codecited by 28
- 2021Adversarial Robustness of Deep Code Comment Generationcited by 22
- 2023Greening Large Language Models of Codecited by 19
- 2024LLM-based Privacy Data Augmentation Guided by Knowledge Distillation with a Distribution Tutor for Medical Text Classificationcited by 8
Built on by
Citing papers per year: 2025: 1; 2026: 2.
3 papers.
- 2025Large Language Model (LLM) for Software Security: Code Analysis, Malware Analysis, Reverse Engineeringcited by 15
- 2026Bridging Generation and Training: A Systematic Review of Quality Issues in LLMs for Codecited by 1
- 2026A Novel Semantic Manifold Alignment Attack against Embedding-to-Embedding Obfuscation in Privacy-Preserving LLMscited by 0
- 2026A Novel Semantic Manifold Alignment Attack against Embedding-to-Embedding Obfuscation in Privacy-Preserving LLMs6 Sep 2026
- 2026Bridging Generation and Training: A Systematic Review of Quality Issues in LLMs for Code6 May 2026
- 2025Large Language Model (LLM) for Software Security: Code Analysis, Malware Analysis, Reverse Engineering7 Apr 2025