Greedy Centroid Initialization for Federated K-means

Kun Yang, Mohammad Mohammadi Amiri, Sanjeev R. Kulkarni

Abstract

In this paper, our focus is on $K$-means within a federated setting, where clients retain their raw data on local devices, and the raw data never leaves the corresponding devices. Given the importance of initialization on the federated $K$-means algorithm, our objective is to find better initial centroids by utilizing the local data stored on each client. To this end, we start the centroid initialization at the clients, rather than at the server, since the server initially lacks any preliminary insight into the clients' data. The clients first select their local initial clusters, and subsequently share their clustering information (including cluster centroids and sizes) with the server. The server then employs a greedy algorithm to determine the global initial centroids based on the information received from the clients. Numerical results obtained from both synthetic and public datasets demonstrate that our proposed method can achieve better and more stable performance than three distinct federated $K$-means variants, and comparable performance to the centralized $K$-means algorithm.

Introduction

Clustering is a cornerstone of unsupervised machine learning, yet executing it across a distributed network of private devices presents a significant challenge. The $K$-means algorithm is highly sensitive to its initial starting points (centroids). Poor initialization often leads the algorithm to converge on a "local optimum"—a solution that is mathematically stable but fails to capture the true structure of the data.

In a Federated Learning (FL) environment, this problem is exacerbated. To maintain privacy, raw data never leaves the client's device. The central server, responsible for coordinating the global model, is effectively "blind" to the underlying data distribution. Traditional approaches often rely on the server making a random guess or simply averaging client-side proposals, which frequently fails when data is "non-IID" (Independent and Identically Distributed)—meaning different clients hold very different types of data. This paper introduces Greedy Federated $K$-means (G-FKM), a method where clients propose local cluster centers and the server greedily selects the best global set, achieving performance nearly identical to centralized clustering while keeping data strictly private.

Methodology: The G-FKM Approach

The G-FKM method shifts the initialization process from the central server to the network's edge. The process follows these key steps:

  1. Local Proposal: Each client performs a local initialization (such as $K$-means++) on their own private data.
  2. Metadata Sharing: Instead of raw data, clients send their local centroids and the size of each local cluster (the number of data points it contains) to the server.
  3. Greedy Global Selection: The server aggregates these proposals and uses a greedy algorithm to select the global starting points. It identifies centroids that represent the highest "density" or "mass" across the network and iteratively selects subsequent points that are well-separated from those already chosen.
  4. Iterative Refinement: Following this "smart" initialization, the system proceeds with standard federated $K$-means updates until convergence.

The core innovation lies in using cluster sizes to weight the importance of local proposals, allowing the server to make informed decisions without ever accessing raw user data.

Experimental Evaluation

The researchers evaluated G-FKM using a variety of datasets to test its robustness:

  • Synthetic Gaussians: Controlled environments with 3 and 10 distributions, designed to test the algorithm's resilience to outliers and data bias.
  • NBAIOT: A real-world dataset focused on detecting IoT botnet attacks.
  • MNIST: The standard benchmark of handwritten digits. To manage high-dimensional image data, the team used a pre-trained VGG16 neural network for feature extraction prior to clustering.

Key Insights and Results

Performance and Stability

In nearly all tests, G-FKM achieved a Within-Cluster Sum of Squares (WCSS) and Adjusted Rand Index (ARI) comparable to "Centralized $K$-means," where all data is pooled in a single location. Furthermore, G-FKM demonstrated significantly lower variance across multiple runs compared to other federated variants, such as "Server-Initialized" or "Average-Initialized" methods.

Efficiency and Robustness

On the MNIST dataset, the method converged in approximately 33% fewer iterations than competing federated techniques, reducing both time and communication costs. Additionally, the greedy selection logic effectively filters out outliers; unlike standard $K$-means++, which can be misled by distant points, G-FKM seeks consensus among client proposals, making it less likely to select a lone outlier as a global centroid.

The Role of Heterogeneity

Counter-intuitively, the algorithm often performs better when data is highly skewed across clients. This "natural heterogeneity" helps the greedy algorithm more easily distinguish between separate clusters. Sharing the number of points in a cluster provides sufficient "gravity" information for the server to identify significant data centers while maintaining a high degree of privacy.

Conclusion and Future Work

G-FKM provides a robust and privacy-preserving solution for federated clustering. By leveraging local data insights through minimal metadata sharing, it overcomes the limitations of server-side initialization.

While G-FKM offers a robust solution, the authors identify several areas for future work. In massive-scale systems, the communication of $K$ centroids per client could become a bottleneck. Future iterations could also incorporate Differential Privacy to further mask the shared metadata. Finally, adapting the greedy selection for "cross-device" FL, where clients frequently join or leave the network, remains an open research challenge.

Summary updated

BibTeX
@inproceedings{yang2023greedy,
  author = {Kun Yang and Mohammad Mohammadi Amiri and Sanjeev R. Kulkarni},
  title = {{Greedy Centroid Initialization for Federated K-means}},
  booktitle = {Research},
  year = {2023},
  doi = {10.21203/rs.3.rs-3458297/v1},
}
Figure