Skip to content

Fix multiple HNSW bugs causing intermittent search quality issues - #371

Merged
kriszyp merged 2 commits into
v5.0from
fix/hnsw-reliability
Apr 17, 2026
Merged

Fix multiple HNSW bugs causing intermittent search quality issues#371
kriszyp merged 2 commits into
v5.0from
fix/hnsw-reliability

Conversation

@kriszyp

@kriszyp kriszyp commented Apr 17, 2026

Copy link
Copy Markdown
Member
  • Only replace entry point when new node level is strictly higher, not equal, to avoid replacing well-connected entry points with unconnected new nodes
  • Use passed distance function for entry point in searchLayer instead of always using the instance default, which mixed distance metrics
  • Prevent orphaning nodes at level 0 when pruning excess connections
  • Update stale distances in reverse connections when a node's vector changes

- Only replace entry point when new node level is strictly higher, not equal,
  to avoid replacing well-connected entry points with unconnected new nodes
- Use passed distance function for entry point in searchLayer instead of
  always using the instance default, which mixed distance metrics
- Prevent orphaning nodes at level 0 when pruning excess connections
- Update stale distances in reverse connections when a node's vector changes

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@kriszyp
kriszyp changed the base branch from main to v5.0 April 17, 2026 11:35
@kriszyp
kriszyp marked this pull request as ready for review April 17, 2026 11:48
@kriszyp
kriszyp requested a review from a team as a code owner April 17, 2026 11:48
Comment thread resources/indexes/HierarchicalNavigableSmallWorld.ts Outdated
Co-authored-by: Nathan Heskew <heskew@pm.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants