# fedml-ai/fedml architecture

> Architecture diagram of the GitHub repository fedml-ai/fedml, 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/fedml-ai/fedml
- Repository: https://github.com/fedml-ai/fedml

## Overview

FedML is a unified machine-learning platform spanning federated training, job orchestration, model serving, storage, and mobile edge execution. A typical user configures or submits a job through the Python API/CLI; the scheduler provisions and runs it, while compute components perform training or serving and report results. The Android SDK adds on-device federated training. The README documents these capabilities, while the sampled excerpts show only selected implementation details, so links between broader subsystems are limited to documented relationships.

Main entry points: [`python/fedml/computing/scheduler/scheduler_entry/launch_manager.py`](https://github.com/fedml-ai/fedml/blob/master/python/fedml/computing/scheduler/scheduler_entry/launch_manager.py) (Launch Manager), [`python/fedml/computing/scheduler`](https://github.com/fedml-ai/fedml/tree/master/python/fedml/computing/scheduler) (Scheduler Runtime), [`android/fedmlsdk/src/main/java/ai/fedml/edge/service/EdgeService.java`](https://github.com/fedml-ai/fedml/blob/master/android/fedmlsdk/src/main/java/ai/fedml/edge/service/EdgeService.java) (Edge Service), [`python/fedml/api/modules`](https://github.com/fedml-ai/fedml/tree/master/python/fedml/api/modules) (Python API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Developer Interfaces"]
  node_cli["FedML CLI<br/>[cli.py]"]
  node_api["Python API"]
  node_init["Framework Init<br/>[__init__.py]"]
  node_storageapi["Storage API<br/>[storage.py]"]
end

subgraph group_orchestration["Job Orchestration"]
  node_launch["Launch Manager<br/>[launch_manager.py]"]
  node_scheduler["Scheduler Runtime"]
  node_arguments["Run Arguments<br/>[arguments.py]"]
end

subgraph group_compute["Training Compute"]
  node_fedrunner["Federated Runner<br/>[runner.py]"]
  node_algframe["Algorithm Frame"]
  node_llmrun["LLM Job<br/>[run_fedllm.py]"]
  node_llmtrainer["LLM Trainer<br/>[hf_trainer.py]"]
  node_engine["ML Engine Adapter"]
  node_objectstore[("S3 Object Storage<br/>[remote_storage.py]")]
end

subgraph group_serving["Model Deployment"]
  node_modeldeploy["Model Deployment"]
  node_modelinfer["Model Inference"]
  node_deviceclient["Device Client"]
end

subgraph group_edge["Mobile Edge"]
  node_androidapp["Edge App<br/>[HomeActivity.java]"]
  node_edgeservice["Edge Service<br/>[EdgeService.java]"]
  node_edgeapi["Edge Training API"]
  node_native["Native Trainer<br/>[FedMLTrainer.cpp]"]
end

node_developer(("Developer"))
node_androiduser(("Mobile User"))
node_edgecloud{{"FedML Cloud"}}

node_developer -->|"runs commands"| node_cli
node_developer -->|"submits jobs"| node_api
node_cli -->|"invokes operations"| node_api
node_api -.->|"requests launch"| node_launch
node_init -->|"loads arguments"| node_arguments
node_launch -->|"orchestrates jobs"| node_scheduler
node_launch -->|"uses configuration"| node_arguments
node_scheduler -.->|"runs workloads"| node_fedrunner
node_fedrunner -.->|"uses algorithms"| node_algframe
node_llmrun -->|"creates trainer"| node_llmtrainer
node_llmtrainer -.->|"uses backend"| node_engine
node_storageapi -->|"uses S3 storage"| node_objectstore
node_scheduler -->|"provisions serving"| node_modeldeploy
node_modeldeploy -.->|"hosts inference"| node_modelinfer
node_deviceclient -.->|"requests inference"| node_modelinfer
node_androiduser -->|"uses app"| node_androidapp
node_androidapp -.->|"starts training"| node_edgeservice
node_edgeservice -->|"initializes training"| node_edgeapi
node_edgeapi -.->|"delegates training"| node_native
node_edgeservice -.->|"communicates"| node_edgecloud

click node_cli "https://github.com/fedml-ai/fedml/blob/master/python/fedml/cli/cli.py"
click node_api "https://github.com/fedml-ai/fedml/tree/master/python/fedml/api/modules"
click node_init "https://github.com/fedml-ai/fedml/blob/master/python/fedml/__init__.py"
click node_launch "https://github.com/fedml-ai/fedml/blob/master/python/fedml/computing/scheduler/scheduler_entry/launch_manager.py"
click node_scheduler "https://github.com/fedml-ai/fedml/tree/master/python/fedml/computing/scheduler"
click node_arguments "https://github.com/fedml-ai/fedml/blob/master/python/fedml/arguments.py"
click node_fedrunner "https://github.com/fedml-ai/fedml/blob/master/python/fedml/runner.py"
click node_algframe "https://github.com/fedml-ai/fedml/tree/master/python/fedml/core/alg_frame"
click node_llmrun "https://github.com/fedml-ai/fedml/blob/master/python/spotlight_prj/fedllm/run_fedllm.py"
click node_llmtrainer "https://github.com/fedml-ai/fedml/blob/master/python/fedml/train/llm/hf_trainer.py"
click node_engine "https://github.com/fedml-ai/fedml/blob/master/python/fedml/ml/engine/ml_engine_adapter.py"
click node_storageapi "https://github.com/fedml-ai/fedml/blob/master/python/fedml/api/modules/storage.py"
click node_objectstore "https://github.com/fedml-ai/fedml/blob/master/python/fedml/core/distributed/communication/s3/remote_storage.py"
click node_modeldeploy "https://github.com/fedml-ai/fedml/blob/master/python/fedml/computing/scheduler/model_scheduler/device_model_deployment.py"
click node_modelinfer "https://github.com/fedml-ai/fedml/blob/master/python/fedml/computing/scheduler/model_scheduler/device_model_inference.py"
click node_deviceclient "https://github.com/fedml-ai/fedml/blob/master/python/fedml/computing/scheduler/model_scheduler/device_client_runner.py"
click node_androidapp "https://github.com/fedml-ai/fedml/blob/master/android/app/src/main/java/ai/fedml/ui/HomeActivity.java"
click node_edgeservice "https://github.com/fedml-ai/fedml/blob/master/android/fedmlsdk/src/main/java/ai/fedml/edge/service/EdgeService.java"
click node_edgeapi "https://github.com/fedml-ai/fedml/blob/master/android/fedmlsdk/src/main/java/ai/fedml/edge/service/FedEdgeTrainImpl.java"
click node_native "https://github.com/fedml-ai/fedml/blob/master/android/fedmlsdk/MobileNN/src/train/FedMLTrainer.cpp"

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_cli,node_api,node_init,node_storageapi,node_androiduser toneBlue
class node_launch,node_scheduler,node_arguments toneAmber
class node_fedrunner,node_algframe,node_llmrun,node_llmtrainer,node_engine,node_objectstore toneMint
class node_modeldeploy,node_modelinfer,node_deviceclient toneRose
class node_androidapp,node_edgeservice,node_edgeapi,node_native,node_developer,node_edgecloud toneIndigo
```

## Components

### Developer Interfaces

- [FedML CLI](https://github.com/fedml-ai/fedml/blob/master/python/fedml/cli/cli.py): `python/fedml/cli/cli.py`
- [Python API](https://github.com/fedml-ai/fedml/tree/master/python/fedml/api/modules): `python/fedml/api/modules`
- [Framework Init](https://github.com/fedml-ai/fedml/blob/master/python/fedml/__init__.py): `python/fedml/__init__.py`
- [Storage API](https://github.com/fedml-ai/fedml/blob/master/python/fedml/api/modules/storage.py): `python/fedml/api/modules/storage.py`

### Job Orchestration

- [Launch Manager](https://github.com/fedml-ai/fedml/blob/master/python/fedml/computing/scheduler/scheduler_entry/launch_manager.py): `python/fedml/computing/scheduler/scheduler_entry/launch_manager.py`
- [Scheduler Runtime](https://github.com/fedml-ai/fedml/tree/master/python/fedml/computing/scheduler): `python/fedml/computing/scheduler`
- [Run Arguments](https://github.com/fedml-ai/fedml/blob/master/python/fedml/arguments.py): `python/fedml/arguments.py`

### Training Compute

- [Federated Runner](https://github.com/fedml-ai/fedml/blob/master/python/fedml/runner.py): `python/fedml/runner.py`
- [Algorithm Frame](https://github.com/fedml-ai/fedml/tree/master/python/fedml/core/alg_frame): `python/fedml/core/alg_frame`
- [LLM Job](https://github.com/fedml-ai/fedml/blob/master/python/spotlight_prj/fedllm/run_fedllm.py): `python/spotlight_prj/fedllm/run_fedllm.py`
- [LLM Trainer](https://github.com/fedml-ai/fedml/blob/master/python/fedml/train/llm/hf_trainer.py): `python/fedml/train/llm/hf_trainer.py`
- [ML Engine Adapter](https://github.com/fedml-ai/fedml/blob/master/python/fedml/ml/engine/ml_engine_adapter.py): `python/fedml/ml/engine/ml_engine_adapter.py`
- [S3 Object Storage](https://github.com/fedml-ai/fedml/blob/master/python/fedml/core/distributed/communication/s3/remote_storage.py): `python/fedml/core/distributed/communication/s3/remote_storage.py`

### Model Deployment

- [Model Deployment](https://github.com/fedml-ai/fedml/blob/master/python/fedml/computing/scheduler/model_scheduler/device_model_deployment.py): `python/fedml/computing/scheduler/model_scheduler/device_model_deployment.py`
- [Model Inference](https://github.com/fedml-ai/fedml/blob/master/python/fedml/computing/scheduler/model_scheduler/device_model_inference.py): `python/fedml/computing/scheduler/model_scheduler/device_model_inference.py`
- [Device Client](https://github.com/fedml-ai/fedml/blob/master/python/fedml/computing/scheduler/model_scheduler/device_client_runner.py): `python/fedml/computing/scheduler/model_scheduler/device_client_runner.py`

### Mobile Edge

- [Edge App](https://github.com/fedml-ai/fedml/blob/master/android/app/src/main/java/ai/fedml/ui/HomeActivity.java): `android/app/src/main/java/ai/fedml/ui/HomeActivity.java`
- [Edge Service](https://github.com/fedml-ai/fedml/blob/master/android/fedmlsdk/src/main/java/ai/fedml/edge/service/EdgeService.java): `android/fedmlsdk/src/main/java/ai/fedml/edge/service/EdgeService.java`
- [Edge Training API](https://github.com/fedml-ai/fedml/blob/master/android/fedmlsdk/src/main/java/ai/fedml/edge/service/FedEdgeTrainImpl.java): `android/fedmlsdk/src/main/java/ai/fedml/edge/service/FedEdgeTrainImpl.java`
- [Native Trainer](https://github.com/fedml-ai/fedml/blob/master/android/fedmlsdk/MobileNN/src/train/FedMLTrainer.cpp): `android/fedmlsdk/MobileNN/src/train/FedMLTrainer.cpp`

### Other components

- **Developer**
- **Mobile User**
- **FedML Cloud**

## Connections

- Developer → FedML CLI: runs commands
- Developer → Python API: submits jobs
- FedML CLI → Python API: invokes operations
- Python API → Launch Manager: requests launch (evidence: `python/fedml/computing/scheduler/scheduler_entry/launch_manager.py`)
- Framework Init → Run Arguments: loads arguments (evidence: `python/fedml/__init__.py`)
- Launch Manager → Scheduler Runtime: orchestrates jobs (evidence: `python/fedml/computing/scheduler/scheduler_entry/launch_manager.py`)
- Launch Manager → Run Arguments: uses configuration (evidence: `python/fedml/computing/scheduler/scheduler_entry/launch_manager.py`)
- Scheduler Runtime → Federated Runner: runs workloads
- Federated Runner → Algorithm Frame: uses algorithms
- LLM Job → LLM Trainer: creates trainer (evidence: `python/spotlight_prj/fedllm/run_fedllm.py`)
- LLM Trainer → ML Engine Adapter: uses backend
- Storage API → S3 Object Storage: uses S3 storage (evidence: `python/fedml/api/modules/storage.py`)
- Scheduler Runtime → Model Deployment: provisions serving
- Model Deployment → Model Inference: hosts inference
- Device Client → Model Inference: requests inference
- Mobile User → Edge App: uses app
- Edge App → Edge Service: starts training
- Edge Service → Edge Training API: initializes training (evidence: `android/fedmlsdk/src/main/java/ai/fedml/edge/service/EdgeService.java`)
- Edge Training API → Native Trainer: delegates training
- Edge Service → FedML Cloud: communicates
