{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/locally-differentially-private-document","title":"Locally Differentially Private Document Generation Using Zero Shot Prompting","arxiv_id":"2310.16111","date":"2023-10-24","proceeding":null,"authors":["Saiteja Utpala","Sara Hooker","Pin Yu Chen"],"abstract":"Numerous studies have highlighted the privacy risks associated with pretrained large language models. In contrast, our research offers a unique perspective by demonstrating that pretrained large language models can effectively contribute to privacy preservation. We propose a locally differentially private mechanism called DP-Prompt, which leverages the power of pretrained large language models and zero-shot prompting to counter author de-anonymization attacks while minimizing the impact on downstream utility. When DP-Prompt is used with a powerful language model like ChatGPT (gpt-3.5), we observe a notable reduction in the success rate of de-anonymization attacks, showing that it surpasses existing approaches by a considerable margin despite its simpler design. For instance, in the case of the IMDB dataset, DP-Prompt (with ChatGPT) perfectly recovers the clean sentiment F1 score while achieving a 46\\% reduction in author identification F1 score against static attackers and a 26\\% reduction against adaptive attackers. We conduct extensive experiments across six open-source large language models, ranging up to 7 billion parameters, to analyze various effects of the privacy-utility tradeoff.","url_abs":"https://arxiv.org/abs/2310.16111v2","url_pdf":"https://arxiv.org/pdf/2310.16111v2.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"locally-differentially-private-document","repo_url":"https://github.com/saitejautpala/dp_prompt","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"language-modeling","task_name":"Language Modeling"},{"task_slug":"language-modelling","task_name":"Language Modelling"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2310.16111","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2310.16111"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/saitejautpala/dp_prompt","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":14,"unverified":8},"by_repo_kind":{"official":{"samples":22,"ran":14,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"da4a1d96cbd0b5d6","entry":"build_idx_to_n_dict","repo":"saitejautpala/dp_prompt","repo_kind":"official","path":"mechanisms/documentlevel/paraphrase_generation_data_utils.py","file_url":"https://github.com/saitejautpala/dp_prompt/blob/HEAD/mechanisms/documentlevel/paraphrase_generation_data_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"da4a1d96cbd0b5d6"}},{"code_sha256_prefix":"9cd82bb0714b58e3","entry":"compute_metrics","repo":"saitejautpala/dp_prompt","repo_kind":"official","path":"attacks/text_attacker_architecture.py","file_url":"https://github.com/saitejautpala/dp_prompt/blob/HEAD/attacks/text_attacker_architecture.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"9cd82bb0714b58e3"}},{"code_sha256_prefix":"4b5ebeb9c7fe2859","entry":"generate","repo":"saitejautpala/dp_prompt","repo_kind":"official","path":"mechanisms/documentlevel/openai_paraphrase_generation.py","file_url":"https://github.com/saitejautpala/dp_prompt/blob/HEAD/mechanisms/documentlevel/openai_paraphrase_generation.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"4b5ebeb9c7fe2859"}},{"code_sha256_prefix":"4718ef9387d6bbac","entry":"get_clipping_boundaries","repo":"saitejautpala/dp_prompt","repo_kind":"official","path":"mechanisms/sentencelevel/truncated_laplace.py","file_url":"https://github.com/saitejautpala/dp_prompt/blob/HEAD/mechanisms/sentencelevel/truncated_laplace.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"4718ef9387d6bbac"}},{"code_sha256_prefix":"bf23d78423539474","entry":"get_save_path","repo":"saitejautpala/dp_prompt","repo_kind":"official","path":"mechanisms/documentlevel/paraphrase_generation_data_utils.py","file_url":"https://github.com/saitejautpala/dp_prompt/blob/HEAD/mechanisms/documentlevel/paraphrase_generation_data_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"bf23d78423539474"}},{"code_sha256_prefix":"ab1e036af7138a3a","entry":"multivariate_laplace","repo":"saitejautpala/dp_prompt","repo_kind":"official","path":"mechanisms/wordlevel/madlib.py","file_url":"https://github.com/saitejautpala/dp_prompt/blob/HEAD/mechanisms/wordlevel/madlib.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"ab1e036af7138a3a"}},{"code_sha256_prefix":"2e7db695e1d4a39c","entry":"multivariate_mahalanobis_sample","repo":"saitejautpala/dp_prompt","repo_kind":"official","path":"mechanisms/wordlevel/mahalanobis.py","file_url":"https://github.com/saitejautpala/dp_prompt/blob/HEAD/mechanisms/wordlevel/mahalanobis.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"2e7db695e1d4a39c"}},{"code_sha256_prefix":"3eac08badfb8dd5d","entry":"prompt_template_fn","repo":"saitejautpala/dp_prompt","repo_kind":"official","path":"mechanisms/documentlevel/openai_paraphrase_generation.py","file_url":"https://github.com/saitejautpala/dp_prompt/blob/HEAD/mechanisms/documentlevel/openai_paraphrase_generation.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"3eac08badfb8dd5d"}},{"code_sha256_prefix":"273fbd3b2860c533","entry":"radius_neighbors","repo":"saitejautpala/dp_prompt","repo_kind":"official","path":"mechanisms/wordlevel/tem.py","file_url":"https://github.com/saitejautpala/dp_prompt/blob/HEAD/mechanisms/wordlevel/tem.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"273fbd3b2860c533"}},{"code_sha256_prefix":"cb16209dce94db5f","entry":"run_eval","repo":"saitejautpala/dp_prompt","repo_kind":"official","path":"attacks/text_attacker_architecture.py","file_url":"https://github.com/saitejautpala/dp_prompt/blob/HEAD/attacks/text_attacker_architecture.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"cb16209dce94db5f"}},{"code_sha256_prefix":"423e7a192563b20b","entry":"save_strings_to_files","repo":"saitejautpala/dp_prompt","repo_kind":"official","path":"mechanisms/documentlevel/paraphrase_generation_data_utils.py","file_url":"https://github.com/saitejautpala/dp_prompt/blob/HEAD/mechanisms/documentlevel/paraphrase_generation_data_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"423e7a192563b20b"}},{"code_sha256_prefix":"56d503b9d0430bed","entry":"split_into_sentences","repo":"saitejautpala/dp_prompt","repo_kind":"official","path":"attacks/embedding_attacker_architecture.py","file_url":"https://github.com/saitejautpala/dp_prompt/blob/HEAD/attacks/embedding_attacker_architecture.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"56d503b9d0430bed"}},{"code_sha256_prefix":"480709d96ec54bf8","entry":"train_step","repo":"saitejautpala/dp_prompt","repo_kind":"official","path":"attacks/embedding_attacker_architecture.py","file_url":"https://github.com/saitejautpala/dp_prompt/blob/HEAD/attacks/embedding_attacker_architecture.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"480709d96ec54bf8"}},{"code_sha256_prefix":"6dd4947c1a74cf75","entry":"train_step","repo":"saitejautpala/dp_prompt","repo_kind":"official","path":"mechanisms/sentencelevel/deep_candidate.py","file_url":"https://github.com/saitejautpala/dp_prompt/blob/HEAD/mechanisms/sentencelevel/deep_candidate.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"6dd4947c1a74cf75"}},{"code_sha256_prefix":"badaa3f953333d88","entry":"attack","repo":"saitejautpala/dp_prompt","repo_kind":"official","path":"attacks/text_attack.py","file_url":"https://github.com/saitejautpala/dp_prompt/blob/HEAD/attacks/text_attack.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"badaa3f953333d88"}},{"code_sha256_prefix":"2f08a06ea4a774e9","entry":"generate_df","repo":"saitejautpala/dp_prompt","repo_kind":"official","path":"mechanisms/documentlevel/openai_paraphrase_generation.py","file_url":"https://github.com/saitejautpala/dp_prompt/blob/HEAD/mechanisms/documentlevel/openai_paraphrase_generation.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"2f08a06ea4a774e9"}},{"code_sha256_prefix":"982fb5af87c4fc90","entry":"get_text_attack_stats","repo":"saitejautpala/dp_prompt","repo_kind":"official","path":"attacks/text_attack.py","file_url":"https://github.com/saitejautpala/dp_prompt/blob/HEAD/attacks/text_attack.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"982fb5af87c4fc90"}},{"code_sha256_prefix":"8cf7ca578c3d0196","entry":"preprocess_df","repo":"saitejautpala/dp_prompt","repo_kind":"official","path":"attacks/embedding_attacker_architecture.py","file_url":"https://github.com/saitejautpala/dp_prompt/blob/HEAD/attacks/embedding_attacker_architecture.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"8cf7ca578c3d0196"}},{"code_sha256_prefix":"e320b1070a6a8f5f","entry":"preprocess_df","repo":"saitejautpala/dp_prompt","repo_kind":"official","path":"mechanisms/sentencelevel/deep_candidate.py","file_url":"https://github.com/saitejautpala/dp_prompt/blob/HEAD/mechanisms/sentencelevel/deep_candidate.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"e320b1070a6a8f5f"}},{"code_sha256_prefix":"2c51d5e1a22d4e0f","entry":"preprocess_df","repo":"saitejautpala/dp_prompt","repo_kind":"official","path":"mechanisms/sentencelevel/truncated_laplace.py","file_url":"https://github.com/saitejautpala/dp_prompt/blob/HEAD/mechanisms/sentencelevel/truncated_laplace.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"2c51d5e1a22d4e0f"}},{"code_sha256_prefix":"cf8124a7098de674","entry":"split_into_sentences","repo":"saitejautpala/dp_prompt","repo_kind":"official","path":"mechanisms/sentencelevel/deep_candidate.py","file_url":"https://github.com/saitejautpala/dp_prompt/blob/HEAD/mechanisms/sentencelevel/deep_candidate.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"cf8124a7098de674"}},{"code_sha256_prefix":"245e7444d9ed2ce3","entry":"split_into_sentences","repo":"saitejautpala/dp_prompt","repo_kind":"official","path":"mechanisms/sentencelevel/truncated_laplace.py","file_url":"https://github.com/saitejautpala/dp_prompt/blob/HEAD/mechanisms/sentencelevel/truncated_laplace.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"245e7444d9ed2ce3"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}