N clients (devices, hospitals, organizations), each with local dataset Dk of size nk
Total data points: n=∑k=1Nnk
Goal: Learn a shared model θ that minimizes global loss:
F(θ)=k=1∑NnnkFk(θ)
where Fk(θ)=nk1∑i∈Dkℓ(xi,yi;θ) is client k's local loss.
Why this weighting? Each client contributes proportionally to its data size. A client with 1000 samples should influence the model 10× more than one with 100 samples.
Optimization Theory: FedAvg is SGD variant; convergence depends on data heterogeneity
Edge Computing: Federated learning pushes computation to edge devices
Multi-Task Learning: Personalized federated learning treats each client as a task
Byzantine Robust Learning: Defense against malicious clients sending bad updates
Model Compression: Quantization + sparsity reduce communication cost per round
Privacy-Preserving ML: Federated learning is one pilar; others include homorphic encryption, secure multi-party computation
Recall Explain Federated Learning to a 12-Year-Old
Imagine you and99 friends all want to build the world's best autocorrect for texting. But here's the problem: everyone's texts are super private—you can't share them!
Old way (doesn't work): Everyone sends all their texts to one person. That person reads EVERYONE's messages (crepy!) and figures out common patterns. Then they tell everyone the autocorrect rules.
Federated learning way:
One person (the "server") writes down some basic autocorrect rules on paper.
They make100 copies and mail one to each friend.
Each friend practices on their OWN texts (privately!) and improves their copy of the rules.
Friends mail back ONLY their improved rules (not their texts!).
Server combines everyone's improvements: "80 people found that'u' usually means 'you', so let's add that."
Server sends out the new better rules. Repeat!
After 50 rounds, everyone has an amazing autocorrect that learned from 100 people's texting styles—but no one ever saw anyone else's private messages. That's federated learning: learn together, stay private.
What is the core difference between federated learning and centralized ML? :: Federated learning brings the MODEL to the DATA (training happens on local devices, only weight updates are sent). Centralized ML brings DATA to the MODEL (raw data uploaded to central server for training).
Write the federated averaging update rule :: θ(t+1)=∑k∈St∑j∈Stnjnkθk(t+1) where θk(t+1) is client k's local model after E epochs of SGD, weighted by dataset size nk.
Why do we weight clients by their dataset size nk in aggregation?
To make each data point contribute equally to the global model. A client with 10× more data should influence the model 10× more. This matches the mathematical objective F(θ)=∑nnkFk(θ).
What is the communication cost trade-off controlled by local epochs E?
Large E → fewer rounds (less communication) but more client drift (local models diverge). Small E → more rounds (more communication) but less drift. Optimal E∈[5,20] for most tasks.
What is (ϵ,δ)-differential privacy in one sentence?
Adding or removing any one person's data changes the algorithm's output probability by at most eϵ (multiplicatively) plus δ, provably bounding information leakage.
What attack does differential privacy defend against in federated learning?
Gradient inversion attacks, where an adversary reconstructs training samples from the gradients/weight updates. DP adds calibrated noise to updates, making reconstruction impossible.
Why is non-IID data a problem for federated learning?
Clients optimize different objectives (θk∗=θj∗ when data distributions differ). Averaging contradictory local models causes oscillation and slower convergence to the global optimum θ∗.
What is secure aggregation?
Cryptographic protocol where the server learns the SUM of client updates ∑kθk but cannot see individual θk. Protects against malicious server trying to infer info from individual updates.
Cross-device vs. cross-silo: which has more clients and less data per client?
Cross-device (millions of smartphones, KBs-MBs each). Cross-silo has 10-100 organizations with GBs-TBs each.
What is client drift and when does it happen?
When clients overfit to local data during many local epochs, their models diverge from the global optimum. Happens with large E and highly non-IID data. Mitigated by smaller E or adaptive optimizers like FedAdam.
Federated learning ka matlab simple hai: socho tumhare pas ek billion smartphones hain aur sabko ek AI model train karna hai jo next word predict kare (jaise WhatsApp mein type karte waqt suggestions ate hain). Traditional methodein kya hota? Sab logon ke messages ek central server pe upload ho jayenge, wahan model train ho, phir wapas phone pe aye. Par yahan do badi problems hain: pehla, privacy ka issue—tumhare private chats kaun padhe server pe? Dosra, bandwidth—1 billion phones se data lana toh nightmare hai.
Federated learning ka jugaad: model ko data ke pas le jao, data ko model ke paas nahi. Matlab serverek initial model bhejta hai har phone pe, har phone apne local data pe privately train karta hai (tumhare messages kabhi bahar nahi jate), phir sirf learned weights (jo model ne seekha) wapas bhejta hai server ko. Server sabke weights ko combine karke ek global model banata hai. Is tareke se, data kabhi move nahi hota, sirf knowledge move hoti hai—privacy bani rahi, bandwidth bhi bach gayi.