Why is Lloyd's algorithm guaranteed to converge?

Quick Overview

Asks why Lloyd's algorithm for k-means always terminates. Tests whether you can follow the clustering objective through the assignment and update steps, turn that into a finite termination argument, and say what the guarantee leaves out.

Why is Lloyd's algorithm guaranteed to converge?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: medium

Interview Round: Other

Why is Lloyd's algorithm guaranteed to converge? Lloyd's algorithm is the standard k-means procedure: alternate between assigning each point to its nearest centroid and moving each centroid to the mean of its assigned points, until the assignments stop changing. ```hint Track one number Pick the quantity k-means is trying to minimize and check what each of the two steps does to it. ``` ```hint Why it has to stop A decreasing quantity that is bounded below can still change forever. Look for something finite about the states the algorithm can be in. ``` ### What a Strong Answer Covers - The objective being minimized, written out - Why neither the assignment step nor the update step can increase it - Why the algorithm stops after finitely many iterations, including how ties are handled - What the guarantee does not promise: global optimality, fast convergence, or the same result under other distance measures ### Follow-up Questions - Why does "the objective decreases and is bounded below" not, on its own, prove that the algorithm stops after finitely many iterations? - If you switch to Manhattan distance for the assignment step but keep the mean update, does the guarantee survive? What would you change? - After Lloyd's algorithm has stopped, how could moving a single point to another cluster still lower the objective? - How do k-means++ seeding and multiple restarts address what the convergence guarantee leaves open?

Overview: Asks why Lloyd's algorithm for k-means always terminates. Tests whether you can follow the clustering objective through the assignment and update steps, turn that into a finite termination argument, and say what the guarantee leaves out.

General logo
General
Nov 24, 2026
mediumMachine Learning EngineerOtherMachine Learning
0
0

Why is Lloyd's algorithm guaranteed to converge?

Lloyd's algorithm is the standard k-means procedure: alternate between assigning each point to its nearest centroid and moving each centroid to the mean of its assigned points, until the assignments stop changing.

What a Strong Answer Covers Guidance

  • The objective being minimized, written out
  • Why neither the assignment step nor the update step can increase it
  • Why the algorithm stops after finitely many iterations, including how ties are handled
  • What the guarantee does not promise: global optimality, fast convergence, or the same result under other distance measures

Follow-up Questions Guidance

  • Why does "the objective decreases and is bounded below" not, on its own, prove that the algorithm stops after finitely many iterations?
  • If you switch to Manhattan distance for the assignment step but keep the mean update, does the guarantee survive? What would you change?
  • After Lloyd's algorithm has stopped, how could moving a single point to another cluster still lower the objective?
  • How do k-means++ seeding and multiple restarts address what the convergence guarantee leaves open?