{"id":28515201,"url":"https://github.com/pair-code/federated-learning","last_synced_at":"2025-07-05T09:30:40.243Z","repository":{"id":32874584,"uuid":"136218688","full_name":"PAIR-code/federated-learning","owner":"PAIR-code","description":"Federated learning experiment using TensorFlow.js","archived":false,"fork":false,"pushed_at":"2025-06-24T05:27:55.000Z","size":13704,"stargazers_count":163,"open_issues_count":97,"forks_count":30,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-07-03T05:03:27.152Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/PAIR-code.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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,"zenodo":null}},"created_at":"2018-06-05T18:30:00.000Z","updated_at":"2025-03-09T18:07:12.000Z","dependencies_parsed_at":"2023-01-14T22:45:24.776Z","dependency_job_id":"cad3508c-9286-4df4-beca-a8eeb2be3b44","html_url":"https://github.com/PAIR-code/federated-learning","commit_stats":{"total_commits":43,"total_committers":5,"mean_commits":8.6,"dds":0.627906976744186,"last_synced_commit":"03deeb2e91c63679bc1ea61cb4af6ede45f69f92"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/PAIR-code/federated-learning","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PAIR-code%2Ffederated-learning","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PAIR-code%2Ffederated-learning/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PAIR-code%2Ffederated-learning/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PAIR-code%2Ffederated-learning/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PAIR-code","download_url":"https://codeload.github.com/PAIR-code/federated-learning/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PAIR-code%2Ffederated-learning/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263718171,"owners_count":23500787,"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":[],"created_at":"2025-06-09T03:04:58.989Z","updated_at":"2025-07-05T09:30:40.237Z","avatar_url":"https://github.com/PAIR-code.png","language":"TypeScript","readme":"# Federated Learning in TensorFlow.js\n\n## *This is not an official federated learning framework for TensorFlow. This is an experimental library for TensorFlow.js that is currently ***unmaintained***. If you would like to use an official federated learning library, check out [tensorflow/federated](https://github.com/tensorflow/federated).*\n\nThis is the parent repository for an (experimental and demonstration-only)\nimplementation of [Federated\nLearning](https://ai.googleblog.com/2017/04/federated-learning-collaborative.html)\nin [Tensorflow.js](https://js.tensorflow.org/). Federated Learning is a\nmethod for training machine learning models in a distributed fashion.\nAlthough it involves a central server, that server never needs to see any\ndata or even compute a gradient. Instead, _clients_ perform all of the\ninference and training locally (which they already do in Tensorflow.js), and\njust periodically send the server updated weights (rather than data). The\nserver's only job is to aggregate and redistribute them, which means it can\nbe extremely lightweight!\n\n## Basic Usage\n\nOn the server (NodeJS) side:\n\n```js\nimport * as http from 'http';\nimport * as federated from 'federated-learning-server';\n\nconst INIT_MODEL = 'file:///initial/model.json';\nconst webServer = http.createServer(); // can also use https\nconst fedServer = new federated.Server(webServer, INIT_MODEL);\n\nfedServer.setup().then(() =\u003e {\n  webServer.listen(80);\n});\n```\n\nOn the client (browser) side:\n\n```js\nimport * as federated from 'federated-learning-client';\n\nconst INIT_MODEL = 'http://my.initial/model.json';\nconst SERVER_URL = 'http://federated.learning.server'; // URL of server above\nconst client = new federated.Client(SERVER_URL, INIT_MODEL);\n\nclient.setup().then(() =\u003e {\n  const yhat = client.predict(x); // make predictions!\n  client.federatedUpdate(x, y);   // train and update the server!\n});\n```\n\n## Documentation and Examples\n\nSee the [server](./src/server) and [client](./src/client)\nREADMEs for documentation, and the [emoji](./demo/emoji_hunt) or\n[Hogwarts](./demo/audio) demos for more fully fleshed out examples.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpair-code%2Ffederated-learning","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpair-code%2Ffederated-learning","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpair-code%2Ffederated-learning/lists"}