{"id":21577458,"url":"https://github.com/denpalrius/bft-federated-learning","last_synced_at":"2026-02-10T03:01:24.101Z","repository":{"id":264450197,"uuid":"893272866","full_name":"denpalrius/bft-federated-learning","owner":"denpalrius","description":"Federated Learning with Byzantine Fault Tolerance","archived":false,"fork":false,"pushed_at":"2025-07-09T16:16:15.000Z","size":11962,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-13T19:43:19.419Z","etag":null,"topics":["artificial-intelligence","bft","bft-protocols","cifar-10","distributed-training","fault-tolerance","federated-learning","federated-learning-algorithm","flower","grpc","machine-learning-algorithms","pytorch"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/denpalrius.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-11-24T01:33:38.000Z","updated_at":"2025-07-09T16:16:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"8c5fa95a-94fc-4687-acad-891c69adec63","html_url":"https://github.com/denpalrius/bft-federated-learning","commit_stats":null,"previous_names":["denpalrius/bft-federated-learning"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/denpalrius/bft-federated-learning","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denpalrius%2Fbft-federated-learning","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denpalrius%2Fbft-federated-learning/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denpalrius%2Fbft-federated-learning/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denpalrius%2Fbft-federated-learning/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/denpalrius","download_url":"https://codeload.github.com/denpalrius/bft-federated-learning/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denpalrius%2Fbft-federated-learning/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29289899,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-10T02:32:08.756Z","status":"ssl_error","status_checked_at":"2026-02-10T02:30:31.937Z","response_time":65,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["artificial-intelligence","bft","bft-protocols","cifar-10","distributed-training","fault-tolerance","federated-learning","federated-learning-algorithm","flower","grpc","machine-learning-algorithms","pytorch"],"created_at":"2024-11-24T13:07:09.096Z","updated_at":"2026-02-10T03:01:24.085Z","avatar_url":"https://github.com/denpalrius.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Federated Learning with Byzantine Fault Tolerance (BFT)\n\nThis repository implements multiple Federated Learning strategies with Byzantine Fault Tolerance (BFT) to simulate and defend against attacks from malicious clients. It includes strategies like FedAvg, Krum, and Trimmed Mean, and supports four types of Byzantine attack strategies: Sign Flip, Gaussian Noise, Constant Bias, and Zero Update.\n\n## Install Dependencies\n\nAt the project root, install the required dependencies and set up the project by running:\n\n```bash\npip install -e .\n```\n\n## Loading Initial Weights\n\nTo modify the initial weights for the model, run the following notebook to generate new weights:\n\n```bash\n./notebooks/cifar10_cnn.ipynb\n```\n\n## Running the Simulation Engine\n\nTo run the local simulation, execute the following command from the root of the repository:\n\n```bash\nflwr run .\n```\n\nFor optimization advice, refer to the [How to Run Simulations](https://flower.ai/docs/framework/how-to-run-simulations.html) guide in the Flower documentation.\n\n## Federated Learning Parameters\n\n| Parameter                         | Description \u0026 Impact | Value Range | Default | Notes |\n|------------------------------------|----------------------|-------------|---------|-------|\n| `num-server-rounds`               | Frequency of global model updates. Higher values improve convergence but increase training time. | 1-100 | 10 | Critical for convergence. |\n| `options.num-supernodes`          | Sets federation size. More nodes increase diversity but slow training. | 3-100 | 7 | System resource dependent. |\n| `fraction-fit`                    | Fraction of clients participating per round. Higher values offer better stability but increase computational load. | 0.0-1.0 | 1.0 | Values \u003c 0.5 may cause instability. |\n| `local-epochs`                    | Local training intensity. More epochs improve local optimization but risk overfitting. | 1-10 | 1 | Balance with `num-server-rounds`. |\n| `batch-size`                      | Affects memory usage and training speed. Larger batches speed up training but may reduce accuracy. | 16-512 | 32 | Dependent on host memory. |\n| `byzantine-clients`               | Number of malicious clients. More clients test defense mechanisms but can break training. | 0-50% of clients | 0 | Monitor accuracy closely. |\n| `strategy-type`                   | Defines update aggregation method. Different strategies offer varying robustness to attacks. | fedavg, krum, trimmed_mean | fedavg | Choose based on threat model. |\n| `byzantine-attack-strategy`       | Defines attack vector. Different strategies test various vulnerabilities. | sign_flip, gaussian_noise, zero_update | none | Match with defense strategy. |\n| `byzantine-attack-intensity`      | Controls attack strength. Higher values test defense limits. | 0.0-1.0 | 0.0 | Strategy-dependent. |\n| `randomize-byzantine-strategy`    | Enables random selection of attack strategies for Byzantine clients. | true/false | false | Increases attack diversity. |\n\n### Critical Combinations\n\n1. **Defense Configurations**\n   - High Byzantine Clients → Use Krum/Trimmed Mean\n   - Random Strategy → Lower Attack Intensity\n   - Large Federation → Lower Fraction Fit\n\n2. **Performance Configurations**\n   - More Local Epochs → Fewer Server Rounds\n   - Higher Batch Size → More Clients per Round\n   - Random Strategy → More Server Rounds\n\n3. **Example Configurations**\n\n```bash\n   flwr run . \\\n      --run-config num-server-rounds=5 \\\n      --run-config options.num-supernodes=20 \\\n      --run-config byzantine-clients=2 \\\n      --run-config 'strategy-type=\"krum\"' \\\n      --run-config 'randomize-byzantine-strategy=false' \\\n      --run-config 'byzantine-attack-strategy=\"zero_update\"' \\\n      --run-config byzantine-attack-intensity=1.0 \\\n      --run-config local-epochs=3\n```\n\n## Experiment Results\n\n- Review the `./notebooks/experiments.ipynb` notebook to see detailed analyses and results.\n- The results of the experiments are extracted from experiment logs and analyzed using the `./notebooks/results_review.ipynb` notebook, which reviews results in JSON format at `./results/experiments/results_summary.json`.\n\n## BFT Strategy for Robust Simulation\n\nEnsure the BFT method (e.g., \"krum\") operates correctly by configuring the following parameters for your system.\n\n### Sufficient Number of Clients\n\nFor Krum to function effectively, the total number of participating clients \\(N\\) must satisfy the inequality:\n\n\\[\nN \u003e 2f\n\\]\n\nWhere \\(f\\) is the maximum number of Byzantine clients you want to tolerate.\n\n**Example**: If you want to tolerate \\(f = 3\\) Byzantine clients, you need at least \\(N = 7\\) clients since 2 x 3 + 1 = 7\\.\n\nTo account for variability and ensure smooth testing, increase the number of clients beyond the minimum required. For example, set `num-clients` to 15 or 20.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenpalrius%2Fbft-federated-learning","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdenpalrius%2Fbft-federated-learning","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenpalrius%2Fbft-federated-learning/lists"}