feat: federated learning demo on the actor framework

Add a FedAvg fraud-detection application in two topologies: provider
mode (coordinator/trainer star) and P2P mode (full mesh with CRDT-gated
rounds), backed by an MLP trained on PaySim data with a synthetic
fallback, plus demo scripts for both modes.

Also harden the actor runtime:
- supervisor: ignore stale death messages (OneForAll restart storm),
  drop normally-exited children instead of respawning, add a
  restart-rate limit
- register actors before their thread starts so UUID dispatch and
  getSelf cannot race the spawn
- killActor now kills the thread so links see Killed
- fulfill connection promises with the pool winner on simultaneous
  connects
- clamp the PaySim test split on small datasets and split shared
  transaction types across trainers in non-IID partitioning

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-06-21 12:00:00 +02:00
parent 9a52fc5089
commit 6822d6c520
25 changed files with 2127 additions and 115 deletions
+38 -1
View File
@@ -71,6 +71,19 @@ library
Control.Actor.Supervision
Control.Actor.Network
Control.Actor.Registry
FL.Types
FL.CRDT
FL.NN
FL.Retry
FL.Data.PaySim
FL.Actors.Logger
FL.Actors.Evaluator
FL.Actors.Trainer
FL.Actors.Aggregator
FL.Actors.Coordinator
FL.Actors.PeerCoordinator
FL.Provider
FL.P2P
-- Modules included in this library but not exported.
-- other-modules:
@@ -79,10 +92,34 @@ library
-- other-extensions:
-- Other library packages from which modules are imported.
build-depends: base ^>=4.18.3.0, stm, uuid, bytestring ^>=0.12.0.0, containers ^>=0.8, mtl ^>=2.3.0, binary ^>=0.8.9, network ^>=3.2
build-depends:
base ^>=4.18.3.0,
stm,
uuid,
bytestring ^>=0.12.0.0,
containers ^>=0.8,
mtl ^>=2.3.0,
binary ^>=0.8.9,
network ^>=3.2,
hmatrix,
cassava,
vector,
random,
text,
time
-- Directories containing source files.
hs-source-dirs: src
-- Base language which the package is written in.
default-language: GHC2021
executable fl-actors
import: warnings
main-is: Main.hs
hs-source-dirs: app
build-depends:
base ^>=4.18.3.0,
actors,
optparse-applicative
default-language: GHC2021