{"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/large-language-models-can-be-strong-1","title":"Large Language Models Can Be Strong Differentially Private Learners","arxiv_id":"2110.05679","date":"2021-10-12","proceeding":"ICLR 2022 4","authors":["Xuechen Li","Florian Tramèr","Percy Liang","Tatsunori Hashimoto"],"abstract":"Differentially Private (DP) learning has seen limited success for building large deep learning models of text, and straightforward attempts at applying Differentially Private Stochastic Gradient Descent (DP-SGD) to NLP tasks have resulted in large performance drops and high computational overhead. We show that this performance drop can be mitigated with (1) the use of large pretrained language models; (2) non-standard hyperparameters that suit DP optimization; and (3) fine-tuning objectives which are aligned with the pretraining procedure. With the above, we obtain NLP models that outperform state-of-the-art DP-trained models under the same privacy budget and strong non-private baselines -- by directly fine-tuning pretrained models with DP optimization on moderately-sized corpora. To address the computational challenge of running DP-SGD with large Transformers, we propose a memory saving technique that allows clipping in DP-SGD to run without instantiating per-example gradients for any linear layer in the model. The technique enables privately training Transformers with almost the same memory cost as non-private training at a modest run-time overhead. Contrary to conventional wisdom that DP optimization fails at learning high-dimensional models (due to noise that scales with dimension) empirical results reveal that private learning with pretrained language models doesn't tend to suffer from dimension-dependent performance degradation. Code to reproduce results can be found at https://github.com/lxuechen/private-transformers.","url_abs":"https://arxiv.org/abs/2110.05679v6","url_pdf":"https://arxiv.org/pdf/2110.05679v6.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":"large-language-models-can-be-strong-1","repo_url":"https://github.com/lxuechen/private-transformers","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"large-language-models-can-be-strong-1","repo_url":"https://github.com/facebookresearch/pytorch-dp","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"large-language-models-can-be-strong-1","repo_url":"https://github.com/jialinmao/private_cnn","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"large-language-models-can-be-strong-1","repo_url":"https://github.com/pytorch/opacus","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"large-language-models-can-be-strong-1","repo_url":"https://github.com/woodyx218/SLOPE_AMP","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok"}},{"paper_slug":"large-language-models-can-be-strong-1","repo_url":"https://github.com/woodyx218/private_vision","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2110.05679","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2110.05679"}},"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/pytorch/opacus","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/woodyx218/private_vision","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/lxuechen/private-transformers","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/woodyx218/SLOPE_AMP","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/facebookresearch/pytorch-dp","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/jialinmao/private_cnn","reach":null}],"summary":{"unverified":9},"by_repo_kind":{"listed":{"samples":9,"ran":0,"repositories":3}},"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":"46783ac8b5216877","entry":"apply_permutation","repo":"pytorch/opacus","repo_kind":"listed","path":"opacus/layers/dp_rnn.py","file_url":"https://github.com/pytorch/opacus/blob/HEAD/opacus/layers/dp_rnn.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"46783ac8b5216877"}},{"code_sha256_prefix":"0b1c417eba15b30c","entry":"dtype_safe","repo":"facebookresearch/pytorch-dp","repo_kind":"listed","path":"opacus/data_loader.py","file_url":"https://github.com/facebookresearch/pytorch-dp/blob/HEAD/opacus/data_loader.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"0b1c417eba15b30c"}},{"code_sha256_prefix":"a20422f8abbda65c","entry":"filter_out_old_keys","repo":"pytorch/opacus","repo_kind":"listed","path":"opacus/layers/param_rename.py","file_url":"https://github.com/pytorch/opacus/blob/HEAD/opacus/layers/param_rename.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"a20422f8abbda65c"}},{"code_sha256_prefix":"38d3968927d62f28","entry":"get_layer_set","repo":"facebookresearch/pytorch-dp","repo_kind":"listed","path":"benchmarks/utils.py","file_url":"https://github.com/facebookresearch/pytorch-dp/blob/HEAD/benchmarks/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"38d3968927d62f28"}},{"code_sha256_prefix":"fc285748768188e6","entry":"get_sigma_from_gdp","repo":"woodyx218/private_vision","repo_kind":"listed","path":"private_vision/privacy_engine.py","file_url":"https://github.com/woodyx218/private_vision/blob/HEAD/private_vision/privacy_engine.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"fc285748768188e6"}},{"code_sha256_prefix":"4cb8d0becf117730","entry":"get_sigma_from_rdp","repo":"woodyx218/private_vision","repo_kind":"listed","path":"private_vision/privacy_engine.py","file_url":"https://github.com/woodyx218/private_vision/blob/HEAD/private_vision/privacy_engine.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"4cb8d0becf117730"}},{"code_sha256_prefix":"5d0f89a9f572d13f","entry":"get_sigma_from_rdp_cks","repo":"woodyx218/private_vision","repo_kind":"listed","path":"private_vision/privacy_engine.py","file_url":"https://github.com/woodyx218/private_vision/blob/HEAD/private_vision/privacy_engine.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"5d0f89a9f572d13f"}},{"code_sha256_prefix":"e49fd334c05bf4ec","entry":"reset_peak_memory_stats","repo":"facebookresearch/pytorch-dp","repo_kind":"listed","path":"benchmarks/utils.py","file_url":"https://github.com/facebookresearch/pytorch-dp/blob/HEAD/benchmarks/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"e49fd334c05bf4ec"}},{"code_sha256_prefix":"556ad0ee1120c05e","entry":"shape_safe","repo":"facebookresearch/pytorch-dp","repo_kind":"listed","path":"opacus/data_loader.py","file_url":"https://github.com/facebookresearch/pytorch-dp/blob/HEAD/opacus/data_loader.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"556ad0ee1120c05e"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}