Skip to main content

Module gradient_sync

Module gradient_sync 

Source
Expand description

Gradient synchronisation service for distributed federated learning.

This module exposes a gRPC-style server-streaming service that allows nodes to exchange gradient chunks during a distributed training round. The implementation is manual (not tonic-generated) so that it can be compiled and tested independently of the proto-build toolchain.

§Architecture

Client                    GradientSyncService
  |                              |
  |-- GradientSyncRequest ------>|
  |                              |  decode local gradient
  |                              |  commit_local → BlockStore
  |<-- GradientChunkResponse 0 --|  (local gradient chunk 0)
  |<-- GradientChunkResponse 1 --|  (local gradient chunk 1)
  |        …                    |
  |<-- GradientChunkResponse N --|  (local gradient chunk N)
  |                              |

In production, peer gradients would be streamed by hooking into the ipfrs-network GossipSub event loop. That wiring lives at the ipfrs crate level (which owns Node) and must not be referenced here to avoid a circular dependency. Instead, the service pushes the local gradient as chunks so that clients can observe server-streaming behaviour without a live network.

Structs§

GradientChunkResponse
A single gradient chunk streamed back to the client.
GradientSyncRequest
Request to initiate a distributed gradient synchronisation session.
GradientSyncService
gRPC-style service that streams gradient chunks to clients as they arrive from peers.