🎉 75% of content is free forever — Unlock Premium from $10/mo →
CW
Search courses…
💼 Servicesℹ️ About✉️ ContactView Pricing Plansfrom $10

Federated Learning — Privacy-Preserving ML

Expert TopicsFederated Learning🟢 Free Lesson

Advertisement

Advanced Topics

Federated Learning — Training Models Without Sharing Data

Learn how federated learning enables collaborative model training while keeping data private and secure. Essential for healthcare, finance, and privacy-sensitive applications.

  • Federated Averaging — The core algorithm for distributed training
  • Privacy Preservation — Keeping data local while learning globally
  • Communication Efficiency — Reducing the cost of distributed learning

"The future of AI is decentralized and privacy-preserving."

Federated Learning — Complete Guide

Federated learning trains models across decentralized devices without centralizing data. Essential for privacy-sensitive applications.


Federated Learning Architecture

Central ServerGlobal Model θAggregation + DistributionDevice 1Hospital ALocal Data — Never SharedDevice 2Hospital BLocal Data — Never SharedDevice 3Hospital CLocal Data — Never SharedDevice 4Hospital DLocal Data — Never SharedPatient RecordsLab ResultsImaging DataGenomic DataBroadcast θBroadcast θBroadcast θBroadcast θΔθᵢΔθᵢΔθᵢΔθᵢFederated Averaging (FedAvg)θglobal = Σ (nₖ/n) · θₖnₖ = local samples on device k, n = total samples across all devices

How It Works


The FedAvg Algorithm

FedAvg Algorithm — Communication Round t1. Server BroadcastSend θt to all K clientsGlobal model shared2. Local TrainingEach client k runs E epochsθₖ ← θₖ − η∇Fₖ(θₖ)3. Upload UpdatesClients send Δθₖ to serverGradients or model diffs4. Aggregationθt+1 = Σ (nₖ/n)θₖWeighted averageRepeat for t = 0, 1, 2, ..., T roundsConvergence Guarantee (Convex Case)F(θ̄) − F(θ*) ≤ O(1/√(KT)) + O(1/(ηKT)) + O(E²G²/(K²η²))Communication ComplexityTotal cost = T × K × d (T rounds × K clients × d parameters)Compression: Top-K sparsification, quantization reduce by 10-100×

Differential Privacy in Federated Learning

Differential Privacy: ε-DP MechanismDefinition: (ε, δ)-Differential PrivacyPr[M(D) ∈ S] ≤ e^ε · Pr[M(D') ∈ S] + δ for all |D Δ D'| = 1Gradient Clippingg ← g · min(1, C/||g||)Clip gradients to norm CControls sensitivity Δf = 2C/nGaussian Noiseñ = g + N(0, σ²C²I)σ ≥ Δf·√(2ln(1.25/δ))/εHigher ε → less noise → less privacyPrivate Updateθ ← θ − η · ñAggregate noisy gradientsPer-round privacy cost ε_rPrivacy Accounting: Composition TheoremAfter T rounds: ε_total ≤ √(2T·ln(1/δ)) · ε_r (Rényi DP / Moments accountant)Key trade-off: More training rounds → more privacy budget consumed → need larger σ or stop earlier

Communication Efficiency


Privacy-Utility Trade-off

Privacy vs Model Utility Trade-offPrivacy Budget ε (log scale) →Model Accuracy (%) →ε=0.1Acc: 72%ε=0.5Acc: 81%ε=1.0Acc: 87%ε=5.0Acc: 91%ε=10Acc: 93%No DP baselineHigh PrivacyHigh Utility

Secure Aggregation

Protocol Overview:

  1. Pairwise Masking: Each pair of clients shares a random mask via Diffie-Hellman key exchange
  2. Summation: Each client sends to server
  3. Cancellation: Server sums all masked updates:
  4. Privacy: Individual updates remain hidden even from the server

Non-IID Data Challenges

Non-IID Data Distributions Across ClientsIID: Balanced DistributionC120%C220%C320%C420%C520%Each client has similar class distributionNon-IID: Skewed DistributionC1C2C3C4C5Each client has different class proportions

Mitigation Strategies:

  • FedProx: Add proximal term to local objective — keeps clients close to global model
  • SCAFFOLD: Use control variates to correct client drift
  • Per-Layer Fine-Tuning: Only aggregate certain layers, freeze others
  • Data Augmentation: Synthetically balance data across clients

Federated Learning at Scale


Key Takeaways


What to Learn Next

-> ML Ethics — Fairness, Bias, Interpretability and Responsible AI Learn about ml ethics — fairness, bias, interpretability and responsible ai.

-> MLOps — Machine Learning Operations Complete Guide Learn about mlops — machine learning operations complete guide.

-> ML System Design — Architecture and Production Patterns Learn about ml system design — architecture and production patterns.

-> Model Evaluation — Metrics, Cross-Validation and Selection Learn about model evaluation — metrics, cross-validation and selection.

-> Model Deployment — APIs, Containers and Production ML Learn about model deployment — apis, containers and production ml.

-> Causal Inference — Moving Beyond Correlation Learn about causal inference — moving beyond correlation.

Need Expert Machine Learning Help?

Get personalized tutoring, project support, or professional consulting.

Advertisement