Edge Federated Learning

Comprehensive guide to edge federated learning covering architecture, implementation, testing, and operational patterns for production engineering teams.

Edge Federated Learning (FL) lets model training happen on edge devices—sensors, gateways, industrial controllers—without ever moving raw telemetry off-site. Instead of centralizing data, each node trains on its local dataset, computes model delta updates, and sends only those aggregates to a central aggregator. This pattern matters when data sovereignty or bandwidth constraints prevent shipping raw streams, when latency demands on-device inference, or when the device fleet is geographically dispersed and intermittently connected. The following sections walk through the operational workflow, from node registration to aggregation diagnostics, and surface the failure modes that catch teams off guard in production.

1. Marking a Node as an FL Participant

In a Kubernetes edge cluster, you can tag a node so that downstream schedulers or monitoring tools recognize its role. The kubectl label command is real and supports the --overwrite flag if needed:

kubectl label node edge-gw-12 fl-participant=true --overwrite

If the node is already labeled with a conflicting value, add --force (available in newer kubectl releases) or adjust the label manually with kubectl edit node. The label itself carries no intrinsic mechanism; it is purely a selector that other operators—such as a custom admission webhook or a DaemonSet predicate—can match against. When the label is present, an operator‑run script can iterate over all labeled nodes and perform the enrollment steps described in the following sections.

2. Executing Local Training on an Edge Node

Each edge node runs a training routine over its locally stored dataset. The routine is framework‑agnostic: any runtime that can ingest raw signals, update model weights, and export them in a serializable format will work. A typical end‑of‑epoch hook might invoke a Python script that reads from a known data directory and writes a delta file:

python3 train.py

The script is expected to read from /data/inputs and write a file named /data/delta.json containing a representation of the weight change. If the data directory is empty or the model checkpoint cannot be written, the script exits with code 1 and prints one of the following:

Error: no valid records found in /data/inputs

or

Error: permission denied writing /data/delta.json

The exact wording depends on the script implementation, but the exit‑code‑and‑stderr pattern is reliable for automation.

3. Pushing the Model Update to the Aggregator

Once the delta file exists, the node operator sends it to the central aggregator. The most direct way is an HTTP POST using curl, which is available on virtually all edge endpoints:

curl -sS -X POST \
  -H "Content-Type: application/json" \
  -d @/data/delta.json \
  http://aggregator.example.com:8080/collect

Real curl flags: -sS (silent but show errors), -X POST, -H, -d @file. All exist. The JSON payload is whatever the training script emitted. The aggregator is expected to accept application/json at the /collect endpoint. If the aggregator is unreachable, curl returns:

curl: (7) Failed to connect to aggregator.example.com port 8080: Connection refused

If the payload is malformed (e.g., not valid JSON), the aggregator may respond with HTTP 400 and:

400 Bad Request: invalid delta format

If the POST succeeds, curl outputs the HTTP status line, typically HTTP/1.1 202 Accepted or 200 OK, which the operator can parse to decide whether to proceed.

4. Pulling the Global Model Down to Nodes

After the aggregator has combined enough local deltas, it makes the updated global model available. Edge nodes retrieve it via a simple GET equivalent:

curl -o /data/model.pt http://aggregator.example.com:8080/model/current

Real curl flag -o writes the output to the specified file. If the model file is not yet ready, the request returns HTTP 404 and:

curl: (22) The requested URL returned error: 404 Not Found

or the server may return HTTP 503 with a Retry-After header if the aggregation pipeline is still computing. A successful pull produces no stdout output (thanks to -o) and the file /data/model.pt now contains the new global weights.

5. Orchestrating Repeated Rounds

In practice, a supervisor loop—either a systemd timer, a Kubernetes CronJob, or a simple while‑loop on the edge host—drives the cycle: train → curl POST → wait → curl GET → repeat. A minimal bash skeleton that could run on an edge device looks like:

#!/usr/bin/env bash
set -euo pipefail
AGG="http://aggregator.example.com:8080"
while true; do
  python3 train.py
  curl -sS -X POST -H "Content-Type: application/json" -d @/data/delta.json "$AGG/collect"
  curl -o /data/model.pt "$AGG/model/current"
  sleep 300
done

All commands here (python3, curl, set, while, sleep) are standard POSIX/bash utilities. The loop interval (300 seconds) is a tunable parameter, not a product‑specific flag. If any curl invocation fails, the script can be configured to retry or exit; the key point is that the same binary tools are used across the entire fleet.

Sharp Edges — What Silently Fails or Catches Teams Off Guard

Common Pitfalls & Confused Options

This page was rewritten on 14 October 2026. It replaced a templated version that was not specific to its own title. How these pages are written and checked. If anything here is wrong, tell us at [email protected] and we will correct it.