# saranrajsnkr/swb-dm-full-empirical-study architecture

> Architecture diagram of the GitHub repository saranrajsnkr/swb-dm-full-empirical-study, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/saranrajsnkr/swb-dm-full-empirical-study
- Repository: https://github.com/saranrajsnkr/swb-dm-full-empirical-study

## Overview

SWB-DM is a research implementation and empirical evaluation suite for Byzantine-robust federated learning under partial client participation. In each round, an experiment samples clients; they train locally and may submit poisoned updates. The server either aggregates sampled updates directly or updates a full-pool delayed-momentum cache and aggregates that pool. Experiments evaluate the resulting global model and compare robustness, generalization, and scale. The graph preserves the documented study branches; source excerpts are partial, so unshown runtime links are omitted rather than inferred.

Main entry points: [`grid_main.py`](https://github.com/saranrajsnkr/swb-dm-full-empirical-study/blob/master/grid_main.py) (Main experiment grid), [`aggregators.py`](https://github.com/saranrajsnkr/swb-dm-full-empirical-study/blob/master/aggregators.py) (FedAvg, Krum, Bulyan, SWB), [`fltrust_corrected.py`](https://github.com/saranrajsnkr/swb-dm-full-empirical-study/blob/master/fltrust_corrected.py) (FLTrust aggregation), [`cache.py`](https://github.com/saranrajsnkr/swb-dm-full-empirical-study/blob/master/cache.py) (Full-pool momentum cache)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_training["Federated training"]
  node_client_data["Client data partitions<br/>[common.py]"]
  node_client_training["Local training and attacks<br/>[common.py]"]
  node_attack_generation["Adaptive attack generation<br/>[attacks.py]"]
  node_test_evaluation["Model evaluation<br/>[common.py]"]
end

subgraph group_aggregation["Robust aggregation"]
  node_aggregation_methods["FedAvg, Krum, Bulyan, SWB<br/>[aggregators.py]"]
  node_fltrust["FLTrust aggregation"]
  node_momentum_cache[("Full-pool momentum cache<br/>[cache.py]")]
end

subgraph group_experiments["Evaluation studies"]
  node_main_grid["Main experiment grid<br/>[grid_main.py]"]
  node_attack_study["Attack validation"]
  node_extended_study["Extended method comparison"]
  node_round_study["Extended-round comparison"]
  node_generalization["Dataset generalization<br/>[generalization.py]"]
  node_scalability["500-client scalability<br/>[scalability.py]"]
  node_krum_scale["Krum scale check"]
  node_adaptive_study["Adaptive attack experiments"]
  node_attack_sweep["Attack experiments"]
  node_generalization_eval["Generalization checks"]
end

subgraph group_analysis["Analysis"]
  node_theory["Robustness bound analysis<br/>[theory_bound.py]"]
  node_adaptive_theory["Adaptive attack bounds"]
end

node_researcher(("Researcher"))

node_researcher -->|"runs study"| node_main_grid
node_main_grid -->|"loads partitions"| node_client_data
node_main_grid -->|"trains clients"| node_client_training
node_main_grid -->|"generates attacks"| node_attack_generation
node_main_grid -->|"aggregates updates"| node_aggregation_methods
node_main_grid -->|"calls FLTrust"| node_fltrust
node_main_grid -->|"updates cache"| node_momentum_cache
node_main_grid -->|"evaluates model"| node_test_evaluation
node_client_training -->|"trains on"| node_client_data
node_attack_study -->|"trains clients"| node_client_training
node_attack_study -->|"selects method"| node_aggregation_methods
node_attack_study -->|"calls FLTrust"| node_fltrust
node_attack_study -->|"steps cache"| node_momentum_cache
node_extended_study -->|"trains clients"| node_client_training
node_extended_study -->|"compares methods"| node_aggregation_methods
node_extended_study -->|"calls FLTrust"| node_fltrust
node_extended_study -->|"uses cache"| node_momentum_cache
node_round_study -->|"compares methods"| node_aggregation_methods
node_round_study -->|"steps cache"| node_momentum_cache
node_generalization -->|"compares methods"| node_aggregation_methods
node_generalization -->|"calls FLTrust"| node_fltrust
node_generalization -->|"steps cache"| node_momentum_cache
node_scalability -->|"compares methods"| node_aggregation_methods
node_scalability -->|"calls FLTrust"| node_fltrust
node_krum_scale -->|"calls Krum"| node_aggregation_methods
node_adaptive_study -->|"uses attacks"| node_attack_generation
node_attack_sweep -->|"uses attacks"| node_attack_generation
node_generalization_eval -->|"compares methods"| node_aggregation_methods
node_theory -->|"analyzes SWB"| node_aggregation_methods
node_adaptive_theory -->|"analyzes attacks"| node_attack_generation

click node_client_data "https://github.com/saranrajsnkr/swb-dm-full-empirical-study/blob/master/common.py"
click node_client_training "https://github.com/saranrajsnkr/swb-dm-full-empirical-study/blob/master/common.py"
click node_attack_generation "https://github.com/saranrajsnkr/swb-dm-full-empirical-study/blob/master/attacks.py"
click node_aggregation_methods "https://github.com/saranrajsnkr/swb-dm-full-empirical-study/blob/master/aggregators.py"
click node_fltrust "https://github.com/saranrajsnkr/swb-dm-full-empirical-study/blob/master/fltrust_corrected.py"
click node_momentum_cache "https://github.com/saranrajsnkr/swb-dm-full-empirical-study/blob/master/cache.py"
click node_main_grid "https://github.com/saranrajsnkr/swb-dm-full-empirical-study/blob/master/grid_main.py"
click node_attack_study "https://github.com/saranrajsnkr/swb-dm-full-empirical-study/blob/master/experiment_attacks_v2.py"
click node_extended_study "https://github.com/saranrajsnkr/swb-dm-full-empirical-study/blob/master/extended_all_methods.py"
click node_round_study "https://github.com/saranrajsnkr/swb-dm-full-empirical-study/blob/master/grid_extended_rounds.py"
click node_generalization "https://github.com/saranrajsnkr/swb-dm-full-empirical-study/blob/master/generalization.py"
click node_scalability "https://github.com/saranrajsnkr/swb-dm-full-empirical-study/blob/master/scalability.py"
click node_krum_scale "https://github.com/saranrajsnkr/swb-dm-full-empirical-study/blob/master/Krum_500-client_scale.py"
click node_adaptive_study "https://github.com/saranrajsnkr/swb-dm-full-empirical-study/blob/master/experiment_adaptive.py"
click node_attack_sweep "https://github.com/saranrajsnkr/swb-dm-full-empirical-study/blob/master/experiment_attacks.py"
click node_generalization_eval "https://github.com/saranrajsnkr/swb-dm-full-empirical-study/blob/master/swb_dm_cifar100_extended.py"
click node_theory "https://github.com/saranrajsnkr/swb-dm-full-empirical-study/blob/master/theory_bound.py"
click node_adaptive_theory "https://github.com/saranrajsnkr/swb-dm-full-empirical-study/blob/master/theory_bound_adaptive_attacks.py"
click node_test_evaluation "https://github.com/saranrajsnkr/swb-dm-full-empirical-study/blob/master/common.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_client_data,node_client_training,node_attack_generation,node_test_evaluation toneBlue
class node_aggregation_methods,node_fltrust,node_momentum_cache toneAmber
class node_main_grid,node_attack_study,node_extended_study,node_round_study,node_generalization,node_scalability,node_krum_scale,node_adaptive_study,node_attack_sweep,node_generalization_eval toneMint
class node_theory,node_adaptive_theory toneRose
class node_researcher toneIndigo
```

## Components

### Federated training

- [Client data partitions](https://github.com/saranrajsnkr/swb-dm-full-empirical-study/blob/master/common.py): `common.py`
- [Local training and attacks](https://github.com/saranrajsnkr/swb-dm-full-empirical-study/blob/master/common.py): `common.py`
- [Adaptive attack generation](https://github.com/saranrajsnkr/swb-dm-full-empirical-study/blob/master/attacks.py): `attacks.py`
- [Model evaluation](https://github.com/saranrajsnkr/swb-dm-full-empirical-study/blob/master/common.py): `common.py`

### Robust aggregation

- [FedAvg, Krum, Bulyan, SWB](https://github.com/saranrajsnkr/swb-dm-full-empirical-study/blob/master/aggregators.py): `aggregators.py`
- [FLTrust aggregation](https://github.com/saranrajsnkr/swb-dm-full-empirical-study/blob/master/fltrust_corrected.py): `fltrust_corrected.py`
- [Full-pool momentum cache](https://github.com/saranrajsnkr/swb-dm-full-empirical-study/blob/master/cache.py): `cache.py`

### Evaluation studies

- [Main experiment grid](https://github.com/saranrajsnkr/swb-dm-full-empirical-study/blob/master/grid_main.py): `grid_main.py`
- [Attack validation](https://github.com/saranrajsnkr/swb-dm-full-empirical-study/blob/master/experiment_attacks_v2.py): `experiment_attacks_v2.py`
- [Extended method comparison](https://github.com/saranrajsnkr/swb-dm-full-empirical-study/blob/master/extended_all_methods.py): `extended_all_methods.py`
- [Extended-round comparison](https://github.com/saranrajsnkr/swb-dm-full-empirical-study/blob/master/grid_extended_rounds.py): `grid_extended_rounds.py`
- [Dataset generalization](https://github.com/saranrajsnkr/swb-dm-full-empirical-study/blob/master/generalization.py): `generalization.py`
- [500-client scalability](https://github.com/saranrajsnkr/swb-dm-full-empirical-study/blob/master/scalability.py): `scalability.py`
- [Krum scale check](https://github.com/saranrajsnkr/swb-dm-full-empirical-study/blob/master/Krum_500-client_scale.py): `Krum_500-client_scale.py`
- [Adaptive attack experiments](https://github.com/saranrajsnkr/swb-dm-full-empirical-study/blob/master/experiment_adaptive.py): `experiment_adaptive.py`
- [Attack experiments](https://github.com/saranrajsnkr/swb-dm-full-empirical-study/blob/master/experiment_attacks.py): `experiment_attacks.py`
- [Generalization checks](https://github.com/saranrajsnkr/swb-dm-full-empirical-study/blob/master/swb_dm_cifar100_extended.py): `swb_dm_cifar100_extended.py`

### Analysis

- [Robustness bound analysis](https://github.com/saranrajsnkr/swb-dm-full-empirical-study/blob/master/theory_bound.py): `theory_bound.py`
- [Adaptive attack bounds](https://github.com/saranrajsnkr/swb-dm-full-empirical-study/blob/master/theory_bound_adaptive_attacks.py): `theory_bound_adaptive_attacks.py`

### Other components

- **Researcher**

## Connections

- Researcher → Main experiment grid: runs study (evidence: `README.md`)
- Main experiment grid → Client data partitions: loads partitions (evidence: `grid_main.py`)
- Main experiment grid → Local training and attacks: trains clients (evidence: `grid_main.py`)
- Main experiment grid → Adaptive attack generation: generates attacks (evidence: `grid_main.py`)
- Main experiment grid → FedAvg, Krum, Bulyan, SWB: aggregates updates (evidence: `grid_main.py`)
- Main experiment grid → FLTrust aggregation: calls FLTrust (evidence: `grid_main.py`)
- Main experiment grid → Full-pool momentum cache: updates cache (evidence: `grid_main.py`)
- Main experiment grid → Model evaluation: evaluates model (evidence: `grid_main.py`)
- Local training and attacks → Client data partitions: trains on (evidence: `common.py`)
- Attack validation → Local training and attacks: trains clients (evidence: `experiment_attacks_v2.py`)
- Attack validation → FedAvg, Krum, Bulyan, SWB: selects method (evidence: `experiment_attacks_v2.py`)
- Attack validation → FLTrust aggregation: calls FLTrust (evidence: `experiment_attacks_v2.py`)
- Attack validation → Full-pool momentum cache: steps cache (evidence: `experiment_attacks_v2.py`)
- Extended method comparison → Local training and attacks: trains clients (evidence: `extended_all_methods.py`)
- Extended method comparison → FedAvg, Krum, Bulyan, SWB: compares methods (evidence: `extended_all_methods.py`)
- Extended method comparison → FLTrust aggregation: calls FLTrust (evidence: `extended_all_methods.py`)
- Extended method comparison → Full-pool momentum cache: uses cache (evidence: `extended_all_methods.py`)
- Extended-round comparison → FedAvg, Krum, Bulyan, SWB: compares methods (evidence: `grid_extended_rounds.py`)
- Extended-round comparison → Full-pool momentum cache: steps cache (evidence: `grid_extended_rounds.py`)
- Dataset generalization → FedAvg, Krum, Bulyan, SWB: compares methods (evidence: `generalization.py`)
- Dataset generalization → FLTrust aggregation: calls FLTrust (evidence: `generalization.py`)
- Dataset generalization → Full-pool momentum cache: steps cache (evidence: `generalization.py`)
- 500-client scalability → FedAvg, Krum, Bulyan, SWB: compares methods (evidence: `scalability.py`)
- 500-client scalability → FLTrust aggregation: calls FLTrust (evidence: `scalability.py`)
- Krum scale check → FedAvg, Krum, Bulyan, SWB: calls Krum (evidence: `Krum_500-client_scale.py`)
- Adaptive attack experiments → Adaptive attack generation: uses attacks (evidence: `experiment_adaptive.py`)
- Attack experiments → Adaptive attack generation: uses attacks (evidence: `experiment_attacks.py`)
- Generalization checks → FedAvg, Krum, Bulyan, SWB: compares methods (evidence: `swb_dm_cifar100_extended.py`)
- Robustness bound analysis → FedAvg, Krum, Bulyan, SWB: analyzes SWB (evidence: `theory_bound.py`)
- Adaptive attack bounds → Adaptive attack generation: analyzes attacks (evidence: `theory_bound_adaptive_attacks.py`)
