Federated learning manifests in two distinct paradigms with fundamentally different characteristics, challenges, and solutions. Cross-device FL involves millions of mobile devices or IoT sensors, while cross-silo FL connects a small number of organizations or data centers. Understanding these differences is crucial for designing effective FL systems.
class CrossDeviceFederatedLearning:
"""
FL system optimized for cross-device scenario
Key features:
- Handles massive client population
- Tolerates high dropout rates
- Minimizes communication cost
- Works with limited device resources
"""
def __init__(self):
self.total_clients = 10_000_000 # 10 million devices
self.clients_per_round = 100 # Sample 100 per round
self.local_epochs = 1 # Minimal local training
self.batch_size = 10 # Small batches
self.dropout_tolerance = 0.5 # Expect 50% dropout
# Aggressive compression for mobile networks
self.compressor = GradientCompressionPipeline(
quantization_bits=8,
sparsity=0.01, # Keep only 1% of gradients
use_error_feedback=True
)
def select_clients(self):
"""
Sample clients for this round
Criteria:
- Device is idle (screen off, charging)
- Connected to WiFi
- Battery > 30%
- Not in low-power mode
"""
eligible_clients = self.filter_by_device_state()
# Over-sample to account for dropouts
num_to_select = int(self.clients_per_round / (1 - self.dropout_tolerance))
return random.sample(eligible_clients, num_to_select)
def client_update(self, client_id):
"""
Minimal local training to conserve resources
- Single epoch
- Small batches
- Aggressive compression
"""
local_data = load_client_data(client_id)
# Quick local training
model_update = train_one_epoch(local_data, batch_size=self.batch_size)
# Compress heavily for transmission
compressed_update = self.compressor.compress(model_update)
return compressed_update
def handle_stragglers(self, client_updates, timeout=300):
"""
Don't wait for slow clients
Aggregate as soon as minimum number respond
"""
min_clients = int(self.clients_per_round * 0.5)
updates_received = []
start_time = time.time()
while len(updates_received) < self.clients_per_round:
# Check for new updates
new_updates = poll_client_responses()
updates_received.extend(new_updates)
# Time out if taking too long or have minimum
if time.time() - start_time > timeout and len(updates_received) >= min_clients:
break
return updates_received
class CrossSiloFederatedLearning:
"""
FL system optimized for cross-silo scenario
Key features:
- Small number of powerful participants
- Strong privacy guarantees (secure MPC)
- Handles large datasets per silo
- Sophisticated aggregation algorithms
"""
def __init__(self):
self.num_silos = 10 # 10 hospitals/banks/companies
self.clients_per_round = 8 # Most participate each round
self.local_epochs = 10 # Extensive local training
self.batch_size = 256 # Large batches
# Strong privacy mechanisms
self.privacy_mechanism = SecureMultiPartyComputation()
self.differential_privacy = DifferentialPrivacy(epsilon=0.5)
# Sophisticated aggregation for non-IID data
self.aggregator = SCAFFOLD() # Variance reduction
def coordinate_training_round(self):
"""
Scheduled coordination among silos
All silos participate in each round (high reliability)
"""
# Send notification to all silos
self.notify_silos_to_begin()
# Wait for all silos (they're reliable)
silo_updates = self.collect_all_silo_updates(timeout=3600) # 1 hour timeout
# Verify all expected silos participated
if len(silo_updates) < self.num_silos * 0.8: # At least 80%
logging.warning("Some silos did not participate")
return silo_updates
def secure_aggregation(self, silo_updates):
"""
Use secure MPC to aggregate without revealing individual updates
Each silo's contribution remains encrypted during aggregation
"""
# Each silo encrypts their update
encrypted_updates = []
for silo_id, update in silo_updates.items():
encrypted = self.privacy_mechanism.encrypt(update, silo_id)
encrypted_updates.append(encrypted)
# Aggregate encrypted updates (homomorphic)
encrypted_result = self.privacy_mechanism.aggregate(encrypted_updates)
# Decrypt final result (requires threshold of silos)
aggregated_model = self.privacy_mechanism.decrypt(encrypted_result)
# Add differential privacy noise
private_model = self.differential_privacy.add_noise(aggregated_model)
return private_model
def handle_non_iid_data(self):
"""
Address statistical heterogeneity across silos
Each hospital/bank has very different data distributions
"""
# Use advanced algorithms
# - FedProx: Proximal term regularization
# - SCAFFOLD: Control variates
# - FedBN: Separate batch normalization per silo
return "Use sophisticated methods for non-IID data"
| Aspect | Cross-Device | Cross-Silo |
|---|---|---|
| Number of Clients | 10⁶ - 10¹⁰ | 2 - 100 |
| Participation Rate | <1% per round | 50-100% per round |
| Dataset Size/Client | Small (KB-MB) | Large (GB-TB) |
| Client Reliability | Low (frequent dropouts) | High (stable) |
| Communication Cost | Critical bottleneck | Less critical |
| Computation/Client | Limited (mobile CPU) | Abundant (GPUs/TPUs) |
| Privacy Requirements | High (personal data) | Very high (competitive/legal) |
| Data Distribution | Highly non-IID | Extremely non-IID |
| Coordination | Asynchronous | Synchronous (scheduled) |
| Training Speed | Slow (many rounds) | Faster (fewer rounds) |
Combine cross-device and cross-silo characteristics:
class HierarchicalFederatedLearning:
"""
Three-tier architecture combining both paradigms
Tier 1: Mobile devices (cross-device)
Tier 2: Edge servers (aggregation)
Tier 3: Cloud data centers (cross-silo)
"""
def __init__(self):
self.edge_servers = 100 # Regional edge servers
self.devices_per_edge = 10000 # Devices per edge server
self.central_cloud = 1 # Global aggregation
def training_round(self):
"""
Multi-level aggregation
1. Devices → Edge servers (cross-device style)
2. Edge servers → Cloud (cross-silo style)
"""
# Level 1: Cross-device FL at each edge
edge_models = []
for edge_server in self.edge_servers:
# Sample local devices
local_devices = edge_server.sample_devices(num=100)
# Aggregate locally (cross-device methods)
edge_model = edge_server.aggregate_devices(
local_devices,
compression='aggressive',
dropout_tolerance=0.5
)
edge_models.append(edge_model)
# Level 2: Cross-silo FL among edge servers
global_model = self.central_cloud.aggregate_edges(
edge_models,
method='secure_mpc',
privacy='strong_dp'
)
return global_model
Choose Cross-Device when:
• You have millions of end-user devices
• Data is naturally distributed to users
• Communication cost is critical
• Example: Mobile apps, IoT sensors
Choose Cross-Silo when:
• You have few organizations with large datasets
• Participants are reliable institutions
• Strong privacy/compliance requirements
• Example: Healthcare consortiums, banking networks
class MedicalFederatedLearning:
"""
Cross-silo FL for multi-hospital disease prediction
Hospitals: 20 participating institutions
Data: Patient records (HIPAA-protected)
Goal: Collaborative model without sharing patient data
"""
def __init__(self, hospitals):
self.hospitals = hospitals # List of hospital clients
self.num_hospitals = len(hospitals)
# HIPAA-compliant privacy
self.secure_mpc = SecureMultiPartyComputation()
self.differential_privacy = DifferentialPrivacy(epsilon=0.3) # Strong privacy
# Handle non-IID medical data
self.aggregator = FedProx(mu=0.01)
def collaborative_training(self, num_rounds=100):
"""
Train disease prediction model across hospitals
"""
global_model = initialize_model()
for round_num in range(num_rounds):
print(f"Round {round_num + 1}/{num_rounds}")
# All hospitals participate (scheduled)
hospital_updates = {}
for hospital in self.hospitals:
# Each hospital trains locally on their patient data
local_model = hospital.train_on_local_data(
global_model,
epochs=10,
batch_size=128
)
# Compute model update
update = local_model - global_model
# Clip and add local DP for patient privacy
update = clip_and_add_noise(update, epsilon=0.1)
hospital_updates[hospital.id] = update
# Secure aggregation (encrypted)
global_model = self.secure_mpc.aggregate_encrypted(
hospital_updates,
global_model
)
# Server-side DP for additional protection
global_model = self.differential_privacy.add_noise(global_model)
# Evaluate on validation data
metrics = self.evaluate_model(global_model)
print(f"Accuracy: {metrics['accuracy']:.3f}, AUC: {metrics['auc']:.3f}")
return global_model
def ensure_fairness(self, hospital_contributions, global_model):
"""
Ensure all hospitals benefit from collaboration
Measure: Each hospital's model should improve
"""
for hospital in self.hospitals:
local_only_accuracy = hospital.evaluate_local_model()
federated_accuracy = hospital.evaluate_model(global_model)
improvement = federated_accuracy - local_only_accuracy
assert improvement >= 0, f"{hospital.name} did not benefit from federation"
print(f"{hospital.name}: {improvement:.2%} improvement")
Korea operates a comprehensive standards governance system through inter-ministerial cooperation. National Standards Council (under Prime Minister's Office, per Framework Act on National Standards Article 5) coordinates KATS (Korean Agency for Technology and Standards), MFDS (Ministry of Food and Drug Safety), MOTIE (Ministry of Trade, Industry and Energy), MSIT (Ministry of Science and ICT), MOIS (Ministry of the Interior and Safety), MOE (Ministry of Environment), MOHW (Ministry of Health and Welfare), MND (Ministry of National Defense), MCST (Ministry of Culture, Sports and Tourism), MOFA (Ministry of Foreign Affairs), MOJ (Ministry of Justice), and FSC (Financial Services Commission). Accreditation and Testing: KOLAS (Korea Laboratory Accreditation Scheme) accredits 800+ testing laboratories. KAS (Korea Accreditation System) accredits 50+ certification bodies. KTC (Korea Testing Certification), KTR (Korea Testing & Research Institute), KTL (Korea Testing Laboratory), and KCL (Korea Conformity Laboratories) provide conformance testing. Telecom and Cyber: KCC (Korea Communications Commission), KCA (Korea Communications Agency), TTA (Telecommunications Technology Association), IITP (Institute for Information & Communications Technology Planning & Evaluation), NIPA (National IT Industry Promotion Agency), KISA (Korea Internet & Security Agency), KCMVP (Korea Cryptographic Module Validation Program), NIS (National Intelligence Service), NSR (National Security Research Institute), and NCSC (National Cyber Security Center). National R&D Centers: KIST, ETRI, KAIST, Seoul National University, Yonsei University, Korea University, POSTECH, UNIST, GIST, DGIST, KISTI, KIER, KIMM, KRICT, KFRI, KRIBB. International Standards Cooperation: ISO TC/SC Korean secretariats, IEC TC/SC Korean secretariats, ITU-T Study Group Korean chairs, 3GPP RAN/SA Korean chairs, IEEE 802 Korean chairs, W3C Korea office, OASIS Korea office, IETF Korea cooperation, OECD CSTP, UN ESCAP, APEC SCSC Korean cooperation. Korean Industrial Standards (KS) Catalog: KS X (Information) 25,000+, KS A (Basic) 15,000+, KS B (Machinery) 25,000+, KS C (Electrical) 18,000+, KS D (Metallurgy) 12,000+, KS E (Mining) 5,000+, KS F (Construction) 18,000+, KS H (Food) 8,000+, KS I (Environment) 5,000+, KS J (Biology) 3,000+, KS K (Textile) 15,000+, KS L (Ceramics) 7,000+, KS M (Chemistry) 12,000+, KS P (Medical) 5,000+, KS Q (Quality Mgmt) 4,000+, KS R (Transport) 12,000+, KS S (Service) 3,000+, KS T (Packaging) 4,000+, KS V (Shipbuilding) 5,000+, KS W (Aerospace) 3,000+ — totaling 220,000+ Korean Industrial Standards. Key Acts: Personal Information Protection Act (Act 19234, effective Sept 15, 2024), Electronic Government Act, Electronic Signature Act, Act on Promotion of Information and Communications Network Utilization and Information Protection, Information and Communications Infrastructure Protection Act, Data Industry Act, Public Data Act, AI Framework Act (Act 20212, effective July 2026), Industrial Technology Innovation Promotion Act, Framework Act on Science and Technology — 70+ Korean standardization-related laws.