# deadserpent/hfl architecture

> Architecture diagram of the GitHub repository deadserpent/hfl, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/deadserpent/hfl
- Repository: https://github.com/deadserpent/hfl

## Overview

PP-HFM is research software for patient-level differential privacy in hierarchical federated multimodal learning, accompanied by a curated public research observatory. The principal workflow is to prepare patient-partitioned datasets, train and account for private federated models, then evaluate utility, privacy, and simulated system costs. The dashboard presents curated findings rather than reading research files at runtime. Several implementation links below are documented capabilities rather than inspected call paths; those are cited to the README, and unsampled details are not inferred.

Main entry points: [`SIMULATORS/scripts/run_pipeline.py`](https://github.com/deadserpent/hfl/blob/main/SIMULATORS/scripts/run_pipeline.py) (Study pipeline), [`SIMULATORS/model/training/hfl_trainer.py`](https://github.com/deadserpent/hfl/blob/main/SIMULATORS/model/training/hfl_trainer.py) (HFL trainer), [`hfl-dashboard/src/app/page.tsx`](https://github.com/deadserpent/hfl/blob/main/hfl-dashboard/src/app/page.tsx) (Research website), [`hfl-dashboard/src/content`](https://github.com/deadserpent/hfl/tree/main/hfl-dashboard/src/content) (Curated content)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_registry["Dataset registry<br/>[datasets.py]"]
  node_preprocess["Corpus preprocessing<br/>[preprocess_eicu.py]"]
  node_loaders["Dataset loaders"]
end

subgraph group_learning["Federated learning"]
  node_model["Multimodal model<br/>[hfl_mm_model.py]"]
  node_trainer["HFL trainer<br/>[hfl_trainer.py]"]
  node_patientdp["Patient-level DP<br/>[patient_dp.py]"]
  node_dpengine["DP-SGD engine<br/>[dp_engine.py]"]
  node_compression["Update compression<br/>[compression.py]"]
  node_conformal["Conformal prediction<br/>[fedconform_hc.py]"]
end

subgraph group_evaluation["Evaluation"]
  node_pipeline["Study pipeline<br/>[run_pipeline.py]"]
  node_utility["Utility evaluation<br/>[joint_eval.py]"]
  node_privacy_audit["Membership audit"]
  node_network["Network simulation<br/>[hfl_network_sim.py]"]
  node_network_integration["Network integration"]
  node_energy["Energy simulation"]
  node_inference["Inference benchmark<br/>[inference_bench.py]"]
end

subgraph group_observatory["Research observatory"]
  node_dashboard["Research website<br/>[page.tsx]"]
  node_research_page["Research overview<br/>[page.tsx]"]
  node_experiments_page["Experiment explorer<br/>[page.tsx]"]
  node_privacy_page["Privacy explanation<br/>[page.tsx]"]
  node_repro_page["Reproduction guide<br/>[page.tsx]"]
  node_curated_content["Curated content"]
end

node_researcher(("Researcher"))

node_researcher -->|"runs study"| node_pipeline
node_pipeline -->|"resolves datasets"| node_registry
node_pipeline -->|"plans topology"| node_network_integration
node_preprocess -.->|"prepares corpora"| node_loaders
node_pipeline -.->|"uses prepared data"| node_preprocess
node_trainer -.->|"trains model"| node_model
node_trainer -.->|"applies patient privacy"| node_patientdp
node_trainer -.->|"uses DP-SGD"| node_dpengine
node_trainer -.->|"compresses updates"| node_compression
node_trainer -.->|"accounts conformal release"| node_conformal
node_pipeline -.->|"runs training"| node_trainer
node_pipeline -.->|"evaluates utility"| node_utility
node_pipeline -.->|"runs privacy audit"| node_privacy_audit
node_network_integration -.->|"simulates network"| node_network
node_pipeline -.->|"models energy"| node_energy
node_pipeline -.->|"benchmarks latency"| node_inference
node_dashboard -->|"presents research"| node_research_page
node_dashboard -->|"presents experiments"| node_experiments_page
node_dashboard -->|"explains privacy"| node_privacy_page
node_dashboard -->|"documents protocol"| node_repro_page
node_research_page -->|"reads content"| node_curated_content
node_experiments_page -->|"reads content"| node_curated_content
node_privacy_page -->|"reads content"| node_curated_content

click node_pipeline "https://github.com/deadserpent/hfl/blob/main/SIMULATORS/scripts/run_pipeline.py"
click node_registry "https://github.com/deadserpent/hfl/blob/main/SIMULATORS/data/loaders/datasets.py"
click node_preprocess "https://github.com/deadserpent/hfl/blob/main/SIMULATORS/data/loaders/preprocess_eicu.py"
click node_loaders "https://github.com/deadserpent/hfl/tree/main/SIMULATORS/data/loaders"
click node_model "https://github.com/deadserpent/hfl/blob/main/SIMULATORS/model/architecture/hfl_mm_model.py"
click node_trainer "https://github.com/deadserpent/hfl/blob/main/SIMULATORS/model/training/hfl_trainer.py"
click node_patientdp "https://github.com/deadserpent/hfl/blob/main/SIMULATORS/model/privacy/patient_dp.py"
click node_dpengine "https://github.com/deadserpent/hfl/blob/main/SIMULATORS/model/privacy/dp_engine.py"
click node_compression "https://github.com/deadserpent/hfl/blob/main/SIMULATORS/model/utils/compression.py"
click node_conformal "https://github.com/deadserpent/hfl/blob/main/SIMULATORS/model/utils/fedconform_hc.py"
click node_utility "https://github.com/deadserpent/hfl/blob/main/SIMULATORS/scripts/joint_eval.py"
click node_privacy_audit "https://github.com/deadserpent/hfl/blob/main/SIMULATORS/scripts/membership_inference.py"
click node_network "https://github.com/deadserpent/hfl/blob/main/SIMULATORS/ns3/hfl-scenarios/hfl_network_sim.py"
click node_network_integration "https://github.com/deadserpent/hfl/blob/main/SIMULATORS/scripts/ns3_phase5_integration.py"
click node_energy "https://github.com/deadserpent/hfl/blob/main/SIMULATORS/cloudsim-plus/hfl-simulation/src/main/java/hfl/HFLCloudSimulation.java"
click node_inference "https://github.com/deadserpent/hfl/blob/main/SIMULATORS/model/deploy/inference_bench.py"
click node_dashboard "https://github.com/deadserpent/hfl/blob/main/hfl-dashboard/src/app/page.tsx"
click node_research_page "https://github.com/deadserpent/hfl/blob/main/hfl-dashboard/src/app/research/page.tsx"
click node_experiments_page "https://github.com/deadserpent/hfl/blob/main/hfl-dashboard/src/app/experiments/page.tsx"
click node_privacy_page "https://github.com/deadserpent/hfl/blob/main/hfl-dashboard/src/app/privacy/page.tsx"
click node_repro_page "https://github.com/deadserpent/hfl/blob/main/hfl-dashboard/src/app/reproducibility/page.tsx"
click node_curated_content "https://github.com/deadserpent/hfl/tree/main/hfl-dashboard/src/content"

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_registry,node_preprocess,node_loaders toneBlue
class node_model,node_trainer,node_patientdp,node_dpengine,node_compression,node_conformal toneAmber
class node_pipeline,node_utility,node_privacy_audit,node_network,node_network_integration,node_energy,node_inference toneMint
class node_dashboard,node_research_page,node_experiments_page,node_privacy_page,node_repro_page,node_curated_content toneRose
class node_researcher toneIndigo
```

## Components

### Data preparation

- [Dataset registry](https://github.com/deadserpent/hfl/blob/main/SIMULATORS/data/loaders/datasets.py): `SIMULATORS/data/loaders/datasets.py`
- [Corpus preprocessing](https://github.com/deadserpent/hfl/blob/main/SIMULATORS/data/loaders/preprocess_eicu.py): `SIMULATORS/data/loaders/preprocess_eicu.py`
- [Dataset loaders](https://github.com/deadserpent/hfl/tree/main/SIMULATORS/data/loaders): `SIMULATORS/data/loaders`

### Federated learning

- [Multimodal model](https://github.com/deadserpent/hfl/blob/main/SIMULATORS/model/architecture/hfl_mm_model.py): `SIMULATORS/model/architecture/hfl_mm_model.py`
- [HFL trainer](https://github.com/deadserpent/hfl/blob/main/SIMULATORS/model/training/hfl_trainer.py): `SIMULATORS/model/training/hfl_trainer.py`
- [Patient-level DP](https://github.com/deadserpent/hfl/blob/main/SIMULATORS/model/privacy/patient_dp.py): `SIMULATORS/model/privacy/patient_dp.py`
- [DP-SGD engine](https://github.com/deadserpent/hfl/blob/main/SIMULATORS/model/privacy/dp_engine.py): `SIMULATORS/model/privacy/dp_engine.py`
- [Update compression](https://github.com/deadserpent/hfl/blob/main/SIMULATORS/model/utils/compression.py): `SIMULATORS/model/utils/compression.py`
- [Conformal prediction](https://github.com/deadserpent/hfl/blob/main/SIMULATORS/model/utils/fedconform_hc.py): `SIMULATORS/model/utils/fedconform_hc.py`

### Evaluation

- [Study pipeline](https://github.com/deadserpent/hfl/blob/main/SIMULATORS/scripts/run_pipeline.py): `SIMULATORS/scripts/run_pipeline.py`
- [Utility evaluation](https://github.com/deadserpent/hfl/blob/main/SIMULATORS/scripts/joint_eval.py): `SIMULATORS/scripts/joint_eval.py`
- [Membership audit](https://github.com/deadserpent/hfl/blob/main/SIMULATORS/scripts/membership_inference.py): `SIMULATORS/scripts/membership_inference.py`
- [Network simulation](https://github.com/deadserpent/hfl/blob/main/SIMULATORS/ns3/hfl-scenarios/hfl_network_sim.py): `SIMULATORS/ns3/hfl-scenarios/hfl_network_sim.py`
- [Network integration](https://github.com/deadserpent/hfl/blob/main/SIMULATORS/scripts/ns3_phase5_integration.py): `SIMULATORS/scripts/ns3_phase5_integration.py`
- [Energy simulation](https://github.com/deadserpent/hfl/blob/main/SIMULATORS/cloudsim-plus/hfl-simulation/src/main/java/hfl/HFLCloudSimulation.java): `SIMULATORS/cloudsim-plus/hfl-simulation/src/main/java/hfl/HFLCloudSimulation.java`
- [Inference benchmark](https://github.com/deadserpent/hfl/blob/main/SIMULATORS/model/deploy/inference_bench.py): `SIMULATORS/model/deploy/inference_bench.py`

### Research observatory

- [Research website](https://github.com/deadserpent/hfl/blob/main/hfl-dashboard/src/app/page.tsx): `hfl-dashboard/src/app/page.tsx`
- [Research overview](https://github.com/deadserpent/hfl/blob/main/hfl-dashboard/src/app/research/page.tsx): `hfl-dashboard/src/app/research/page.tsx`
- [Experiment explorer](https://github.com/deadserpent/hfl/blob/main/hfl-dashboard/src/app/experiments/page.tsx): `hfl-dashboard/src/app/experiments/page.tsx`
- [Privacy explanation](https://github.com/deadserpent/hfl/blob/main/hfl-dashboard/src/app/privacy/page.tsx): `hfl-dashboard/src/app/privacy/page.tsx`
- [Reproduction guide](https://github.com/deadserpent/hfl/blob/main/hfl-dashboard/src/app/reproducibility/page.tsx): `hfl-dashboard/src/app/reproducibility/page.tsx`
- [Curated content](https://github.com/deadserpent/hfl/tree/main/hfl-dashboard/src/content): `hfl-dashboard/src/content`

### Other components

- **Researcher**

## Connections

- Researcher → Study pipeline: runs study
- Study pipeline → Dataset registry: resolves datasets (evidence: `SIMULATORS/scripts/run_pipeline.py`)
- Study pipeline → Network integration: plans topology (evidence: `SIMULATORS/scripts/run_pipeline.py`)
- Corpus preprocessing → Dataset loaders: prepares corpora
- Study pipeline → Corpus preprocessing: uses prepared data
- HFL trainer → Multimodal model: trains model
- HFL trainer → Patient-level DP: applies patient privacy
- HFL trainer → DP-SGD engine: uses DP-SGD (evidence: `SIMULATORS/model/privacy/dp_engine.py`)
- HFL trainer → Update compression: compresses updates
- HFL trainer → Conformal prediction: accounts conformal release
- Study pipeline → HFL trainer: runs training
- Study pipeline → Utility evaluation: evaluates utility
- Study pipeline → Membership audit: runs privacy audit
- Network integration → Network simulation: simulates network
- Study pipeline → Energy simulation: models energy
- Study pipeline → Inference benchmark: benchmarks latency
- Research website → Research overview: presents research (evidence: `hfl-dashboard/src/app/research/page.tsx`)
- Research website → Experiment explorer: presents experiments (evidence: `hfl-dashboard/src/app/experiments/page.tsx`)
- Research website → Privacy explanation: explains privacy (evidence: `hfl-dashboard/src/app/privacy/page.tsx`)
- Research website → Reproduction guide: documents protocol (evidence: `hfl-dashboard/src/app/reproducibility/page.tsx`)
- Research overview → Curated content: reads content (evidence: `hfl-dashboard/src/app/research/page.tsx`)
- Experiment explorer → Curated content: reads content (evidence: `hfl-dashboard/src/app/experiments/page.tsx`)
- Privacy explanation → Curated content: reads content (evidence: `hfl-dashboard/src/app/privacy/page.tsx`)
