Skip to content

Fix join set degeneration on low-degree nodes - #16435

Merged
mayya-sharipova merged 2 commits into
apache:mainfrom
mayya-sharipova:fix-16251-joinset-degree-clamp
Jul 30, 2026
Merged

Fix join set degeneration on low-degree nodes#16435
mayya-sharipova merged 2 commits into
apache:mainfrom
mayya-sharipova:fix-16251-joinset-degree-clamp

Conversation

@mayya-sharipova

Copy link
Copy Markdown
Contributor

UpdateGraphsUtils#computeJoinSet asked for a coverage of 2 for every node with a degree below 9, including nodes with a degree of 1. Such a node can be covered at most once (only its neighbours can cover it), so the coverage was unsatisfiable and the node always ended up in the join set itself.

On hub-and-spoke shaped graphs, which HNSW produces for 1-dimensional or heavily duplicated vectors, almost all nodes have a degree of 1, so the join set degenerated to the whole graph and merging lost all its savings. Clamp the requested coverage by the node's degree; graphs where all nodes have a degree of 2 or more are unaffected.

Fixes #16251

UpdateGraphsUtils#computeJoinSet asked for a coverage of 2 for every
node with a degree below 9, including nodes with a degree of 1. Such a
node can be covered at most once (only its neighbours can cover it), so
the coverage was unsatisfiable and the node always ended up in the join
set itself.

On hub-and-spoke shaped graphs, which HNSW produces for 1-dimensional
or heavily duplicated vectors, almost all nodes have a degree of 1, so
the join set degenerated to the whole graph and merging lost all its
savings. Clamp the requested coverage by the node's degree; graphs
where all nodes have a degree of 2 or more are unaffected.

Fixes apache#16251
The fix is going to be backported to branch_10x, so it will ship in
10.6.0 rather than 11.0.0.
@mayya-sharipova
mayya-sharipova merged commit 5fa57e7 into apache:main Jul 30, 2026
12 checks passed
mayya-sharipova added a commit that referenced this pull request Jul 30, 2026
UpdateGraphsUtils#computeJoinSet asked for a coverage of 2 for every
node with a degree below 9, including nodes with a degree of 1. Such a
node can be covered at most once (only its neighbours can cover it), so
the coverage was unsatisfiable and the node always ended up in the join
set itself.

On hub-and-spoke shaped graphs, which HNSW produces for 1-dimensional
or heavily duplicated vectors, almost all nodes have a degree of 1, so
the join set degenerated to the whole graph and merging lost all its
savings. Clamp the requested coverage by the node's degree; graphs
where all nodes have a degree of 2 or more are unaffected.

Fixes #16251
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TestHnswFloatVectorGraph.testBuildingJoinSet failure

1 participant