Replies: 4 comments 4 replies
-
|
For all the usage code blocks, the |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for adding more implementation details, @nisha987, I think it's a very good starting point! On the other hand, I think the sequence diagram you've shared mostly corresponds to the In fact, for As a next step, I would therefore suggest creating a separate sequence diagram for |
Beta Was this translation helpful? Give feedback.
-
|
PS: in terms of implementation sequence, it could make sense to deliver branching support for |
Beta Was this translation helpful? Give feedback.
-
|
Another small question - what does "All branches must adhere to Metaflow validation rules" mean? Could you reference those rules, presumably from Metaflow's documentation? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
Branching in Metaflow can be explained with parallel steps. it supports any number of parallel branches. This proposal is to enable branching support for Vertical Federated Learning (VFL) in OpenFL, providing a flexible workflow management system that allows for complex, multi-path federated learning scenarios.
Motivation
Proposal
Vertical FL
Vertical Federated Learning (VFL) is a federated machine learning method that allows multiple clients, each possessing complementary and non-overlapping features about the same entity, to collaboratively train machine learning models without disclosing their raw data. This approach is particularly valuable in situations where organizations have distinct yet highly informative data subsets. By combining these subsets, VFL can significantly improve the predictive performance of machine learning models.
Core Features
We propose branching support for the following use-case:
This use-case addresses the branching within collaborator steps. collaborator can branch into multiple steps and join at the end. Example mentioned below is for understanding how branching works and not a usage example.
Implementation Requirements
Scheduling the collaborator
Parallel Execution:
Implementation:
Components which will require changes:
FLSpec:
The
FLSpecclass needs to be updated to support branch selection and routing in thenext()method. Currently, thenext()method supports transitioning to the next task withforeachparameter for collaborator selection. It needs to be extended to handle branching.next()method: Modify to handle a new keyword parameterbrancheswhich will specify different execution paths based on branch names.Runtime Changes
Both
LocalRuntimeandFederatedRuntimeneed updates to handle branch execution and joining. The primary focus is on ensuring that branching works in both simulation and distributed environments.Aggregator Changes
The aggregator component is central to the branching feature and requires significant changes.
The sequence diagram below illustrates the enhanced internal flow of the aggregator component when handling branching in Vertical Federated Learning. The key steps include:
next()with thebranchesparameter to dispatch different tasks to different collaboratorssequenceDiagram title OpenFL Vertical Federated Learning with Branching - Aggregator Flow participant Client as Client Application participant FLSpec as FLSpec participant Runtime as Runtime participant Agg as Aggregator participant Branch1 as "Branch1 Collaborator" participant Branch2 as "Branch2 Collaborator" Note over Client,Branch2: Initialization Phase Client->>FLSpec: Create FLSpec workflow Client->>Runtime: Create runtime(aggregator, collaborators) Client->>FLSpec: Set runtime Client->>FLSpec: Run() Note over FLSpec,Branch2: Start Task Execution FLSpec->>Runtime: execute_task(self, start_function) Runtime->>Agg: execute_agg_task() Note over Agg: Execute start() function Agg->>Agg: Initialize model, data, parameters Note over Agg: Branch Dispatch Agg->>FLSpec: next() with branches={"branch1": ["collab1"], "branch2": ["collab2"]} FLSpec->>FLSpec: Store branch mapping Note over FLSpec,Branch2: Branch Execution Phase FLSpec->>Runtime: execute_task() with branch information Note over Runtime: Execute Branch 1 Runtime->>Runtime: Map branch1 to collab1 Runtime->>Branch1: execute_branch_task(branch1_task) Branch1->>Branch1: Process data in branch1 Branch1->>Branch1: Generate partial results Note over Runtime: Execute Branch 2 (in parallel) Runtime->>Runtime: Map branch2 to collab2 Runtime->>Branch2: execute_branch_task(branch2_task) Branch2->>Branch2: Process data in branch2 Branch2->>Branch2: Generate partial results Note over Branch1,Agg: Results Collection Branch1-->>Runtime: Return branch1 results Branch2-->>Runtime: Return branch2 results Note over Runtime,Agg: Join Operation Runtime->>Agg: execute_agg_task(join) with results from branches Note over Agg: Join Logic Agg->>Agg: Merge results from different branches Agg->>Agg: Integrate different feature components Agg->>Agg: Update model with combined results Note over Agg: Next Round Decision alt More rounds needed Agg->>FLSpec: next() to branches or next task else Final round completed Agg->>FLSpec: next(self.end) FLSpec->>Runtime: execute_task(end_function) Runtime->>Agg: execute_agg_task(end) Agg->>Agg: Finalize model and metrics end Note over FLSpec,Agg: Completion Runtime->>FLSpec: Return final results FLSpec->>Client: Return completed workflowSequence diagram for federated runtime is added below. Key differences from the LocalRuntime approach include:
The 1:1 mapping between branches and collaborators is maintained, with each branch executing on its dedicated collaborator via its associated envoy.
sequenceDiagram title OpenFL Vertical Federated Learning with Branching - Federated Runtime Flow participant Client as Client Application participant FLSpec as FLSpec participant Director as Director participant Agg as Aggregator participant Envoy1 as "Envoy (Collab1)" participant Collab1 as "Collaborator 1" participant Envoy2 as "Envoy (Collab2)" participant Collab2 as "Collaborator 2" Note over Client,Collab2: Initialization Phase Client->>FLSpec: Create FLSpec workflow Client->>FLSpec: Create FederatedRuntime(director, envoys) Client->>FLSpec: Set runtime Client->>FLSpec: Run() Note over FLSpec,Director: Runtime Initialization FLSpec->>Director: start_experiment_execution_loop() Director->>Agg: Initialize aggregator coroutine Director->>Envoy1: Connect to envoy Director->>Envoy2: Connect to envoy Envoy1->>Collab1: Initialize collaborator Envoy2->>Collab2: Initialize collaborator Note over Director,Agg: Start Task Execution Director->>Agg: Execute start function Note over Agg: Execute start() function Agg->>Agg: Initialize model, data, parameters Note over Agg: Branch Dispatch Agg->>FLSpec: next() with branches={"branch1": ["collab1"], "branch2": ["collab2"]} FLSpec->>FLSpec: Store branch mapping Note over Director,Collab2: Branch Execution Phase (Parallel) par Branch 1 and Branch 2 Execute in Parallel Note over Director,Envoy1: Branch 1 Execution Director->>Envoy1: Dispatch branch1_task to envoy Envoy1->>Collab1: Execute branch1_task Collab1->>Collab1: Process data in branch1 Collab1->>Collab1: Generate partial results Collab1-->>Envoy1: Return branch1 results and Note over Director,Envoy2: Branch 2 Execution Director->>Envoy2: Dispatch branch2_task to envoy Envoy2->>Collab2: Execute branch2_task Collab2->>Collab2: Process data in branch2 Collab2->>Collab2: Generate partial results Collab2-->>Envoy2: Return branch2 results end Note over Envoy1,Director: Results Collection (May happen asynchronously) par Asynchronous Results Collection Envoy1-->>Director: Forward branch1 results and Envoy2-->>Director: Forward branch2 results end Note over Director,Agg: Join Operation Director->>Agg: Provide results from all branches Note over Agg: Join Logic Agg->>Agg: Merge results from different branches Agg->>Agg: Integrate different feature components Agg->>Agg: Update model with combined results Note over Agg,Director: Next Round Decision alt More rounds needed Agg->>FLSpec: next() to continue training FLSpec->>Director: Continue with next round else Final round completed Agg->>FLSpec: next(self.end) FLSpec->>Director: Execute end function Director->>Agg: Execute end function Agg->>Agg: Finalize model and metrics end Note over Director,Client: Completion Director->>FLSpec: Return final experiment state FLSpec->>Client: Return completed workflow resultsImplementation Approach
1.1. Add branching support to
FLSpec.next()method1.2. Create helper utilities for branch-to-collaborator mapping
1.3. Add branch-specific decorators (if needed)
2.1. Update
LocalRuntimeto handle branching execution2.2. Test with simulation-based workflows
2.3. Update
FederatedRuntimeto support distributed branching3.1. Modify aggregator to handle branch task assignment and execution
3.2. Implement efficient join operation for branches
3.3. Update task tracking and result collection
Sample Usage Example
Limitations and Scope
Current Design and Limitations
Next steps and other information.
Beta Was this translation helpful? Give feedback.
All reactions