©2025. This code is provided exclusively as supplementary material for the NeurIPS’25 submission. Any use, distribution, or modification without explicit permission is prohibited.

** Prerequisites **
Ensure that the following software and libraries are installed on your system:

a. Python 3.7 or higher
b. PyTorch
c. torchvision

You can install the required Python packages using pip:
``
    pip install torch torchvision
''
    
** Configuration **
The system configuration is handled via a dictionary in the "main.py" file. Key configuration parameters include:

a. dataset_name: Name of the dataset (e.g., "Cifar100", "ImageNet", "Food")
b. phi_type: Feature extractor type (e.g., "ResNet", "CLIP")
c. defense_type: Defense mechanism to apply (e.g., "FedRACE", "MultiKrum", "TrimMean")
d. attack_type: Type of attack to perform (e.g., "minmax", "inner_product")
e. num_clients: Total number of clients in the federated learning setup
f. num_malicious: Number of malicious clients controlled by the adversary
g. participant_ratio: Fraction of clients participating in each training round
h. learning_rate: Learning rate for model training
i. dirichlet_alpha: Parameter for data distribution among clients
j. batch_size: Batch size for training
k. num_epoch: Number of local training epochs per client
l. num_rounds: Total number of federated learning rounds

** Running the Simulation **
To execute the federated learning simulation, run the main.py script:
``
    python main.py
''

** Description of Files **

a. settings.py: Configures the environment, including random seeds and device settings.
b. utils.py: Contains utility functions for loading models, data preprocessing, splitting data among clients, and various mathematical operations used throughout the system.
c. attacks.py: Implements attack strategies that malicious clients can perform to manipulate the global model.
d. defenses.py: Implements defense mechanisms to detect and mitigate malicious client contributions.
e. models.py: Defines the HStat-Net architectures used in the system.
f. simulator.py: Defines the Client and Server classes, managing local training, model parameter handling, and malicious client detection.
g. main.py: The entry point of the simulation. Initializes configurations, sets up clients and server, and orchestrates the federated learning process.
