# Federated Learning: A Comparative Study of Defenses Against Poisoning Attacks
## 5 Defense Methods
### Krlu  
KRUM, initially designed to combat \"Byzantine\" attacks, stands out as a robust aggregation algorithm in the realm of federated learning. Unlike traditional approaches, KRUM strategically evaluates the reliability of models by considering the distances between them. It takes a discerning stance, excluding models that deviate significantly from the majority, thereby prioritizing the creation of a dependable global model [9]. This algorithm finds particular significance in the federated learning landscape, where its application serves as a defense against the introduction of malicious or poisoned models by specific clients. KRUM's primary goal is to minimize the potential impact of these models on the collaborative training process, contributing to the overall security and effectiveness of federated learning endeavors. Through its selective model inclusion based on proximity, KRUM enhances the global model's resilience against harmful contributions, reinforcing the integrity of federated learning systems [8]. The algorithm of the federated learning system using KRUM as the aggregation model works as follows (Algorithm 4):  
```
Input:numberOfAgents,T (number of iterations) Output:globalWeights // Step 1: Initialization and Configuration  Initialize agents with indices [1, 2,..., numberOfAgents]  Initialize globalWeights  Set t = 0 // Step 2: Main Training Loop whilet < T do // Step 2a: Calculate probabilities for agent selection  probabilities = CalculateSelectionProbabilities(agents) // Step 2b: Start parallel training and wait for completion  selectedAgents = SelectAgents(probabilities)  updates = ParallelTraining(selectedAgents) // Step 2c: Calculate Distance  distanceMatrix = InitializeDistanceMatrix() for each agent_1 in selectedAgents do  for each agent_1 in selectedAgents, where j \(\
eq\) i do  distanceMatrix[i][j] = CalculateDistance(agent_1 update, agent_1 update) endfor endfor // Step 2d: Select Models  selectedDistances = SelectSmallestDistances(distanceMatrix) // Step 2c: Calculate Score for each agent in selectedAgents do  score[agent] = Sum(selectedDistances[agent]) endfor // Step 2f: Choose Final Model  krum_index = AgentWithLowestScore(score)  globalUpdate = updates[krum_index]
```  
**Algorithm 4**Identifying malicious model updates using KRUM  
### Krlu  
**K```
// Step 3: Evaluation and Updating globalWeights = UpdateGlobalWeights(globalWeights, globalUpdate) EvaluateModel(globalWeights) // Step 4: Close Loop StoreEvaluationResults(globalWeights) t = t + 1 endwhile return globalWeights
```

**Algorithm 4**Cont. ### Coomed

The coordinate-wise median (COMED) algorithm stands out as a significant aggregation strategy in federated learning systems [10]. Handling sets of updates in different dimensions, COMED calculates a coordinate median to strengthen the formation of the global model. COMED uses information from all agents, and promotes robust and efficient coordination to achieve effective global models. COMED's functioning is characterized by its coordination mechanism, where it incorporates information from all participating agents. Instead of favoring one specific update, COMED collaboratively leverages insights from multiple agents [17]. In essence, COMED enhances the global model's formation by ensuring that each dimension is influenced by the coordinated median, creating a more comprehensive and resilient representation of the aggregated updates.