{"id":20484529,"url":"https://github.com/sap-samples/machine-learning-diff-private-federated-learning","last_synced_at":"2025-04-11T23:18:07.464Z","repository":{"id":37928263,"uuid":"121224951","full_name":"SAP-samples/machine-learning-diff-private-federated-learning","owner":"SAP-samples","description":"Simulate a federated setting and run differentially private federated learning.","archived":false,"fork":false,"pushed_at":"2025-03-07T12:53:08.000Z","size":85,"stargazers_count":373,"open_issues_count":2,"forks_count":92,"subscribers_count":15,"default_branch":"main","last_synced_at":"2025-04-11T23:18:03.222Z","etag":null,"topics":["differential-privacy","federated-learning","machine-learning","sample","sample-code","security"],"latest_commit_sha":null,"homepage":"https://arxiv.org/abs/1712.07557v1","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SAP-samples.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-12T09:14:54.000Z","updated_at":"2025-04-08T13:25:19.000Z","dependencies_parsed_at":"2024-12-08T06:02:53.208Z","dependency_job_id":"72a81680-c79e-4c1f-a110-038ce633a420","html_url":"https://github.com/SAP-samples/machine-learning-diff-private-federated-learning","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SAP-samples%2Fmachine-learning-diff-private-federated-learning","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SAP-samples%2Fmachine-learning-diff-private-federated-learning/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SAP-samples%2Fmachine-learning-diff-private-federated-learning/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SAP-samples%2Fmachine-learning-diff-private-federated-learning/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SAP-samples","download_url":"https://codeload.github.com/SAP-samples/machine-learning-diff-private-federated-learning/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248492885,"owners_count":21113163,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["differential-privacy","federated-learning","machine-learning","sample","sample-code","security"],"created_at":"2024-11-15T16:23:39.198Z","updated_at":"2025-04-11T23:18:07.446Z","avatar_url":"https://github.com/SAP-samples.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Differentially Private Federated Learning: A Client-level Perspective\r\n[![REUSE status](https://api.reuse.software/badge/github.com/SAP-samples/machine-learning-diff-private-federated-learning)](https://api.reuse.software/info/github.com/SAP-samples/machine-learning-diff-private-federated-learning)\r\n[![made-with-python](https://img.shields.io/badge/Made%20with-Python-red.svg)](#python) [![PyPI](https://badge.fury.io/py/tensorflow.svg)](https://badge.fury.io/py/tensorflow) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\r\n\r\n## Description:\r\nFederated Learning is a privacy preserving decentralized learning protocol introduced by Google. Multiple clients jointly learn a model without data centralization. Centralization is pushed from data space to parameter space: https://research.google.com/pubs/pub44822.html [1].\r\nDifferential privacy in deep learning is concerned with preserving privacy of individual data points: https://arxiv.org/abs/1607.00133 [2].\r\nIn this work we combine the notion of both by making federated learning differentially private. We focus on preserving privacy for the entire data set of a client. For more information, please refer to: https://arxiv.org/abs/1712.07557v2.\r\n\r\nThis code simulates a federated setting and enables federated learning with differential privacy. The privacy accountant used is from https://arxiv.org/abs/1607.00133 [2]. The files: accountant.py, utils.py, gaussian_moments.py are taken from: https://github.com/tensorflow/models/tree/master/research/differential_privacy\r\n\r\nNote that the privacy agent is not completely set up yet (especially for more than 100 clients). It has to be specified manually or otherwise parameters 'm' and 'sigma' need to be specified.\r\n\r\n#### Authors:\r\n - [Robin C. Geyer](https://www.linkedin.com/in/robin-geyer-419b2513b/)\r\n - [Tassilo Klein](https://tjklein.github.io/)\r\n - [Moin Nabi](https://moinnabi.github.io/)\r\n\r\n## Requirements\r\n- [Tensorflow 1.4.1](https://www.tensorflow.org/)\r\n- [MNIST data-set](http://yann.lecun.com/exdb/mnist/)\r\n\r\n## Download and Installation\r\n1. Install Tensorflow 1.4.1\r\n2  [Download the files as a ZIP archive](https://github.com/SAP-samples/machine-learning-diff-private-federated-learning/archive/master.zip), or you can [clone the repository](https://help.github.com/articles/cloning-a-repository/) to your local hard drive.\r\n\r\n3. Change to the directory of the download, If using macOS, simply run: \r\n    ```bash\r\n    bash RUNME.sh\r\n    ```\r\n    This will download the [MNIST data-sets](http://yann.lecun.com/exdb/mnist/), create clients and getting started. \r\n    \r\nFor more information on the individual functions, please refer to their doc strings.  \r\n\r\n## Known Issues\r\nNo issues known\r\n\r\n\r\n## How to obtain support\r\nThis project is provided \"as-is\" and any bug reports are not guaranteed to be fixed.\r\n\r\n\r\n## Citations\r\nIf you use this code or the pretrained models in your research,\r\nplease cite:\r\n\r\n```\r\n@ARTICLE{2017arXiv171207557G,\r\n   author = {{Geyer}, R.~C. and {Klein}, T. and {Nabi}, M.},\r\n    title = \"{Differentially Private Federated Learning: A Client Level Perspective}\",\r\n  journal = {ArXiv e-prints},\r\narchivePrefix = \"arXiv\",\r\n   eprint = {1712.07557},\r\n primaryClass = \"cs.CR\",\r\n keywords = {Computer Science - Cryptography and Security, Computer Science - Learning, Statistics - Machine Learning},\r\n     year = 2017,\r\n    month = dec,\r\n   adsurl = {http://adsabs.harvard.edu/abs/2017arXiv171207557G},\r\n  adsnote = {Provided by the SAO/NASA Astrophysics Data System}\r\n}\r\n```\r\n\r\n## References\r\n- H. Brendan McMahan et al., Communication-Efficient Learning of Deep Networks from Decentralized Data, 2017, http://arxiv.org/abs/1602.05629.\r\n\r\n- Martin Abadi et al., Deep Learning with Differential Privacy, 2016, https://arxiv.org/abs/1607.00133.\r\n\r\n\r\n## License\r\n\r\nCopyright (c) 2024 SAP SE or an SAP affiliate company. All rights reserved. This project is licensed under the Apache Software License, version 2.0 except as noted otherwise in the [LICENSE](/LICENSE) file.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsap-samples%2Fmachine-learning-diff-private-federated-learning","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsap-samples%2Fmachine-learning-diff-private-federated-learning","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsap-samples%2Fmachine-learning-diff-private-federated-learning/lists"}