arXiv:2610.06182cs.LGOct 2026

Manuscript Offprint

arXiv:2610.06182

Two-Point Local Optimality in kk-Means via Boundary-Point Screening

Wenlong Lyu, Xujie Xiao, Yuheng Jia

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

ABSTRACT

Lloyd’s algorithm and the discrete local (D-local) optimization method (Li et al., 2025a) for k-means provide only weak local-optimality guarantees, and their solution quality remains sensitive to initialization. In this paper, we introduce r-point local optimality, under which no reassignment of at most r samples decreases the objective function, and focus on r = 2. The main computational obstacle is the O(n2(k2+d))\mathcal{O}(n^2(k^2 + d)) cost of exhaustive two-point certification for n samples in d dimensions and k clusters. To address this challenge, we prove that (i) every improving two-point move of a D-local optimum must involve a cluster shared by both reassignments, and (ii) only certificate-defined boundary points can participate in an improving pair. Exploiting this structure, we propose Boundary-Point-Screened Two-Point Local Search (BPS-2PLS), which terminates at a two-point local optimum. For fixed k, d and nonvanishing cluster occupancy, the number m of retained candidates satisfies m=OP(log⁡n)m = \mathcal{O}_{\mathbb{P}}(\log n) under i.i.d. sampling from a bounded-support distribution with bounded density or from a Gaussian mixture. Across twelve benchmarks, BPS-2PLS attains the lowest available mean WCSS on ten. In a subsampling study, screening retains 0.10%–2.81% of samples on average at the largest tested sizes. The code is available at https://github.com/lwl-learning/BPS-2PLS.

1 INTRODUCTION

k-means (MacQueen, 1967) is a canonical clustering method because of its simple geometric interpretation, with broad applications including image analysis (Jia et al., 2025; Li et al., 2025b; Qi et al., 2024; Achanta et al., 2012), large-scale similarity search (Jégou et al., 2011), single-cell genomics (Chari et al., 2024), climate science (Lee and Messori, 2024), and speech processing (Ambilduke et al., 2025). k-means seeks a partition that minimizes the within-cluster sum of squares (WCSS). Despite the simplicity of its objective, finding a global minimizer is NP-hard (Aloise et al., 2009). Practical methods therefore seek a suboptimal solution from a given initialization.

Lloyd’s algorithm alternates between assignment and centroid updates. At termination, the assignments and centroids are each optimal with the other fixed (Lloyd, 1982). This partial optimality does not exclude a reassignment that decreases WCSS after centroid recomputation. Hartigan-style methods (Hartigan and Wong, 1979; Telgarsky and Vattani, 2010) address this weakness, and Li et al. (2025a) formalize D-local optimality, under which no one-sample reassignment decreases WCSS after centroid recomputation.

However, two reassignments that are individually non-improving can yield an improvement when applied simultaneously, because their centroid updates interact through shared clusters. This motivates r-point local optimality, which excludes improvements from simultaneously reassigning at most r samples and ranges from D-locality at r = 1 to global optimality at r = n. We focus on r = 2, the first level beyond one-point relocation.

Exact certification of two-point local optimality appears expensive because direct enumeration over sample pairs and their destination clusters yields (n2)(k−1)2\binom{n}{2}(k-1)^2 candidates. Nevertheless, we establish that, at a D-local optimum, every improving two-point move must involve a cluster shared by both sample reassignments, reducing all potentially improving moves to six directed configurations. To further reduce sample-pair enumeration, we construct, for each sample, an upper bound on the gains of connected two-point moves involving it, following the safe-screening principle (El Ghaoui et al., 2012; Fercoq et al., 2015). A sample with a non-positive upper bound cannot participate in any improving pair and can therefore be safely discarded. After initial Lloyd convergence, alternating Min-D-LO one-point descent with exact search over the retained samples yields Boundary-Point-Screened Two-Point Local Search (BPS-2PLS), which terminates at a two-point local optimum. With m retained candidates and lazily computed pair distances, screening and search cost O(k2d+nklog⁡n+m2(d+k))\mathcal{O}(k^2d + nk\log n + m^2(d + k)) after each one-point descent phase, without a full sample-pair cache.

The benefit of screening depends on how m grows with n. We localize retained samples near empirical cluster boundaries and prove m=OP(log⁡n)m = \mathcal{O}_{\mathbb{P}}(\log n) for fixed k, d under bounded-support sampling with bounded density or Gaussian-mixture sampling. The bounds hold uniformly over D-local states with nonvanishing cluster occupancy. Complementing this theoretical analysis, a six-dataset subsampling experiment shows mean pruning rates above 97% at the largest tested sizes. Together, these results show that exact two-point local optimality can be attained efficiently on the evaluated problems.

Overall, our contributions are summarized as follows:

• We introduce a hierarchy from D-local to global optimality and characterize improving moves through connected cluster-transfer graphs.

• We develop BPS-2PLS, combining exact two-point search with safe sample screening to certify two-point local optimality.

• We establish uniform logarithmic candidate-size bounds m=OP(log⁡n)m = \mathcal{O}_{\mathbb{P}}(\log n) for two common distribution classes and a nonvanishing cluster-occupancy condition.

References (70)